jwyu 2 anni fa
parent
commit
9d5f6e4fbb

+ 28 - 0
mixin/index.js

@@ -133,5 +133,33 @@ module.exports = {
       }
     },
 
+    //全局检测用户是否绑定过方法(用户点击前的判断或者其他时候的判断)
+    checkUserIsBind(){
+      return new Promise((resovle,reject)=>{
+        if(store.state.user.userInfo.is_bind===0){
+          wx.showModal({
+            title: '温馨提示',
+            content: '为了优化您的用户体验,\n 请登录后查看更多信息!',
+            confirmText:'去登录',
+            cancelColor:'#666',
+            confirmColor:'#E6B77D',
+            success: function (res) {
+              if (res.confirm) {
+                console.log('用户点击确定');
+                uni.reLaunch({
+                  url:'/pages/login'
+                })
+              } else if (res.cancel) {
+                console.log('用户点击取消');
+              }
+            }
+          });
+          reject()
+        }else{
+          resovle('不用登录')
+        }
+      })
+    }
+
   },
 };

+ 1 - 0
mixin/questionMixin.js

@@ -352,6 +352,7 @@ export default {
         },
         //申请权限
         async handleGoApply(){
+            await this.checkUserIsBind()
             const {customer_info} = this.noAuthInfo
             if (customer_info.has_apply) { //已经申请过
                 uni.showToast({

+ 2 - 1
pages-sandTable/sandTable.vue

@@ -386,7 +386,8 @@
 				})
 			},
 			// 权限申请
-			toApply(type=''){
+			async toApply(type=''){
+				await this.checkUserIsBind()
 				if(type=='auto'){
 					apiApplyPermission({
 						company_name:this.applyer.company,

+ 7 - 3
pages/activity/activity.vue

@@ -667,7 +667,8 @@ export default {
             this.getList()
         },
 
-        handleGoDetail(id) {
+        async handleGoDetail(id) {
+            await this.checkUserIsBind()
             uni.navigateTo({
                 url: '/pages-activity/detail?id=' + id
             });
@@ -694,7 +695,8 @@ export default {
             }
         },
 
-        handleRemind(e,index){    
+        async handleRemind(e,index){   
+            await this.checkUserIsBind()
             if(e.hasRemind===0){
                 this.handleAddRemind(e,index)
             }else{
@@ -770,7 +772,8 @@ export default {
             }
         },
 
-        handleRegister(e,index){
+        async handleRegister(e,index){
+            await this.checkUserIsBind()
             if(e.registerState===0){
                 this.handleAddRegister(e,index)
             }else{
@@ -850,6 +853,7 @@ export default {
 
         // 点击立即申请
         async handleApply(){
+            await this.checkUserIsBind()
             if(this.pupData.customer_info.has_apply){//已经申请过
                 this.pupData.content=`<p>您已提交过申请,请耐心等待</p>`
                 this.pupData.type=''

+ 2 - 1
pages/chart/component/noAuth.vue

@@ -83,7 +83,8 @@ export default {
             }
         },
 
-        handleApply(){
+        async handleApply(){
+            await this.checkUserIsBind()
             if(this.info.customer_info.status=='流失'){
                 apiApplyPermission({
                     company_name:this.info.customer_info.company_name,

+ 1 - 1
pages/pricedriven/pricedriven.vue

@@ -1,5 +1,5 @@
 <template>
-    <web-view :src="url" @message="handleGetMessage"/></web-view>
+    <web-view :src="url" @message="handleGetMessage"></web-view>
 </template>
 
 <script>

+ 16 - 14
pages/report/report.vue

@@ -262,17 +262,17 @@ export default {
       }
     },
 
-	//跳转
-	linkPage({mark}) {
-		const url = this.tabPathMap.get(mark);
-		uni.navigateTo({ url,
-			fail () {
-			   uni.switchTab({
-				  url,
-			   })
-		   } 
-		})
-	},
+    //跳转
+    linkPage({mark}) {
+      const url = this.tabPathMap.get(mark);
+      uni.navigateTo({ url,
+        fail () {
+          uni.switchTab({
+            url,
+          })
+        } 
+      })
+    },
 	
     // 跳转分类
     goClassify(){
@@ -285,8 +285,9 @@ export default {
     },
     
     //跳转我的
-    goUser(){
-       uni.navigateTo({
+    async goUser(){
+      await this.checkUserIsBind()
+      uni.navigateTo({
         url: '/pages/user/user',
         fail () {
           uni.switchTab({
@@ -297,7 +298,8 @@ export default {
     },
 
     //跳转报告详情
-    goDetail(item){
+    async goDetail(item){
+      await this.checkUserIsBind()
       if(['晨报','周报'].includes(item.classify_name_first)){
         uni.navigateTo({url: `/pages-report/chapterDetail?chapterId=${item.report_chapter_id}&fromPage=home`})
       }else{

+ 2 - 1
pages/video/components/noAuth.vue

@@ -50,7 +50,8 @@ export default {
             }
         },
 
-        handleApply(){
+        async handleApply(){
+            await this.checkUserIsBind()
             const {customer_info}=this.info
             if(customer_info.has_apply){
                 uni.showToast({

+ 2 - 1
pages/voice/components/noAuth.vue

@@ -50,7 +50,8 @@ export default {
             }
         },
 
-        handleApply(){
+        async handleApply(){
+            await this.checkUserIsBind()
             const {customer_info}=this.info
             if(customer_info.has_apply){
                 uni.showToast({

+ 6 - 4
pages/voice/voice.vue

@@ -165,10 +165,12 @@ export default {
         //无权限时刷新列表
         if(!this.isAuth){
             this.getOptionsList()
+        }else{
+            this.$nextTick(()=>{
+                this.selectComponent('#tabs').resize();// 解决初始渲染 vant tab 底部条
+            })
         }
-        this.$nextTick(()=>{
-			this.selectComponent('#tabs').resize();// 解决初始渲染 vant tab 底部条
-		})
+        
         this.showPage=true
     },
     onHide(){
@@ -304,7 +306,7 @@ export default {
             this.tabsList=temarr||[]
             this.activeId=temarr[0].SectionId
             this.$nextTick(()=>{
-                this.selectComponent('#tabs').resize();// 解决初始渲染 vant tab 底部条
+                this.selectComponent('#tabs')?.resize();// 解决初始渲染 vant tab 底部条
             })
             this.getVoiceList()
         },

+ 8 - 7
utils/request.js

@@ -35,6 +35,7 @@ const wechatLogin=()=>{
 				apiWechatLogin({code:loginRes.code}).then(res=>{
 					if(res.code===200){
 						store.commit('setToken', res.data.authorization)
+						store.dispatch('getUserInfo')
 						resolve(res.data)
 					}
 				})
@@ -61,13 +62,13 @@ const refreshToken=async (url,params,method,resolve)=>{
 		isRefreshing=true
 		const wechatLoginRes=await wechatLogin()
 		console.log(wechatLoginRes);
-		if(!wechatLoginRes.is_bind){
-			uni.reLaunch({
-				url:'/pages/login'
-			})
-			isRefreshing=false
-			return
-		}
+		// if(!wechatLoginRes.is_bind){
+		// 	uni.reLaunch({
+		// 		url:'/pages/login'
+		// 	})
+		// 	isRefreshing=false
+		// 	return
+		// }
 		// 重新请求队列
 		requestList.map(MT=>{MT()})
 		requestList=[]