From 908b9876dde97acbb09c53dc6debe3eecbb9d1b4 Mon Sep 17 00:00:00 2001
From: rk <94314517@qq.com>
Date: 星期二, 28 四月 2026 22:10:32 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 small-program/shop/pages/login/login.vue |  111 +++++++++++++++++++++++++++++++++----------------------
 1 files changed, 67 insertions(+), 44 deletions(-)

diff --git a/small-program/shop/pages/login/login.vue b/small-program/shop/pages/login/login.vue
index de6bb48..954e918 100644
--- a/small-program/shop/pages/login/login.vue
+++ b/small-program/shop/pages/login/login.vue
@@ -26,9 +26,9 @@
 			<image class="agree-icon" :src="agreed ? '/static/icon/ic_accept_sel@2x.png' : '/static/icon/ic_accept@2x.png'" mode="aspectFit" @tap="agreed = !agreed"></image>
 			<view class="agreement-text-wrap">
 				<text class="agreement-text">鎴戝凡闃呰骞跺悓鎰�</text>
-				<text class="agreement-link" @click="goToService">銆婄敤鎴锋湇鍔″崗璁��</text>
+				<text class="agreement-link" @click="goToService(2)">銆婇棬搴楁湇鍔″崗璁��</text>
 				<text class="agreement-text">鍙�</text>
-				<text class="agreement-link" @click="goToPrivacy">銆婄敤鎴烽殣绉佹斂绛栥��</text>
+				<text class="agreement-link" @click="goToService(3)">銆婇棬搴楅殣绉佹斂绛栥��</text>
 			</view>
 		</view>
 	</view>
@@ -39,7 +39,7 @@
 
 	export default {
 		computed: {
-			...mapState(['openid'])
+			...mapState(['openid', 'userInfo','userType'])
 		},
 		data() {
 			return {
@@ -50,15 +50,44 @@
 				}
 			}
 		},
+		onLoad() {
+			// 闈欓粯鐧诲綍
+			if (this.userInfo.bindShopId) {
+				uni.showLoading({
+					title:'鐧诲綍涓�...'
+				})
+				try{
+					console.log(this.userType,"============================================")
+					this.$u.api.shopSilentLogin({})
+						.then( res => {
+							if (res.code === 200 && res.data) {
+								this.$store.commit('setUserType', 1)
+								this.$store.commit('setShopToken', res.data.token)
+								// 鑾峰彇闂ㄥ簵淇℃伅
+								this.$u.api.getShopInfo({}).then( shopInfoRes => {
+									if (shopInfoRes.code === 200) {
+										this.$store.commit('setShopInfo', shopInfoRes.data)
+									}
+									uni.hideLoading();
+									// setTimeout(() => {
+										uni.navigateTo({
+											url: '/shop/pages/store-home/store-home'
+										});
+									// }, 1000)
+								})
+							}
+							uni.hideLoading()
+						})
+				}catch(e){
+					uni.hideLoading()
+				}
+				setTimeout(() => {
+					uni.hideLoading()
+				}, 10000)
+			}
+		},
 		methods: {
 			async handleLogin() {
-				if (!this.agreed) {
-					uni.showToast({
-						title: '璇峰厛闃呰骞跺悓鎰忓崗璁�',
-						icon: 'none'
-					})
-					return
-				}
 				if (!this.form.telephone) {
 					uni.showToast({
 						title: '璇疯緭鍏ヨ处鍙�',
@@ -73,47 +102,41 @@
 					})
 					return
 				}
-				uni.showLoading({ title: '鐧诲綍涓�...', mask: true })
-				try {
-					const res = await this.$u.api.shopLogin({
-						openid: this.openid,
-						password: this.form.password,
-						telephone: this.form.telephone
-					})
-					uni.hideLoading()
-					if (res.code === 200) {
-						this.$store.commit('setUserType', 1)
-						this.$store.commit('setShopToken', res.data.token)
-						uni.showToast({ title: '鐧诲綍鎴愬姛', icon: 'success' })
-						setTimeout(() => {
-							uni.switchTab({
-								url: '/pages/shop-index/shop-index'
-							})
-						}, 1500)
-					} else {
-						uni.showToast({
-							title: res.msg || '鐧诲綍澶辫触',
-							icon: 'none'
-						})
-					}
-				} catch (err) {
-					uni.hideLoading()
+				if (!this.agreed) {
 					uni.showToast({
-						title: '鐧诲綍澶辫触',
+						title: '璇峰厛闃呰骞跺悓鎰忓崗璁�',
 						icon: 'none'
 					})
+					return
+				}
+				uni.showLoading({ title: '鐧诲綍涓�...', mask: true })
+				const res = await this.$u.api.shopLogin({
+					openid: this.openid,
+					password: this.form.password,
+					telephone: this.form.telephone
+				})
+				uni.hideLoading()
+				if (res.code === 200) {
+					this.$store.commit('setUserType', 1)
+					this.$store.commit('setShopToken', res.data.token)
+					// 鑾峰彇闂ㄥ簵淇℃伅
+					const shopInfoRes = await this.$u.api.getShopInfo({})
+					if (shopInfoRes.code === 200) {
+						this.$store.commit('setShopInfo', shopInfoRes.data)
+					}
+					uni.showToast({ title: '鐧诲綍鎴愬姛', icon: 'success' })
+					setTimeout(() => {
+						uni.reLaunch({
+							url: '/shop/pages/store-home/store-home'
+						});
+					}, 1500)
 				}
 			},
-			goToService() {
+			goToService(type) {
 				uni.navigateTo({
-					url: '/pages/rich-text/rich-text?type=userAgreement'
+					url: '/pages/rich-text/rich-text?type='+type
 				})
-			},
-			goToPrivacy() {
-				uni.navigateTo({
-					url: '/pages/rich-text/rich-text?type=privacyPolicy'
-				})
-			}
+			} 
 		}
 	}
 </script>

--
Gitblit v1.9.3