aexiaoliou 2 gadi atpakaļ
vecāks
revīzija
bfa5723cb5

+ 0 - 2
h5/package.json

@@ -19,8 +19,6 @@
 		"@element-plus/icons-vue": "^2.1.0",
 		"@wangeditor/editor": "^5.1.23",
 		"@wangeditor/editor-for-vue": "^5.1.12",
-		"ant-design-vue": "^3.2.20",
-		"await-to-js": "^3.0.0",
 		"axios": "^1.4.0",
 		"countup.js": "^2.6.2",
 		"cropperjs": "^1.5.13",

+ 1 - 116
h5/pnpm-lock.yaml

@@ -14,12 +14,6 @@ dependencies:
   '@wangeditor/editor-for-vue':
     specifier: ^5.1.12
     version: 5.1.12(@wangeditor/editor@5.1.23)(vue@3.3.4)
-  ant-design-vue:
-    specifier: ^3.2.20
-    version: 3.2.20(vue@3.3.4)
-  await-to-js:
-    specifier: ^3.0.0
-    version: 3.0.0
   axios:
     specifier: ^1.4.0
     version: 1.4.0
@@ -167,26 +161,6 @@ packages:
       '@jridgewell/trace-mapping': 0.3.18
     dev: true
 
-  /@ant-design/colors@6.0.0:
-    resolution: {integrity: sha512-qAZRvPzfdWHtfameEGP2Qvuf838NhergR35o+EuVyB5XvSA98xod5r4utvi4TJ3ywmevm290g9nsCG5MryrdWQ==}
-    dependencies:
-      '@ctrl/tinycolor': 3.6.0
-    dev: false
-
-  /@ant-design/icons-svg@4.2.1:
-    resolution: {integrity: sha512-EB0iwlKDGpG93hW8f85CTJTs4SvMX7tt5ceupvhALp1IF44SeUFOMhKUOYqpsoYWQKAOuTRDMqn75rEaKDp0Xw==}
-    dev: false
-
-  /@ant-design/icons-vue@6.1.0(vue@3.3.4):
-    resolution: {integrity: sha512-EX6bYm56V+ZrKN7+3MT/ubDkvJ5rK/O2t380WFRflDcVFgsvl3NLH7Wxeau6R8DbrO5jWR6DSTC3B6gYFp77AA==}
-    peerDependencies:
-      vue: '>=3.0.3'
-    dependencies:
-      '@ant-design/colors': 6.0.0
-      '@ant-design/icons-svg': 4.2.1
-      vue: 3.3.4
-    dev: false
-
   /@babel/code-frame@7.22.5:
     resolution: {integrity: sha512-Xmwn266vad+6DAqEB2A6V/CcZVp62BbwVmcOJc2RPuwih1kw02TjQvWVWlcKGbBPd+8/0V5DEkOcizRGYsspYQ==}
     engines: {node: '>=6.9.0'}
@@ -1018,13 +992,6 @@ packages:
       fastq: 1.15.0
     dev: true
 
-  /@simonwep/pickr@1.8.2:
-    resolution: {integrity: sha512-/l5w8BIkrpP6n1xsetx9MWPWlU6OblN5YgZZphxan0Tq4BByTCETL6lyIeY8lagalS2Nbt4F2W034KHLIiunKA==}
-    dependencies:
-      core-js: 3.31.0
-      nanopop: 2.3.0
-    dev: false
-
   /@sxzz/popperjs-es@2.11.7:
     resolution: {integrity: sha512-Ccy0NlLkzr0Ex2FKvh2X+OyERHXJ88XJ1MXtsI9y9fGexlaXaVTPzBCRBwIxFkORuOb+uBqeu+RqnpgYTEZRUQ==}
     dev: false
@@ -1621,32 +1588,6 @@ packages:
       color-convert: 2.0.1
     dev: true
 
-  /ant-design-vue@3.2.20(vue@3.3.4):
-    resolution: {integrity: sha512-YWpMfGaGoRastIXEYfCoJiaRiDHk4chqtYhlKQM5GqPt6NfvrM1Vg2e60yHtjxlZjed91wCMm0rAmyUr7Hwzdg==}
-    engines: {node: '>=12.22.0'}
-    peerDependencies:
-      vue: '>=3.2.0'
-    dependencies:
-      '@ant-design/colors': 6.0.0
-      '@ant-design/icons-vue': 6.1.0(vue@3.3.4)
-      '@babel/runtime': 7.22.5
-      '@ctrl/tinycolor': 3.6.0
-      '@simonwep/pickr': 1.8.2
-      array-tree-filter: 2.1.0
-      async-validator: 4.2.5
-      dayjs: 1.11.8
-      dom-align: 1.12.4
-      dom-scroll-into-view: 2.0.1
-      lodash: 4.17.21
-      lodash-es: 4.17.21
-      resize-observer-polyfill: 1.5.1
-      scroll-into-view-if-needed: 2.2.31
-      shallow-equal: 1.2.1
-      vue: 3.3.4
-      vue-types: 3.0.2(vue@3.3.4)
-      warning: 4.0.3
-    dev: false
-
   /anymatch@3.1.3:
     resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==}
     engines: {node: '>= 8'}
@@ -1659,10 +1600,6 @@ packages:
     resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==}
     dev: true
 
-  /array-tree-filter@2.1.0:
-    resolution: {integrity: sha512-4ROwICNlNw/Hqa9v+rk5h22KjmzB1JGTMVKP2AKJBOCgb0yL0ASf0+YvCcLNNwquOHNX48jkeZIJ3a+oOQqKcw==}
-    dev: false
-
   /array-union@2.1.0:
     resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==}
     engines: {node: '>=8'}
@@ -1676,11 +1613,6 @@ packages:
     resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==}
     dev: false
 
-  /await-to-js@3.0.0:
-    resolution: {integrity: sha512-zJAaP9zxTcvTHRlejau3ZOY4V7SRpiByf3/dxx2uyKxxor19tpmpV2QRsTKikckwhaPmr2dVpxxMr7jOCYVp5g==}
-    engines: {node: '>=6.0.0'}
-    dev: false
-
   /axios@1.4.0:
     resolution: {integrity: sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==}
     dependencies:
@@ -1925,14 +1857,6 @@ packages:
       esutils: 2.0.3
     dev: true
 
-  /dom-align@1.12.4:
-    resolution: {integrity: sha512-R8LUSEay/68zE5c8/3BDxiTEvgb4xZTF0RKmAHfiEVN3klfIpXfi2/QCoiWPccVQ0J/ZGdz9OjzL4uJEP/MRAw==}
-    dev: false
-
-  /dom-scroll-into-view@2.0.1:
-    resolution: {integrity: sha512-bvVTQe1lfaUr1oFzZX80ce9KLDlZ3iU+XGNE/bz9HnGdklTieqsbmsLHe+rT2XWqopvL0PckkYqN7ksmm5pe3w==}
-    dev: false
-
   /dom7@3.0.0:
     resolution: {integrity: sha512-oNlcUdHsC4zb7Msx7JN3K0Nro1dzJ48knvBOnDPKJ2GV9wl1i5vydJZUSyOfrkKFDZEud/jBsTk92S/VGSAe/g==}
     dependencies:
@@ -2510,11 +2434,6 @@ packages:
     engines: {node: '>=8'}
     dev: true
 
-  /is-plain-object@3.0.1:
-    resolution: {integrity: sha512-Xnpx182SBMrr/aBik8y+GuR4U1L9FqMSojwDQwPMmxyC6bvEqly9UBCxhauBF5vNh2gwWJNX6oDV7O+OM4z34g==}
-    engines: {node: '>=0.10.0'}
-    dev: false
-
   /is-plain-object@5.0.0:
     resolution: {integrity: sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==}
     engines: {node: '>=0.10.0'}
@@ -2546,6 +2465,7 @@ packages:
 
   /js-tokens@4.0.0:
     resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}
+    dev: true
 
   /js-yaml@4.1.0:
     resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==}
@@ -2663,13 +2583,6 @@ packages:
   /lodash@4.17.21:
     resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==}
 
-  /loose-envify@1.4.0:
-    resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==}
-    hasBin: true
-    dependencies:
-      js-tokens: 4.0.0
-    dev: false
-
   /lru-cache@5.1.1:
     resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==}
     dependencies:
@@ -2772,10 +2685,6 @@ packages:
     engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
     hasBin: true
 
-  /nanopop@2.3.0:
-    resolution: {integrity: sha512-fzN+T2K7/Ah25XU02MJkPZ5q4Tj5FpjmIYq4rvoHX4yb16HzFdCO6JxFFn5Y/oBhQ8no8fUZavnyIv9/+xkBBw==}
-    dev: false
-
   /natural-compare-lite@1.4.0:
     resolution: {integrity: sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==}
     dev: true
@@ -2991,10 +2900,6 @@ packages:
     resolution: {integrity: sha512-CiD3ZSanZqcMPRhtfct5K9f7i3OLCcBBWsJjLh1gW9RO/nS94sVzY59iS+fgYBOBqaBpf4EzfqUF3j9IG+xo8A==}
     dev: false
 
-  /resize-observer-polyfill@1.5.1:
-    resolution: {integrity: sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg==}
-    dev: false
-
   /resolve-from@4.0.0:
     resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==}
     engines: {node: '>=4'}
@@ -3077,10 +2982,6 @@ packages:
       lru-cache: 6.0.0
     dev: true
 
-  /shallow-equal@1.2.1:
-    resolution: {integrity: sha512-S4vJDjHHMBaiZuT9NPb616CSmLf618jawtv3sufLl6ivK8WocjAo58cXwbRV1cgqxH0Qbv+iUt6m05eqEa2IRA==}
-    dev: false
-
   /shebang-command@2.0.0:
     resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==}
     engines: {node: '>=8'}
@@ -3386,16 +3287,6 @@ packages:
       vue: 3.3.4
     dev: false
 
-  /vue-types@3.0.2(vue@3.3.4):
-    resolution: {integrity: sha512-IwUC0Aq2zwaXqy74h4WCvFCUtoV0iSWr0snWnE9TnU18S66GAQyqQbRf2qfJtUuiFsBf6qp0MEwdonlwznlcrw==}
-    engines: {node: '>=10.15.0'}
-    peerDependencies:
-      vue: ^3.0.0
-    dependencies:
-      is-plain-object: 3.0.1
-      vue: 3.3.4
-    dev: false
-
   /vue-vuecmf-dialog@1.4.8:
     resolution: {integrity: sha512-a2dQfW3mNH7wM7oz2u9Nmsth5JI64YzJ5zU91j/DU3k5oaeDcqolipq/QyyF/jRvKvY3af0FHrgIolER+9USmg==}
     dependencies:
@@ -3417,12 +3308,6 @@ packages:
       '@vue/server-renderer': 3.3.4(vue@3.3.4)
       '@vue/shared': 3.3.4
 
-  /warning@4.0.3:
-    resolution: {integrity: sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w==}
-    dependencies:
-      loose-envify: 1.4.0
-    dev: false
-
   /which@2.0.2:
     resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==}
     engines: {node: '>= 8'}

+ 6 - 8
h5/src/api/role/index.ts

@@ -56,7 +56,7 @@ export interface CodeTree {
  * @returns 角色列表
  */
 export const list = async () => {
-    const res = await Http.get(role.list)
+    const res = await Http.get<Role[]>(role.list)
     return res
 }
 /**
@@ -64,7 +64,7 @@ export const list = async () => {
  * @returns vue ref role
  */
 export const init = async () => {
-    const roles = ref(null)
+    const roles = ref<Role[]>([])
     const res = await list()
     roles.value = res.data
     return roles
@@ -75,7 +75,7 @@ export const init = async () => {
  * @returns 创建后对象
  */
 export const create = async (param: any) => {
-    const res = await Http.post(role.create, param)
+    const res = await Http.post<Role>(role.create, param)
     return res
 }
 /**
@@ -84,9 +84,7 @@ export const create = async (param: any) => {
  * @returns 更新后对象
  */
 export const update = async (param: any) => {
-    console.log("🚀 ~ file: index.ts:89 ~ update ~ role:", role)
-    const res = await Http.post(role.update, param)
-    console.log("🚀 ~ file: index.ts:90 ~ update ~ role:", role)
+    const res = await Http.post<Role>(role.update, param)
     return res
 }
 /**
@@ -95,11 +93,11 @@ export const update = async (param: any) => {
  * @returns res
  */
 export const del = async (id: number[]) => {
-    const res = await Http.post(role.del, { id })
+    const res = await Http.post<Role>(role.del, { id })
     return res
 }
 
 export const codes = async () => {
-    const res = await Http.get(role.codes)
+    const res = await Http.get<CodeTree[]>(role.codes)
     return res
 }

+ 6 - 6
h5/src/components/role/codes.vue

@@ -15,9 +15,11 @@
 <script setup lang="ts">
 import { update, codes as getCodes } from '/@/api/role'
 import type { Role } from '/@/api/role'
-import { ref, onMounted } from 'vue'
+import { ref, onMounted, inject } from 'vue';
 import { ElMessage } from 'element-plus'
-import { throttle } from 'lodash';
+import { throttle } from 'lodash'
+import { codes as symbolCode } from '/@/types/di';
+import { CodeTree } from '/@/api/role';
 
 const { modelValue, role } = defineProps<{
     modelValue: boolean,
@@ -29,7 +31,7 @@ const emit = defineEmits<{
     (e: 'submit', result: any): void
 }>()
 
-const codes = ref()
+const codes = ref<CodeTree[]>([])
 
 const tree = ref()
 
@@ -42,17 +44,15 @@ const treeProps = {
 }
 
 onMounted(async () => {
-    codes.value = (await getCodes()).data
+    codes.value = await inject(symbolCode, () => getCodes().then(res => res.data))
 })
 
 const submitForm = throttle(async () => {
     const checkedCodes = tree.value?.getCheckedNodes(true).map(node => node.lable)
     const checkedKeys = tree.value?.getCheckedKeys()
 
-    console.log("🚀 ~ file: codes.vue:50 ~ submitForm ~ role:", role)
     role.codes = checkedKeys
     role.codes_cn = checkedCodes
-    console.log("🚀 ~ file: codes.vue:52 ~ submitForm ~ role:", role)
 
     submitLoading.value = true
     const result = await update(role)

+ 4 - 0
h5/src/types/di/index.ts

@@ -0,0 +1,4 @@
+import type { InjectionKey } from 'vue'
+import type { CodeTree } from '/@/api/role';
+
+export const codes = Symbol() as InjectionKey<Promise<CodeTree[]>>

+ 0 - 3
h5/src/types/global.d.ts

@@ -69,9 +69,6 @@ declare interface RouteToFrom<T = any> extends RouteItem {
 // 声明路由当前项类型集合
 declare type RouteItems<T extends RouteItem = any> = T[];
 
-// 声明 ref
-declare type RefType<T = any> = T | null;
-
 // 声明 HTMLElement
 declare type HtmlType = HTMLElement | string | undefined | null;
 

+ 28 - 20
h5/src/utils/net/Http.ts

@@ -1,5 +1,3 @@
-// 不知道这是个什么鬼玩意,也无法理解为什么要用这个东西,但是既然用了就用了,懒得改了
-import to from 'await-to-js'
 import request from '../request'
 import { Session } from '/@/utils/storage'
 import { AxiosRequestConfig, AxiosResponse } from 'axios'
@@ -21,23 +19,22 @@ const Http = {
     /**
      * 二次封装axios的Post请求
      * @param url 接口url
-     * @param param post data
+     * @param body post data
      * @param axiosConfig axios config
      * @param checkResConfig 检查返回值的设置
+     * @template T 接口数据类型(Result里面的那个)
      * @returns 接口数据
      */
-    async post<
-        T = any
-    >(
+    async post<T = any>(
         url: string,
-        param: any,
+        body: any,
         axiosConfig: AxiosRequestConfig = {},
         checkResConfig: CheckResponseConfig = { useNotZeroCodeCheck: true, msgType: 'box' }
     ) {
         axiosConfig.headers = { ...axiosConfig.headers, token: Session.get('token') }
 
         // 检查http错误
-        let result = await request.post<any, Result<T>>(url, param, axiosConfig)
+        let result = await request.post<any, Result<T>>(url, body, axiosConfig)
             .catch((err) => {
                 return { code: 999, data: err, msg: '请求失败' }
             })
@@ -50,15 +47,26 @@ const Http = {
         }
         return result
     },
-    async get<T = any>(url: string, param: any = {}, checkResConfig: CheckResponseConfig = { useNotZeroCodeCheck: true, msgType: 'box' }) {
-
-        let [err, result] = await to(request.get(url, { params: this.combineData(param) }))
+    /**
+     * 二次封装get请求
+     * @param url 请求url
+     * @param param queryParams
+     * @param checkResConfig 参数检查参数
+     * @template T 接口数据类型(Result里面的那个)
+     * @returns 接口数据
+     */
+    async get<T = any>(
+        url: string,
+        param: any = {},
+        axiosConfig: AxiosRequestConfig = {},
+        checkResConfig: CheckResponseConfig = { useNotZeroCodeCheck: true, msgType: 'box' }
+    ) {
+        axiosConfig.headers = { ...axiosConfig.headers, token: Session.get('token') }
 
-        // 检查http错误
-        if (err) {
-            console.log('err', err)
-            return { code: 999, data: err, msg: '请求失败' }
-        }
+        let result = await request.get<any, Result<T>>(url, { params: param, ...axiosConfig })
+            .catch((err) => {
+                return { code: 999, data: err, msg: '请求失败' }
+            })
 
         // 检查业务错误
         if (checkResConfig.useNotZeroCodeCheck && result?.code != 0) {
@@ -66,12 +74,12 @@ const Http = {
                 message: result?.msg,
             })
         }
-        return result as AxiosResponse<Result<T>>
+        return result
     },
+    /**
+     * 合并token
+     */
     combineData(param: any = {}): any {
-        // 在请求发送之前做一些处理
-        // 让每个请求携带token-- ['X-Token']为自定义key 请根据实际情况自行修改
-        // config.headers['X-Token'] = token;
         if (Session.get('token')) {
             param.token = `${Session.get('token')}`
         }

+ 11 - 2
h5/src/views/admin/role/index.vue

@@ -25,11 +25,12 @@
 </template>
 
 <script lang="tsx" setup>
-import { ref, defineComponent } from 'vue'
+import { ref, defineComponent, provide } from 'vue'
 import { ElTag, ElMessage, ElButton, ElPopconfirm, TableV2FixedDir } from 'element-plus'
 import type { Column } from 'element-plus'
 import { clone, throttle } from 'lodash'
-import { init, list, update, newRole } from '/@/api/role'
+import { init, list, update, newRole, codes } from '/@/api/role'
+import { codes as symbolCodes } from '/@/types/di'
 import type { Role } from '/@/api/role'
 import Codes from '/@/components/role/codes.vue'
 import Edit from '/@/components/role/edit.vue'
@@ -63,6 +64,14 @@ const editRole = ref<Role>(newRole())
  */
 const editType = ref<'update' | 'create'>('update')
 
+/*
+ * DI
+ */
+/**
+ * 子组件数据
+ */
+provide(symbolCodes, codes().then(res => res.data))
+
 /**
  * 虚拟表格列信息
  */

+ 0 - 107
h5/src/views/admin/role/role.ts

@@ -1,107 +0,0 @@
-const Data = {
-    role_list: [
-		{
-			id: 1,
-			label: '系统管理',
-			children: [
-				{
-					id: 11,
-					label: '菜单管理',
-					children: [
-						{
-							id: 111,
-							label: '菜单新增',
-						},
-						{
-							id: 112,
-							label: '菜单修改',
-						},
-						{
-							id: 113,
-							label: '菜单删除',
-						},
-						{
-							id: 114,
-							label: '菜单查询',
-						},
-					],
-				},
-				{
-					id: 12,
-					label: '角色管理',
-					children: [
-						{
-							id: 121,
-							label: '角色新增',
-						},
-						{
-							id: 122,
-							label: '角色修改',
-						},
-						{
-							id: 123,
-							label: '角色删除',
-						},
-						{
-							id: 124,
-							label: '角色查询',
-						},
-					],
-				},
-				{
-					id: 13,
-					label: '用户管理',
-					children: [
-						{
-							id: 131,
-							label: '用户新增',
-						},
-						{
-							id: 132,
-							label: '用户修改',
-						},
-						{
-							id: 133,
-							label: '用户删除',
-						},
-						{
-							id: 134,
-							label: '用户查询',
-						},
-					],
-				},
-			],
-		},
-		{
-			id: 2,
-			label: '权限管理',
-			children: [
-				{
-					id: 21,
-					label: '前端控制',
-					children: [
-						{
-							id: 211,
-							label: '页面权限',
-						},
-						{
-							id: 212,
-							label: '页面权限',
-						},
-					],
-				},
-				{
-					id: 22,
-					label: '后端控制',
-					children: [
-						{
-							id: 221,
-							label: '页面权限',
-						},
-					],
-				},
-			],
-		},
-	],
-}
-export default Data;

+ 225 - 230
h5/src/views/login/component/account.vue

@@ -1,272 +1,267 @@
 <template>
-	<el-form size="large" class="login-content-form">
-		<el-form-item class="login-animation1">
-			<el-input text :placeholder="$t('message.account.accountPlaceholder1')" v-model="state.ruleForm.phone" clearable autocomplete="off">
-				<template #prefix>
-					<el-icon class="el-input__icon"><ele-User /></el-icon>
-				</template>
-			</el-input>
-		</el-form-item>
-		<el-form-item class="login-animation2">
-			<el-input
-				:type="state.isShowPassword ? 'text' : 'password'"
-				:placeholder="$t('message.account.accountPlaceholder2')"
-				v-model="state.ruleForm.password"
-				autocomplete="off"
-			>
-				<template #prefix>
-					<el-icon class="el-input__icon"><ele-Unlock /></el-icon>
-				</template>
-				<template #suffix>
-					<i
-						class="iconfont el-input__icon login-content-password"
-						:class="state.isShowPassword ? 'icon-yincangmima' : 'icon-xianshimima'"
-						@click="state.isShowPassword = !state.isShowPassword"
-					>
-					</i>
-				</template>
-			</el-input>
-		</el-form-item>
-		<el-form-item class="login-animation3">
-			<el-col :span="15">
-				<el-input
-					text
-					maxlength="4"
-					:placeholder="$t('message.account.accountPlaceholder3')"
-					v-model="state.ruleForm.code"
-					clearable
-					autocomplete="off"
-					@keyup.enter="onSignInThor"
-				>
-					<template #prefix>
-						<el-icon class="el-input__icon"><ele-Position /></el-icon>
-					</template>
-				</el-input>
-			</el-col>
-			<el-col :span="1"></el-col>
-			<el-col :span="8">
-				<el-button class="login-content-code" v-waves @click="flushCode()">{{ state.codeNum }}</el-button>
-			</el-col>
-		</el-form-item>
+    <el-form size="large" class="login-content-form">
+        <el-form-item class="login-animation1">
+            <el-input text :placeholder="$t('message.account.accountPlaceholder1')" v-model="state.ruleForm.phone" clearable
+                autocomplete="off">
+                <template #prefix>
+                    <el-icon class="el-input__icon"><ele-User /></el-icon>
+                </template>
+            </el-input>
+        </el-form-item>
+        <el-form-item class="login-animation2">
+            <el-input :type="state.isShowPassword ? 'text' : 'password'"
+                :placeholder="$t('message.account.accountPlaceholder2')" v-model="state.ruleForm.password"
+                autocomplete="off">
+                <template #prefix>
+                    <el-icon class="el-input__icon"><ele-Unlock /></el-icon>
+                </template>
+                <template #suffix>
+                    <i class="iconfont el-input__icon login-content-password"
+                        :class="state.isShowPassword ? 'icon-yincangmima' : 'icon-xianshimima'"
+                        @click="state.isShowPassword = !state.isShowPassword">
+                    </i>
+                </template>
+            </el-input>
+        </el-form-item>
+        <el-form-item class="login-animation3">
+            <el-col :span="15">
+                <el-input text maxlength="4" :placeholder="$t('message.account.accountPlaceholder3')"
+                    v-model="state.ruleForm.code" clearable autocomplete="off" @keyup.enter="signInThor">
+                    <template #prefix>
+                        <el-icon class="el-input__icon"><ele-Position /></el-icon>
+                    </template>
+                </el-input>
+            </el-col>
+            <el-col :span="1"></el-col>
+            <el-col :span="8">
+                <el-button class="login-content-code" v-waves @click="flushCode()">{{ state.codeNum }}</el-button>
+            </el-col>
+        </el-form-item>
 
-		<!-- 记住账号和密码 -->
-		<view class="checked-box">
-			<el-checkbox v-model="state.checked1" label="记住账号和密码" size="large" />
-		</view>
+        <!-- 记住账号和密码 -->
+        <view class="checked-box">
+            <el-checkbox v-model="state.checked1" label="记住账号和密码" size="large" />
+        </view>
 
-		<el-form-item class="login-animation4">
-			<el-button type="primary" class="login-content-submit" round v-waves @click="onSignInThor" :loading="state.loading.signIn">
-				<span>{{ $t('message.account.accountBtnText') }}</span>
-			</el-button>
-		</el-form-item>
-	</el-form>
+        <el-form-item class="login-animation4">
+            <el-button type="primary" class="login-content-submit" round v-waves @click="signInThor"
+                :loading="state.loading.signIn">
+                <span>{{ $t('message.account.accountBtnText') }}</span>
+            </el-button>
+        </el-form-item>
+    </el-form>
 </template>
 
 <script setup lang="ts" name="loginAccount">
-import { reactive, computed, onMounted, watch } from 'vue';
-import { useRoute, useRouter } from 'vue-router';
-import { ElMessage } from 'element-plus';
-import { useI18n } from 'vue-i18n';
-import Cookies from 'js-cookie';
-import { storeToRefs } from 'pinia';
-import { useThemeConfig } from '/@/stores/themeConfig';
-import { initFrontEndControlRoutes } from '/@/router/frontEnd';
-import { initBackEndControlRoutes } from '/@/router/backEnd';
-import { Session } from '/@/utils/storage';
-import { formatAxis } from '/@/utils/formatTime';
-import { NextLoading } from '/@/utils/loading';
-import Login from '/@/api/login/login';
-import { debounce, throttle } from 'lodash';
-// import { setBackEndControlRefreshRoutes } from "/@/router/backEnd";
+import { reactive, computed, onMounted, watch, provide } from 'vue';
+import { useRoute, useRouter } from 'vue-router'
+import { ElMessage } from 'element-plus'
+import { useI18n } from 'vue-i18n'
+import Cookies from 'js-cookie'
+import { storeToRefs } from 'pinia'
+import { useThemeConfig } from '/@/stores/themeConfig'
+import { initFrontEndControlRoutes } from '/@/router/frontEnd'
+import { initBackEndControlRoutes } from '/@/router/backEnd'
+import { Session } from '/@/utils/storage'
+import { formatAxis } from '/@/utils/formatTime'
+import { NextLoading } from '/@/utils/loading'
+import Login from '/@/api/login/login'
+import { throttle } from 'lodash'
 
 // 定义变量内容
-const { t } = useI18n();
-const storesThemeConfig = useThemeConfig();
-const { themeConfig } = storeToRefs(storesThemeConfig);
-const route = useRoute();
-const router = useRouter();
+const { t } = useI18n()
+const storesThemeConfig = useThemeConfig()
+const { themeConfig } = storeToRefs(storesThemeConfig)
+const route = useRoute()
+const router = useRouter()
 const state = reactive({
-	isShowPassword: false,
-	ruleForm: {
-		phone: '',
-		password: '',
-		code: '',
-	},
-	codeNum: '',
-	loading: {
-		signIn: false,
-	},
-	checked1: false,
-});
+    isShowPassword: false,
+    ruleForm: {
+        phone: '',
+        password: '',
+        code: '',
+    },
+    codeNum: '',
+    loading: {
+        signIn: false,
+    },
+    checked1: false,
+})
 
 // 读取缓存
-let user_name = localStorage.getItem('user_name');
-let pass_word = localStorage.getItem('pass_word');
+let user_name = localStorage.getItem('user_name')
+let pass_word = localStorage.getItem('pass_word')
 if (user_name) {
-	state.ruleForm.phone = user_name;
-	state.checked1 = true;
-	console.log('state.checked1', state.checked1);
+    state.ruleForm.phone = user_name
+    state.checked1 = true
+    console.log('state.checked1', state.checked1)
 }
 if (pass_word) {
-	state.ruleForm.password = pass_word;
+    state.ruleForm.password = pass_word
 }
 // 监视是否勾选记住账号和密码
 watch(
-	() => state.checked1,
-	(newValue, oldValue) => {
-		console.log(newValue, oldValue);
-		// 清除缓存
-		if (newValue == false) {
-			let user_name = localStorage.getItem('user_name');
-			let pass_word = localStorage.getItem('pass_word');
-			if (user_name) {
-				localStorage.removeItem('user_name');
-			}
-			if (pass_word) {
-				localStorage.removeItem('pass_word');
-			}
-		}
-		if (newValue == true) {
-			localStorage.setItem('user_name', state.ruleForm.phone);
-			localStorage.setItem('pass_word', state.ruleForm.password);
-		}
-	}
-);
+    () => state.checked1,
+    (newValue, oldValue) => {
+        console.log(newValue, oldValue)
+        // 清除缓存
+        if (newValue == false) {
+            let user_name = localStorage.getItem('user_name')
+            let pass_word = localStorage.getItem('pass_word')
+            if (user_name) {
+                localStorage.removeItem('user_name')
+            }
+            if (pass_word) {
+                localStorage.removeItem('pass_word')
+            }
+        }
+        if (newValue == true) {
+            localStorage.setItem('user_name', state.ruleForm.phone)
+            localStorage.setItem('pass_word', state.ruleForm.password)
+        }
+    }
+)
 
 onMounted(() => {
-	flushCode();
-});
+    flushCode()
+})
 
+/**
+ * 刷新验证码
+ */
 const flushCode = () => {
-	state.codeNum = '';
-	for (let i = 0; i < 4; i++) {
-		state.codeNum += Number(9 * Math.random()).toFixed(0);
-	}
-	console.log(state.codeNum);
-};
+    state.codeNum = ''
+    for (let i = 0; i < 4; i++) {
+        state.codeNum += Number(9 * Math.random()).toFixed(0)
+    }
+    console.log(state.codeNum)
+}
 
-// 时间获取
+/** 
+* 时间获取
+*/
 const currentTime = computed(() => {
-	return formatAxis(new Date());
-});
+    return formatAxis(new Date())
+})
 
 /**
  * 登录
  */
-const onSignIn = async () => {
-	if (state.ruleForm.code != state.codeNum) {
-		return ElMessage.error('验证码不正确');
-	}
-	let res = await Login.login(state.ruleForm);
-	if (res.code != 0) {
-		return;
-	}
-	/* if (res.data.is_pass !== 1 && res.data.is_root !== 1) {
-		Session.clear();
-		return ElMessage.warning('抱歉,您的账号未审核通过,请联系管理员');
-	} */
-	state.loading.signIn = true;
-	Session.set('userInfo', res.data);
+const signIn = async () => {
+    if (state.ruleForm.code != state.codeNum) {
+        return ElMessage.error('验证码不正确')
+    }
+    let res = await Login.login(state.ruleForm)
+    if (res.code != 0) {
+        return
+    }
+    state.loading.signIn = true
+    Session.set('userInfo', res.data)
+
+    // 设置缓存记住账号和密码
+    if (state.checked1 == true) {
+        localStorage.setItem('user_name', state.ruleForm.phone)
+        localStorage.setItem('pass_word', state.ruleForm.password)
+    }
 
-	// 设置缓存记住账号和密码
-	if (state.checked1 == true) {
-		localStorage.setItem('user_name', state.ruleForm.phone);
-		localStorage.setItem('pass_word', state.ruleForm.password);
-	}
+    // 存储 token 到浏览器缓存
+    Session.set('token', res.data.token)
 
-	// 存储 token 到浏览器缓存
-	// Session.set('token', Math.random().toString(36).substr(0));
-	Session.set('token', res.data.token);
+    Cookies.set('userName', res.data.name)
 
-	// 模拟数据,对接接口时,记得删除多余代码及对应依赖的引入。用于 `/src/stores/userInfo.ts` 中不同用户登录判断(模拟数据)
-	// Cookies.set('userName', state.ruleForm.phone);
-	Cookies.set('userName', res.data.name);
+    let isNoPower: boolean | undefined = false
+    if (!themeConfig.value.isRequestRoutes) {
+        console.log('前端控制路由')
+        // 前端控制路由,2、请注意执行顺序
+        isNoPower = await initFrontEndControlRoutes()
+    } else {
+        console.log('后端控制路由')
+        // 模拟后端控制路由,isRequestRoutes 为 true,则开启后端控制路由
+        // 添加完动态路由,再进行 router 跳转,否则可能报错 No match found for location with path "/"
+        isNoPower = await initBackEndControlRoutes()
+        // 执行完 initBackEndControlRoutes,再执行 signInSuccess
+    }
+    signInRedirct(isNoPower)
+}
 
-	if (!themeConfig.value.isRequestRoutes) {
-		console.log('前端控制路由');
-		// 前端控制路由,2、请注意执行顺序
-		const isNoPower = await initFrontEndControlRoutes();
-		signInSuccess(isNoPower);
-	} else {
-		console.log('后端控制路由');
-		// 模拟后端控制路由,isRequestRoutes 为 true,则开启后端控制路由
-		// 添加完动态路由,再进行 router 跳转,否则可能报错 No match found for location with path "/"
-		const isNoPower = await initBackEndControlRoutes();
-		// 执行完 initBackEndControlRoutes,再执行 signInSuccess
-		signInSuccess(isNoPower);
-	}
-};
 /**
  * 防抖登录
  */
-const onSignInThor = throttle(onSignIn,1000)
-// 登录成功后的跳转
-const signInSuccess = (isNoPower: boolean | undefined) => {
-	if (isNoPower) {
-		console.log('lzj500🚀 ~ file: account.vue:198 ~ signInSuccess ~ isNoPower:', isNoPower);
-		ElMessage.warning('抱歉,您没有登录权限');
-		Session.clear();
-	} else {
-		// 初始化登录成功时间问候语
-		let currentTimeInfo = currentTime.value;
-		// 登录成功,跳到转首页
-		// 如果是复制粘贴的路径,非首页/登录页,那么登录成功后重定向到对应的路径中
-		if (route.query?.redirect) {
-			router.push({
-				path: <string>route.query?.redirect,
-				query: Object.keys(<string>route.query?.params).length > 0 ? JSON.parse(<string>route.query?.params) : '',
-			});
-		} else {
-			router.push('/');
-		}
-		// 登录成功提示
-		const signInText = t('message.signInText');
-		ElMessage.success(`${currentTimeInfo},${signInText}`);
-		// 添加 loading,防止第一次进入界面时出现短暂空白
-		NextLoading.start();
-	}
-	state.loading.signIn = false;
-	// setTimeout(()=>{
-	// 	setBackEndControlRefreshRoutes() // 刷新菜单,未进行后端接口测试
-	// },500)
-};
+const signInThor = throttle(signIn, 1000)
+
+/**
+ * 登录成功调转
+ * @param isNoPower 
+ */
+const signInRedirct = (isNoPower: boolean | undefined) => {
+    if (isNoPower) {
+        console.log('lzj500🚀 ~ file: account.vue:198 ~ signInSuccess ~ isNoPower:', isNoPower)
+        ElMessage.warning('抱歉,您没有登录权限')
+        Session.clear()
+    } else {
+        // 初始化登录成功时间问候语
+        let currentTimeInfo = currentTime.value
+        // 登录成功,跳到转首页
+        // 如果是复制粘贴的路径,非首页/登录页,那么登录成功后重定向到对应的路径中
+        if (route.query?.redirect) {
+            router.push({
+                path: <string>route.query?.redirect,
+                query: Object.keys(<string>route.query?.params).length > 0 ? JSON.parse(<string>route.query?.params) : '',
+            })
+        } else {
+            router.push('/')
+        }
+        // 登录成功提示
+        const signInText = t('message.signInText')
+        ElMessage.success(`${currentTimeInfo},${signInText}`)
+        // 添加 loading,防止第一次进入界面时出现短暂空白
+        NextLoading.start()
+    }
+    state.loading.signIn = false
+}
 </script>
 
 <style scoped lang="scss">
 .checked-box {
-	position: absolute;
-	margin-top: -25px;
+    position: absolute;
+    margin-top: -25px;
 }
+
 .login-content-form {
-	margin-top: 20px;
-	@for $i from 1 through 4 {
-		.login-animation#{$i} {
-			opacity: 0;
-			animation-name: error-num;
-			animation-duration: 0.5s;
-			animation-fill-mode: forwards;
-			animation-delay: calc($i/10) + s;
-		}
-	}
-	.login-content-password {
-		display: inline-block;
-		width: 20px;
-		cursor: pointer;
-		&:hover {
-			color: #909399;
-		}
-	}
-	.login-content-code {
-		width: 100%;
-		padding: 0;
-		font-weight: bold;
-		letter-spacing: 5px;
-	}
-	.login-content-submit {
-		width: 100%;
-		letter-spacing: 2px;
-		font-weight: 300;
-		margin-top: 15px;
-	}
+    margin-top: 20px;
+
+    @for $i from 1 through 4 {
+        .login-animation#{$i} {
+            opacity: 0;
+            animation-name: error-num;
+            animation-duration: 0.5s;
+            animation-fill-mode: forwards;
+            animation-delay: calc($i/10) + s;
+        }
+    }
+
+    .login-content-password {
+        display: inline-block;
+        width: 20px;
+        cursor: pointer;
+
+        &:hover {
+            color: #909399;
+        }
+    }
+
+    .login-content-code {
+        width: 100%;
+        padding: 0;
+        font-weight: bold;
+        letter-spacing: 5px;
+    }
+
+    .login-content-submit {
+        width: 100%;
+        letter-spacing: 2px;
+        font-weight: 300;
+        margin-top: 15px;
+    }
 }
 </style>