- 手机号/账号全场景一律脱敏:SensitiveFieldPolicy 删除完整值分支与 ADMIN_EDIT,SELF_PROFILE 同样脱敏;convertToVO 全调用点统一脱敏 - 联系信息接口不再返回号码:toContact 置空 phone 并给出 phoneAvailable,补齐 ensureUserCanSeeShop 真实可见范围校验 - 新增 POST /contact-info/dial,按 scene(SHOP_MANAGER/ORDER_ARTIST/PRODUCT_ARTIST/PLATFORM) 一次一取;DialTargetProvider 抽象直连/隐私号,未配置隐私号返回 9001 且不回退真实号;/contact-info/** 按用户限流并记录审计 - 验证码与换绑手机号改为服务端按当前登录用户取号,客户端 phone/oldPhone 参数兼容忽略;前端与小程序同步去掉回传 - 消息发布人昵称兜底改为脱敏账号,避免 account 明文写入 publisher_name - 新增 V5 账号加密与账号哈希、V6 协议文本改为全场景脱敏与单次拨号取号
This commit is contained in:
@@ -202,7 +202,8 @@ export interface InviteCodeVO {
|
||||
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
export interface UpdatePhoneRequest {
|
||||
oldPhone: string
|
||||
/** 兼容旧协议保留;服务端按当前登录用户取原手机号,不再使用该字段。 */
|
||||
oldPhone?: string
|
||||
newPhone: string
|
||||
verificationCode: string
|
||||
}
|
||||
@@ -319,6 +320,20 @@ export interface ContactInfoVO {
|
||||
platformContactText?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* 拨号场景:与后端 /contact-info/dial 的 scene 取值一致。
|
||||
*/
|
||||
export type ContactDialScene = 'SHOP_MANAGER' | 'ORDER_ARTIST' | 'PRODUCT_ARTIST' | 'PLATFORM'
|
||||
|
||||
/**
|
||||
* 单次拨号取号结果;DIRECT 为直拨真实号码,PRIVACY_NUMBER 为隐私号码。
|
||||
*/
|
||||
export interface DialContactResult {
|
||||
mode: 'DIRECT' | 'PRIVACY_NUMBER'
|
||||
dialNumber: string
|
||||
expiresInSeconds: number
|
||||
}
|
||||
|
||||
/**
|
||||
* userApi groups all API calls for this page domain.
|
||||
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
|
||||
@@ -385,7 +400,7 @@ export const userApi = {
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
* @param data: { phone: string; sceneCode?: string } caller-supplied value for `data: { phone: string; sceneCode?: string }`
|
||||
*/
|
||||
sendVerificationCode: (data: { phone: string; sceneCode?: string }) => {
|
||||
sendVerificationCode: (data: { phone?: string; sceneCode?: string }) => {
|
||||
return api.post('/user/send-verification-code', data)
|
||||
},
|
||||
/**
|
||||
@@ -459,6 +474,10 @@ export const userApi = {
|
||||
getPlatformContact: async (): Promise<ContactInfoVO> => {
|
||||
return await api.get<ContactInfoVO>('/contact-info/platform') as unknown as ContactInfoVO
|
||||
},
|
||||
// 单次拨号取号:号码不缓存到本地,拨号完成后即丢弃。
|
||||
dialContact: async (scene: ContactDialScene, targetId?: IdType, artistId?: IdType): Promise<DialContactResult> => {
|
||||
return await api.post<DialContactResult>('/contact-info/dial', { scene, targetId, artistId }) as unknown as DialContactResult
|
||||
},
|
||||
/**
|
||||
* `deactivateAccount` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
|
||||
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
|
||||
|
||||
@@ -625,8 +625,8 @@ const handleChangePhoneSubmit = async () => {
|
||||
changePhoneLoading.value = true
|
||||
try {
|
||||
await runWithGlobalLoading(async () => {
|
||||
// 原手机号由服务端按当前登录用户读取,前端不再回传可能已脱敏的号码。
|
||||
await userApi.updatePhone({
|
||||
oldPhone: userInfo.value.phone!,
|
||||
newPhone: changePhoneForm.newPhone,
|
||||
verificationCode: changePhoneForm.verificationCode
|
||||
})
|
||||
|
||||
@@ -9,6 +9,20 @@ import { BRAND_CONFIG } from '@/config/brand'
|
||||
const router = useRouter()
|
||||
const loading = ref(false)
|
||||
const contact = ref<ContactInfoVO | null>(null)
|
||||
const dialing = ref(false)
|
||||
|
||||
/** 平台客服拨号:点击后才单次取号,号码不落页面状态。 */
|
||||
const dialPlatform = async () => {
|
||||
dialing.value = true
|
||||
try {
|
||||
const result = await userApi.dialContact('PLATFORM')
|
||||
window.location.href = `tel:${result.dialNumber}`
|
||||
} catch (error: any) {
|
||||
message.error(error?.message || '获取客服号码失败')
|
||||
} finally {
|
||||
dialing.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const loadContact = async () => {
|
||||
loading.value = true
|
||||
@@ -46,7 +60,9 @@ onMounted(loadContact)
|
||||
<section class="section-card">
|
||||
<h3>平台联系信息</h3>
|
||||
<p v-if="contact?.contactName">{{ contact.contactName }} {{ contact.roleLabel || '' }}</p>
|
||||
<p v-if="contact?.phoneAvailable && contact.phone">电话:{{ contact.phone }}</p>
|
||||
<p v-if="contact?.phoneAvailable">
|
||||
<a-button type="primary" size="small" :loading="dialing" @click="dialPlatform">拨打客服电话</a-button>
|
||||
</p>
|
||||
<p v-if="contact?.wechatAvailable && contact.wechatId">微信:{{ contact.wechatId }}</p>
|
||||
<p v-if="contact?.platformContactText">{{ contact.platformContactText }}</p>
|
||||
<p v-if="!contact">暂无可展示的客服信息,请稍后重试或通过订单详情联系服务人员。</p>
|
||||
|
||||
@@ -19,6 +19,7 @@ const reviews = ref<OrderArtistReviewVO[]>([])
|
||||
const changeRequests = ref<OrderArtistChangeRequestVO[]>([])
|
||||
const afterSales = ref<AfterSaleVO[]>([])
|
||||
const contact = ref<ContactInfoVO | null>(null)
|
||||
const dialing = ref(false)
|
||||
const quoteReply = ref('')
|
||||
const quoteSubmitting = ref(false)
|
||||
const quoteConfirming = ref(false)
|
||||
@@ -130,6 +131,20 @@ const loadRelated = async () => {
|
||||
contact.value = contactInfo
|
||||
}
|
||||
|
||||
/** 单次取号后立即拨号:不缓存号码,仅使用本次返回的 dialNumber。 */
|
||||
const dialArtist = async () => {
|
||||
if (!orderId.value) return
|
||||
dialing.value = true
|
||||
try {
|
||||
const result = await userApi.dialContact('ORDER_ARTIST', orderId.value)
|
||||
window.location.href = `tel:${result.dialNumber}`
|
||||
} catch (error: any) {
|
||||
message.error(error?.message || '获取拨号号码失败')
|
||||
} finally {
|
||||
dialing.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const loadOrder = async () => {
|
||||
if (!orderId.value) {
|
||||
order.value = null
|
||||
@@ -334,7 +349,9 @@ onMounted(loadOrder)
|
||||
<section v-if="contact" class="section-card">
|
||||
<h3>联系信息</h3>
|
||||
<p>{{ contact.contactName || contact.roleLabel || '服务联系人' }}</p>
|
||||
<p v-if="contact.phoneAvailable && contact.phone">电话:{{ contact.phone }}</p>
|
||||
<p v-if="contact.phoneAvailable">
|
||||
<a-button size="small" :loading="dialing" @click="dialArtist">拨打美甲师电话</a-button>
|
||||
</p>
|
||||
<p v-if="contact.wechatAvailable && contact.wechatId">微信:{{ contact.wechatId }}</p>
|
||||
<p v-if="contact.platformContactText">{{ contact.platformContactText }}</p>
|
||||
</section>
|
||||
|
||||
@@ -238,7 +238,7 @@ const handleSendVerificationCode = async () => {
|
||||
|
||||
try {
|
||||
await runWithGlobalLoading(() => userApi.sendVerificationCode({
|
||||
phone: userPhone.value,
|
||||
// 号码由服务端按当前登录用户读取,前端只传场景,避免回传已脱敏的展示值。
|
||||
sceneCode: 'USER_CHANGE_PASSWORD_SMS_CODE'
|
||||
}))
|
||||
message.success('验证码发送成功')
|
||||
|
||||
@@ -373,6 +373,9 @@ const editForm = reactive({
|
||||
wechatQrCode: ''
|
||||
})
|
||||
|
||||
/** 打开编辑弹窗时的联系电话原值,用于判断用户是否真实修改过(未修改则不提交该字段)。 */
|
||||
const originalContactPhone = ref('')
|
||||
|
||||
/** getDraftKey is a local helper used by this page script. */
|
||||
const getDraftKey = () => buildDraftStorageKey('profile-edit')
|
||||
|
||||
@@ -596,6 +599,7 @@ const handleEditProfile = () => {
|
||||
editForm.avatar = userInfo.value.avatar || ''
|
||||
editForm.signature = userInfo.value.signature || ''
|
||||
editForm.contactPhone = userInfo.value.contactPhone || ''
|
||||
originalContactPhone.value = editForm.contactPhone
|
||||
editForm.birthday = userInfo.value.birthday || ''
|
||||
editForm.wechatId = userInfo.value.wechatId || ''
|
||||
editForm.wechatQrCode = userInfo.value.wechatQrCode || ''
|
||||
@@ -742,15 +746,17 @@ const handleSaveProfile = async () => {
|
||||
saving.value = true
|
||||
try {
|
||||
await runWithGlobalLoading(async () => {
|
||||
await userApi.updateUserInfo({
|
||||
const payload = {
|
||||
nickname: editForm.nickname,
|
||||
avatar: editForm.avatar,
|
||||
signature: editForm.signature,
|
||||
contactPhone: editForm.contactPhone,
|
||||
birthday: editForm.birthday || undefined,
|
||||
wechatId: editForm.wechatId,
|
||||
wechatQrCode: editForm.wechatQrCode
|
||||
})
|
||||
wechatQrCode: editForm.wechatQrCode,
|
||||
// 只有联系电话真实变更时才提交,避免把接口回填值(可能已脱敏)原样写回
|
||||
...(editForm.contactPhone !== originalContactPhone.value ? { contactPhone: editForm.contactPhone } : {})
|
||||
}
|
||||
await userApi.updateUserInfo(payload)
|
||||
await fetchUserInfo()
|
||||
})
|
||||
message.success('资料更新成功')
|
||||
|
||||
@@ -226,16 +226,12 @@
|
||||
<p class="contact-name">{{ contactInfo.contactName || contactInfo.roleLabel || '联系人' }}</p>
|
||||
<div class="contact-row">
|
||||
<span>联系电话</span>
|
||||
<strong>{{ contactInfo.phoneAvailable ? contactInfo.phone : '暂无电话' }}</strong>
|
||||
<strong>{{ contactInfo.phoneAvailable ? '点击下方按钮获取当次号码' : '暂无电话' }}</strong>
|
||||
</div>
|
||||
<div class="contact-actions">
|
||||
<a-button v-if="contactInfo.phoneAvailable" type="primary" :href="`tel:${contactInfo.phone}`">
|
||||
<a-button v-if="contactInfo.phoneAvailable" type="primary" :loading="dialing" @click="dialManager">
|
||||
<PhoneOutlined />
|
||||
拨号
|
||||
</a-button>
|
||||
<a-button v-if="contactInfo.phoneAvailable" @click="copyToClipboard(contactInfo.phone || '', '联系电话')">
|
||||
<CopyOutlined />
|
||||
复制电话
|
||||
拨打店长电话
|
||||
</a-button>
|
||||
</div>
|
||||
<div class="contact-row">
|
||||
@@ -372,6 +368,7 @@ const contactOpen = ref(false)
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const contactInfo = ref<ContactInfoVO>({})
|
||||
const dialing = ref(false)
|
||||
/**
|
||||
* Purpose: mapOpen supports ShopDetailView.vue by holding or executing the map open page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
@@ -617,11 +614,24 @@ const openWechatContact = async () => {
|
||||
window.location.href = 'weixin://'
|
||||
}
|
||||
|
||||
/** copyContactInfo copies all available contact channels in one action. */
|
||||
/** 单次取号后立即拨号:页面不缓存号码,仅使用本次返回的 dialNumber。 */
|
||||
const dialManager = async () => {
|
||||
if (!shopInfo.value.id) return
|
||||
dialing.value = true
|
||||
try {
|
||||
const result = await userApi.dialContact('SHOP_MANAGER', shopInfo.value.id)
|
||||
window.location.href = `tel:${result.dialNumber}`
|
||||
} catch (error: any) {
|
||||
message.error(error?.message || '获取拨号号码失败')
|
||||
} finally {
|
||||
dialing.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** copyContactInfo copies the WeChat channel only; phone numbers are no longer rendered or cached. */
|
||||
const copyContactInfo = async () => {
|
||||
const lines = [
|
||||
contactInfo.value.contactName || contactInfo.value.roleLabel || '联系人',
|
||||
contactInfo.value.phoneAvailable && contactInfo.value.phone ? `电话:${contactInfo.value.phone}` : '',
|
||||
contactInfo.value.wechatAvailable && contactInfo.value.wechatId ? `微信:${contactInfo.value.wechatId}` : ''
|
||||
].filter(Boolean)
|
||||
await copyToClipboard(lines.join('\n'), '联系方式')
|
||||
|
||||
Reference in New Issue
Block a user