Explorar el Código

style: 格式调整

zhanghaijun hace 1 año
padre
commit
be75454a84

+ 1 - 7
src/main.ts

@@ -15,20 +15,14 @@ import '@styles/tailwind.css'                       // tailwindcss
 import '@icons/system/iconfont.css'                 // 系统图标
 import * as ElementPlusIconsVue from '@element-plus/icons-vue'
 import { setupGlobDirectives } from './directives'
-import { setupErrorHandle } from './utils/sys/error-handle'
 import language from './locales'
 
-document.addEventListener(
-  'touchstart',
-  function () {},
-  { passive: false }
-)
+document.addEventListener('touchstart',  function () {},  { passive: false })
 
 const app = createApp(App)
 initStore(app)
 initRouter(app)
 setupGlobDirectives(app)
-setupErrorHandle(app)
 
 app.use(language)
 

+ 1 - 9
src/utils/echarts.ts

@@ -2,15 +2,7 @@
 import * as echarts from 'echarts/core'
 
 // 导入图表类型
-import {
-  BarChart,
-  LineChart,
-  PieChart,
-  ScatterChart,
-  RadarChart,
-  MapChart,
-  CandlestickChart
-} from 'echarts/charts'
+import { BarChart, LineChart, PieChart, ScatterChart, RadarChart, MapChart, CandlestickChart } from 'echarts/charts'
 
 // 导入组件
 import {

+ 3 - 15
src/utils/sys/error-handle.ts

@@ -12,13 +12,7 @@ export function vueErrorHandler(err: unknown, instance: any, info: string) {
 /**
  * 全局脚本错误处理
  */
-export function scriptErrorHandler(
-  message: Event | string,
-  source?: string,
-  lineno?: number,
-  colno?: number,
-  error?: Error
-): boolean {
+export function scriptErrorHandler(message: Event | string, source?: string, lineno?: number, colno?: number, error?: Error): boolean {
   console.error('[ScriptError]', { message, source, lineno, colno, error })
   // reportError({ type: 'script', message, source, lineno, colno, error })
   return true // 阻止默认控制台报错,可根据需求改
@@ -42,16 +36,10 @@ export function registerResourceErrorHandler() {
     'error',
     (event: Event) => {
       const target = event.target as HTMLElement
-      if (
-        target &&
-        (target.tagName === 'IMG' || target.tagName === 'SCRIPT' || target.tagName === 'LINK')
-      ) {
+      if (target && (target.tagName === 'IMG' || target.tagName === 'SCRIPT' || target.tagName === 'LINK')) {
         console.error('[ResourceError]', {
           tagName: target.tagName,
-          src:
-            (target as HTMLImageElement).src ||
-            (target as HTMLScriptElement).src ||
-            (target as HTMLLinkElement).href
+          src: (target as HTMLImageElement).src || (target as HTMLScriptElement).src || (target as HTMLLinkElement).href
         })
         // reportError({ type: 'resource', target })
       }

+ 5 - 21
src/utils/sys/upgrade.ts

@@ -58,19 +58,10 @@ class VersionManager {
     const currentVersionPrefix = StorageConfig.generateStorageKey('').slice(0, -1) // 移除末尾的 '-'
 
     // 查找旧的单一存储结构
-    const oldSysKey =
-      storageKeys.find(
-        (key) =>
-          StorageConfig.isVersionedKey(key) && key !== currentVersionPrefix && !key.includes('-')
-      ) || null
+    const oldSysKey = storageKeys.find((key) => StorageConfig.isVersionedKey(key) && key !== currentVersionPrefix && !key.includes('-')) || null
 
     // 查找旧版本的分离存储键
-    const oldVersionKeys = storageKeys.filter(
-      (key) =>
-        StorageConfig.isVersionedKey(key) &&
-        !StorageConfig.isCurrentVersionKey(key) &&
-        key.includes('-')
-    )
+    const oldVersionKeys = storageKeys.filter((key) => StorageConfig.isVersionedKey(key) && !StorageConfig.isCurrentVersionKey(key) && key.includes('-'))
 
     return { oldSysKey, oldVersionKeys }
   }
@@ -84,9 +75,7 @@ class VersionManager {
 
     return upgradeLogList.value.some((item) => {
       const itemVersion = this.normalizeVersion(item.version)
-      return (
-        item.requireReLogin && itemVersion > normalizedStored && itemVersion <= normalizedCurrent
-      )
+      return item.requireReLogin && itemVersion > normalizedStored && itemVersion <= normalizedCurrent
     })
   }
 
@@ -104,9 +93,7 @@ class VersionManager {
     ]
 
     if (requireReLogin) {
-      messageParts.push(
-        `<p style="color: var(--main-color); padding-top: 5px;">升级完成,请重新登录后继续使用。</p>`
-      )
+      messageParts.push(`<p style="color: var(--main-color); padding-top: 5px;">升级完成,请重新登录后继续使用。</p>`)
     }
 
     return messageParts.join('')
@@ -157,10 +144,7 @@ class VersionManager {
   /**
    * 执行升级流程
    */
-  private async executeUpgrade(
-    storedVersion: string,
-    legacyStorage: ReturnType<typeof this.findLegacyStorage>
-  ): Promise<void> {
+  private async executeUpgrade(storedVersion: string, legacyStorage: ReturnType<typeof this.findLegacyStorage>): Promise<void> {
     try {
       if (!upgradeLogList.value.length) {
         console.warn('[Upgrade] 升级日志列表为空')

+ 2 - 4
src/utils/validation/formValidator.ts

@@ -193,8 +193,7 @@ export function validateEmail(value: string): boolean {
   const trimmedValue = value.trim()
 
   // RFC 5322 标准的简化版邮箱正则
-  const emailRegex =
-    /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/
+  const emailRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/
 
   return emailRegex.test(trimmedValue) && trimmedValue.length <= 254
 }
@@ -230,8 +229,7 @@ export function validateChineseIDCard(value: string): boolean {
   const trimmedValue = value.trim()
 
   // 18位身份证号码正则
-  const idCardRegex =
-    /^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/
+  const idCardRegex = /^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/
 
   if (!idCardRegex.test(trimmedValue)) {
     return false

+ 1 - 9
src/views/dashboard/analysis/widget/CustomerSatisfaction.vue

@@ -4,15 +4,7 @@
       <span class="title">客户满意度</span>
     </div>
     <div class="custom-card-body">
-      <ArtLineChart
-        height="100%"
-        :data="chartData"
-        :xAxisData="xAxisData"
-        :showLegend="true"
-        :showAxisLabel="true"
-        :showAxisLine="false"
-        :showSplitLine="true"
-      />
+      <ArtLineChart height="100%" :data="chartData" :xAxisData="xAxisData" :showLegend="true" :showAxisLabel="true" :showAxisLine="false" :showSplitLine="true" />
     </div>
   </div>
 </template>

+ 1 - 7
src/views/dashboard/analysis/widget/TargetVsReality.vue

@@ -4,13 +4,7 @@
       <span class="title">目标与实际</span>
     </div>
     <div class="custom-card-body">
-      <ArtBarChart
-        height="10rem"
-        :data="revenueData"
-        :xAxisData="weekDays"
-        :showAxisLine="false"
-        barWidth="28%"
-      />
+      <ArtBarChart height="10rem" :data="revenueData" :xAxisData="weekDays" :showAxisLine="false" barWidth="28%" />
     </div>
     <div class="custom-card-footer">
       <div class="total-item">

+ 1 - 3
src/views/dashboard/analysis/widget/TodaySales.vue

@@ -19,9 +19,7 @@
             <p>{{ item.label }}</p>
             <small>
               较昨天
-              <span :class="[item.change.indexOf('+') === -1 ? 'text-danger' : 'text-success']">{{
-                item.change
-              }}</span>
+              <span :class="[item.change.indexOf('+') === -1 ? 'text-danger' : 'text-success']">{{ item.change }}</span>
             </small>
           </div>
         </el-col>

+ 2 - 14
src/views/dashboard/analysis/widget/TopProducts.vue

@@ -4,23 +4,11 @@
       <span class="title">热门产品</span>
     </div>
     <div class="custom-card-body">
-      <ArtTable
-        :data="products"
-        style="width: 100%"
-        size="large"
-        :border="false"
-        :stripe="false"
-        :header-cell-style="{ background: 'transparent' }"
-      >
+      <ArtTable :data="products" style="width: 100%" size="large" :border="false" :stripe="false" :header-cell-style="{ background: 'transparent' }">
         <el-table-column prop="name" label="产品名称" width="200" />
         <el-table-column prop="popularity" label="销量">
           <template #default="scope">
-            <el-progress
-              :percentage="scope.row.popularity"
-              :color="getColor(scope.row.popularity)"
-              :stroke-width="5"
-              :show-text="false"
-            />
+            <el-progress :percentage="scope.row.popularity" :color="getColor(scope.row.popularity)" :stroke-width="5" :show-text="false" />
           </template>
         </el-table-column>
         <el-table-column prop="sales" label="销量" width="80">

+ 1 - 8
src/views/dashboard/analysis/widget/TotalRevenue.vue

@@ -4,14 +4,7 @@
       <span class="title">总收入</span>
     </div>
     <div class="custom-card-body">
-      <ArtBarChart
-        height="100%"
-        :data="revenueData"
-        :xAxisData="weekDays"
-        :showLegend="true"
-        :showAxisLine="false"
-        barWidth="18%"
-      />
+      <ArtBarChart height="100%" :data="revenueData" :xAxisData="weekDays" :showLegend="true" :showAxisLine="false" barWidth="18%" />
     </div>
   </div>
 </template>

+ 1 - 9
src/views/dashboard/analysis/widget/VisitorInsights.vue

@@ -4,15 +4,7 @@
       <span class="title">访客洞察</span>
     </div>
     <div class="custom-card-body">
-      <ArtLineChart
-        height="15rem"
-        :data="chartData"
-        :xAxisData="xAxisData"
-        :showLegend="true"
-        :showAxisLabel="true"
-        :showAxisLine="false"
-        :showSplitLine="true"
-      />
+      <ArtLineChart height="15rem" :data="chartData" :xAxisData="xAxisData" :showLegend="true" :showAxisLabel="true" :showAxisLine="false" :showSplitLine="true" />
     </div>
   </div>
 </template>

+ 1 - 9
src/views/dashboard/analysis/widget/VolumeServiceLevel.vue

@@ -4,15 +4,7 @@
       <span class="title">业务量与服务水平</span>
     </div>
     <div class="custom-card-body">
-      <ArtBarChart
-        height="14.3rem"
-        :data="volumeServiceData"
-        :xAxisData="serviceCategories"
-        :showLegend="true"
-        :showAxisLine="false"
-        :stack="true"
-        barWidth="22%"
-      />
+      <ArtBarChart height="14.3rem" :data="volumeServiceData" :xAxisData="serviceCategories" :showLegend="true" :showAxisLine="false" :stack="true" barWidth="22%" />
     </div>
   </div>
 </template>