Jelajahi Sumber

更新日期选择的保存功能,现在可以本地保存,且多页面共享同一个日期范围;优化代码结构;

fxs 7 bulan lalu
induk
melakukan
6671cef849
36 mengubah file dengan 331 tambahan dan 281 penghapusan
  1. 30 44
      src/components/Table.vue
  2. 3 3
      src/components/common/Dialog.vue
  3. 1 9
      src/components/common/WithIconSelect.vue
  4. 13 21
      src/components/dataAnalysis/HeaderCard.vue
  5. 3 11
      src/components/dataAnalysis/StatisticText.vue
  6. 3 2
      src/components/dataAnalysis/TemporalTrend.vue
  7. 4 2
      src/components/echarts/TimeLineChart.vue
  8. 2 1
      src/components/form/FileUpload.vue
  9. 1 0
      src/components/form/Form.vue
  10. 2 1
      src/components/form/MyInput.vue
  11. 4 1
      src/hooks/useDialog.ts
  12. 3 1
      src/hooks/useForm.ts
  13. 6 4
      src/hooks/useRequest.ts
  14. 3 3
      src/hooks/useTable.ts
  15. 4 2
      src/main.ts
  16. 87 23
      src/stores/useCommon.ts
  17. 1 4
      src/stores/useTable.ts
  18. 5 3
      src/utils/axios/axiosInstance.ts
  19. 26 1
      src/utils/common/index.ts
  20. 13 13
      src/utils/localStorage/localStorage.ts
  21. 2 0
      src/utils/table/table.ts
  22. 2 0
      src/utils/token/token.ts
  23. 3 3
      src/views/AppManage/BaseInfoView.vue
  24. 13 13
      src/views/AppManage/EventDetailsView.vue
  25. 21 32
      src/views/AppManage/EventManageView.vue
  26. 8 9
      src/views/AppManage/EventMangeTable.vue
  27. 11 12
      src/views/Home/Analysis/EventAnalysisDetail.vue
  28. 3 9
      src/views/Home/Analysis/EventAnalysisTable.vue
  29. 3 2
      src/views/Home/Analysis/EventAnalysisView.vue
  30. 8 7
      src/views/Home/Analysis/KeepView.vue
  31. 8 6
      src/views/Home/Analysis/UserTrendView.vue
  32. 5 5
      src/views/Home/InfoManage/GameManageView.vue
  33. 10 19
      src/views/Home/InfoManage/PlayerManageView.vue
  34. 6 6
      src/views/Home/Overview/OverView.vue
  35. 8 5
      src/views/Index.vue
  36. 6 4
      src/views/Login/LoginView.vue

+ 30 - 44
src/components/Table.vue

@@ -2,7 +2,7 @@
  * @Author: fxs bjnsfxs@163.com
  * @Date: 2024-08-20 18:16:18
  * @LastEditors: fxs bjnsfxs@163.com
- * @LastEditTime: 2024-10-14 14:36:44
+ * @LastEditTime: 2024-10-15 11:49:12
  * @FilePath: \Game-Backstage-Management-System\src\components\Table.vue
  * @Description: 
  * 
@@ -10,22 +10,21 @@
 <script setup lang="ts">
 import type { PropsParams, TablePaginationSetting } from '@/types/table'
 import type { ReqConfig } from '@/types/dataAnalysis'
+import type { TableFieldInfo } from '@/types/table'
+import type { FormInstance } from 'element-plus'
+
 import { FilterType, FieldSpecialEffectType } from '@/types/table'
 import { initLoadResouce } from '@/utils/resource'
 import { fuzzySearch } from '@/utils/common'
-
+import { throttleFunc } from '@/utils/common'
 import { computed, onMounted, reactive, ref, toRaw, watch } from 'vue'
 import { useTable } from '@/hooks/useTable'
+import { useRequest } from '@/hooks/useRequest'
 
 import FilterPopover from './toolsBtn/FilterPopover.vue'
 import RegreshBtn from './toolsBtn/RegreshBtn.vue'
-import { useRequest } from '@/hooks/useRequest'
-
-import type { FormInstance } from 'element-plus'
 import axiosInstance from '@/utils/axios/axiosInstance'
 
-import { throttleFunc } from '@/utils/common'
-
 const { analysisResCode } = useRequest()
 
 // 节流的延迟时间
@@ -140,42 +139,34 @@ const handleSizeChange = (val: number) => {
  * @return {*}
  */
 const loadTableData = async () => {
-  return new Promise((resolve, reject) => {
+  return new Promise(async (resolve, reject) => {
+    loading.value = true
     if (props.dataList) {
       tableData.splice(0, tableData.length, ...props.dataList)
 
       paginationConfig.total = props.paginationConfig.total
       loading.value = false
-      // emits('loadSuccess', tableData)
 
       resolve(true)
     } else {
-      loading.value = true
       if (props.requestConfig) {
-        if (props.openPageQuery) {
+        try {
           // 如果开启了分页查询,那么要计算出需要展示的页码位置所对应的偏移量
           // 同时要将查询的条数改为对应的用户选择的展示条数
-          reqconfig.otherOptions.offset =
-            (paginationConfig.currentPage - 1) * paginationConfig.limit
-          reqconfig.otherOptions.limit = paginationConfig.limit
+          if (props.openPageQuery) {
+            reqconfig.otherOptions.offset =
+              (paginationConfig.currentPage - 1) * paginationConfig.limit
+            reqconfig.otherOptions.limit = paginationConfig.limit
+          }
+          await getTableData(reqconfig.url, reqconfig.otherOptions, props.openPageQuery)
+          backupTableData.splice(0, backupTableData.length, ...tableData)
+          resolve(true)
+        } catch (err) {
+          console.log(err)
+          reject(err)
+        } finally {
+          loading.value = false
         }
-
-        // 查询时要根据是否开启分页查询传入对应参数
-        getTableData(reqconfig.url, reqconfig.otherOptions, props.openPageQuery)
-          .then(() => {
-            // emits('loadSuccess', tableData)
-            backupTableData.splice(0, backupTableData.length, ...tableData)
-
-            resolve(true)
-          })
-          .catch((err) => {
-            console.log(err)
-
-            reject(err)
-          })
-          .finally(() => {
-            loading.value = false
-          })
       } else {
         loading.value = false
 
@@ -184,7 +175,6 @@ const loadTableData = async () => {
     }
   })
 }
-import type { TableFieldInfo } from '@/types/table'
 
 /**
  * @description: 获取数据,如果没有直接传入数据,则去请求数据,有则直接用
@@ -339,22 +329,23 @@ const tableCellStyle = (info: any) => {
 /**
  * @description: 监听litmit,currentpage的变化,改变后去重新请求数据
  * 如果是limit的变化,则需要把当前页置为1
- *
- *  对于Gid需要去监听props的,而不是本地的,因为是外部的改变
  * @return {*}
  */
-const changePageLimit = watch(
+watch(
   () => [paginationConfig.limit, paginationConfig.currentPage],
-  ([newLimit, newCurPage], [oldLimit, oldCruPage]) => {
+  ([newLimit], [oldLimit]) => {
+    console.log(newLimit, oldLimit)
     if (newLimit != oldLimit) {
       // 需要给分页按钮加上:current-page.sync="current_page" 配置,不然不生效
       // 当改变每页大小时把之前的缓存全部清除,重新开始
       paginationConfig.currentPage = 1
     }
 
-    if (newCurPage != oldCruPage) paginationConfig.currentPage = newCurPage
-
-    if (newLimit != oldLimit || !tableData[paginationConfig.currentPage]) {
+    // 开启分页查询的情况下,改变limit或者没有这页的缓存的情况下,重新请求
+    if (
+      props.openPageQuery &&
+      (newLimit !== oldLimit || !tableData[paginationConfig.currentPage])
+    ) {
       getData()
     }
   },
@@ -430,11 +421,6 @@ if (!props.dataList) {
   changeDataList()
 }
 
-// 没有开启分页查询就关闭掉这个监听
-if (!props.openPageQuery) {
-  changePageLimit()
-}
-
 /**
  * @description: 拷贝一份配置文件
  * @return {*}

+ 3 - 3
src/components/common/Dialog.vue

@@ -9,12 +9,12 @@
 -->
 
 <script setup lang="ts">
-import Form from '../form/Form.vue'
-import { useDialog } from '@/hooks/useDialog'
+import type { DialogConfig } from '@/types/dialog'
 
+import { useDialog } from '@/hooks/useDialog'
 import { nextTick, onMounted, reactive, ref } from 'vue'
 
-import type { DialogConfig } from '@/types/dialog'
+import Form from '../form/Form.vue'
 
 interface DialogProps {
   config: DialogConfig

+ 1 - 9
src/components/common/WithIconSelect.vue

@@ -147,14 +147,6 @@ const syncTempMultipleChioce = () => {
 }
 
 /**
- * @description: 引导层关闭
- * @return {*}
- */
-// const tourClose = () => {
-//   setPfSelectTourShowState(false)
-// }
-
-/**
  * @description: 监听selectinfo的变化,然后同步到页面上
  * @return {*}
  */
@@ -216,7 +208,7 @@ onMounted(() => {
         <div class="displayIcon">
           <span class="iconItem" v-for="item in selectBaseInfo">
             <el-image
-              v-if="item.isSelected"
+              v-show="item.isSelected"
               style="width: 20px; height: 20px; margin-right: 5px"
               :src="blobUrlInfo[item.value]"
               :fit="'cover'"

+ 13 - 21
src/components/dataAnalysis/HeaderCard.vue

@@ -7,11 +7,17 @@
 -->
 
 <script setup lang="ts">
-import router from '@/router'
 import type { HeaderCardProps, IconDropdownItem } from '@/types/dataAnalysis'
+
 import { computed, onMounted, reactive, ref, watch } from 'vue'
+import { createDateRange } from '@/utils/common'
+import { useCommonStore } from '@/stores/useCommon'
+
+import router from '@/router'
 import WithIconSelect from '@/components/common/WithIconSelect.vue'
 
+const { selectInfo, changeDateRange } = useCommonStore()
+
 const props = withDefaults(defineProps<HeaderCardProps>(), {
   openDateSelect: false,
   needPfSelect: true,
@@ -25,35 +31,20 @@ const emits = defineEmits(['changePf', 'changeDate'])
 const shortcuts = [
   {
     text: '上一周',
-    value: () => {
-      const end = new Date()
-      const start = new Date()
-      start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
-      return [start, end]
-    }
+    value: () => createDateRange(7)
   },
   {
     text: '上个月',
-    value: () => {
-      const end = new Date()
-      const start = new Date()
-      start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
-      return [start, end]
-    }
+    value: () => createDateRange(30)
   },
   {
     text: '近三个月',
-    value: () => {
-      const end = new Date()
-      const start = new Date()
-      start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
-      return [start, end]
-    }
+    value: () => createDateRange(90)
   }
 ]
 
 // 选择的日期
-const selectDate = ref<Array<Date>>(shortcuts[0].value())
+const selectDate = ref<Array<Date>>([selectInfo.startTime, selectInfo.endTime])
 
 // 面包屑列表
 const breadcrumbList = reactive<
@@ -106,7 +97,8 @@ const goBack = (index: number) => {
  * @param {*} val 新日期
  * @return {*}
  */
-const dateChange = (val: any) => {
+const dateChange = (val: Array<Date>) => {
+  changeDateRange(val)
   emits('changeDate', val)
 }
 

+ 3 - 11
src/components/dataAnalysis/StatisticText.vue

@@ -1,20 +1,12 @@
-<!--
- * @Author: fxs bjnsfxs@163.com
- * @Date: 2024-08-26 13:57:37
- * @LastEditors: fxs bjnsfxs@163.com
- * @LastEditTime: 2024-10-14 17:46:27
- * @FilePath: \Game-Backstage-Management-System\src\components\dataAnalysis\StatisticText.vue
- * @Description: 用于展示统计数据,如总览页面上方的总览数据
- * 
--->
-
 <script setup lang="ts">
 import type { StaticDataInfo, StaticField } from '@/types/dataAnalysis'
+
 import { decimalToPercentage } from '@/utils/common'
 import { onMounted, reactive, ref, watch } from 'vue'
-import axiosInstance from '@/utils/axios/axiosInstance'
 import { useAnalysis } from '@/hooks/useAnalysis'
 
+import axiosInstance from '@/utils/axios/axiosInstance'
+
 const { updateReqConfig } = useAnalysis()
 
 const props = defineProps<StaticDataInfo>()

+ 3 - 2
src/components/dataAnalysis/TemporalTrend.vue

@@ -7,13 +7,14 @@
 -->
 
 <script setup lang="ts">
-import { nextTick, onMounted, reactive, ref, watch } from 'vue'
 import type { TemporalTrendProps, OptionsProps, StaticField, ReqConfig } from '@/types/dataAnalysis'
 import type { TablePaginationSetting, TableFieldInfo } from '@/types/table'
+
+import { nextTick, onMounted, reactive, ref, watch } from 'vue'
+
 import Table from '../Table.vue'
 import TimeLineChart from '../echarts/TimeLineChart.vue'
 import StatisticText from './StatisticText.vue'
-
 import axiosInstance from '@/utils/axios/axiosInstance'
 
 interface CacheData {

+ 4 - 2
src/components/echarts/TimeLineChart.vue

@@ -1,9 +1,11 @@
 <script setup lang="ts">
+import type { OptionsProps } from '@/types/dataAnalysis'
+
 import { onMounted, ref, shallowRef, watch, useAttrs } from 'vue'
-import echarts from '.'
 import { nextTick } from 'vue'
 import { debounceFunc } from '@/utils/common'
-import type { OptionsProps } from '@/types/dataAnalysis'
+
+import echarts from '.'
 
 // 图表需要的props
 const props = defineProps<OptionsProps>()

+ 2 - 1
src/components/form/FileUpload.vue

@@ -1,7 +1,8 @@
 <script setup lang="ts">
+import type { UploadInstance, UploadRawFile } from 'element-plus'
+
 import { reactive, ref } from 'vue'
 import { ElMessage, genFileId } from 'element-plus'
-import type { UploadInstance, UploadRawFile } from 'element-plus'
 
 interface UploadProps {
   title: string

+ 1 - 0
src/components/form/Form.vue

@@ -5,6 +5,7 @@ import type { FormConfig } from '@/types/form'
 import { FormFieldType } from '@/types/form'
 import { reactive, ref } from 'vue'
 import { useForm } from '@/hooks/useForm'
+
 import CryptoJS from 'crypto-js'
 
 const { submitForm } = useForm()

+ 2 - 1
src/components/form/MyInput.vue

@@ -8,9 +8,10 @@
  * 
 -->
 <script setup lang="ts">
-import { onMounted, ref } from 'vue'
 import type { RuleInfo } from '@/types/input'
 
+import { onMounted, ref } from 'vue'
+
 interface InputInfo {
   modelValue: string
   pInputType: string

+ 4 - 1
src/hooks/useDialog.ts

@@ -7,9 +7,12 @@
  * @Description:
  *
  */
-import Form from '@/components/form/Form.vue'
 import type { DialogSetting } from '@/types/table'
+
 import { nextTick } from 'vue'
+
+import Form from '@/components/form/Form.vue'
+
 import 'element-plus/theme-chalk/el-message.css'
 import 'element-plus/theme-chalk/el-message-box.css'
 

+ 3 - 1
src/hooks/useForm.ts

@@ -8,11 +8,13 @@
  *
  */
 import type { FormInstance } from 'element-plus'
+
 import { ElMessage, ElMessageBox } from 'element-plus'
 import { nextTick } from 'vue'
-import axiosInstance from '@/utils/axios/axiosInstance'
 import { useRequest } from './useRequest'
 
+import axiosInstance from '@/utils/axios/axiosInstance'
+
 const { analysisResCode } = useRequest()
 export function useForm() {
   const vaildForm = async (formEl: FormInstance | undefined): Promise<boolean> => {

+ 6 - 4
src/hooks/useRequest.ts

@@ -7,14 +7,16 @@
  * @Description:
  *
  */
-import { ElMessage } from 'element-plus'
-import 'element-plus/theme-chalk/el-message.css'
-import 'element-plus/theme-chalk/el-message-box.css'
-import { MessageType } from '@/types/res'
 
 import type { AxiosResponse } from 'axios'
 import type { ResponseInfo } from '@/types/res'
 
+import { ElMessage } from 'element-plus'
+import { MessageType } from '@/types/res'
+
+import 'element-plus/theme-chalk/el-message.css'
+import 'element-plus/theme-chalk/el-message-box.css'
+
 export function useRequest() {
   let baseURL = ''
   if (import.meta.env.MODE === 'development') {

+ 3 - 3
src/hooks/useTable.ts

@@ -8,13 +8,13 @@
  *
  */
 import type { ResponseInfo } from '@/types/res'
-import axiosInstance from '../utils/axios/axiosInstance'
+import type { TablePaginationSetting } from '@/types/table'
 
 import { initLoadResouce } from '@/utils/resource'
-
-import type { TablePaginationSetting } from '@/types/table'
 import { reactive } from 'vue'
 
+import axiosInstance from '../utils/axios/axiosInstance'
+
 // 资源的加载路径
 const resourceInfo: Record<string, string> = {
   defaultHead: `/img/default/defaultHead.png`

+ 4 - 2
src/main.ts

@@ -1,10 +1,12 @@
 import { createApp } from 'vue'
 import { createPinia } from 'pinia'
-import * as ElementPlusIconsVue from '@element-plus/icons-vue'
-import './assets/base.css'
+
 import App from './App.vue'
 import router from './router'
 
+import * as ElementPlusIconsVue from '@element-plus/icons-vue'
+import './assets/base.css'
+
 const app = createApp(App)
 
 for (const [key, component] of Object.entries(ElementPlusIconsVue)) {

+ 87 - 23
src/stores/useCommon.ts

@@ -2,7 +2,7 @@
  * @Author: fxs bjnsfxs@163.com
  * @Date: 2024-08-28 11:46:10
  * @LastEditors: fxs bjnsfxs@163.com
- * @LastEditTime: 2024-10-12 17:07:58
+ * @LastEditTime: 2024-10-15 11:01:18
  * @FilePath: \Game-Backstage-Management-System\src\stores\useCommon.ts
  * @Description:通用的store,在多个页面均会使用
  *
@@ -10,10 +10,18 @@
 import { reactive } from 'vue'
 import { defineStore } from 'pinia'
 import { getLocalInfo, saveLocalInfo } from '@/utils/localStorage/localStorage'
+import { createDateRange, invaildDateRange } from '@/utils/common'
 
 interface SelectInfo {
   gid: string
   pf: Array<string>
+  startTime: Date
+  endTime: Date
+}
+
+interface MultipleChioce {
+  gid: string
+  pf: Array<string>
 }
 
 interface GameInfo {
@@ -21,32 +29,72 @@ interface GameInfo {
   gameName: string
 }
 
-export const useCommonStore = defineStore('commonStore', () => {
-  // 这里是是为了去初始化selectInfo,当用户第一次进入网站的时候,是没有selectInfo的,所以需要初始化
-  let gid = getLocalInfo('selectInfo', 'gid')
-  gid = gid ? gid : '1001'
-  let pf = getLocalInfo('selectInfo', 'pf')
-  if (pf.length > 1) {
-    pf = [pf[0]]
+const defaultPf = ['web']
+const defaultGid = '1001'
+
+/**
+ * @description: 获取selectInfo
+ * @return {SelectInfo} 返回本地gid、pf和时间
+ */
+const getSelectInfo = (): SelectInfo => {
+  let gid = getLocalInfo('selectInfo', 'gid') as string
+  let pf = getLocalInfo('selectInfo', 'pf') as string[]
+  let localStartTime = getLocalInfo('selectInfo', 'startTime') as string
+  let localEndTime = getLocalInfo('selectInfo', 'endTime') as string
+  let newDateRange = createDateRange(7)
+  let startTime = newDateRange[0]
+  let endTime = newDateRange[1]
+
+  gid = gid ? gid : defaultGid
+  pf = pf ? [pf[0]] : defaultPf
+  if (invaildDateRange(localStartTime, localEndTime)) {
+    startTime = new Date(localStartTime)
+    endTime = new Date(localEndTime)
   }
-  pf = pf ? pf : ['wx']
-  const selectInfo = reactive<SelectInfo>({
-    gid: gid as string,
-    pf: pf as string[]
-  })
+  return { pf, gid, startTime, endTime }
+}
+
+/**
+ * @description: 获取多选的pf
+ * @return {{ tempPf: string[] }} 多选pf
+ */
+const getMultipleChioce = (): { tempPf: string[] } => {
+  let tempPf = getLocalInfo('tempMultipleChioce', 'pf') as string[]
+  tempPf = tempPf ? tempPf : defaultPf
+  return { tempPf }
+}
 
+/**
+ * @description: 初始化两种选择器
+ * @param {SelectInfo} selectInfo 单选的选择器
+ * @param {SelectInfo} tempMultipleChioce 多选的选择器
+ * @return {*}
+ */
+const initSelect = (selectInfo: SelectInfo, tempMultipleChioce: MultipleChioce) => {
+  const { gid, pf, startTime, endTime } = getSelectInfo()
+  const { tempPf } = getMultipleChioce()
+  Object.assign(selectInfo, { gid, pf, startTime, endTime })
+  Object.assign(tempMultipleChioce, { gid, pf: tempPf })
   saveLocalInfo('selectInfo', selectInfo)
+  saveLocalInfo('tempMultipleChioce', tempMultipleChioce)
+}
 
-  // 同上
-  let tempPf = getLocalInfo('tempMultipleChioce', 'pf')
-  tempPf = tempPf ? tempPf : [selectInfo.pf[0]]
-  // 临时使用的多选pf,为了不与selectInfo冲突
-  // pf初始化的时候更seleinfo的一致,但是后续的修改不会影响selectInfo
-  const tempMultipleChioce = reactive<SelectInfo>({
-    gid: gid as string,
-    pf: tempPf as string[]
+export const useCommonStore = defineStore('commonStore', () => {
+  // 用于保存当前的gid和pf的选择
+  const selectInfo = reactive<SelectInfo>({
+    gid: defaultGid,
+    pf: defaultPf,
+    startTime: new Date(),
+    endTime: new Date()
   })
-  saveLocalInfo('tempMultipleChioce', tempMultipleChioce)
+
+  // 临时用来保存多选平台,因为目前业务只有部分页面需要多选,后续可能会改为全部多选
+  const tempMultipleChioce = reactive<MultipleChioce>({
+    gid: defaultGid,
+    pf: defaultPf
+  })
+
+  initSelect(selectInfo, tempMultipleChioce)
 
   /**
    * @description: 保存现有的selectInfo
@@ -64,6 +112,22 @@ export const useCommonStore = defineStore('commonStore', () => {
     localStorage.setItem('tempMultipleChioce', JSON.stringify(tempMultipleChioce))
   }
 
+  const changeDateRange = (date: Array<Date>) => {
+    const startTime = date[0]
+    const endTime = date[1]
+
+    selectInfo.startTime = startTime
+    selectInfo.endTime = endTime
+    saveSelectInfo()
+  }
+
   const allGameInfo = reactive<Array<GameInfo>>([])
-  return { selectInfo, allGameInfo, tempMultipleChioce, saveSelectInfo, saveTempMultipleChioce }
+  return {
+    selectInfo,
+    allGameInfo,
+    tempMultipleChioce,
+    saveSelectInfo,
+    saveTempMultipleChioce,
+    changeDateRange
+  }
 })

+ 1 - 4
src/stores/useTable.ts

@@ -2,7 +2,7 @@
  * @Author: fxs bjnsfxs@163.com
  * @Date: 2024-08-22 10:05:10
  * @LastEditors: fxs bjnsfxs@163.com
- * @LastEditTime: 2024-10-11 14:57:48
+ * @LastEditTime: 2024-10-15 11:24:59
  * @FilePath: \Game-Backstage-Management-System\src\stores\useTable.ts
  * @Description:
  *
@@ -11,9 +11,6 @@
 import { reactive } from 'vue'
 import { defineStore } from 'pinia'
 
-// 你可以任意命名 `defineStore()` 的返回值,但最好使用 store 的名字,同时以 `use` 开头且以 `Store` 结尾。
-// (比如 `useUserStore`,`useCartStore`,`useProductStore`)
-// 第一个参数是你的应用中 Store 的唯一 ID。
 interface QueryGameInfo {
   gid: string
   gameName: string

+ 5 - 3
src/utils/axios/axiosInstance.ts

@@ -2,20 +2,22 @@
  * @Author: fxs bjnsfxs@163.com
  * @Date: 2024-08-20 17:18:52
  * @LastEditors: fxs bjnsfxs@163.com
- * @LastEditTime: 2024-10-12 12:15:23
+ * @LastEditTime: 2024-10-15 11:53:42
  * @FilePath: \Game-Backstage-Management-System\src\utils\axios\axiosInstance.ts
  * @Description:
  *
  */
 // 引入axios
-import axios from 'axios'
-import router from '@/router'
+
 import { ElMessage } from 'element-plus'
 import { useRequest } from '@/hooks/useRequest'
 import { MessageType } from '@/types/res'
 import { getToken, refreshToken, setToken, removeAllToeken } from '../token/token'
 import { setLoginState } from '../localStorage/localStorage'
 
+import axios from 'axios'
+import router from '@/router'
+
 const { baseURL } = useRequest()
 
 const errorCodeMsg: {

+ 26 - 1
src/utils/common/index.ts

@@ -2,7 +2,7 @@
  * @Author: fxs bjnsfxs@163.com
  * @Date: 2024-08-26 15:46:42
  * @LastEditors: fxs bjnsfxs@163.com
- * @LastEditTime: 2024-10-12 17:37:45
+ * @LastEditTime: 2024-10-15 10:47:42
  * @FilePath: \Game-Backstage-Management-System\src\utils\common\index.ts
  * @Description:
  *
@@ -104,6 +104,31 @@ export function resetTimeToMidnight(dateTime: Date): string {
 }
 
 /**
+ * @description: 创建一个日期范围
+ * @param {*} day 天数
+ * @return {*}
+ */
+export const createDateRange = (day: number): Array<Date> => {
+  const end = new Date()
+  const start = new Date()
+  start.setTime(start.getTime() - 3600 * 1000 * 24 * day)
+  return [start, end]
+}
+
+/**
+ * @description:  判断日期范围是否有效
+ * @param {string} startTime 开始时间
+ * @param {string} endTime 结束时间
+ * @return {boolean} 返回是否有效
+ */
+export const invaildDateRange = (startTime: string, endTime: string): boolean => {
+  const start = new Date(startTime).getTime()
+  const end = new Date(endTime).getTime()
+  // 判断日期是否有效,`isNaN` 判断生成的时间是否为 "Invalid Date"
+  return !isNaN(start) && !isNaN(end) && start < end
+}
+
+/**
  * @description: 生成一个打包后可以使用的url
  * @param {string} url  传入一个assets文件夹下的文件名
  * @return {*}

+ 13 - 13
src/utils/localStorage/localStorage.ts

@@ -2,17 +2,17 @@
  * @description: 从本地拿数据
  * @param {string} name locastorage的key
  * @param {string} prop 属性名,不传就返回整个对象
- * @return {*}
+ * @return {string | string[]} 本地信息
  */
 const getLocalInfo = (name: string, prop?: string): string | string[] => {
-  let selectInfo = localStorage.getItem(name)
+  let info = localStorage.getItem(name)
   let result = ''
-  if (!selectInfo) return result
-
-  let jsonSelectInfo = JSON.parse(selectInfo)
+  if (info) {
+    let jsonInfo = JSON.parse(info)
 
-  if (prop) result = jsonSelectInfo[prop]
-  else result = jsonSelectInfo
+    if (prop) result = jsonInfo[prop]
+    else result = jsonInfo
+  }
 
   return result
 }
@@ -25,13 +25,13 @@ const getLocalInfo = (name: string, prop?: string): string | string[] => {
  * @return {*}
  */
 const saveLocalInfo = (name: string, value: any, prop?: string) => {
-  let selectInfo = localStorage.getItem(name)
-  if (selectInfo) {
-    let jsonSelectInfo = JSON.parse(selectInfo)
-    if (prop) jsonSelectInfo[prop] = value
-    localStorage.setItem('selectInfo', JSON.stringify(jsonSelectInfo))
+  let info = localStorage.getItem(name)
+  if (info) {
+    let jsonInfo = JSON.parse(info)
+    if (prop) jsonInfo[prop] = value
+    localStorage.setItem(name, JSON.stringify(jsonInfo))
   } else {
-    localStorage.setItem('selectInfo', JSON.stringify(value))
+    localStorage.setItem(name, JSON.stringify(value))
   }
 }
 

+ 2 - 0
src/utils/table/table.ts

@@ -1,6 +1,8 @@
 import { useTableStore } from '@/stores/useTable'
 import { useRequest } from '@/hooks/useRequest'
+
 import axiosInstance from '../axios/axiosInstance'
+
 const { AllApi } = useRequest()
 
 /**

+ 2 - 0
src/utils/token/token.ts

@@ -1,5 +1,7 @@
 import { useRequest } from '@/hooks/useRequest'
+
 import axios from 'axios'
+
 const { AllApi, baseURL } = useRequest()
 
 const TokenKey = 'token' // token的key

+ 3 - 3
src/views/AppManage/BaseInfoView.vue

@@ -1,13 +1,13 @@
 <script setup lang="ts">
-import HeaderCard from '@/components/dataAnalysis/HeaderCard.vue'
-
 import { reactive, onMounted, ref, watch } from 'vue'
 import { initLoadResouce } from '@/utils/resource'
 import { copyText } from '@/utils/common'
-import axiosInstance from '@/utils/axios/axiosInstance'
 import { useRequest } from '@/hooks/useRequest'
 import { useCommonStore } from '@/stores/useCommon'
 
+import axiosInstance from '@/utils/axios/axiosInstance'
+import HeaderCard from '@/components/dataAnalysis/HeaderCard.vue'
+
 const { AllApi } = useRequest()
 const { selectInfo } = useCommonStore()
 

+ 13 - 13
src/views/AppManage/EventDetailsView.vue

@@ -1,23 +1,23 @@
 <script setup lang="ts">
-import Form from '@/components/form/Form.vue'
-import Table from '@/components/Table.vue'
-import Dialog from '@/components/common/Dialog.vue'
-import FileUpload from '@/components/form/FileUpload.vue'
-
 import type { ReqConfig } from '@/types/dataAnalysis'
-import { type FormField, FormFieldType } from '@/types/form'
-import { ElMessageBox, type FormRules } from 'element-plus'
-import type { FormConfig } from '@/types/form'
-import {
-  type TablePaginationSetting,
-  type TableFieldInfo,
-  FieldSpecialEffectType
-} from '@/types/table'
+import type { FormField, FormConfig } from '@/types/form'
+import type { FormRules } from 'element-plus'
 import type { DialogConfig } from '@/types/dialog'
+import type { TablePaginationSetting, TableFieldInfo } from '@/types/table'
+
+import { FormFieldType } from '@/types/form'
+import { ElMessageBox } from 'element-plus'
+import { FieldSpecialEffectType } from '@/types/table'
 import { watch, onUnmounted, reactive, ref } from 'vue'
 import { useRoute } from 'vue-router'
 import { useRequest } from '@/hooks/useRequest'
 import { useCommonStore } from '@/stores/useCommon'
+
+import Form from '@/components/form/Form.vue'
+import Table from '@/components/Table.vue'
+import Dialog from '@/components/common/Dialog.vue'
+import FileUpload from '@/components/form/FileUpload.vue'
+
 import axiosInstance from '@/utils/axios/axiosInstance'
 import router from '@/router'
 

+ 21 - 32
src/views/AppManage/EventManageView.vue

@@ -2,7 +2,7 @@
  * @Author: fxs bjnsfxs@163.com
  * @Date: 2024-09-02 17:57:15
  * @LastEditors: fxs bjnsfxs@163.com
- * @LastEditTime: 2024-10-14 18:35:26
+ * @LastEditTime: 2024-10-15 14:12:21
  * @FilePath: \Game-Backstage-Management-System\src\views\AppManage\EventManageView.vue
  * @Description: 
  * 
@@ -10,20 +10,19 @@
 <script setup lang="ts">
 import type { ResponseInfo } from '@/types/res'
 
-import HeaderCard from '@/components/dataAnalysis/HeaderCard.vue'
-import router from '@/router'
-import FileUpload from '@/components/form/FileUpload.vue'
-import axiosInstance from '@/utils/axios/axiosInstance'
-
 import { ref, reactive, computed } from 'vue'
 import { useRequest } from '@/hooks/useRequest'
 import { useCommonStore } from '@/stores/useCommon'
 import { downLoadData } from '@/utils/table/table'
 import { resetTimeToMidnight } from '@/utils/common'
 import { shouldListenToEvent } from '@/utils/table/table'
-
 import { throttleFunc } from '@/utils/common'
 
+import HeaderCard from '@/components/dataAnalysis/HeaderCard.vue'
+import router from '@/router'
+import FileUpload from '@/components/form/FileUpload.vue'
+import axiosInstance from '@/utils/axios/axiosInstance'
+
 interface uploadEvent {
   id?: number // 更新需要传入id
   gid: string
@@ -118,7 +117,7 @@ const showUploadMsg = (failedCount: number, totalCount: number, name: string): b
 
   let state = true
   let duration = 3000
-  let title = '上传成功'
+  let title = `${name}上传完成`
   let position: 'top-left' | 'top-right' = 'top-left'
   let message: string = `${name}全部上传成功`
   let type: 'success' | 'warning' | 'error' = 'success'
@@ -303,33 +302,23 @@ const throttleStartDownload = throttleFunc(startDownload, 1000)
  * @return {*}
  */
 const createUploadReqFunc = async (url: string, reqParams: any, name: string): Promise<boolean> => {
-  let result: boolean = false
-  try {
-    const res: ResponseInfo = await axiosInstance.post<string, ResponseInfo>(url, reqParams)
-
-    if (res.code !== 0) {
+  return axiosInstance
+    .post<string, ResponseInfo>(url, reqParams)
+    .then((res) => {
+      if (res.code !== 0) throw new Error(res.msg)
+      return res.code === 0
+    })
+    .catch((err) => {
+      console.log(err)
       ElNotification({
-        type: 'warning',
-        title: '事件上传失败',
-        dangerouslyUseHTMLString: true,
-        message: `${name}上传失败.<br/>${res.msg}`,
-        position: 'top-left',
+        type: 'error',
+        title: '上传失败',
+        message: `${name}上传失败,请检查参数`,
+        position: 'top-right',
         duration: 8000
       })
-    }
-
-    result = res.code === 0
-  } catch (err: any) {
-    ElNotification({
-      type: 'error',
-      title: '上传失败',
-      message: `${name}上传失败,请检查参数`,
-      position: 'top-right',
-      duration: 5000
+      return false
     })
-    console.log(err)
-  }
-  return result
 }
 
 /**
@@ -393,7 +382,7 @@ const uploadOpiton = async (uploadOptionsInfo: { [key: string]: Array<UploadOpti
           ElNotification({
             type: 'warning',
             title: `没有对应事件`,
-            message: `没有${item.actionName}事件,为事件添加的选项无效`,
+            message: `没有${item.actionName}事件,为事件添加的选项无效`,
             position: 'top-right',
             duration: 8000
           })

+ 8 - 9
src/views/AppManage/EventMangeTable.vue

@@ -1,19 +1,18 @@
 <script setup lang="ts">
-import Table from '@/components/Table.vue'
-import Dialog from '@/components/common/Dialog.vue'
-import { useRequest } from '@/hooks/useRequest'
-import { useCommonStore } from '@/stores/useCommon'
-
-import type { TablePaginationSetting, TableFieldInfo, QueryInfo, SelectInfo } from '@/types/table'
-import { FieldSpecialEffectType, FilterType } from '@/types/table'
 import type { ReqConfig } from '@/types/dataAnalysis'
 import type { FormRules } from 'element-plus'
-import { type DialogConfig } from '@/types/dialog'
-import { FormFieldType } from '@/types/form'
+import type { DialogConfig } from '@/types/dialog'
+import type { TablePaginationSetting, TableFieldInfo, QueryInfo, SelectInfo } from '@/types/table'
 import type { FormField } from '@/types/form'
 
+import { useRequest } from '@/hooks/useRequest'
+import { useCommonStore } from '@/stores/useCommon'
+import { FieldSpecialEffectType, FilterType } from '@/types/table'
+import { FormFieldType } from '@/types/form'
 import { reactive, ref, watch } from 'vue'
 
+import Table from '@/components/Table.vue'
+import Dialog from '@/components/common/Dialog.vue'
 import router from '@/router'
 
 const { selectInfo } = useCommonStore()

+ 11 - 12
src/views/Home/Analysis/EventAnalysisDetail.vue

@@ -8,17 +8,7 @@
  * 
 -->
 <script setup lang="ts">
-import Table from '@/components/Table.vue'
-import TemporalTrend from '@/components/dataAnalysis/TemporalTrend.vue'
-import { resetTimeToMidnight } from '@/utils/common'
-
-import { computed, reactive, watch } from 'vue'
-import { useRequest } from '@/hooks/useRequest'
-import { useRoute } from 'vue-router'
-import { useAnalysis } from '@/hooks/useAnalysis'
-
-import { useCommonStore } from '@/stores/useCommon'
-
+import type { TablePaginationSetting, TableFieldInfo } from '@/types/table'
 import type {
   ReqConfig,
   ResDataFieldInfo,
@@ -26,7 +16,16 @@ import type {
   TemporalTrendProps,
   TrendTableField
 } from '@/types/dataAnalysis'
-import { type TablePaginationSetting, type TableFieldInfo } from '@/types/table'
+
+import { resetTimeToMidnight } from '@/utils/common'
+import { computed, reactive, watch } from 'vue'
+import { useRequest } from '@/hooks/useRequest'
+import { useRoute } from 'vue-router'
+import { useAnalysis } from '@/hooks/useAnalysis'
+import { useCommonStore } from '@/stores/useCommon'
+
+import Table from '@/components/Table.vue'
+import TemporalTrend from '@/components/dataAnalysis/TemporalTrend.vue'
 import router from '@/router'
 
 const { selectInfo, tempMultipleChioce } = useCommonStore()

+ 3 - 9
src/views/Home/Analysis/EventAnalysisTable.vue

@@ -1,22 +1,16 @@
 <script setup lang="ts">
 import type { ReqConfig } from '@/types/dataAnalysis'
-import {
-  type TablePaginationSetting,
-  type TableFieldInfo,
-  type QueryInfo,
-  FilterType
-} from '@/types/table'
-
-import Table from '@/components/Table.vue'
+import type { TablePaginationSetting, TableFieldInfo, QueryInfo } from '@/types/table'
 
+import { FilterType } from '@/types/table'
 import { reactive, ref } from 'vue'
 import { useRequest } from '@/hooks/useRequest'
 import { useCommonStore } from '@/stores/useCommon'
 import { resetTimeToMidnight } from '@/utils/common'
-
 import { useAnalysis } from '@/hooks/useAnalysis'
 import { usePage } from '@/hooks/usePage'
 
+import Table from '@/components/Table.vue'
 import router from '@/router'
 
 const { updateReqConfig } = useAnalysis()

+ 3 - 2
src/views/Home/Analysis/EventAnalysisView.vue

@@ -2,7 +2,7 @@
  * @Author: fxs bjnsfxs@163.com
  * @Date: 2024-08-27 17:11:23
  * @LastEditors: fxs bjnsfxs@163.com
- * @LastEditTime: 2024-10-10 15:47:48
+ * @LastEditTime: 2024-10-15 11:59:09
  * @FilePath: \Game-Backstage-Management-System\src\views\Home\Analysis\EventAnalysisView.vue
  * @Description: 
  * 
@@ -10,11 +10,12 @@
 <script setup lang="ts">
 import type { HeaderCardProps } from '@/types/dataAnalysis'
 
-import HeaderCard from '@/components/dataAnalysis/HeaderCard.vue'
 import { resetTimeToMidnight } from '@/utils/common'
 import { shouldListenToEvent } from '@/utils/table/table'
 import { reactive, ref } from 'vue'
 
+import HeaderCard from '@/components/dataAnalysis/HeaderCard.vue'
+
 // 顶部ref
 const headerCard = ref()
 

+ 8 - 7
src/views/Home/Analysis/KeepView.vue

@@ -2,25 +2,26 @@
  * @Author: fxs bjnsfxs@163.com
  * @Date: 2024-08-27 17:11:23
  * @LastEditors: fxs bjnsfxs@163.com
- * @LastEditTime: 2024-10-14 15:44:22
+ * @LastEditTime: 2024-10-15 11:59:31
  * @FilePath: \Game-Backstage-Management-System\src\views\Home\Analysis\KeepView.vue
  * @Description: 
  * 
 -->
 <script setup lang="ts">
-import { reactive, ref, toRaw } from 'vue'
-import Table from '@/components/Table.vue'
-import HeaderCard from '@/components/dataAnalysis/HeaderCard.vue'
-import axiosInstance from '@/utils/axios/axiosInstance'
 import type { TablePaginationSetting, TableFieldInfo } from '@/types/table'
-
 import type { ReqConfig, HeaderCardProps } from '@/types/dataAnalysis'
+
+import { reactive, ref, toRaw } from 'vue'
 import { resetTimeToMidnight } from '@/utils/common'
 import { useRequest } from '@/hooks/useRequest'
 import { useCommonStore } from '@/stores/useCommon'
 import { useAnalysis } from '@/hooks/useAnalysis'
-
 import { usePage } from '@/hooks/usePage'
+
+import Table from '@/components/Table.vue'
+import HeaderCard from '@/components/dataAnalysis/HeaderCard.vue'
+import axiosInstance from '@/utils/axios/axiosInstance'
+
 const { watchPageChange } = usePage()
 
 const { updateReqConfig } = useAnalysis()

+ 8 - 6
src/views/Home/Analysis/UserTrendView.vue

@@ -1,18 +1,20 @@
 <script setup lang="ts">
-import HeaderCard from '@/components/dataAnalysis/HeaderCard.vue'
-import Table from '@/components/Table.vue'
-import { reactive, ref, toRaw } from 'vue'
 import type { StaticField, ReqConfig, TemporalTrendInfo } from '@/types/dataAnalysis'
 import type { TablePaginationSetting, TableFieldInfo } from '@/types/table'
 
-import StatisticText from '@/components/dataAnalysis/StatisticText.vue'
-import TemporalTrend from '@/components/dataAnalysis/TemporalTrend.vue'
+import { reactive, ref, toRaw } from 'vue'
 import { useCommonStore } from '@/stores/useCommon'
 import { useRequest } from '@/hooks/useRequest'
 import { useAnalysis } from '@/hooks/useAnalysis'
 import { resetTimeToMidnight } from '@/utils/common'
-import axiosInstance from '@/utils/axios/axiosInstance'
 import { usePage } from '@/hooks/usePage'
+
+import HeaderCard from '@/components/dataAnalysis/HeaderCard.vue'
+import Table from '@/components/Table.vue'
+import StatisticText from '@/components/dataAnalysis/StatisticText.vue'
+import TemporalTrend from '@/components/dataAnalysis/TemporalTrend.vue'
+import axiosInstance from '@/utils/axios/axiosInstance'
+
 const { watchPageChange } = usePage()
 
 const { updateReqConfig } = useAnalysis()

+ 5 - 5
src/views/Home/InfoManage/GameManageView.vue

@@ -1,18 +1,18 @@
 <script setup lang="ts">
-import Dialog from '@/components/common/Dialog.vue'
-import Table from '@/components/Table.vue'
-
 import type { TablePaginationSetting, TableFieldInfo, QueryInfo } from '@/types/table'
-import { FilterType } from '@/types/table'
 import type { FormRules } from 'element-plus'
 import type { DialogConfig } from '@/types/dialog'
 import type { FormField } from '@/types/form'
-import { FormFieldType } from '@/types/form'
 
+import { FormFieldType } from '@/types/form'
+import { FilterType } from '@/types/table'
 import { onMounted, reactive, ref } from 'vue'
 import { useRequest } from '@/hooks/useRequest'
 import { useCommonStore } from '@/stores/useCommon'
 
+import Dialog from '@/components/common/Dialog.vue'
+import Table from '@/components/Table.vue'
+
 const { allGameInfo } = useCommonStore()
 const { AllApi } = useRequest()
 

+ 10 - 19
src/views/Home/InfoManage/PlayerManageView.vue

@@ -1,30 +1,21 @@
 <script setup lang="ts">
-import {
-  type TablePaginationSetting,
-  type QueryInfo,
-  FilterType,
-  type SelectInfo,
-  type TableFieldInfo,
-  FieldSpecialEffectType,
-  ColorType
-} from '@/types/table'
-
-import Dialog from '@/components/common/Dialog.vue'
-import Table from '@/components/Table.vue'
-
-import axiosInstance from '@/utils/axios/axiosInstance'
-
-import { reactive, ref } from 'vue'
-import { ElMessageBox } from 'element-plus'
-
+import type { TablePaginationSetting, QueryInfo, SelectInfo, TableFieldInfo } from '@/types/table'
 import type { FormRules } from 'element-plus'
 import type { FormField } from '@/types/form'
 import type { DialogConfig } from '@/types/dialog'
-import { FormFieldType } from '@/types/form'
 
+import { FilterType, FieldSpecialEffectType, ColorType } from '@/types/table'
+import { reactive, ref } from 'vue'
+import { ElMessageBox } from 'element-plus'
+import { FormFieldType } from '@/types/form'
 import { useRequest } from '@/hooks/useRequest'
 import { useCommonStore } from '@/stores/useCommon'
 import { useAnalysis } from '@/hooks/useAnalysis'
+
+import Dialog from '@/components/common/Dialog.vue'
+import Table from '@/components/Table.vue'
+import axiosInstance from '@/utils/axios/axiosInstance'
+
 const { updateReqConfig } = useAnalysis()
 
 const { AllApi, analysisResCode } = useRequest()

+ 6 - 6
src/views/Home/Overview/OverView.vue

@@ -1,17 +1,17 @@
 <script setup lang="ts">
-import HeaderCard from '@/components/dataAnalysis/HeaderCard.vue'
-import { reactive, ref, toRaw } from 'vue'
 import type { StaticField, ReqConfig, TemporalTrendInfo } from '@/types/dataAnalysis'
 
-import StatisticText from '@/components/dataAnalysis/StatisticText.vue'
-import TemporalTrend from '@/components/dataAnalysis/TemporalTrend.vue'
+import { reactive, ref, toRaw } from 'vue'
 import { useCommonStore } from '@/stores/useCommon'
 import { useRequest } from '@/hooks/useRequest'
 import { useAnalysis } from '@/hooks/useAnalysis'
-
 import { usePage } from '@/hooks/usePage'
-const { watchPageChange } = usePage()
 
+import StatisticText from '@/components/dataAnalysis/StatisticText.vue'
+import TemporalTrend from '@/components/dataAnalysis/TemporalTrend.vue'
+import HeaderCard from '@/components/dataAnalysis/HeaderCard.vue'
+
+const { watchPageChange } = usePage()
 const { updateReqConfig } = useAnalysis()
 const { AllApi } = useRequest()
 const { selectInfo } = useCommonStore()

+ 8 - 5
src/views/Index.vue

@@ -2,28 +2,32 @@
  * @Author: fxs bjnsfxs@163.com
  * @Date: 2024-08-20 14:06:49
  * @LastEditors: fxs bjnsfxs@163.com
- * @LastEditTime: 2024-10-14 15:57:06
+ * @LastEditTime: 2024-10-15 12:02:38
  * @FilePath: \Game-Backstage-Management-System\src\views\Index.vue
  * @Description: 
  * 
 -->
 <script setup lang="ts">
+import type { DropDownInfo } from '@/types/dataAnalysis'
+
 import { zhCn } from 'element-plus/es/locales.mjs'
 import { RouterView } from 'vue-router'
 import { onMounted, reactive, ref, computed, watch } from 'vue'
 import { useRoute } from 'vue-router'
 import { ElMessage } from 'element-plus'
 import { getAllGameInfo } from '@/utils/table/table'
-import router from '@/router'
-import type { DropDownInfo } from '@/types/dataAnalysis'
-import DropDownSelection from '@/components/dataAnalysis/DropDownSelection.vue'
+
 import { useCommonStore } from '@/stores/useCommon'
 import { initLoadResouce } from '@/utils/resource'
 import { setLoginState } from '@/utils/localStorage/localStorage'
 import { removeAllToeken } from '@/utils/token/token'
 
+import router from '@/router'
+import DropDownSelection from '@/components/dataAnalysis/DropDownSelection.vue'
+
 const route = useRoute()
 const { selectInfo, allGameInfo, saveSelectInfo } = useCommonStore()
+
 const isCollapse = ref(false)
 const navBarSelect = ref<string>('Home')
 const siderBarOpened = ref<Array<string>>(['数据总览'])
@@ -230,7 +234,6 @@ onMounted(() => {
   initLoadResouce(resourceInfo).then((data) => {
     Object.assign(blobUrlInfo, data)
   })
-  throw new Error('aaa')
 })
 </script>
 

+ 6 - 4
src/views/Login/LoginView.vue

@@ -1,14 +1,16 @@
 <script setup lang="ts">
-import { onMounted, reactive, ref } from 'vue'
 import type { RuleInfo } from '@/types/input'
+
+import { onMounted, reactive, ref } from 'vue'
 import { useRequest } from '@/hooks/useRequest'
+import { initLoadResouce } from '@/utils/resource'
+import { setToken, setRefreshToken } from '@/utils/token/token'
+import { setLoginState } from '@/utils/localStorage/localStorage'
+
 import router from '@/router'
 import axiosInstance from '@/utils/axios/axiosInstance'
 import MyButton from '@/components/form/MyButton.vue'
 import MyInput from '@/components/form/MyInput.vue'
-import { initLoadResouce } from '@/utils/resource'
-import { setToken, setRefreshToken } from '@/utils/token/token'
-import { setLoginState } from '@/utils/localStorage/localStorage'
 
 const { AllApi, analysisResCode } = useRequest()