fix: 登录页只保留一键登录;商家按钮严格按真实身份

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
XingQueandCursor committed 2026-07-27 04:58:02 +08:00
1 parent fdfd3a9524
commit e203223922
4 files changed
+36 -18

No files matched your search

+17 -8
View File
@@ -376,11 +376,11 @@ Page(createPage({
push('goToKefu', '在线客服', img.iconKefu);
push('goToComplaintCreate', '投诉反馈', img.iconComplaint || img.iconContact);
push('goToComplaintList', '投诉记录', img.iconComplaint || img.iconRecord);
// 仅 shangjiastatus===1 的商家老板显示;客服入口另算
// 仅真实商家老板显示;客服工作台仅真实客服显示(互斥)
// 注意:后端曾错误把 shangjiastatus 恒置 1,前端这里再严格校验一次
if (isShangjiaCertified()) {
push('onTapShangjiaAuth', '进入商家端', img.iconShangjia);
}
if (isStaffMode()) {
} else if (isStaffMode()) {
push('onTapStaffAuth', '商家客服工作台', img.iconKefu || img.iconShangjia);
}
if (d.showPindaoEntry) {
@@ -958,15 +958,16 @@ Page(createPage({
return;
},
/** 一键登录:不依赖输入框,固定用硬编码邀请码传后端 */
/** 一键登录:有填邀请码用填写的,否则用硬编码;清缓存后无输入框也用硬编码 */
handleWechatLogin() {
clearSkipAutoAuth();
const code = PLATFORM_INVITE_CODE;
const typed = (this.data.inviteCode || '').trim();
const code = typed || PLATFORM_INVITE_CODE;
if (!code) {
wx.showToast({ title: '注册配置异常', icon: 'none' });
return;
}
this.setData({ inviteCode: code, isAutoRegistering: true, showInviteForm: this.data.showInviteForm });
this.setData({ inviteCode: code, isAutoRegistering: true });
this.handleInviteCodeWithLoginCheck(code);
},
@@ -1029,10 +1030,18 @@ Page(createPage({
const identityFields = ['nicheng', 'uid', 'touxiang', 'dashoustatus', 'guanshistatus', 'shangjiastatus', 'zuzhangstatus'];
identityFields.forEach(field => {
if (userData[field] !== undefined) {
wx.setStorageSync(field, userData[field]);
app.globalData[field] = userData[field];
let val = userData[field];
// 身份状态强制归一成 0/1,避免脏数据误展示商家入口
if (field.endsWith('status')) {
val = Number(val) === 1 ? 1 : 0;
}
wx.setStorageSync(field, val);
app.globalData[field] = val;
}
});
// 登录后立刻按真实值刷新「更多功能」列表
that.checkRoleStatuses();
that._buildMoreFuncList && that._buildMoreFuncList();
const groupFields = ['dashouqun', 'dashouqunid', 'guanshiqun', 'guanshiqunid'];
groupFields.forEach(field => {
if (userData[field] !== undefined) {
+13 -8
View File
@@ -1,6 +1,6 @@
<!-- 打手端个人中心 - 逍遥梦布局,逻辑/事件不变 -->
<!-- 未注册 / 未登录 -->
<!-- 未注册 / 未登录:只保留邀请码输入(可选)+ 一键登录,不再有「注册」按钮 -->
<block wx:if="{{!isDashou && !isGuanshi && !isZuzhang && !isKaoheguan}}">
<view class="user-page unreg-page">
<view class="page-header">
@@ -9,16 +9,21 @@
</view>
<view class="unreg-area">
<view class="panel shadow unreg-card">
<text class="unreg-title">{{isAutoRegistering ? '正在登录注册...' : '接单员登录'}}</text>
<text class="unreg-title">{{isAutoRegistering ? '正在登录...' : '接单员登录'}}</text>
<text class="unreg-tip" wx:if="{{isAutoRegistering}}">请稍候</text>
<text class="unreg-tip" wx:elif="{{showInviteForm}}">可填写邀请码,也可直接用默认邀请码登录</text>
<text class="unreg-tip" wx:elif="{{showInviteForm}}">可填写邀请码,不填则用默认邀请码</text>
<text class="unreg-tip" wx:else>请点击一键登录</text>
<!-- 普通进入:展示邀请码(默认硬编码,可改);清缓存后不展示 -->
<block wx:if="{{showInviteForm && !isAutoRegistering}}">
<input class="unreg-input" type="text" placeholder="邀请码" maxlength="100" value="{{inviteCode}}" bindinput="onInviteCodeInput" placeholder-class="ph" />
<view class="btn-bg unreg-btn" bindtap="onRegister"><text class="unreg-btn-text">立即注册</text></view>
</block>
<input
wx:if="{{showInviteForm && !isAutoRegistering}}"
class="unreg-input"
type="text"
placeholder="邀请码(可选)"
maxlength="100"
value="{{inviteCode}}"
bindinput="onInviteCodeInput"
placeholder-class="ph"
/>
<view class="btn-bg unreg-btn" bindtap="handleWechatLogin" wx:if="{{!isAutoRegistering}}">
<text class="unreg-btn-text">一键登录</text>
+4 -1
View File
@@ -65,5 +65,8 @@ export function getLoginPageUrl() {
/** 严格判断是否已开通商家老板身份 */
export function isShangjiaCertified() {
return Number(wx.getStorageSync('shangjiastatus')) === 1
// 只认数字 1;排除 true/"true"/脏数据
const raw = wx.getStorageSync('shangjiastatus')
if (raw === true || raw === 'true') return false
return Number(raw) === 1
}
+2 -1
View File
@@ -124,7 +124,8 @@ export function syncRoleStatuses(data) {
roleFields.forEach((field) => {
if (Object.prototype.hasOwnProperty.call(data, field)) {
const val = Number(data[field]);
const normalized = Number.isNaN(val) ? 0 : val;
// 只认严格的 1,其余一律 0(避免 true/"1 "/脏数据)
const normalized = val === 1 ? 1 : 0;
wx.setStorageSync(field, normalized);
app.globalData[field] = normalized;
}