Просмотр исходного кода

消息长英文显示优化,打回时全屏loading的文案修改为:“操作中,请稍等...”

刘洋 1 год назад
Родитель
Сommit
2694544947

+ 5 - 2
src/components/common/LoadingFlag.vue

@@ -2,11 +2,14 @@
   <div class="loading-flag flex justify-center items-center">
     <div class="loading-content">
       <img src="../../assets/images/screen_loading.png" />
-      <p>计算中,请稍等...</p>
+      <p>{{ mainStore.globalLoadingText }}</p>
     </div>
   </div>
 </template>
-<script setup lang="ts" name="LoadingFlag"></script>
+<script setup lang="ts" name="LoadingFlag">
+import useMainStore from '@/store/main'
+const mainStore = useMainStore()
+</script>
 <style scoped lang="scss">
 .loading-flag {
   position: fixed;

+ 1 - 0
src/components/shared/message/MessageHeadList.vue

@@ -161,6 +161,7 @@ watch(
       -webkit-box-orient: vertical;
       font-size: $SmallFont;
       white-space: pre-wrap;
+      word-break: break-all;
     }
   }
 }

+ 6 - 1
src/hooks/useFetch.ts

@@ -35,6 +35,11 @@ const needLoadingApiList: any[] = [
   '/api/system/check/reject',
   '/api/self/check/reject',
 ]
+const loadingTextMap: any = {
+  '/api/custom/query/reject': '操作中,请稍等...',
+  '/api/system/check/reject': '操作中,请稍等...',
+  '/api/self/check/reject': '操作中,请稍等...',
+}
 function useFetch<K extends ApiKeys>(key: K): ReturnType<K>
 function useFetch<K extends ApiKeys>(key: K, config: AxiosRequestConfig, method?: HttpMethod): ReturnType<K>
 function useFetch<K extends ApiKeys>(key: K, method: HttpMethod): ReturnType<K>
@@ -71,7 +76,7 @@ function useFetch<K extends ApiKeys>(k: K, ...args: any[]) {
 
       loading.value = true
       if (needLoadingApiList.indexOf(apiConfigUrl) > -1) {
-        mainStore.setGlobalLoading(true)
+        mainStore.setGlobalLoading(true, loadingTextMap[apiConfigUrl])
       }
       // const apiConfig = api[k]
 

+ 5 - 2
src/store/main.ts

@@ -17,6 +17,7 @@ interface MainStoreState {
   lockScreenStatus: boolean
   keepAliveViews: any[]
   globalLoading: boolean
+  globalLoadingText: string
   paneSizeConfig: any
   showRowNextBottomDialog: boolean
   markerPausedLimit: number
@@ -33,7 +34,7 @@ interface MainStoreActions {
   setLockScreen: (bool: boolean) => void
   setKeepAliveViews: (name: string) => void
   cutKeepAliveViews: (name: string) => void
-  setGlobalLoading: (name: boolean) => void
+  setGlobalLoading: (name: boolean, text?: string | undefined) => void
   setPaneSizeConfig: (path: string, size: number) => void
   setRowNextBottomDialogStatus: (bool: boolean) => void
   setMarkerPausedLimit: (time: number) => void
@@ -61,6 +62,7 @@ const useMainStore = defineStore<'main', MainStoreState, Record<string, any>, Ma
       lockScreenStatus: sessionStorage.get('lockScreenStatus') == '1' ? true : false,
       keepAliveViews: ['MainLayout'],
       globalLoading: false,
+      globalLoadingText: '计算中,请稍等...',
       paneSizeConfig: localStorage.getItem('paneSizeConfig')
         ? JSON.parse(localStorage.getItem('paneSizeConfig') as string)
         : {},
@@ -98,8 +100,9 @@ const useMainStore = defineStore<'main', MainStoreState, Record<string, any>, Ma
       this.paneSizeConfig[path] = size
       localStorage.setItem('paneSizeConfig', JSON.stringify(this.paneSizeConfig))
     },
-    setGlobalLoading(bool) {
+    setGlobalLoading(bool, text?: string | undefined) {
       this.globalLoading = bool
+      this.globalLoadingText = text || '计算中,请稍等...'
     },
     setKeepAliveViews(name) {
       if (!this.keepAliveViews.includes(name)) {