Ver Fonte

update: 解决登录Token过期bug

KELECHUAN há 2 anos atrás
pai
commit
91eb942144

BIN
.vs/slnx.sqlite


+ 39 - 8
subpkg/startup/guide.vue

@@ -36,16 +36,47 @@
 						icon: 'error'
 					});
 				} else {
-					if (this.token) {
-						let proof = await new WXBizDataCrypt('wx5705da8747c77cfe', this.token.session_key)
-						let numData = await proof.decryptData(e.detail.encryptedData, e.detail.iv)
-						this.$store.commit('m_parent/updatePhoneNumber', numData.phoneNumber);
-						//初始化App
-						await this.$initStart(numData.phoneNumber)
-						uni.navigateTo({
-							url: '/subpkg/startup/options'
+					try{
+						if (this.token) {
+							let proof = await new WXBizDataCrypt('wx5705da8747c77cfe', this.token.session_key)
+							let numData = await proof.decryptData(e.detail.encryptedData, e.detail.iv)
+							this.$store.commit('m_parent/updatePhoneNumber', numData.phoneNumber);
+							//初始化App
+							await this.$initStart(numData.phoneNumber)
+							uni.navigateTo({
+								url: '/subpkg/startup/options'
+							})
+						}else{
+							this.updateToken()
+							this.updateParentInfo()
+							this.updatePhoneNumber()
+							this.updateChildrenData()
+							this.updateUserData()
+							this.updateChildInfo()
+							uni.reLaunch({
+								url: '/subpkg/startup/login'
+							})
+							return uni.showToast({
+								title: '获取不到您的信息请重新登录',
+								icon: 'error'
+							});
+						}
+					}catch(e){
+						this.updateToken()
+						this.updateParentInfo()
+						this.updatePhoneNumber()
+						this.updateChildrenData()
+						this.updateUserData()
+						this.updateChildInfo()
+						uni.reLaunch({
+							url: '/subpkg/startup/login'
 						})
+						return uni.showToast({
+							title: '身份验证已过期请重新登录',
+							icon: 'error'
+						});
 					}
+
 				}
 			},
 		},

Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/subpkg/startup/guide.js.map


Diff do ficheiro suprimidas por serem muito extensas
+ 1 - 1
unpackage/dist/dev/mp-weixin/subpkg/startup/guide.js