jwyu 3 years ago
parent
commit
6029d81517
7 changed files with 54 additions and 5 deletions
  1. 13 0
      mixin/index.js
  2. 1 4
      pages-activity/detail.vue
  3. 22 1
      pages/activity/activity.vue
  4. 1 0
      pages/login.vue
  5. 3 0
      pages/user/user.vue
  6. 2 0
      store/index.js
  7. 12 0
      store/modules/activity.js

+ 13 - 0
mixin/index.js

@@ -57,6 +57,7 @@ module.exports = {
   },
   onShow(){
     this.userInfo=this.$store.state.user.userInfo
+    this.handleActivityListPageRefresh()
   },
   methods: {
     // 设置tabbar的选中态
@@ -76,6 +77,18 @@ module.exports = {
           });
         }
       }
+    },
+
+    // 控制是否刷新活动列表页
+    handleActivityListPageRefresh(){
+      const page = this.$mp&&this.$mp.page;
+      if(page&&page.route&&page.route=='pages/activity/activity') return
+
+      if(page&&page.route&&page.route=='pages-activity/detail'){
+        this.$store.commit('setActivityListPageRefreshStatus', false)
+      }else{
+        this.$store.commit('setActivityListPageRefreshStatus', true)
+      }
       
     },
 

+ 1 - 4
pages-activity/detail.vue

@@ -158,6 +158,7 @@ export default {
     onLoad(options) {
         this.id = options.id;
         this.getDetail();
+        this.getAudios()
     },
     onShareAppMessage() {
         return {
@@ -224,10 +225,6 @@ export default {
                       this.infoList.push({label: "网络参会",text: res.data.linkParticipants,color: "yellow",type: "copy"})
                     }
                 }
-
-                if (res.data.activityState === 3) {
-                    this.getAudios();
-                }
             }
         },
 

+ 22 - 1
pages/activity/activity.vue

@@ -137,7 +137,7 @@ export default {
                 }
               }
           }
-      }  
+      }
     },
     data() {
         return {
@@ -163,6 +163,11 @@ export default {
         this.addEventListenerRemind()
         this.addEventListenerRegister()
     },
+    onShow() {
+        if(this.$store.state.activity.activityListPageRefresh){
+            this.allRefresh()
+        }
+    },
     onUnload(){
 		uni.$off('activityDetailSetRemind')
         uni.$off('activityDetailSetRegister')
@@ -188,6 +193,22 @@ export default {
     },
 
     methods: {
+        // 切换tabbar页面时 整个刷新
+        allRefresh(){
+            this.tabActive= '1'
+            this.statusActive='1'
+            this.pupData={
+                show:false,
+                content:'',//弹窗html字符串
+                type:'',
+                mobile:"",
+            }
+            this.page = 1
+            this.list = []
+            this.finished = false
+            this.getList()
+        },
+
         // 监听详情中设置提醒
         addEventListenerRemind(){
             uni.$on('activityDetailSetRemind',e=>{

+ 1 - 0
pages/login.vue

@@ -125,6 +125,7 @@ export default {
 
         // 获取微信绑定的手机号登录
         async getPhoneNumber({detail}){
+            if(!detail.encryptedData||!detail.iv) return
             const res=await apiGetWechatPhone({
                 encryptedData:detail.encryptedData,
                 iv:detail.iv,

+ 3 - 0
pages/user/user.vue

@@ -57,6 +57,9 @@
 				lastTime:""		
 			}
 		},
+		onShow() {
+			this.$store.dispatch('getUserInfo')
+		},
 		methods: {
 			async handleGoApplyPermission(){
 				const res=await apiLastApplyRecord()

+ 2 - 0
store/index.js

@@ -1,6 +1,7 @@
 import Vue from 'vue'
 import Vuex from 'vuex'
 import user from './modules/user.js'
+import activity from './modules/activity'
 Vue.use(Vuex);//vue的插件机制
 
 //Vuex.Store 构造器选项
@@ -10,6 +11,7 @@ const store = new Vuex.Store({
 	actions:{},
 	modules:{
 		user,
+		activity
 	}
 })
 export default store

+ 12 - 0
store/modules/activity.js

@@ -0,0 +1,12 @@
+const activityModules={
+    state:{
+        activityListPageRefresh:false,//活动列表是否刷新
+    },
+    mutations: {
+        setActivityListPageRefreshStatus(state,e){
+            state.activityListPageRefresh=e
+        }
+    }
+}
+
+export default activityModules;