From a2299a6d4a6f99e9c11132138f5d3e9ec68f03ea Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期五, 06 六月 2025 19:19:34 +0800
Subject: [PATCH] 开发更新

---
 h5/pages/login.vue |   87 ++++++++++++++++++++++++++++++++++---------
 1 files changed, 68 insertions(+), 19 deletions(-)

diff --git a/h5/pages/login.vue b/h5/pages/login.vue
index bfa5c86..134d69c 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,
@@ -44,12 +46,26 @@
 					phone: '',
 					code: ''
 				},
+				ywinfo: {},
 				downTime: 0,
-				// code: '011dfEkl2PzcFe4ZxSnl22NKXz4dfEkQ'
 				code: ''
 			}
 		},
-
+		onLoad(option) {
+			console.log('onLoad');
+			// https://zhcg.fnwtzx.com/#/pages/login?type=0&ywid=ywid
+			const ywinfo = uni.getStorageSync('ywinfo') || {}
+			if (ywinfo.ywid && (ywinfo.type || ywinfo.type == 0)) {
+				this.ywinfo = ywinfo
+				uni.setStorageSync('ywinfo', {})
+			}
+			if (option.ywid || option.ywid == 0) {
+				uni.setStorageSync('ywinfo', {
+					type: option.type,
+					ywid: option.ywid
+				})
+			}
+		},
 		onShow() {
 			// return
 			var that = this
@@ -67,23 +83,43 @@
 					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 = this.ywinfo
+							if (ywinfo.ywid && (ywinfo.type || ywinfo.type == 0)) {
+								getRecordByUserPoint({
+									pointCode: ywinfo.ywid
+								}).then(res => {
+									if (res.data && res.data.id) {
+										uni.redirectTo({
+											url: "/pages/polling/point?id=" + res.data.id
+										})
+									} else {
+										uni.redirectTo({
+											url: "/pages/polling/empty?message=" + res.message
+										})
+									}
 								})
-							}, 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 +127,6 @@
 			}
 
 		},
-		// onBackPress(options) {
-		// 	uni.redirectTo({
-		// 		url: '/pages/login/login'
-		// 	})
-		// 	return true
-		// },
 		methods: {
 			...mapMutations(["setToken", "setUserInfo"]),
 			onLogin() {
@@ -122,9 +152,28 @@
 						this.showToast('鐧诲綍鎴愬姛')
 						getUserInfo().then(ress => {
 							this.setUserInfo(ress.data)
-							uni.redirectTo({
-								url: "/pages/index"
-							})
+							const ywinfo = this.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.redirectTo({
+											url: "/pages/polling/point?id=" + res.data.id
+										})
+									} else {
+										uni.redirectTo({
+											url: "/pages/polling/empty?message=" + res.message
+										})
+									}
+								})
+								// })
+							} else {
+								uni.redirectTo({
+									url: "/pages/index"
+								})
+							}
 						})
 					}
 				})

--
Gitblit v1.9.3