From d1f08bfc65d459b893fb6d5134927e0c078d32e5 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期五, 24 一月 2025 13:50:59 +0800
Subject: [PATCH] Merge branch '2.0.1' of http://139.186.142.91:10010/r/productDev/funingyunwei into 2.0.1

---
 h5/pages/login.vue |   73 ++++++++++++++++++++++++++----------
 1 files changed, 53 insertions(+), 20 deletions(-)

diff --git a/h5/pages/login.vue b/h5/pages/login.vue
index bfa5c86..ebe40f2 100644
--- a/h5/pages/login.vue
+++ b/h5/pages/login.vue
@@ -29,7 +29,9 @@
 		loginPost,
 		getUserInfo,
 		sendSMsPost,
-		ywWxAuthorize
+		ywWxAuthorize,
+		
+		getRecordByUserPoint
 	} from '@/api'
 	import {
 		mapState,
@@ -45,11 +47,19 @@
 					code: ''
 				},
 				downTime: 0,
-				// code: '011dfEkl2PzcFe4ZxSnl22NKXz4dfEkQ'
 				code: ''
 			}
 		},
-
+		onLoad(option) {
+			console.log('onLoad');
+			// https://zhcg.fnwtzx.com/#/pages/login?type=0&ywid=ywid
+			if (option.ywid || option.ywid == 0) {
+				uni.setStorageSync('ywinfo', {
+					type: option.type,
+					ywid: option.ywid
+				})
+			}
+		},
 		onShow() {
 			// return
 			var that = this
@@ -67,23 +77,38 @@
 					code: code || this.code
 				}).then(res => {
 					if (res.code === 200) {
+						console.log('res', res);
 						that.$store.commit('setOpenId', res.data.openid)
-						if (res.data.token && res.data.token != '') {
+						if (res.data.token && res.data.token != '') {
 							that.$store.commit('setToken', res.data.token)
 							getUserInfo().then(ress => {
 								that.$store.commit('setUserInfo', ress.data)
 							})
-							setTimeout(() => {
-								uni.redirectTo({
-									url: "/pages/index"
+							const ywinfo = uni.getStorageSync('ywinfo') || {}
+							if (ywinfo.ywid && (ywinfo.type || ywinfo.type == 0)) {
+								getRecordByUserPoint({pointCode: ywinfo.ywid}).then(res => {
+									if(res.data && res.data.id){
+										uni.setStorageSync('ywinfo', {})
+										uni.redirectTo({
+											url: "/pages/polling/point?id=" + res.data.id
+										})
+									}
 								})
-							}, 300)
+							} else {
+								setTimeout(() => {
+									uni.redirectTo({
+										url: "/pages/index"
+									})
+								}, 300)
+							}
 						}
 					}
 				})
 			} else {
-				let url = 'https://zhcg.fnwtzx.com/yunwei_h5'
-				const appID = 'wx95ac1efb67f0330d'
+				// let url = 'https://zhcg.fnwtzx.com/yunwei_h5'
+				// const appID = 'wx95ac1efb67f0330d'
+				let url = 'https://dmtest.ahapp.net/yunwei_h5'
+				const appID = 'wx4d7c10bdec51942b'
 				let uri = encodeURIComponent(url)
 				let authURL =
 					`https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appID}&redirect_uri=${uri}&response_type=code&scope=snsapi_base#wechat_redirect`
@@ -91,12 +116,6 @@
 			}
 
 		},
-		// onBackPress(options) {
-		// 	uni.redirectTo({
-		// 		url: '/pages/login/login'
-		// 	})
-		// 	return true
-		// },
 		methods: {
 			...mapMutations(["setToken", "setUserInfo"]),
 			onLogin() {
@@ -121,10 +140,24 @@
 						this.setToken(res.data)
 						this.showToast('鐧诲綍鎴愬姛')
 						getUserInfo().then(ress => {
-							this.setUserInfo(ress.data)
-							uni.redirectTo({
-								url: "/pages/index"
-							})
+							this.setUserInfo(ress.data)
+							const ywinfo = uni.getStorageSync('ywinfo') || {}
+							if (ywinfo.ywid && (ywinfo.type || ywinfo.type == 0)) {
+							getRecordByUserPoint({pointCode: ywinfo.ywid}).then(res => {
+								getRecordByUserPoint({pointCode: ywinfo.ywid}).then(res => {
+									if(res.data && res.data.id){
+										uni.setStorageSync('ywinfo', {})
+										uni.redirectTo({
+											url: "/pages/polling/point?id=" + res.data.id
+										})
+									}
+								})
+							})
+							} else {
+								uni.redirectTo({
+									url: "/pages/index"
+								})
+							}
 						})
 					}
 				})

--
Gitblit v1.9.3