From 2800434db8a3117cf4f1ccb119e7ac939f0511bb Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期四, 23 四月 2026 09:02:50 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
small-program/shop/pages/login/login.vue | 57 +++++++++++++++++++++++++++++++++++----------------------
1 files changed, 35 insertions(+), 22 deletions(-)
diff --git a/small-program/shop/pages/login/login.vue b/small-program/shop/pages/login/login.vue
index dcd8401..a139eb9 100644
--- a/small-program/shop/pages/login/login.vue
+++ b/small-program/shop/pages/login/login.vue
@@ -9,19 +9,13 @@
<view class="form-wrap">
<view class="input-row">
<u-icon name="account" size="30" color="#B8B8B8"></u-icon>
- <input v-model="form.account" class="input-field" type="text" placeholder="璇疯緭鍏ヨ处鍙�" placeholder-style="color: #999999;" />
+ <input v-model="form.telephone" class="input-field" type="text" placeholder="璇疯緭鍏ヨ处鍙�" placeholder-style="color: #999999;" />
</view>
<view class="input-divider"></view>
<view class="input-row password-row">
<u-icon name="lock" size="30" color="#B8B8B8"></u-icon>
<input v-model="form.password" class="input-field" password type="text" placeholder="璇疯緭鍏ュ瘑鐮�" placeholder-style="color: #999999;" />
- </view>
- <view class="input-divider"></view>
-
- <view class="input-row password-row">
- <u-icon name="phone" size="30" color="#B8B8B8"></u-icon>
- <input v-model="form.telephone" class="input-field" type="number" maxlength="11" placeholder="璇疯緭鍏ユ墜鏈哄彿" placeholder-style="color: #999999;" />
</view>
<view class="input-divider"></view>
</view>
@@ -45,16 +39,37 @@
export default {
computed: {
- ...mapState(['openid'])
+ ...mapState(['openid', 'userInfo'])
},
data() {
return {
agreed: false,
form: {
- account: '',
- password: '',
- telephone: ''
+ telephone: '',
+ password: ''
}
+ }
+ },
+ onLoad() {
+ // 闈欓粯鐧诲綍
+ if (this.userInfo.bindShopId) {
+ this.$u.api.shopSilentLogin({})
+ .then(async res => {
+ 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)
+ }
+ setTimeout(() => {
+ uni.reLaunch({
+ url: '/shop/pages/store-home/store-home'
+ });
+ }, 1000)
+ }
+ })
}
},
methods: {
@@ -66,7 +81,7 @@
})
return
}
- if (!this.form.account) {
+ if (!this.form.telephone) {
uni.showToast({
title: '璇疯緭鍏ヨ处鍙�',
icon: 'none'
@@ -76,13 +91,6 @@
if (!this.form.password) {
uni.showToast({
title: '璇疯緭鍏ュ瘑鐮�',
- icon: 'none'
- })
- return
- }
- if (!this.form.telephone) {
- uni.showToast({
- title: '璇疯緭鍏ユ墜鏈哄彿',
icon: 'none'
})
return
@@ -98,11 +106,16 @@
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.switchTab({
- url: '/pages/shop-index/shop-index'
- })
+ uni.reLaunch({
+ url: '/shop/pages/store-home/store-home'
+ });
}, 1500)
} else {
uni.showToast({
--
Gitblit v1.9.3