hookehuyr

refactor: 移除未使用的 NutUI 组件和 H5 小程序跳转逻辑

清理未使用的 NutTabbar 和 NutTabbarItem 组件类型定义。
删除 AppTabbar 中用于 H5 环境跳转小程序的复杂逻辑,简化页面导航。
移除已不再使用的 miniProgram.js 工具文件。
更新地图引导页面的 URL 参数。
...@@ -9,8 +9,6 @@ declare module 'vue' { ...@@ -9,8 +9,6 @@ declare module 'vue' {
9 export interface GlobalComponents { 9 export interface GlobalComponents {
10 AppTabbar: typeof import('./src/components/AppTabbar.vue')['default'] 10 AppTabbar: typeof import('./src/components/AppTabbar.vue')['default']
11 IndexNav: typeof import('./src/components/indexNav.vue')['default'] 11 IndexNav: typeof import('./src/components/indexNav.vue')['default']
12 - NutTabbar: typeof import('@nutui/nutui-taro')['Tabbar']
13 - NutTabbarItem: typeof import('@nutui/nutui-taro')['TabbarItem']
14 Picker: typeof import('./src/components/time-picker-data/picker.vue')['default'] 12 Picker: typeof import('./src/components/time-picker-data/picker.vue')['default']
15 PosterBuilder: typeof import('./src/components/PosterBuilder/index.vue')['default'] 13 PosterBuilder: typeof import('./src/components/PosterBuilder/index.vue')['default']
16 QrCode: typeof import('./src/components/qrCode.vue')['default'] 14 QrCode: typeof import('./src/components/qrCode.vue')['default']
......
...@@ -30,8 +30,6 @@ ...@@ -30,8 +30,6 @@
30 <script setup> 30 <script setup>
31 import Taro from '@tarojs/taro' 31 import Taro from '@tarojs/taro'
32 import { Home, Message, My } from '@nutui/icons-vue-taro' 32 import { Home, Message, My } from '@nutui/icons-vue-taro'
33 -// 迁移到独立 H5 项目时,别忘了把 miniProgram helper 一起带走。
34 -import { isH5Env, navigateToMiniProgramPage } from '@/utils/miniProgram'
35 33
36 const props = defineProps({ 34 const props = defineProps({
37 current: { 35 current: {
...@@ -66,23 +64,11 @@ const tabItems = [ ...@@ -66,23 +64,11 @@ const tabItems = [
66 64
67 const isActive = (name) => name === props.current 65 const isActive = (name) => name === props.current
68 66
69 -const handleTabClick = async (item) => { 67 +const handleTabClick = (item) => {
70 if (!item?.url || item.name === props.current) { 68 if (!item?.url || item.name === props.current) {
71 return 69 return
72 } 70 }
73 71
74 - if (isH5Env()) {
75 - try {
76 - const has_navigated = await navigateToMiniProgramPage(item.url)
77 -
78 - if (has_navigated) {
79 - return
80 - }
81 - } catch (error) {
82 - console.error('H5 跳转小程序页面失败:', error)
83 - }
84 - }
85 -
86 Taro.redirectTo({ url: item.url }) 72 Taro.redirectTo({ url: item.url })
87 } 73 }
88 </script> 74 </script>
......
1 <!-- 1 <!--
2 * @Date: 2026-04-22 13:14:52 2 * @Date: 2026-04-22 13:14:52
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2026-04-22 13:20:49 4 + * @LastEditTime: 2026-04-29 13:17:28
5 * @FilePath: /jls_weapp/src/pages/map-guide/index.vue 5 * @FilePath: /jls_weapp/src/pages/map-guide/index.vue
6 * @Description: 文件描述 6 * @Description: 文件描述
7 --> 7 -->
...@@ -10,5 +10,5 @@ ...@@ -10,5 +10,5 @@
10 </template> 10 </template>
11 11
12 <script setup> 12 <script setup>
13 -const map_guide_url = 'https://oa-dev.onwall.cn/f/map/#/checkin/?id=835368&current_lng=121.52609&current_lat=31.25956&openid=oAHBN14FGjUihI-ayF22_rCe0APM&discount_title=便民服务&activityId=835370&_t=1776834254361' 13 +const map_guide_url = 'https://oa-dev.onwall.cn/f/map/#/checkin/?id=835368&current_lng=121.52609&current_lat=31.25956&openid=oAHBN14FGjUihI-ayF22_rCe0APM&&activityId=8353701&_t=&navMode=jls'
14 </script> 14 </script>
......
1 -const WECHAT_JS_SDK_URL = 'https://res.wx.qq.com/open/js/jweixin-1.6.0.js'
2 -
3 -let wechat_bridge_loading_promise = null
4 -
5 -const isBrowserEnv = () => typeof window !== 'undefined' && typeof document !== 'undefined'
6 -
7 -const getWechatBridge = () => {
8 - if (typeof window === 'undefined') {
9 - return null
10 - }
11 -
12 - return window.wx || window.jWeixin || null
13 -}
14 -
15 -const getMiniProgramBridge = () => getWechatBridge()?.miniProgram || null
16 -
17 -export const isH5Env = () => isBrowserEnv()
18 -
19 -const ensureWechatBridge = async () => {
20 - if (!isH5Env()) {
21 - return null
22 - }
23 -
24 - const current_bridge = getWechatBridge()
25 -
26 - if (current_bridge) {
27 - return current_bridge
28 - }
29 -
30 - if (!wechat_bridge_loading_promise) {
31 - wechat_bridge_loading_promise = new Promise((resolve, reject) => {
32 - const script = document.createElement('script')
33 -
34 - script.src = WECHAT_JS_SDK_URL
35 - script.async = true
36 - script.onload = () => resolve(getWechatBridge())
37 - script.onerror = () => reject(new Error('微信 JS SDK 加载失败'))
38 -
39 - document.head.appendChild(script)
40 - })
41 - }
42 -
43 - try {
44 - return await wechat_bridge_loading_promise
45 - } catch (error) {
46 - wechat_bridge_loading_promise = null
47 - throw error
48 - }
49 -}
50 -
51 -export const isWechatMiniProgramWebview = () => new Promise((resolve) => {
52 - const check_env = async () => {
53 - if (!isH5Env()) {
54 - resolve(false)
55 - return
56 - }
57 -
58 - try {
59 - await ensureWechatBridge()
60 - } catch (error) {
61 - console.error('微信 JS SDK 初始化失败:', error)
62 - resolve(false)
63 - return
64 - }
65 -
66 - const mini_program_bridge = getMiniProgramBridge()
67 -
68 - if (!mini_program_bridge) {
69 - resolve(false)
70 - return
71 - }
72 -
73 - if (typeof mini_program_bridge.getEnv !== 'function') {
74 - resolve(true)
75 - return
76 - }
77 -
78 - mini_program_bridge.getEnv((result = {}) => {
79 - resolve(!!result.miniprogram)
80 - })
81 - }
82 -
83 - check_env().catch(() => {
84 - resolve(false)
85 - })
86 -})
87 -
88 -export const navigateToMiniProgramPage = async (url = '') => {
89 - const normalized_url = String(url || '').trim()
90 -
91 - if (!normalized_url) {
92 - return false
93 - }
94 -
95 - const is_supported_webview = await isWechatMiniProgramWebview()
96 -
97 - if (!is_supported_webview) {
98 - return false
99 - }
100 -
101 - const mini_program_bridge = getMiniProgramBridge()
102 -
103 - if (typeof mini_program_bridge?.navigateTo !== 'function') {
104 - return false
105 - }
106 -
107 - return new Promise((resolve, reject) => {
108 - mini_program_bridge.navigateTo({
109 - url: normalized_url,
110 - success: () => resolve(true),
111 - fail: (error) => reject(error),
112 - })
113 - })
114 -}