From 4d5ca8decf4f3138a9a53843b6743165c5ba4e2f Mon Sep 17 00:00:00 2001 From: lzh Date: Sat, 21 Mar 2026 10:23:05 +0800 Subject: [PATCH] =?UTF-8?q?feat(home):=20=E5=B7=A5=E4=BD=9C=E5=8F=B0?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=20FAB=20=E5=BF=AB=E6=8D=B7=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=EF=BC=8C=E4=BC=98=E5=8C=96=20tabbar=20=E6=89=AB=E7=A0=81?= =?UTF-8?q?=E5=92=8C=E5=BE=AE=E4=BF=A1=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - index.vue:新增 FAB 按钮(选择区域巡检 + 新增工单),合并原工单和巡检列表的入口 - menu-section.vue:新增蓝牙调试快捷入口 - tabbar:扫码巡检改用 parseQrCode 解析,取消扫码不再跳转 - wechat-login-panel:手机号授权拒绝后 emit phone-refused,回退到账号密码登录 Co-Authored-By: Claude Opus 4.6 (1M context) --- .../auth/components/wechat-login-panel.vue | 7 +- src/pages-core/auth/login.vue | 1 + src/pages/index/components/menu-section.vue | 1 + src/pages/index/index.vue | 145 ++++++++++++++++++ src/tabbar/index.vue | 15 +- 5 files changed, 164 insertions(+), 5 deletions(-) diff --git a/src/pages-core/auth/components/wechat-login-panel.vue b/src/pages-core/auth/components/wechat-login-panel.vue index 37b9f2c..0f5fbfe 100644 --- a/src/pages-core/auth/components/wechat-login-panel.vue +++ b/src/pages-core/auth/components/wechat-login-panel.vue @@ -43,6 +43,10 @@ const props = defineProps<{ validateTenant: () => boolean }>() +const emit = defineEmits<{ + (e: 'phone-refused'): void +}>() + const toast = useToast() const loading = ref(false) const needPhoneAuth = ref(false) @@ -79,7 +83,8 @@ async function handleWechatLogin() { /** 第二步:手机号授权后完成登录 */ async function handleGetPhoneNumber(e: any) { if (e.detail.errMsg !== 'getPhoneNumber:ok') { - toast.warning('未获取到手机号授权,无法继续登录') + toast.warning('为方便工作,建议授权手机号') + emit('phone-refused') return } diff --git a/src/pages-core/auth/login.vue b/src/pages-core/auth/login.vue index f61f0aa..588296e 100644 --- a/src/pages-core/auth/login.vue +++ b/src/pages-core/auth/login.vue @@ -22,6 +22,7 @@ :agreed="agreed" :redirect-url="redirectUrl" :validate-tenant="validateTenant" + @phone-refused="activeTab = 'username'" /> diff --git a/src/pages/index/components/menu-section.vue b/src/pages/index/components/menu-section.vue index 634ba70..1dd8363 100644 --- a/src/pages/index/components/menu-section.vue +++ b/src/pages/index/components/menu-section.vue @@ -97,6 +97,7 @@ const quickApps = [ { key: 'inspection', name: '巡检记录', icon: 'i-carbon-list-checked', color: '#8B5CF6', bgLight: '#F5F3FF', url: '/pages/scan/inspection/list' }, { key: 'workOrderStats', name: '工单统计', icon: 'i-carbon-chart-bar', color: '#3B82F6', bgLight: '#EFF6FF', url: '/pages/scan/work-order/stats' }, { key: 'trafficStats', name: '客流统计', icon: 'i-carbon-pedestrian', color: '#10B981', bgLight: '#ECFDF5', url: '/pages/scan/traffic/index' }, + { key: 'bluetoothDebug', name: '蓝牙调试', icon: 'i-carbon-bluetooth', color: '#0EA5E9', bgLight: '#F0F9FF', url: '/pages/scan/bluetooth-debug/index' }, ] function handleQuickApp(app: any) { diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 15118f4..ddf10e0 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -4,10 +4,46 @@ + + + + + + + + + + + 选择区域巡检 + + + + + + 新增工单 + + + + + + + + + + diff --git a/src/tabbar/index.vue b/src/tabbar/index.vue index 9cbc10c..f0efe29 100644 --- a/src/tabbar/index.vue +++ b/src/tabbar/index.vue @@ -2,6 +2,7 @@ /* eslint-disable brace-style */ // 原因:unibest 官方维护的代码,尽量不要大概,避免难以合并 // i-carbon-code import type { CustomTabBarItem } from './types' +import { parseQrCode } from '@/utils/qrcode' import { customTabbarEnable, needHideNativeTabbar, tabbarCacheEnable } from './config' import { tabbarList, tabbarStore } from './store' @@ -25,12 +26,18 @@ function handleClickBulge() { uni.navigateTo({ url: fallbackUrl }) return } - uni.navigateTo({ - url: `/pages/scan/inspection/index?code=${encodeURIComponent(res.result)}`, - }) + const parsed = parseQrCode(res.result) + if (parsed) { + uni.navigateTo({ + url: `/pages/scan/inspection/index?areaId=${parsed.areaId}&areaName=${encodeURIComponent(parsed.areaName)}`, + }) + } + else { + uni.showToast({ title: '无法识别该二维码', icon: 'none' }) + } }, fail: () => { - uni.navigateTo({ url: fallbackUrl }) + // 用户取消扫码,不跳转(避免进入 scan/index 又自动触发一次扫码) }, }) }