From 3eb55758a49eb73ad09a6bf00c6ce58eb255254a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E9=A3=9E=E6=B4=8B?=
<15778543+xufeiyang6017@user.noreply.gitee.com>
Date: Mon, 5 Jan 2026 16:52:14 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E7=99=BB=E5=BD=95?=
=?UTF-8?q?=E5=90=8E=E6=98=BE=E7=A4=BA=E8=B4=A7=E6=BA=90=E7=AE=A1=E7=90=86?=
=?UTF-8?q?=E6=8C=89=E9=92=AE=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 新增 isLoggedIn 状态字段控制货源管理按钮显示
- 在登录成功后自动更新 isLoggedIn 状态
- 使用 wx:if 条件渲染货源管理按钮,仅登录后显示
---
pages/index/index.js | 20 +++++++++++++++++---
pages/index/index.wxml | 5 ++---
pages/index/index.wxss | 2 +-
3 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/pages/index/index.js b/pages/index/index.js
index b44ed16..01faf87 100644
--- a/pages/index/index.js
+++ b/pages/index/index.js
@@ -48,6 +48,7 @@ function processGoodsMedia(goods) {
Page({
data: {
+ isLoggedIn: false,
currentUserType: null,
showUserInfoForm: false,
avatarUrl: 'https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0',
@@ -2049,6 +2050,11 @@ Page({
duration: 2000
})
+ // 更新登录状态
+ this.setData({
+ isLoggedIn: true
+ })
+
// 测试登录成功,但已移除类型选择和跳转功能
} catch (error) {
wx.hideLoading()
@@ -2204,6 +2210,11 @@ Page({
console.log('手机号验证通过:', userInfo.phoneNumber)
}
+ // 更新登录状态
+ this.setData({
+ isLoggedIn: true
+ })
+
return true
} else {
console.warn('服务器验证失败,可能是新用户或登录状态无效')
@@ -2413,13 +2424,15 @@ Page({
if (app.globalData.userInfo) {
this.setData({
userInfo: app.globalData.userInfo,
- needPhoneAuth: !app.globalData.userInfo.phoneNumber
+ needPhoneAuth: !app.globalData.userInfo.phoneNumber,
+ isLoggedIn: !!(userId && openid)
})
} else {
app.globalData.userInfo = localUserInfo
this.setData({
userInfo: localUserInfo,
- needPhoneAuth: !localUserInfo.phoneNumber
+ needPhoneAuth: !localUserInfo.phoneNumber,
+ isLoggedIn: !!(userId && openid)
})
}
@@ -2768,7 +2781,8 @@ Page({
this.setData({
needPhoneAuth: false,
userInfo: userInfo,
- showOneKeyLoginModal: false
+ showOneKeyLoginModal: false,
+ isLoggedIn: true
})
wx.hideLoading()
diff --git a/pages/index/index.wxml b/pages/index/index.wxml
index 72cd2c9..5f57b78 100644
--- a/pages/index/index.wxml
+++ b/pages/index/index.wxml
@@ -100,12 +100,11 @@
-
+
diff --git a/pages/index/index.wxss b/pages/index/index.wxss
index 1bdbef9..f0dcb0e 100644
--- a/pages/index/index.wxss
+++ b/pages/index/index.wxss
@@ -1391,7 +1391,7 @@ video.product-media {
}
.promo-tag.sold-out {
- background: linear-gradient(135deg, #8c8c8c 0%, #a6a6a6 100%);
+ background: linear-gradient(135deg, #a92a2aff 0%, #a6a6a6 100%);
box-shadow: 0 2rpx 8rpx rgba(140, 140, 140, 0.3);
}