From e49e0e98c6776900bc3578ed2fe880bfceeb1c2c Mon Sep 17 00:00:00 2001
From: quanyawei <401863037@qq.com>
Date: Wed, 08 Nov 2023 15:53:26 +0800
Subject: [PATCH] fix:查看详情权限修改

---
 App.vue |   80 ++++++++++++++++++++++++++++++++++++---
 1 files changed, 73 insertions(+), 7 deletions(-)

diff --git a/App.vue b/App.vue
index 2dbd4d1..3c6773b 100644
--- a/App.vue
+++ b/App.vue
@@ -3,11 +3,19 @@
 		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) {
+			console.log('optionsonShow', options)
+			if (options.scene === 1007 || options.scene === 1014 || options.scene === 1008) {
+				// ������������������������������������
+				this.getWXCode()
+			}
+		},
 		onLaunch() {
 			// ������������������
 			let token = uni.getStorageSync('token')
@@ -20,11 +28,13 @@
 						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 {
@@ -54,6 +64,7 @@
 								title: errors,
 								icon: 'none',
 							})
+							this.$isResolve()
 						})
 					}
 				})
@@ -68,13 +79,59 @@
 			 *
 			 */
 			getWXCode() {
-				let that = this
-				uni.login({
-					provider: 'weixin',
-					success(res) {
-						that.getLogin(res.code)
-					}
-				})
+				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)
+								}
+							}).catch(errors => {
+								console.log('appdddd', errors)
+								uni.showToast({
+									title: errors,
+									icon: 'none',
+								})
+								this.$isResolve()
+							})
+						}
+					})
+				} else {
+					this.$isResolve()
+				}
 			},
 			getLogin(data) {
 				// ������������������������code������������������������
@@ -148,4 +205,13 @@
 			line-height: 30px !important;
 		}
 	}
+
+	.ridoaBox {
+		text-align: center;
+		padding: 10px 0px;
+
+		/deep/.u-radio {
+			padding-right: 10px;
+		}
+	}
 </style>
\ No newline at end of file

--
Gitblit v1.8.0