backup: 紫色UI换肤前完整备份(当前橙色逍遥梦主题)
保留改造前全部页面样式与功能代码,便于回滚。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -4,11 +4,14 @@ import { ensureLogin } from '../../utils/login';
|
||||
import {
|
||||
backfillUserProfileCache,
|
||||
getUserProfileForDisplay,
|
||||
getSessionToken,
|
||||
isRoleStatusActive,
|
||||
ensureRoleOnCenterPage,
|
||||
} from '../../utils/role-tab-bar';
|
||||
import { enterLockedRole } from '../../utils/primary-role.js';
|
||||
import { isStaffMode, getStaffContext, restoreStaffContextAfterAuth } from '../../utils/staff-api.js';
|
||||
import { createPage } from '../../utils/base-page.js';
|
||||
import { ensurePhoneAuth } from '../../utils/phone-auth.js';
|
||||
|
||||
Page(createPage({
|
||||
data: {
|
||||
@@ -23,6 +26,8 @@ Page(createPage({
|
||||
zuzhangIcon: '', guanzhualongIcon: '', arrowRightIcon: '', qingchuIcon: '',
|
||||
dashouCertified: false,
|
||||
shangjiaCertified: false,
|
||||
staffCertified: false,
|
||||
staffTag: '入驻',
|
||||
bottomSafePadding: 0
|
||||
},
|
||||
|
||||
@@ -32,13 +37,26 @@ Page(createPage({
|
||||
this.setBottomSafe()
|
||||
},
|
||||
|
||||
onShow() {
|
||||
async onShow() {
|
||||
const phoneOk = await ensurePhoneAuth({
|
||||
redirect: true,
|
||||
returnPage: '/pages/mine/mine',
|
||||
});
|
||||
if (!phoneOk) return;
|
||||
|
||||
this.initIconUrls();
|
||||
this.registerNotificationComponent();
|
||||
this.checkAvatarPrompt();
|
||||
backfillUserProfileCache(app);
|
||||
this.loadUserData();
|
||||
this.updateOrderCounts();
|
||||
if (getSessionToken(app)) {
|
||||
restoreStaffContextAfterAuth().finally(() => {
|
||||
this.loadUserData();
|
||||
this.updateOrderCounts();
|
||||
});
|
||||
} else {
|
||||
this.loadUserData();
|
||||
this.updateOrderCounts();
|
||||
}
|
||||
},
|
||||
|
||||
setBottomSafe() {
|
||||
@@ -84,6 +102,8 @@ Page(createPage({
|
||||
|
||||
loadUserData() {
|
||||
const profile = getUserProfileForDisplay(app);
|
||||
const ctx = getStaffContext();
|
||||
const staffActive = isStaffMode();
|
||||
this.setData({
|
||||
avatarUrl: profile.avatarUrl,
|
||||
userNicheng: profile.nick,
|
||||
@@ -91,6 +111,8 @@ Page(createPage({
|
||||
showLoginBtn: !profile.isLoggedIn,
|
||||
dashouCertified: isRoleStatusActive(wx.getStorageSync('dashoustatus')),
|
||||
shangjiaCertified: isRoleStatusActive(wx.getStorageSync('shangjiastatus')),
|
||||
staffCertified: staffActive,
|
||||
staffTag: staffActive ? (ctx.role_name || '已入驻') : '入驻',
|
||||
});
|
||||
},
|
||||
|
||||
@@ -107,6 +129,7 @@ Page(createPage({
|
||||
handleWechatLogin() {
|
||||
wx.showLoading({ title: '登录中...', mask: true });
|
||||
ensureLogin({ silent: false, page: this })
|
||||
.then(() => restoreStaffContextAfterAuth())
|
||||
.then(() => {
|
||||
this.loadUserData();
|
||||
this.updateOrderCounts();
|
||||
@@ -122,8 +145,13 @@ Page(createPage({
|
||||
const type = e.currentTarget.dataset.type;
|
||||
if (!type || !['dashou', 'shangjia'].includes(type)) return;
|
||||
ensureLogin({ silent: false, page: this })
|
||||
.then(() => restoreStaffContextAfterAuth())
|
||||
.then(() => {
|
||||
this.loadUserData();
|
||||
if (type === 'shangjia' && isStaffMode()) {
|
||||
enterLockedRole('shangjia', app);
|
||||
return;
|
||||
}
|
||||
const statusKey = type === 'dashou' ? 'dashoustatus' : 'shangjiastatus';
|
||||
if (isRoleStatusActive(wx.getStorageSync(statusKey))) {
|
||||
ensureRoleOnCenterPage(this, type);
|
||||
@@ -136,5 +164,20 @@ Page(createPage({
|
||||
},
|
||||
|
||||
goToCustomService() { this.goToKefu() },
|
||||
|
||||
goToStaffJoin() {
|
||||
ensureLogin({ silent: false, page: this })
|
||||
.then(() => restoreStaffContextAfterAuth())
|
||||
.then(() => {
|
||||
this.loadUserData();
|
||||
if (isStaffMode()) {
|
||||
enterLockedRole('shangjia', app);
|
||||
return;
|
||||
}
|
||||
wx.navigateTo({ url: '/pages/staff-join/staff-join' });
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
|
||||
goToGuanzhuA() { wx.navigateTo({ url: '/pages/manager-assign/manager-assign' }) },
|
||||
}))
|
||||
|
||||
@@ -88,6 +88,13 @@
|
||||
<text class="service-name">商家</text>
|
||||
<text class="auth-tag {{shangjiaCertified ? 'auth-tag-done' : ''}}">{{shangjiaCertified ? '已认证' : '去认证'}}</text>
|
||||
</view>
|
||||
<view class="service-unit" bindtap="goToStaffJoin">
|
||||
<view class="icon-bg icon-bg-sm">
|
||||
<image src="{{kefuIcon}}" mode="aspectFit" class="icon-dark icon-size-sm" />
|
||||
</view>
|
||||
<text class="service-name">商家客服</text>
|
||||
<text class="auth-tag {{staffCertified ? 'auth-tag-done' : ''}}">{{staffTag}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user