feat(mine): 小程序「我的」页对齐 Web 个人中心 + 我的报名/任务/园区/认证子页
- mine 页:我的服务宫格(报名/任务/园区/认证)+账号绑定状态卡(手机号/微信/小程序)+身份标签;pickUser 持久化 wxBound/wxMiniBound/account_type_label - 新增子页 my-bookings/my-tasks/my-park/my-cert(复用 getMyBookings/getMyTasks/getMyAdmission/getOpCertMine) - app.config 注册 4 子页;build:weapp 通过
This commit is contained in:
@@ -41,6 +41,15 @@ const fmtTime = (iso) => {
|
||||
return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())} 周${week}`;
|
||||
};
|
||||
|
||||
/** 我的服务宫格项:label → 子页 */
|
||||
const SVC = [
|
||||
['报名', '/pages/my-bookings/index'],
|
||||
['任务', '/pages/my-tasks/index'],
|
||||
['园区', '/pages/my-park/index'],
|
||||
['认证', '/pages/my-cert/index'],
|
||||
];
|
||||
const maskPhone = (p) => (/^1\d{10}$/.test(p || '') ? p.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2') : (p || ''));
|
||||
|
||||
export default function Mine() {
|
||||
useTabIndex(4);
|
||||
const [user, setUser] = useState(getUser());
|
||||
@@ -328,6 +337,9 @@ export default function Mine() {
|
||||
<Text className={`phone-tag${user.phoneBound ? ' bound' : ''}`}>
|
||||
{user.phoneBound ? (user.phone ? `已绑定 ${user.phone}` : '已绑定手机') : '未绑定手机'}
|
||||
</Text>
|
||||
{user.account_type_label || user.role ? (
|
||||
<Text className="role-tag">{user.account_type_label || user.role}</Text>
|
||||
) : null}
|
||||
{nickDraft && nickDraft !== ((user && user.name) || '') && (
|
||||
<Button className="btn-ghost save-nick" onClick={onSaveNick}>保存昵称</Button>
|
||||
)}
|
||||
@@ -335,6 +347,30 @@ export default function Mine() {
|
||||
<Button className="btn-ghost logout-btn" onClick={onLogout}>退出</Button>
|
||||
</View>
|
||||
|
||||
{/* 我的服务宫格:报名 / 任务 / 园区 / 认证 */}
|
||||
<View className="mk-grid">
|
||||
{SVC.map(([label, url]) => (
|
||||
<View className="mk-grid-item" key={label} onClick={() => Taro.navigateTo({ url })}>
|
||||
<View className="mk-grid-ico"><Text>{label.slice(0, 1)}</Text></View>
|
||||
<Text className="mk-grid-label">我的{label}</Text>
|
||||
</View>
|
||||
))}
|
||||
</View>
|
||||
|
||||
{/* 账号绑定状态 */}
|
||||
<View className="card bind-state">
|
||||
<Text className="bind-title">账号绑定</Text>
|
||||
<View className="bind-line"><Text className="bind-key">手机号</Text>
|
||||
<Text className={`bind-val${user.phoneBound ? ' on' : ''}`}>{user.phoneBound ? maskPhone(user.phone) : '未绑定'}</Text>
|
||||
</View>
|
||||
<View className="bind-line"><Text className="bind-key">微信(开放平台)</Text>
|
||||
<Text className={`bind-val${user.wxBound ? ' on' : ''}`}>{user.wxBound ? '已绑定' : '未绑定'}</Text>
|
||||
</View>
|
||||
<View className="bind-line"><Text className="bind-key">小程序</Text>
|
||||
<Text className={`bind-val${user.wxMiniBound ? ' on' : ''}`}>{user.wxMiniBound ? '已绑定' : '未绑定'}</Text>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
{/* 跨端口扫码登录:由电脑/网页登录页展示「小程序码」,微信扫码自动进入小程序授权页确认 */}
|
||||
<View className="card next-card">
|
||||
<Text className="next-lbl">登录其它端</Text>
|
||||
|
||||
Reference in New Issue
Block a user