Commit 498e5084 by chenwq1

feat:顶部title

1 parent 2eb0c33d
Pipeline #151 for 498e5084 failed in 0 seconds
...@@ -8,16 +8,22 @@ ...@@ -8,16 +8,22 @@
* 可以输入预定的版权声明、个性签名、空行等 * 可以输入预定的版权声明、个性签名、空行等
--> -->
<script setup lang="ts"> <script setup lang="ts">
import { computed } from "vue";
import { useRoute } from "vue-router";
import PageTitle from "@/components/PageTitle.vue"; import PageTitle from "@/components/PageTitle.vue";
withDefaults( defineProps<{
defineProps<{
title: string; title: string;
/** 宿主小程序带 openType=miniApp 跳转时隐藏标题栏 */ }>();
hideTitle?: boolean;
}>(), const route = useRoute();
{ hideTitle: false },
); /** 宿主小程序带 openType=miniApp 跳转时隐藏各 Tab 页顶部标题 */
const hideTitle = computed(() => {
const v = route.query.openType;
return (Array.isArray(v) ? v[0] : v) === "miniApp";
});
</script> </script>
<template> <template>
......
...@@ -65,7 +65,8 @@ function onTabChange(index: number | string) { ...@@ -65,7 +65,8 @@ function onTabChange(index: number | string) {
const i = tabbarIndex(index); const i = tabbarIndex(index);
const tab = tabList[i]; const tab = tabList[i];
if (tab) { if (tab) {
router.push({ name: tab.routeName }); // 保留 query(如 openType=miniApp),避免 Tab 切换后 PageTop 等依赖 query 的状态丢失
router.push({ name: tab.routeName, query: { ...route.query } });
} }
} }
</script> </script>
......
...@@ -3,7 +3,7 @@ import type { CardAction, WorkOrderItem } from "@/types/views/home"; ...@@ -3,7 +3,7 @@ import type { CardAction, WorkOrderItem } from "@/types/views/home";
import type { AuditStatus, WorkOrderStatus } from "@/types/views/work-order-common"; import type { AuditStatus, WorkOrderStatus } from "@/types/views/work-order-common";
import { computed, ref, watch } from "vue"; import { computed, ref, watch } from "vue";
import { useRoute, useRouter } from "vue-router"; import { useRouter } from "vue-router";
import { getWorkOrderCountByStatus, getWorkOrderH5Url, getWorkOrderPage } from "@/api/modules/work-order"; import { getWorkOrderCountByStatus, getWorkOrderH5Url, getWorkOrderPage } from "@/api/modules/work-order";
import PageTop from "@/components/PageTop.vue"; import PageTop from "@/components/PageTop.vue";
...@@ -19,14 +19,7 @@ const pageSize = 20; ...@@ -19,14 +19,7 @@ const pageSize = 20;
const displayList = ref<WorkOrderItem[]>([]); const displayList = ref<WorkOrderItem[]>([]);
const currentPage = ref(1); const currentPage = ref(1);
const scroller = ref<Element | undefined>(undefined); const scroller = ref<Element | undefined>(undefined);
const route = useRoute();
const router = useRouter(); const router = useRouter();
/** 宿主小程序跳转带 openType=miniApp 时隐藏顶部标题 */
const hidePageTitle = computed(() => {
const v = route.query.openType;
return (Array.isArray(v) ? v[0] : v) === "miniApp";
});
const rejectReasonDialogVisible = ref(false); const rejectReasonDialogVisible = ref(false);
const rejectReasonContent = ref(""); const rejectReasonContent = ref("");
const tabCounts = ref({ const tabCounts = ref({
...@@ -276,7 +269,7 @@ void onRefresh(); ...@@ -276,7 +269,7 @@ void onRefresh();
<template> <template>
<div class="work-order-page"> <div class="work-order-page">
<PageTop title="检测工单" :hide-title="hidePageTitle"> <PageTop title="检测工单">
<!-- 顶部状态 Tab --> <!-- 顶部状态 Tab -->
<div class="status-tabs"> <div class="status-tabs">
<div v-for="t in statusTabs" <div v-for="t in statusTabs"
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!