XSLu08042 пре 4 дана
родитељ
комит
a86f5225db
2 измењених фајлова са 28 додато и 30 уклоњено
  1. 7 1
      common/request.js
  2. 21 29
      pages_course/videovip.vue

+ 7 - 1
common/request.js

@@ -62,7 +62,13 @@ export default class Request {
 					//收到开发者服务器成功返回的回调函数
 					if(type !==0&&(res.data.code == 401 || res.data.code == 4001||res.data.code == 4004)) {
 						store.commit('setCoureLogin', 2);
-						resolve({ code: 401, msg: '处理中', data: null });
+						uni.removeStorageSync("userinfos")
+						uni.removeStorageSync('userInfo');
+						uni.removeStorageSync('TOKEN_WEXIN');
+						if(type==1) {
+							uni.removeStorageSync('AppTokenmini_MYCourse')
+						}
+						resolve({ code: 401, data: null });
 						return
 					}
 					if (res.data.code == 401) { //没有权限直接退出到登录界面

+ 21 - 29
pages_course/videovip.vue

@@ -469,8 +469,11 @@
 
 			this.getWebviewUrl()
 			uni.$on('usercode', (data) => {
-				console.log('huoqu ', data)
-				this.goLogin(data)
+				console.log('huoqu ',data)
+				if(data) {
+					this.code=data.code
+					this.goLogin(data)
+				}
 			})
 			uni.$on('vipMsg', (data) => {
 				console.log(4444, data)
@@ -532,32 +535,19 @@
 				this.getH5CourseByVideo()
 			}
 			const AppToken = uni.getStorageSync('TOKEN_WEXIN')
-			console.log(AppToken)
-			// if (AppToken) {
-			// 	console.log("console.log(AppToken,this.userinfo)===",this.userinfo)
-			// 	// this.isLogin=true
-			// 	this.getUserInfoLooks()
-			// 	if (this.isAddKf == 1 && this.userinfo.userId) {
-			// 		console.log(1233)
-			// 		this.getH5CourseVideoDetails()
-			// 	} else {
-			// 		// this.checkUserInfoA()
-			// 		this.getIsAddKf()
-			// 	}
-			// }
-			this.$isLoginCourse().then(res=>{
-				if(res) {
-					this.isLogin = true
-					this.getUserInfoLooks()
-					if (this.isAddKf == 1 && this.userinfo.userId) {
-						console.log(1233)
-						this.getH5CourseVideoDetails()
-					} else {
-						// this.checkUserInfoA()
-						this.getIsAddKf()
-					}
+			console.log(this.code,AppToken)
+			if (AppToken&&!this.code) {
+				console.log("console.log(AppToken,this.userinfo)===",this.userinfo)
+				this.isLogin=true
+				this.getUserInfoLooks()
+				if (this.isAddKf == 1 && this.userinfo.userId) {
+					console.log(1233)
+					this.getH5CourseVideoDetails()
+				} else {
+					// this.checkUserInfoA()
+					this.getIsAddKf()
 				}
-			})
+			}
 			// if(this.sortLink){
 			// 	this.getLink()
 			// } else {
@@ -634,6 +624,7 @@
 				})
 			},
 			goLogin(data) {
+				this.isAddKf = 0
 				if (data) {
 					console.log('huoqu1222', data)
 					uni.showLoading({
@@ -660,9 +651,10 @@
 										uni.getStorageSync('TOKEN_WEXIN');
 										this.userInfo = uni.getStorageSync('userInfo');
 										this.isLogin = true
+										this.code = ''
 										// this.getH5CourseVideoDetails()
 										// setTimeout(()=>{
-										// 	this.getIsAddKf()
+											this.getIsAddKf()
 										// },200)
 									} else if (res.code == 406) {
 										uni.hideLoading();
@@ -1266,6 +1258,7 @@
 										title: '已清除缓存,请重新进入页面!',
 										icon: 'none'
 									})
+									this.goLogin()
 								}
 							}
 						} else {
@@ -1509,7 +1502,6 @@
 				// {videoId: this.videoId,qwUserId: this.qwUserId,corpId: this.corpId}
 				getIsAddKf(data).then(res => {
 						if (res.code == 200) {
-							this.isLogin = true
 							if (res.data) {
 								this.isAddKf = 1
 								if (this.userInfo.userId) {