From a8c03746e6bd8ac1d46dc48c1b10bceff543664f Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期二, 10 十二月 2024 20:16:12 +0800
Subject: [PATCH] ll

---
 h5/pages/login/login.vue |   82 +++++++++++++++++++---------------------
 1 files changed, 39 insertions(+), 43 deletions(-)

diff --git a/h5/pages/login/login.vue b/h5/pages/login/login.vue
index c20258d..15766ad 100644
--- a/h5/pages/login/login.vue
+++ b/h5/pages/login/login.vue
@@ -1,6 +1,6 @@
 <template>
 	<view class="main_app">
-		<image class="login_bg" src="@/static/login_bg@2x.png" mode="widthFix" />
+		<image class="login_bg" src="@/static/staff/shenfen_bg@2x.png" mode="widthFix" />
 		<view class="h1">瀹夋嘲鐗╂祦鏅烘収鍥尯</view>
 		<view class="placeholder6 place">璇烽�夋嫨鎮ㄧ殑韬唤</view>
 		<view class="item" @click="userAuth(1)">
@@ -32,7 +32,7 @@
 
 <script>
 	import {
-		wxAuthorizea,
+		wxAuthorizea,
 		getUserInfo
 	} from '@/api'
 	import {
@@ -41,18 +41,17 @@
 	export default {
 		data() {
 			return {
-				code: '091RVIkl2SZXDe4WySll2pAL8D1RVIkb'
+				code: ''
 			}
 		},
-		onLoad() {
+		onShow() {
 			var that = this
-			let url = window.location.href
+			let url = 'https://atwl.ahzyssl.com/zhyq_h5/#/'
 			let code = ''
-			if (url.indexOf('code=') !== -1) {
+			if (window.location.href.indexOf('code=') !== -1 || this.code) {
 
-			} else {
-				return
-				let url = window.location.href
+			} else {
+				// let url = window.location.href
 				const appID = 'wx173e6caf5abc718a'
 				let uri = encodeURIComponent(url)
 				let authURL =
@@ -98,13 +97,13 @@
 				let url = window.location.href
 				let code = ''
 				if (url.indexOf('code=') !== -1 || this.code) {
-					// const query = url.split('?')
-					// for (const q of query) {
-					// 	if (q.indexOf('code=') !== -1) {
-					// 		let statusIndex = q.indexOf('&state') - 1
-					// 		code = q.substring(q.indexOf('code=') + 5, statusIndex)
-					// 	}
-					// }
+					const query = url.split('?')
+					for (const q of query) {
+						if (q.indexOf('code=') !== -1) {
+							let statusIndex = q.indexOf('&state')
+							code = q.substring(q.indexOf('code=') + 5, statusIndex)
+						}
+					}
 					wxAuthorizea({
 						code: code || this.code,
 						source: source
@@ -113,35 +112,32 @@
 							that.$store.commit('setOpenId', res.data.openid)
 							if (res.data.member) {
 								that.$store.commit('setMember', res.data.member)
-							}
-							if (res.data.token) {
-								that.$store.commit('setToken', res.data.token)
-								getUserInfo().then(ress => {
-								  that.$store.commit('setUserInfo', ress.data)
-								})
 							}
 							let flag = res.data.member && res.data.member.id
-							setTimeout(() => {
-								if (source == 0) {
-									this.driverLogin(flag)
-								} else if (source == 2) {
-									this.staffLogin(flag)
-								} else {
-									this.jump('/pages/index/index')
-								}
+							setTimeout(() => {
+								if (source == 0) {
+									if (res.data.token) {
+										that.$store.commit('setToken', res.data.token)
+										getUserInfo().then(ress => {
+											that.$store.commit('setDriverInfo', ress.data)
+										})
+									}
+									this.driverLogin(flag)
+								} else if (source == 2) {
+									if (res.data.token) {
+										that.$store.commit('setToken', res.data.token)
+										getUserInfo().then(ress => {
+											that.$store.commit('setUserInfo', ress.data)
+										})
+									}
+									this.staffLogin(flag)
+								} else {
+									this.jump('/pages/index/index')
+								}
 							}, 300)
 						}
 					})
 				}
-				// }
-				// 鍒锋柊token
-				// setTimeout(() => {
-				// 	refreshToken().then(res => {
-				// 		if (res.code && res.code === 200) {
-				// 			this.$store.commit('setToken', res.data)
-				// 		}
-				// 	})
-				// }, 3000)
 			}
 		}
 	}
@@ -149,9 +145,9 @@
 
 <style lang="scss">
 	.main_app {
-		width: 100vw;
-		box-sizing: border-box;
-		overflow: hidden;
+		width: 100vw;
+		box-sizing: border-box;
+		overflow: hidden;
 		margin: 0;
 		height: 100vh;
 		padding-top: 80rpx;
@@ -161,7 +157,7 @@
 
 		.login_bg {
 			position: absolute;
-			top: 0;
+			top: 0;
 			left: 0;
 			width: 100%;
 			z-index: -1;

--
Gitblit v1.9.3