feat:tabbar

This commit is contained in:
dzc committed 2026-08-24 17:29:33 +08:00
1 parent f4adf95e7a
commit 6d267bcfc5
11 files changed
+142 -26

No files matched your search

+1
View File
@@ -1,5 +1,6 @@
<template>
<crud-layout title="通知公告" :bg="filePath(SERVICE_IMAGE.blueBg)">
<view class="h-30rpx" />
<view class="notice-container">
<view class="notice-list">
<view v-if="noticeList.length === 0" class="empty-tip"> 暂无公告 </view>
+2
View File
@@ -73,6 +73,8 @@ const doMenu = async (v: any) => {
// 是否是具体页面
const routePath = v.page.split("?")[0]
if (v.page.startsWith("/") && __ROUTES__.some((route) => route.path === routePath)) {
// 直接页面入口也要先组装所属业务 Tabbar,再进入目标页面。
await tabbarStore.componetTabbarList(v.page)
router.jump(v.page)
return
}
+40 -9
View File
@@ -1,24 +1,55 @@
<script setup lang="ts">
import { ref, reactive } from "vue"
import { onLoad, onShow } from "@dcloudio/uni-app"
import { reactive } from "vue"
import { onLoad } from "@dcloudio/uni-app"
const state = reactive({
url: ""
url: "",
})
onLoad((options: any) => {
if (options.url) {
state.url = decodeURIComponent(options.url)
// 只记录地址结构,不输出 token,便于定位微信 WebView 域名校验问题。
try {
const url = new URL(state.url)
console.log("[web-view] 加载地址:", {
origin: url.origin,
pathname: url.pathname,
queryKeys: Array.from(url.searchParams.keys()),
})
} catch (error) {
console.error("[web-view] 地址解析失败:", error)
}
}
})
const handleWebViewLoad = (event: any) => {
console.log("[web-view] 加载完成:", event?.detail?.src || state.url)
}
const handleWebViewError = (event: any) => {
console.error("[web-view] 加载失败:", {
url: state.url,
detail: event?.detail,
})
uni.showToast({ title: "第三方页面加载失败,请检查业务域名配置", icon: "none" })
}
</script>
<template>
<crud-layout mainIsScroll tabBarType="just-flot-back">
<web-view :update-title="false" :fullscreen="false" :webview-styles="{
width: '100%',
height: '100%',
backgroundColor: '#fff'
}" :src="state.url" />
<web-view class="mall-web-view" :update-title="false" :fullscreen="false" @load="handleWebViewLoad"
@error="handleWebViewError" :webview-styles="{
width: '100%',
height: '100%',
backgroundColor: '#fff'
}" :src="state.url" />
</crud-layout>
</template>
</template>
<style lang="scss" scoped>
.mall-web-view {
width: 100%;
height: 100%;
}
</style>
+28 -3
View File
@@ -33,8 +33,18 @@ function normalizeMallUrl(rawUrl: string) {
const [, origin, rawPathname = "/", search = "", hash = ""] = matched
const queryItems = search.slice(1).split("&").filter(Boolean)
const queryKeys = queryItems.map((item) => decodeURIComponent(item.split("=")[0] || ""))
const hasToken = queryItems.some((item) => /^token=.+/i.test(item))
const decodeQueryPart = (value: string) => {
try {
return decodeURIComponent(value)
} catch {
return value
}
}
const queryKeys = queryItems.map((item) => decodeQueryPart(item.split("=")[0] || ""))
const hasToken = queryItems.some((item) => {
const [key, ...valueParts] = item.split("=")
return decodeQueryPart(key || "").toLowerCase() === "token" && valueParts.join("=")
})
let pathname = rawPathname
// 宁波银行正常登录页是 /h5/thirdApp;部分环境会错误返回带 token 的根路径。
@@ -51,7 +61,22 @@ function normalizeMallUrl(rawUrl: string) {
if (pathname === "/" || !hasToken) {
throw new Error("商城登录地址异常,请联系管理员")
}
return `${origin}${pathname}${search}${hash}`
// 宁波银行 H5 通过 platform 判断是否运行在微信小程序中。设置为 XR 后,
// H5 左上角返回按钮会调用 wx.miniProgram.navigateBack(),直接返回小程序上一页,
// 不会先消耗宁波银行 H5 自己的 history。覆盖旧值,避免后端返回其他平台参数。
const queryWithoutPlatform = queryItems.filter((item) => {
const key = decodeQueryPart(item.split("=")[0] || "").toLowerCase()
return key !== "platform"
})
queryWithoutPlatform.push("platform=XR")
const normalizedSearch = `?${queryWithoutPlatform.join("&")}`
console.log("[happyMall] 跳转平台:", {
platform: "XR",
queryKeys: queryWithoutPlatform.map((item) => decodeQueryPart(item.split("=")[0] || "")),
})
return `${origin}${pathname}${normalizedSearch}${hash}`
}
onLoad(async () => {