shenxin 4 лет назад
Родитель
Сommit
62a779c9b0
3 измененных файлов с 48 добавлено и 23 удалено
  1. 12 4
      src/pages/my.vue
  2. 3 3
      src/pages/order.vue
  3. 33 16
      src/pagesSub/activity/activityDetail.vue

+ 12 - 4
src/pages/my.vue

@@ -74,7 +74,7 @@ export default {
   },
   },
   computed: {
   computed: {
     isCommissionEnable () {
     isCommissionEnable () {
-      return this.$store.state.enable_commission * 1 === 1
+      return this.$store.state.enable_commission * 1 === 1 && this.userInfo.token
     },
     },
     userInfo () {
     userInfo () {
       return this.$store.state.userInfo
       return this.$store.state.userInfo
@@ -84,7 +84,7 @@ export default {
     }
     }
   },
   },
   onShow () {
   onShow () {
-    if (this.userInfo) {
+    if (this.userInfo.token) {
       api.getUserInfoByToken().then(({ code, data }) => {
       api.getUserInfoByToken().then(({ code, data }) => {
         if (code === 200) {
         if (code === 200) {
           this.$store.commit('updateUserInfo', data)
           this.$store.commit('updateUserInfo', data)
@@ -108,6 +108,10 @@ export default {
         })
         })
       }
       }
       if (type === 3) {
       if (type === 3) {
+        if (!this.userInfo.token) {
+          this.login()
+          return
+        }
         uni.switchTab({
         uni.switchTab({
           url: 'order'
           url: 'order'
         })
         })
@@ -121,7 +125,7 @@ export default {
       })
       })
     },
     },
     jumpToCommissionApply () {
     jumpToCommissionApply () {
-      if (this.userInfo) {
+      if (this.userInfo.token) {
         uni.navigateTo({ url: '/pagesSub/commission/commission' })
         uni.navigateTo({ url: '/pagesSub/commission/commission' })
       } else {
       } else {
         uni.navigateTo({
         uni.navigateTo({
@@ -130,7 +134,7 @@ export default {
       }
       }
     },
     },
     jumpToCommission () {
     jumpToCommission () {
-      if (this.userInfo) {
+      if (this.userInfo.token) {
         uni.navigateTo({ url: '/pagesSub/commission/invite' })
         uni.navigateTo({ url: '/pagesSub/commission/invite' })
       } else {
       } else {
         uni.navigateTo({
         uni.navigateTo({
@@ -140,6 +144,10 @@ export default {
     },
     },
     // 个人信息
     // 个人信息
     toUserDetail () {
     toUserDetail () {
+      if (!this.userInfo.token) {
+        this.login()
+        return
+      }
       uni.navigateTo({
       uni.navigateTo({
         url: '/pagesSub/my/userDetail'
         url: '/pagesSub/my/userDetail'
       })
       })

+ 3 - 3
src/pages/order.vue

@@ -102,9 +102,9 @@ export default {
   },
   },
   onShow () {
   onShow () {
     if (!this.userId) {
     if (!this.userId) {
-      uni.navigateTo({
-        url: '/pagesSub/other/login'
-      })
+      // uni.navigateTo({
+      //   url: '/pagesSub/other/login'
+      // })
       return
       return
     }
     }
     this.enable = true
     this.enable = true

+ 33 - 16
src/pagesSub/activity/activityDetail.vue

@@ -25,7 +25,11 @@
         <view class="u-flex u-row-between u-p-t-22">
         <view class="u-flex u-row-between u-p-t-22">
           <text class="u-content-color">{{detail.join_number}}已参与</text>
           <text class="u-content-color">{{detail.join_number}}已参与</text>
           <button class="share-btn u-primary-color u-font-24 line-34"
           <button class="share-btn u-primary-color u-font-24 line-34"
-                  open-type="share">分享活动</button>
+                  v-if="!userId"
+                  @click="jumpToLogin">分享活动</button>
+          <button class="share-btn u-primary-color u-font-24 line-34"
+                  open-type="share"
+                  v-if="userId">分享活动</button>
         </view>
         </view>
         <image v-if="platBanner"
         <image v-if="platBanner"
                :src="platBanner.img"
                :src="platBanner.img"
@@ -331,26 +335,26 @@ export default {
       }
       }
     }
     }
   },
   },
-  watch: {
-    userId (e) {
-      if (!e) {
-        uni.navigateTo({
-          url: '/pagesSub/other/login'
-        })
-      }
-    }
-  },
+  // watch: {
+  //   userId (e) {
+  //     if (!e) {
+  //       uni.navigateTo({
+  //         url: '/pagesSub/other/login'
+  //       })
+  //     }
+  //   }
+  // },
   onLoad (options) {
   onLoad (options) {
     this.activityId = options.id
     this.activityId = options.id
     this.recordId = options.record_id
     this.recordId = options.record_id
   },
   },
   onShow () {
   onShow () {
-    if (!this.userId) {
-      uni.navigateTo({
-        url: '/pagesSub/other/login'
-      })
-      return
-    }
+    // if (!this.userId) {
+    //   uni.navigateTo({
+    //     url: '/pagesSub/other/login'
+    //   })
+    //   return
+    // }
     this.getDetailData()
     this.getDetailData()
     this.reNowTime()
     this.reNowTime()
   },
   },
@@ -385,6 +389,11 @@ export default {
     }
     }
   },
   },
   methods: {
   methods: {
+    jumpToLogin () {
+      uni.navigateTo({
+        url: '/pagesSub/other/login'
+      })
+    },
     onDialogOpen () {
     onDialogOpen () {
       uni.setClipboardData({
       uni.setClipboardData({
         data: this.detail.search_key ? this.detail.search_key : this.detail.shop_name
         data: this.detail.search_key ? this.detail.search_key : this.detail.shop_name
@@ -394,6 +403,10 @@ export default {
       this.openOtherApplte()
       this.openOtherApplte()
     },
     },
     onClickShare () {
     onClickShare () {
+      if (!this.userId) {
+        this.jumpToLogin()
+        return
+      }
       uni.navigateTo({ url: '/pagesSub/commission/invite' })
       uni.navigateTo({ url: '/pagesSub/commission/invite' })
     },
     },
     getShareUrl () {
     getShareUrl () {
@@ -502,6 +515,10 @@ export default {
         })
         })
         return
         return
       }
       }
+      if (!this.userId) {
+        this.jumpToLogin()
+        return
+      }
       uni.requestSubscribeMessage({
       uni.requestSubscribeMessage({
         tmplIds: this.$store.state.joinTemplateIds,
         tmplIds: this.$store.state.joinTemplateIds,
         complete: () => {
         complete: () => {