From d8b41fff43a2cee6a8f714ffa807623b15803786 Mon Sep 17 00:00:00 2001
From: quanyawei <401863037@qq.com>
Date: Fri, 20 Oct 2023 15:21:35 +0800
Subject: [PATCH] fix:立行立改Uniapp小程序新建项目

---
 App.vue |  142 +++++++++++++++++++----------------------------
 1 files changed, 58 insertions(+), 84 deletions(-)

diff --git a/App.vue b/App.vue
index 040d57f..dd2c821 100644
--- a/App.vue
+++ b/App.vue
@@ -1,97 +1,71 @@
 <script>
-import Vue from 'vue'
-import {
-	httpPost,
-	httpGet
-} from '@/utils/http.js'
-export default {
-	onLaunch: function() {
-		// ������������������
-		this.getUserInfo()
-	},
-	methods: {
-		/**
+	import Vue from 'vue'
+	import {
+		getUserInfor,
+		getDic
+	} from '@/utils/login.js' // ������������
+	import {
+		httpPost,
+		httpGet
+	} from '@/utils/http.js'
+	export default {
+		onLaunch: function() {
+			// ������������������
+			this.getUserInfo()
+		},
+		methods: {
+			/**
 			 * ������������
 			 * ���������������������������������������������������������������������
 			 *
 			 */
-		getUserInfo() {
-			uni.login({
-				provider: 'weixin',
-				success(res) {
-					if (res.code) {
-						console.log('code', res.code)
-						// ������������������������code������������������������
-						httpGet('/AppUser/wx/login', {
-							'code': res.code
-						}).then((result)=> {
-							if (result.data.code === 0) {
-								// ������������
-							} else {
-								// ���������������
-								uni.setStorageSync('openId', result.data.openId)
-								uni.showModal({
-									title: '���������',
-									content: '������������������������������������������',
-									showCancel: false,
-									confirmText: '������',
-									success: (res)=> {
-										if (res.confirm) {
-											uni.reLaunch({
-												url: '/pages/login/login',
-											})
-										}
-									},
-								})
-							}
-
-						})
-					} else {
-						console.log(res.errMsg)
-					}
-				}
-			})
-		},
-
-		autoLogin() {
-			console.log('Vue.prototype.$storage', Vue.prototype.$storage.get('tonken'))
-			let tonken = this.$storage.get('utoken')
-			console.log('tonken', tonken)
-			// ���������������������������������������������������������������������
-			if (!tonken) {
-				const params = {
-					account: accountInFor.account,
-					password: accountInFor.password,
-				}
-				uni.showLoading({
-					title: '���������������...',
-				})
-				setTimeout(()=> {
-					uni.reLaunch({
-						url: '/pages/actionChange/agencyPage/index',
-					})
-				}, 3000)
-			} else {
-				// ������������������������������������������������������������
-				uni.showModal({
-					title: '���������',
-					content: '������������������������������������������',
-					showCancel: false,
-					confirmText: '������',
-					success: (res)=> {
-						if (res.confirm) {
-							uni.reLaunch({
-								url: '/pages/login/login',
+			getUserInfo() {
+				uni.login({
+					provider: 'weixin',
+					success(res) {
+						if (res.code) {
+							// ������������������������code������������������������
+							httpGet('/AppUser/wx/login', {
+								'code': res.code
+							}).then(result => {
+								if (result.data.code === 0) {
+									// ������������
+									uni.clearStorageSync()
+									uni.setStorageSync('token', result.data.token)
+									// setTimeout(() => {
+									// 	uni.reLaunch({
+									// 		url: '/pages/actionChange/agencyPage/index',
+									// 	})
+									// }, 3000)
+									getUserInfor(result.data.token)
+									getDic()
+								} else {
+									// ���������������
+									uni.setStorageSync('openId', result.data.openId)
+									uni.showModal({
+										title: '���������',
+										content: '������������������������������������������',
+										showCancel: false,
+										confirmText: '������',
+										success: res => {
+											if (res.confirm) {
+												uni.reLaunch({
+													url: '/pages/login/login',
+												})
+											}
+										},
+									})
+								}
 							})
+						} else {
+							console.log(res.errMsg)
 						}
-					},
+					}
 				})
-			}
+			},
 		},
-	},
-}
+	}
 </script>
-
 <style lang="scss">
 	/* ������������������������������������style������������lang="scss"������ */
 	@import "@/uni_modules/uview-ui/index.scss";

--
Gitblit v1.8.0