diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 95f30b1..94281c6 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -101,16 +101,6 @@ onLoad(async (query) => { console.error('用户登录处理失败:', error); } - // 检查是否需要跳转到个人资料设置页面 - // 条件:未绑定 ab98UserId 且 profileDone 不为真 - if (wxUserDTO.value && !wxUserDTO.value.ab98UserId && wxUserDTO.value.profileDone !== true) { - console.log('用户需要完善资料,跳转到个人资料设置页面'); - uni.navigateTo({ - url: '/pages/profile/index' - }); - return; // 跳转后不执行后续逻辑 - } - // 获取店铺列表 if (showShopList.value) { try { diff --git a/src/pages/me/index.vue b/src/pages/me/index.vue index bb6b7f4..5a0be44 100644 --- a/src/pages/me/index.vue +++ b/src/pages/me/index.vue @@ -30,27 +30,50 @@ const name = computed(() => { return userName.value || qyName.value || '未知用户' }) -const userAvatar = computed(() => face_img.value ? toHttpsUrl(face_img.value) : +const userAvatar = computed(() => face_img.value ? toHttpsUrl(face_img.value) : wxUserDTO.value?.avatar ? toHttpsUrl(wxUserDTO.value.avatar) : '/static/favicon.ico') +const showProfileSetupButton = computed(() => { + return wxUserDTO.value && !wxUserDTO.value.ab98UserId && wxUserDTO.value.profileDone !== true +}) + // 动态码相关 const dynamicCodeActionSheet = ref(false) const dynamicCodeData = ref(null) const toast = useToast() // wx参数展示弹窗 -const wxParamsActionSheet = ref(false) - -const ab98BalanceInYuan = computed(() => { - if (ab98User.value && ab98User.value.ab98Balance !== undefined) { - return (ab98User.value.ab98Balance / 100).toFixed(2) - } - return '0.00' -}) - +const wxParamsActionSheet = ref(false); +// 连点计数器 +const clickTimestamps = ref([]); // 展示wx参数 const handleShowWxParams = () => { - wxParamsActionSheet.value = true + const now = Date.now(); + const timestamps = clickTimestamps.value; + + // 移除超过3秒的旧时间戳 + const threeSecondsAgo = now - 3000; + const validTimestamps = timestamps.filter(timestamp => timestamp >= threeSecondsAgo); + + // 检查最后一次点击的间隔 + if (validTimestamps.length > 0) { + const lastTimestamp = validTimestamps[validTimestamps.length - 1]; + const interval = now - lastTimestamp; + if (interval < 100) { + // 间隔小于100毫秒, + return; + } + } + + // 添加当前时间戳 + validTimestamps.push(now); + clickTimestamps.value = validTimestamps; + + // 检查是否达到5次点击 + if (clickTimestamps.value.length >= 5) { + wxParamsActionSheet.value = true; // 触发弹窗 + clickTimestamps.value = []; // 重置计数器 + } } // 统一的页面跳转函数 @@ -78,7 +101,7 @@ const navigateToPage = (pagePath: string, options: { type?: 'navigateTo' | 'swit } onMounted(() => { - wxStore.refreshBalance() + wxStore.refreshBalance(); }); onShow(async () => { @@ -117,13 +140,23 @@ const handleGenerateDynamicCode = async () => { {{ wxUserDTO?.ab98Name || wxUserDTO?.nickName }} + + + 设置个人资料 + + @@ -321,6 +354,17 @@ const handleGenerateDynamicCode = async () => { font-weight: 600; color: #1a1a1a; letter-spacing: 0.5px; + margin-bottom: 8px; + } + + .profile-setup-button { + margin-top: 8px; + + :deep(.wd-button) { + --wot-button-small-height: 28px; + --wot-button-small-padding: 0 12px; + --wot-button-small-font-size: 12px; + } } } } diff --git a/src/pages/profile/index.vue b/src/pages/profile/index.vue index 883352b..88fbf2c 100644 --- a/src/pages/profile/index.vue +++ b/src/pages/profile/index.vue @@ -29,7 +29,7 @@ const nickName = ref('') // 初始化数据 onMounted(() => { - // 优先使用微信用户信息,其次使用企业用户信息 + /* // 优先使用微信用户信息,其次使用企业用户信息 if (wxUserDTO.value) { avatarUrl.value = wxUserDTO.value.avatar || '' nickName.value = wxUserDTO.value.nickName || '' @@ -47,8 +47,8 @@ onMounted(() => { // 默认头像 if (!avatarUrl.value) { - avatarUrl.value = '/static/favicon.ico' - } + avatarUrl.value = '' + } */ }) // 图片上传相关 @@ -198,7 +198,12 @@ const handleSubmit = async () => { } // 获取要使用的头像路径 - const finalAvatarPath = tempAvatarPath.value || avatarUrl.value + const finalAvatarPath = tempAvatarPath.value || avatarUrl.value; + + if (!finalAvatarPath) { + toast.show('请选择头像') + return + } loading.value = true try { @@ -391,6 +396,7 @@ const handleSubmit = async () => { font-size: 16px; color: #1a1a1a; margin-bottom: 12px; + box-sizing: border-box; &:focus { border-color: #409EFF;