From 3db69ad0012032cf01c0911d2517135394ec9bea Mon Sep 17 00:00:00 2001
From: quanyawei <401863037@qq.com>
Date: Thu, 27 Jun 2024 14:39:22 +0800
Subject: [PATCH] fix: bug修改

---
 App.vue |  158 +++++++++++++++++++++++++++++++++-------------------
 1 files changed, 101 insertions(+), 57 deletions(-)

diff --git a/App.vue b/App.vue
index 3c6773b..d4a820d 100644
--- a/App.vue
+++ b/App.vue
@@ -3,32 +3,32 @@
 		getDic
 	} from '@/utils/login.js' // ������������
 	import store from '@/store/index.js'
-	import routingIntercept from '@/utils/permission.js'
 	import {
 		httpPost,
 		httpGet
 	} from '@/utils/http.js'
 	export default {
-		onShow: function(options) {
+		onShow(options) {
+			this.checkUpdate()
 			console.log('optionsonShow', options)
 			if (options.scene === 1007 || options.scene === 1014 || options.scene === 1008) {
 				// ������������������������������������
-				this.getWXCode()
+				// this.getWXCode()
 			}
 		},
 		onLaunch() {
 			// ������������������
 			let token = uni.getStorageSync('token')
-			console.log('apptoken', token)
+			console.log('apptoken1', !token)
 			if (!token) {
 				uni.login({
 					provider: 'weixin',
 					success: loginRes => {
-						console.log('loginRes', loginRes)
+						console.log('loginRes1', loginRes)
 						httpGet('/AppUser/wx/login', {
 							'code': loginRes.code
 						}).then(result => {
-							routingIntercept()
+							console.log('AppUser1', result)
 							try {
 								if (result.data.code === 0) {
 									uni.clearStorageSync()
@@ -73,65 +73,107 @@
 			}
 		},
 		methods: {
+			checkUpdate() {
+				// ������������������������������������������������������,������������������������������v1.9.90���������������getUpdateManager������������������������������������������
+				if (uni.canIUse('getUpdateManager')) {
+					const updateManager = uni.getUpdateManager()
+					// ���������������������������������
+					updateManager.onCheckForUpdate(function(res) {
+						// ���������������������������������������������������
+						console.log('res.hasUpdate', res.hasUpdate)
+						console.log('������������', res)
+						if (res.hasUpdate) {
+							// ���������������������
+							updateManager.onUpdateReady(function() {
+								uni.showModal({
+									title: '������������',
+									content: '���������������',
+									showCancel: false,
+									success(res) {
+										if (res.confirm) {
+											// ������������������������������������ applyUpdate ������������������������
+											updateManager.applyUpdate()
+										}
+									}
+								})
+							})
+							// ���������������������
+							updateManager.onUpdateFailed(function() {
+								uni.showModal({
+									title: '������������',
+									content: '������������������������~������������������������������������������������������~',
+									showCancel: false
+								})
+							})
+						}
+					})
+				} else {
+					// ���������������������������������������������������������������������������������������������
+					uni.showModal({
+						title: '������',
+						content: '���������������������������������������������������������������������������������������������������������',
+						success(res) {
+							if (res.confirm) {
+								// ������������������������������������������������������������������
+								uni.updateWeChatApp()
+							}
+						}
+					})
+				}
+			},
 			/**
 			 * ������������
 			 * ���������������������������������������������������������������������
 			 *
 			 */
 			getWXCode() {
-				let token = uni.getStorageSync('token')
-				console.log('apptoken', token)
-				if (!token) {
-					uni.login({
-						provider: 'weixin',
-						success: loginRes => {
-							console.log('loginRes', loginRes)
-							httpGet('/AppUser/wx/login', {
-								'code': loginRes.code
-							}).then(result => {
-								routingIntercept()
-								try {
-									if (result.data.code === 0) {
-										uni.clearStorageSync()
-										uni.setStorageSync('userInfor', JSON.stringify(result.data))
-										uni.setStorageSync('tonken', result.data.token)
-										uni.setStorageSync('openId', result.data.openId)
-										getDic()
-										this.$isResolve()
-									} else {
-										uni.clearStorageSync()
-										uni.setStorageSync('openId', result.data.openId)
-										uni.showModal({
-											title: '���������',
-											content: '������������������������������������������',
-											showCancel: false,
-											confirmText: '������',
-											success: res => {
-												if (res.confirm) {
-													uni.reLaunch({
-														url: '/pages/login/login',
-													})
-												}
-											},
-										})
-										this.$isResolve()
-									}
-								} catch (e) {
-									console.error(e)
+				uni.login({
+					provider: 'weixin',
+					success: loginRes => {
+						console.log('loginRes2', loginRes)
+						httpGet('/AppUser/wx/login', {
+							'code': loginRes.code
+						}).then(result => {
+							console.log('AppUser2', result)
+							try {
+								if (result.data.code === 0) {
+									uni.clearStorageSync()
+									uni.setStorageSync('userInfor', JSON.stringify(result.data))
+									uni.setStorageSync('tonken', result.data.token)
+									uni.setStorageSync('openId', result.data.openId)
+									getDic()
+									this.$isResolve()
+								} else {
+									uni.clearStorageSync()
+									uni.setStorageSync('openId', result.data.openId)
+									uni.showModal({
+										title: '���������',
+										content: '������������������������������������������',
+										showCancel: false,
+										confirmText: '������',
+										success: res => {
+											if (res.confirm) {
+												uni.reLaunch({
+													url: '/pages/login/login',
+												})
+											}
+										},
+									})
+									this.$isResolve()
 								}
-							}).catch(errors => {
-								console.log('appdddd', errors)
-								uni.showToast({
-									title: errors,
-									icon: 'none',
-								})
-								this.$isResolve()
+							} catch (e) {
+								console.error(e)
+							}
+						}).catch(errors => {
+							console.log('appdddd2', errors)
+							uni.showToast({
+								title: errors,
+								icon: 'none',
 							})
-						}
-					})
-				} else {
-					this.$isResolve()
-				}
+							this.$isResolve()
+						})
+					}
+				})
 			},
 			getLogin(data) {
 				// ������������������������code������������������������
@@ -165,6 +207,8 @@
 
 	html {
 		height: 100%;
+		overflow-x: hidden;
+		width: 750rpx;
 	}
 
 	.formItemContent {

--
Gitblit v1.8.0