This commit is contained in:
hero920103 committed 2026-11-11 18:42:09 +08:00
1 parent fb04d66e61
commit b6b528490c
13 files changed
+518 -168

No files matched your search

+30 -12
View File
@@ -7,8 +7,8 @@
<text class="head-eyebrow">WENXIN WORKSPACE</text>
<text class="head-title">工作台</text>
</view>
<view v-if="!guest" class="account-chip" @tap="goProfile"><FaIcon name="user" color="#3478f6" :size="15" /><text>{{ user.account || '我的账号' }}</text></view>
<view v-else class="account-chip" @tap="goProfile"><FaIcon name="user" color="#3478f6" :size="15" /><text>游客</text></view>
<view v-if="!guest" class="account-chip" @tap="goProfile"><FaIcon name="user" color="#3478f6" :size="15" /><text>{{ user.name || user.nickname || '未设置姓名' }}</text></view>
<button v-else class="account-chip account-chip-button" open-type="getPhoneNumber" @getphonenumber="onCardPhone($event)"><FaIcon name="user" color="#3478f6" :size="15" /><text>游客</text></button>
</view>
<view v-if="!guest" class="tenant-switch" @tap="chooseTenant">
<view class="tenant-mark"><FaIcon name="building" color="#ffffff" :size="19" /></view>
@@ -471,12 +471,8 @@ async function load(force = false) {
/* ==================== 交互 ==================== */
/** 点击右上角用户名 → 进入个人中心修改资料;未授权时提示先点模块授权手机号 */
/** 点击右上角用户名 → 进入个人中心修改资料(游客态 chip 不绑定此函数) */
function goProfile() {
if (guest.value) {
uni.showToast({ title: '请先点击模块授权手机号', icon: 'none' })
return
}
uni.navigateTo({ url: '/pages/profile/profile' })
}
@@ -491,8 +487,8 @@ function chooseTenant() {
/* ==================== 手机号授权 / 注册 / 企业分流 ==================== */
/** 点卡片(未授权时)直接触发微信手机号授权;有账号静默登录,无账号去设密码注册 */
async function onCardPhone(e, card) {
/** 手机号授权统一入口:card 为空表示只做识别/注册(如点「游客」),不进入模块 */
async function onCardPhone(e, card = null) {
const detail = (e && e.detail) || {}
if (String(detail.errMsg || '').indexOf('ok') === -1 || !detail.code) {
uni.showToast({ title: '需要授权手机号才能使用', icon: 'none' })
@@ -509,7 +505,7 @@ async function onCardPhone(e, card) {
} catch (err) {
appid = ''
}
setPendingCard(card)
if (card) setPendingCard(card)
const res = await onboardingPhone({ code, phoneCode: detail.code, appid })
if (res && res.need_register) {
uni.hideLoading()
@@ -523,8 +519,10 @@ async function onCardPhone(e, card) {
const ready = await silentLogin(code, detail.code)
if (!ready) return
await load(true)
await enter(card)
takePendingCard()
if (card) {
await enter(card)
takePendingCard()
}
} catch (err) {
console.error('[nav] onboarding phone failed:', err)
uni.showToast({ title: (err && err.message) || '授权失败,请重试', icon: 'none' })
@@ -678,6 +676,26 @@ onShow(() => {
font-size: 22rpx;
}
/* 游客态 chip 是微信手机号授权按钮:抹平 button 默认样式,外观与普通 chip 一致 */
.account-chip-button {
display: flex;
align-items: center;
gap: 9rpx;
margin: 0;
padding: 12rpx 17rpx;
border: none;
border-radius: 30rpx;
background: rgba(255, 255, 255, .85);
color: #526b8d;
font-size: 22rpx;
line-height: 1.4;
text-align: left;
&::after {
border: none;
}
}
.tenant-switch {
display: flex;
align-items: center;