统一排行榜对齐星雀UI,页面资源后台配置实时刷新

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
XingQue
2026-06-27 01:26:11 +08:00
parent 1ab2e2080a
commit 21112173f2
292 changed files with 64010 additions and 81 deletions

View File

@@ -0,0 +1,155 @@
// pages/renzheng/renzheng.js
import request from '../../utils/request.js'
const API_MAP = {
dashou: '/yonghu/dashouzhuce',
shangjia: '/yonghu/shangjiahuce',
guanshi: '/yonghu/guanshizhuce',
zuzhang: '/yonghu/zuzhangzhuce',
kaoheguan: '/dengji/khgzc' // 🆕 考核官注册接口
}
const STATUS_KEY_MAP = {
dashou: 'dashoustatus',
shangjia: 'shangjiastatus',
guanshi: 'guanshistatus',
zuzhang: 'zuzhangstatus',
kaoheguan: 'kaoheguanstatus' // 🆕 考核官缓存键
}
const NAME_MAP = {
dashou: '接单员',
shangjia: '商家',
guanshi: '管事',
zuzhang: '组长',
kaoheguan: '考核官' // 🆕 考核官中文名
}
Page({
data: {
authType: '',
authName: '',
pageState: 'need_register',
inviteCode: '',
isLoading: false,
},
onLoad(options) {
const type = options.type || ''
if (!API_MAP[type]) {
wx.showToast({ title: '认证类型错误', icon: 'none' })
setTimeout(() => wx.navigateBack(), 1500)
return
}
this.setData({ authType: type, authName: NAME_MAP[type] })
this.checkStatus()
},
onShow() {
if (this.data.authType) this.checkStatus()
},
checkStatus() {
const key = STATUS_KEY_MAP[this.data.authType]
const val = wx.getStorageSync(key)
if (val === 1) {
this.setData({ pageState: 'done' })
} else {
this.setData({ pageState: 'need_register' })
}
},
onInviteCodeInput(e) {
this.setData({ inviteCode: e.detail.value.trim() })
},
async onRegister() {
const { inviteCode, authType } = this.data
if (!inviteCode) {
wx.showToast({ title: '请输入邀请码', icon: 'none' })
return
}
if (inviteCode.length > 100) {
wx.showToast({ title: '邀请码不能超过100字符', icon: 'none' })
return
}
this.setData({ isLoading: true })
wx.showLoading({ title: '注册中...', mask: true })
try {
const res = await request({
url: API_MAP[authType],
method: 'POST',
data: { inviteCode }
})
if (res && res.data.code === 200) {
const data = res.data.data || res.data
const app = getApp()
// ----- 缓存身份状态(完全由后端决定) -----
const key = STATUS_KEY_MAP[authType]
if (data[key] !== undefined) {
wx.setStorageSync(key, data[key])
app.globalData[key] = data[key]
} else {
wx.setStorageSync(key, 1)
app.globalData[key] = 1
}
// 更新其他可能返回的身份状态字段
const allKeys = ['dashoustatus', 'shangjiastatus', 'guanshistatus', 'zuzhangstatus', 'kaoheguanstatus'] // 🆕 新增
allKeys.forEach(k => {
if (data[k] !== undefined && k !== key) {
wx.setStorageSync(k, data[k])
app.globalData[k] = data[k]
}
})
// 保存各身份详细信息(参照各注册页面的处理)
if (authType === 'dashou') {
const fields = ['dashounicheng','zhanghaostatus','yongjin','zonge','yajin','chenghao','jifen','clumber','chengjiaoliang','zaixianzhuangtai']
fields.forEach(f => { if (data[f] !== undefined) app.globalData[f] = data[f] })
} else if (authType === 'shangjia') {
app.globalData.shangjia = app.globalData.shangjia || {}
const sf = ['nicheng','sjyue','fabu','chengjiao','tuikuan','jinridingdan','jinriliushui','jinyuedingdan','jinyueliushui','zhuangtai']
sf.forEach(f => { if (data[f] !== undefined) app.globalData.shangjia[f] = data[f] })
} else if (authType === 'guanshi') {
app.globalData.guanshi = app.globalData.guanshi || {}
const gf = ['gszhstatus','yaoqingzongshu','fenyongzonge','fenyongtixian','yichongzhiDashou']
gf.forEach(f => { if (data[f] !== undefined) app.globalData.guanshi[f] = data[f] })
} else if (authType === 'zuzhang') {
const zf = ['ketixian','guanshiCount','fenhongZonge']
zf.forEach(f => { if (data[f] !== undefined) app.globalData[f] = data[f] })
} else if (authType === 'kaoheguan') { // 🆕 考核官数据更新
app.globalData.kaoheguan = app.globalData.kaoheguan || {}
const kf = ['shenhe_zongshu','tongguo_zongshu','yue','zonge','shenhe_zhuangtai','bankuai_list']
kf.forEach(f => { if (data[f] !== undefined) app.globalData.kaoheguan[f] = data[f] })
}
wx.hideLoading()
this.setData({ isLoading: false, pageState: 'done' })
wx.showToast({ title: '认证成功', icon: 'success' })
} else {
wx.hideLoading()
this.setData({ isLoading: false })
wx.showToast({ title: res?.data?.msg || '注册失败', icon: 'none' })
}
} catch (err) {
wx.hideLoading()
this.setData({ isLoading: false })
wx.showToast({ title: err.message || '注册失败', icon: 'none' })
}
},
goToKefu() {
const app = getApp()
const { link, enterpriseId } = app.globalData.kefuConfig || {}
if (!link || !enterpriseId) {
wx.showToast({ title: '客服配置未加载', icon: 'none' })
return
}
wx.openCustomerServiceChat({ extInfo: { url: link }, corpId: enterpriseId })
}
})

View File

@@ -0,0 +1,8 @@
{
"usingComponents": {},
"navigationBarTitleText": "身份认证",
"navigationBarBackgroundColor": "#F7F3ED",
"navigationBarTextStyle": "black",
"backgroundColor": "#F7F3ED",
"enablePullDownRefresh": false
}

View File

@@ -0,0 +1,29 @@
<!-- pages/renzheng/renzheng.wxml -->
<view class="page-container">
<!-- 未注册或异常:邀请码注册 + 联系客服 -->
<view class="card" wx:if="{{pageState === 'need_register'}}">
<view class="card-title">{{authName}}认证</view>
<view class="card-desc">您尚未注册此角色或账号已被封禁,请输入邀请码注册或联系客服</view>
<view class="input-box">
<input class="invite-input" placeholder="请输入邀请码" value="{{inviteCode}}" bindinput="onInviteCodeInput" maxlength="100"/>
</view>
<view class="btn-primary" bindtap="onRegister">
{{isLoading ? '注册中…' : '立即注册'}}
</view>
<view class="kefu-link" bindtap="goToKefu">联系客服</view>
</view>
<!-- 已注册:切换引导 -->
<view class="card done-card" wx:if="{{pageState === 'done'}}">
<view class="done-icon">✓</view>
<view class="card-title">认证成功</view>
<view class="done-tip">
您已是<text class="highlight">{{authName}}</text>身份,
<text class="highlight">请退出此页面</text>点击底部导航栏左侧的
<text class="highlight">「切换」</text>
按钮,选择
<text class="highlight">「{{authName}}」</text>
即可开始使用。
</view>
</view>
</view>

View File

@@ -0,0 +1,95 @@
page {
background: #F7F3ED;
height: 100vh;
}
.page-container {
display: flex;
flex-direction: column;
align-items: center;
padding: 100rpx 40rpx;
}
.card {
width: 100%;
background: #fff;
border-radius: 36rpx;
padding: 60rpx 40rpx;
box-shadow: 0 20rpx 40rpx rgba(0,0,0,0.04);
text-align: center;
}
.card-title {
font-size: 40rpx;
font-weight: 700;
color: #1A1A1A;
margin-bottom: 30rpx;
}
.card-desc {
font-size: 28rpx;
color: #7A7A7A;
margin-bottom: 50rpx;
line-height: 1.6;
}
.input-box {
background: #F7F3ED;
border-radius: 24rpx;
padding: 0 24rpx;
margin-bottom: 40rpx;
}
.invite-input {
height: 90rpx;
font-size: 30rpx;
color: #1A1A1A;
}
.btn-primary {
width: 100%;
height: 96rpx;
line-height: 96rpx;
background: linear-gradient(135deg, #C9A962, #D4B56A);
color: #fff;
font-size: 34rpx;
font-weight: 600;
border-radius: 48rpx;
text-align: center;
}
.kefu-link {
margin-top: 30rpx;
font-size: 28rpx;
color: #C9A962;
text-decoration: underline;
}
/* 已认证专用 */
.done-card {
padding: 80rpx 40rpx;
}
.done-icon {
font-size: 80rpx;
color: #C9A962;
margin-bottom: 30rpx;
font-weight: bold;
}
.done-tip {
font-size: 34rpx;
color: #1A1A1A;
line-height: 1.8;
font-weight: 500;
background: rgba(201,169,98,0.08);
border-radius: 20rpx;
padding: 30rpx 24rpx;
margin-top: 40rpx;
}
.highlight {
color: #C9A962;
font-weight: 700;
font-size: 36rpx;
}