配置
This commit is contained in:
1 parent
a0eac3aabb
commit
98e2c198db
5 files changed
+103
-47
No files matched your search
+11
-3
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { getLaunchParam, getUrlQueryParam } from "@/sheep/utils/app"
|
||||
import { getAppInfo } from "@@/utils/app"
|
||||
import { APPENV } from "./sheep/constant"
|
||||
import { APPENV, INTEGRATED_LAUNCH_PARAMS } from "./sheep/constant"
|
||||
|
||||
interface TabbarItem {
|
||||
pagePath: string
|
||||
@@ -115,7 +115,7 @@ const tabbar: TabbarItem[] = [
|
||||
text: "综合服务",
|
||||
iconPath: "/static/tabbar/integrated.png",
|
||||
selectedIconPath: "/static/tabbar/integrated-select.png",
|
||||
launchParam: ["integrated"],
|
||||
launchParam: [...INTEGRATED_LAUNCH_PARAMS],
|
||||
auth: ["user"],
|
||||
},
|
||||
{
|
||||
@@ -123,7 +123,15 @@ const tabbar: TabbarItem[] = [
|
||||
text: "我的",
|
||||
iconPath: "/static/tabbar/my.png",
|
||||
selectedIconPath: "/static/tabbar/my-select.png",
|
||||
launchParam: ["canteen", "selfMerchant", "onlineShop", "coopMerchant", "integrated", "prosperityShop", "prosperityShopMchList"],
|
||||
launchParam: [
|
||||
"canteen",
|
||||
"selfMerchant",
|
||||
"onlineShop",
|
||||
"coopMerchant",
|
||||
...INTEGRATED_LAUNCH_PARAMS,
|
||||
"prosperityShop",
|
||||
"prosperityShopMchList",
|
||||
],
|
||||
auth: ["user", "merchant", "doorAdmin"],
|
||||
},
|
||||
]
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { APPENV } from "@/sheep/constant"
|
||||
import { INTEGRATED_ENTRIES, getIntegratedPageByLaunchParam } from "@/sheep/constant/integrated-entry"
|
||||
import { getAppInfo, getLaunchParam, getUrlQueryParam, isDevEnv } from "@/sheep/utils/app"
|
||||
import { onShow } from "@dcloudio/uni-app"
|
||||
|
||||
@@ -58,6 +59,12 @@ const moduleList = [
|
||||
iconPath: "/static/tabbar/integrated-select.png",
|
||||
launchParam: "integrated",
|
||||
},
|
||||
...INTEGRATED_ENTRIES.map((e) => ({
|
||||
pagePath: e.pagePath,
|
||||
text: e.text,
|
||||
iconPath: e.iconPath,
|
||||
launchParam: e.launchParam,
|
||||
})),
|
||||
]
|
||||
|
||||
onShow(() => {
|
||||
@@ -68,6 +75,16 @@ onShow(() => {
|
||||
jumpByParam()
|
||||
})
|
||||
|
||||
async function jumpIntegratedSubPage(launchParam: string): Promise<boolean> {
|
||||
const url = getIntegratedPageByLaunchParam(launchParam)
|
||||
if (!url) return false
|
||||
uni.setStorageSync("launchParam", launchParam)
|
||||
const app = getApp() as { _initTabbar?: () => Promise<void> }
|
||||
if (app?._initTabbar) await app._initTabbar()
|
||||
uni.reLaunch({ url })
|
||||
return true
|
||||
}
|
||||
|
||||
const jumpByParam = async () => {
|
||||
const appInfo = await getAppInfo() // 环境判断
|
||||
const launchParam = getLaunchParam() // 获取启动参数
|
||||
@@ -77,6 +94,7 @@ const jumpByParam = async () => {
|
||||
const { tryZzdEntryLogin } = await import("@/sheep/utils/request")
|
||||
const zzdR = await tryZzdEntryLogin()
|
||||
if (zzdR !== "ok") return
|
||||
if (await jumpIntegratedSubPage(launchParam)) return
|
||||
switch (launchParam) {
|
||||
case "thirdApp":
|
||||
uni.setStorageSync("launchParam", launchParam)
|
||||
@@ -156,6 +174,7 @@ const jumpByParam = async () => {
|
||||
uni.setStorageSync("launchParam", launchParam)
|
||||
return uni.reLaunch({ url: "/pages/tabbar/integrated" })
|
||||
}
|
||||
if (await jumpIntegratedSubPage(launchParam)) return
|
||||
case "doorAdmin":
|
||||
return uni.switchTab({ url: "/pages/tabbar/cabinet" })
|
||||
default:
|
||||
|
||||
@@ -31,54 +31,17 @@ import { onLoad } from "@dcloudio/uni-app"
|
||||
import { ref, onMounted } from "vue"
|
||||
|
||||
import integratedApi from "@/sheep/api/integrated"
|
||||
import { INTEGRATED_ENTRIES } from "@/sheep/constant/integrated-entry"
|
||||
import { hooks } from "@@/index"
|
||||
|
||||
const todoCount = ref(0)
|
||||
|
||||
const services = [
|
||||
{
|
||||
name: "todo",
|
||||
label: "工作待办",
|
||||
icon: "/static/icon/todo.png",
|
||||
url: "/pages/integrated/todo/index",
|
||||
},
|
||||
{
|
||||
name: "meeting-booking",
|
||||
label: "会议预定",
|
||||
icon: "/static/icon/meeting-booking.png",
|
||||
url: "/pages/integrated/meeting/index",
|
||||
},
|
||||
{
|
||||
name: "lost-and-found",
|
||||
label: "失物招领",
|
||||
icon: "/static/icon/service_1.png",
|
||||
url: "/pages/integrated/lostAndFound/index",
|
||||
},
|
||||
{
|
||||
name: "feedback",
|
||||
label: "意见反馈",
|
||||
icon: "/static/icon/feedback.png",
|
||||
url: "/pages/integrated/feedback/index",
|
||||
},
|
||||
{
|
||||
name: "repair-report",
|
||||
label: "物业维修",
|
||||
icon: "/static/icon/service_2.png",
|
||||
url: "/pages/integrated/repair/index",
|
||||
},
|
||||
{
|
||||
name: "notice",
|
||||
label: "通知公告",
|
||||
icon: "/static/icon/service_3.png",
|
||||
url: "/pages/integrated/notice/index",
|
||||
},
|
||||
{
|
||||
name: "visitor",
|
||||
label: "访客邀约",
|
||||
icon: "/static/icon/visitor.png",
|
||||
url: "/pages/integrated/visitor/invitation",
|
||||
},
|
||||
]
|
||||
const services = INTEGRATED_ENTRIES.map((e) => ({
|
||||
name: e.launchParam,
|
||||
label: e.text,
|
||||
icon: e.iconPath,
|
||||
url: e.pagePath,
|
||||
}))
|
||||
|
||||
// 获取待办数量
|
||||
async function fetchTodoCount() {
|
||||
|
||||
@@ -3,3 +3,10 @@ export { default as serviceEnum } from "./service-enum"
|
||||
export { default as storageConstant } from "./storage-constant"
|
||||
|
||||
export { default as APPENV } from "./app-env"
|
||||
|
||||
export {
|
||||
INTEGRATED_ENTRIES,
|
||||
INTEGRATED_LAUNCH_PARAMS,
|
||||
getIntegratedPageByLaunchParam,
|
||||
type IntegratedEntry,
|
||||
} from "./integrated-entry"
|
||||
@@ -0,0 +1,59 @@
|
||||
/** 综合服务子入口(与 pages/tabbar/integrated.vue services 对齐) */
|
||||
export type IntegratedEntry = {
|
||||
launchParam: string
|
||||
text: string
|
||||
iconPath: string
|
||||
pagePath: string
|
||||
}
|
||||
|
||||
export const INTEGRATED_ENTRIES: IntegratedEntry[] = [
|
||||
{
|
||||
launchParam: "todo",
|
||||
text: "工作待办",
|
||||
iconPath: "/static/icon/todo.png",
|
||||
pagePath: "/pages/integrated/todo/index",
|
||||
},
|
||||
{
|
||||
launchParam: "meeting",
|
||||
text: "会议预定",
|
||||
iconPath: "/static/icon/meeting-booking.png",
|
||||
pagePath: "/pages/integrated/meeting/index",
|
||||
},
|
||||
{
|
||||
launchParam: "lostAndFound",
|
||||
text: "失物招领",
|
||||
iconPath: "/static/icon/service_1.png",
|
||||
pagePath: "/pages/integrated/lostAndFound/index",
|
||||
},
|
||||
{
|
||||
launchParam: "feedback",
|
||||
text: "意见反馈",
|
||||
iconPath: "/static/icon/feedback.png",
|
||||
pagePath: "/pages/integrated/feedback/index",
|
||||
},
|
||||
{
|
||||
launchParam: "repair",
|
||||
text: "物业维修",
|
||||
iconPath: "/static/icon/service_2.png",
|
||||
pagePath: "/pages/integrated/repair/index",
|
||||
},
|
||||
{
|
||||
launchParam: "notice",
|
||||
text: "通知公告",
|
||||
iconPath: "/static/icon/service_3.png",
|
||||
pagePath: "/pages/integrated/notice/index",
|
||||
},
|
||||
{
|
||||
launchParam: "visitor",
|
||||
text: "访客邀约",
|
||||
iconPath: "/static/icon/visitor.png",
|
||||
pagePath: "/pages/integrated/visitor/invitation",
|
||||
},
|
||||
]
|
||||
|
||||
/** 综合服务 tab 及子入口 launchParam(用于 tabbar 显隐) */
|
||||
export const INTEGRATED_LAUNCH_PARAMS = ["integrated", ...INTEGRATED_ENTRIES.map((e) => e.launchParam)]
|
||||
|
||||
export function getIntegratedPageByLaunchParam(launchParam: string): string | undefined {
|
||||
return INTEGRATED_ENTRIES.find((e) => e.launchParam === launchParam)?.pagePath
|
||||
}
|
||||
Reference in new issue
Block a user