Browse Source

提交链接分享

wangming 2 months ago
parent
commit
7f41844f63

+ 27 - 13
src/pagesA/linkShare/linkShare.vue

@@ -69,8 +69,10 @@
                 >
             </view>
         </view>
-        <button class="btn1" open-type="share">确认分享</button>
-        <!-- <button class="btn1" @click="sureShare()">确认分享</button> -->
+        <button class="btn1" open-type="share" v-if="shareFlag">
+            确认分享
+        </button>
+        <button class="btn1" v-else>暂不可分享</button>
     </view>
 </template>
 <script>
@@ -82,19 +84,34 @@ export default {
             messageFlag: true,
             serviceNumberFlag: true,
             voipFlag: true,
+            shareFlag: false,
         };
     },
     methods: {
         smChange() {
             this.messageFlag = !this.messageFlag;
+            this.shareUserLink("权限修改成功");
         },
         snChange() {
             this.serviceNumberFlag = !this.serviceNumberFlag;
+            this.shareUserLink("权限修改成功");
         },
+
         vfChange() {
             this.voipFlag = !this.voipFlag;
+            this.shareUserLink("权限修改成功");
         },
         onShareAppMessage() {
+            return {
+                title: "好友向您分享了一台设备",
+                path:
+                    "/pagesA/sharePages/sharePages?phone=" +
+                    this.phone +
+                    "&devInfo=" +
+                    JSON.stringify(this.devInfo),
+            };
+        },
+        shareUserLink(itemTitle) {
             let shareParam = {
                 devId: this.devInfo.devId,
                 sharerUserId: uni.getStorageSync("userId"),
@@ -113,19 +130,11 @@ export default {
                 .then((res) => {
                     if (res.statusCode == 200) {
                         uni.showToast({
-                            title: "分享成功",
-                            icon: "success",
+                            title: itemTitle,
+                            icon: "none",
                             duration: 1500,
                         });
-                        return {
-                            title: "好友向您分享了一台设备",
-                            path:
-                                "/pagesA/sharePages/sharePages?phone=" +
-                                this.phone +
-                                "&devInfo=" +
-                                JSON.stringify(this.devInfo),
-                            miniprogramType: 2,
-                        };
+                        this.shareFlag = true;
                     } else {
                         uni.showToast({
                             title: res.data.message,
@@ -139,6 +148,11 @@ export default {
     onLoad(options) {
         this.devInfo = JSON.parse(options.devInfo);
     },
+    onShow() {
+        setTimeout(() => {
+            this.shareUserLink("分享链接创建成功");
+        }, 500);
+    },
 };
 </script>
 <style lang="less" scoped>

+ 27 - 13
src/pagesA/loginNew/loginNew.vue

@@ -15,14 +15,18 @@
                 同意协议并手机号快捷登录
             </van-button>
         </view>
-        <van-checkbox
-            custom-class="input-check"
-            v-model="checked"
-            shape="round"
-            checked-color="#000000"
-            icon-size="16px"
-            @change="changeCheck"
-        >
+
+        <view class="funItem">
+            <label class="simple-radio" @click="changeCheck()"
+                ><radio
+                    :value="serviceNumberFlag"
+                    color="#000000"
+                    icon-size="12px"
+                    :checked="checked == true"
+                    class="hide-original"
+                    style="transform: scale(0.7)"
+                />
+            </label>
             <text style="font-size: 26rpx; color: #fff"
                 >我已阅读并同意
                 <text class="green" @click="dkwd('yhfwxy')">《用户协议》</text
@@ -30,7 +34,7 @@
                     >《隐私协议》</text
                 ></text
             >
-        </van-checkbox>
+        </view>
     </view>
 </template>
 <script>
@@ -45,8 +49,7 @@ export default {
     computed: {},
     methods: {
         changeCheck(e) {
-            console.log(e);
-            this.checked = e.detail;
+            this.checked = !this.checked;
         },
         dkwd(val) {
             let typeval = val;
@@ -80,10 +83,11 @@ export default {
             // console.log(e.detail.code, 9999);
             if (e.detail) {
                 code = e.detail.code;
+                this.checked = true;
             } else {
                 code = e.code;
+                this.checked = true;
             }
-            this.checked = true;
             this.$http
                 .post(
                     "wap/user/wx/loginByPhone",
@@ -155,7 +159,7 @@ export default {
     onShareAppMessage() {},
 };
 </script>
-<style>
+<style scoped>
 .content {
     width: 100vw;
     height: 100vh;
@@ -209,4 +213,14 @@ export default {
 .green {
     color: #000;
 }
+.funItem {
+    display: flex;
+    justify-content: center;
+    align-items: center;
+}
+.funItem .simple-radio {
+    display: flex;
+    align-items: center;
+    padding: 20rpx 0;
+}
 </style>

+ 21 - 0
src/pagesA/sharePages/sharePages.vue

@@ -70,6 +70,7 @@ export default {
     },
     methods: {
         acceptDevice() {
+            let userId = uni.getStorageSync("userId");
             if (!userId) {
                 uni.showModal({
                     content: "暂未登录,请重新登录",
@@ -85,6 +86,7 @@ export default {
                         }
                     },
                 });
+                return;
             }
             let shareConfirmParam = {
                 devId: this.devInfo.devId,
@@ -152,6 +154,25 @@ export default {
         this.devInfo = JSON.parse(options.devInfo);
         this.sharePhone = options.phone;
     },
+    onShow() {
+        let userId = uni.getStorageSync("userId");
+        if (!userId) {
+            uni.showModal({
+                content: "暂未登录,请重新登录",
+                complete: (res) => {
+                    if (res.confirm) {
+                        uni.reLaunch({
+                            url: "/pagesA/loginNew/loginNew",
+                        });
+                    } else {
+                        // uni.reLaunch({
+                        //     url: "/pagesA/loginNew/loginNew",
+                        // });
+                    }
+                },
+            });
+        }
+    },
     onShareAppMessage() {},
 };
 </script>