ソースを参照

feat: 修改日期格式化、添加system detail 详情页面包屑

zhouyuhao 10 ヶ月 前
コミット
7966c8d104

+ 2 - 2
src/components/VLoading/src/VLoading.vue

@@ -46,11 +46,11 @@ const props = withDefaults(defineProps<internalProps>(), {
 }
 
 .v-loading-spinner {
+  position: sticky;
   top: 50%;
-  margin-top: -24px;
+  transform: translateY(-50%);
   width: 100%;
   text-align: center;
-  position: absolute;
 }
 
 .circular {

+ 3 - 0
src/router/index.ts

@@ -96,6 +96,9 @@ const router = createRouter({
         {
           path: '/system-message-detail',
           name: 'System Message Detail',
+          meta: {
+            breadName: 'Detail'
+          },
           component: () => import('../views/SystemMessage/src/components/SystemMessageDetail.vue')
         }
       ]

+ 8 - 2
src/stores/modules/breadCrumb.ts

@@ -9,7 +9,13 @@ interface BreadCrumb {
   routeList: Route[]
 }
 // 需要添加多级菜单的页面,值为route的name
-const whiteList = ['Booking Detail', 'Tracking Detail', 'Add VGM', 'Public Tracking Detail']
+const whiteList = [
+  'Booking Detail',
+  'Tracking Detail',
+  'Add VGM',
+  'Public Tracking Detail',
+  'System Message Detail'
+]
 
 export const useBreadCrumb = defineStore('breadCrumb', {
   state: (): BreadCrumb => ({
@@ -36,7 +42,7 @@ export const useBreadCrumb = defineStore('breadCrumb', {
         ]
       } else if (toRoute.name && whiteList.includes(toRoute.name)) {
         this.routeList.push({
-          label: toRoute.name,
+          label: toRoute?.meta?.breadName || toRoute.name,
           path: toRoute.path,
           query: toRoute.query
         })

+ 4 - 4
src/utils/tools.ts

@@ -4,17 +4,17 @@ export const formatTimezone = (time: string, timezone: string) => {
   if (!time) return '--'
   let formattedTime = ''
   if (time.length > 12) {
-    formattedTime = moment(time).format('MMM-DD-YYYY hh:mm A')
+    formattedTime = moment(time).format(`${formatString} hh:mm A`)
     if (!timezone) {
       return formattedTime
     }
     let gmtOffset = ''
-    const timeZoneOffset = moment().tz(timezone).format('Z')
+    const timeZoneOffset = moment.tz(`${moment().year()}-01-01`, timezone).format('Z')
     // 替换 "+07:00" 为 "GMT+07"
     gmtOffset = `(GMT${timeZoneOffset.slice(0, 3)})`
     return `${formattedTime} ${gmtOffset}`
   } else {
-    formattedTime = moment(time).format('MMM-DD-YYYY')
+    formattedTime = moment(time).format(formatString)
     return formattedTime
   }
 }
@@ -50,7 +50,7 @@ export const formatTimezoneByUser = (time: string, timezone?: string) => {
       return formattedTime
     }
     let gmtOffset = ''
-    const timeZoneOffset = moment().tz(timezone).format('Z')
+    const timeZoneOffset = moment.tz(`${moment().year()}-01-01`, timezone).format('Z')
     // 替换 "+07:00" 为 "GMT+07"
     gmtOffset = `(GMT${timeZoneOffset.slice(0, 3)})`
     return `${formattedTime} ${gmtOffset}`