Showing
19 changed files
with
248 additions
and
218 deletions
| 1 | # Proxy | 1 | # Proxy |
| 2 | VITE_GLOB_PROXY = [["/api", "http://222.180.200.114:48080/api"]] | 2 | VITE_GLOB_PROXY = [["/api", "http://222.180.200.114:48080/api"]] |
| 3 | 3 | ||
| 4 | +# Api prefix | ||
| 5 | +VITE_GLOB_API_URL = /api | ||
| 6 | + | ||
| 7 | +# | ||
| 8 | +VITE_GLOB_API_URL_PREFIX = /yt | ||
| 9 | + | ||
| 4 | # 内容安全协议 | 10 | # 内容安全协议 |
| 5 | VITE_GLOB_CONTENT_SECURITY_POLICY = false | 11 | VITE_GLOB_CONTENT_SECURITY_POLICY = false |
| 1 | # Proxy | 1 | # Proxy |
| 2 | VITE_GLOB_PROXY = [["/api", "http://222.180.200.114:48080/api"]] | 2 | VITE_GLOB_PROXY = [["/api", "http://222.180.200.114:48080/api"]] |
| 3 | 3 | ||
| 4 | +# Api prefix | ||
| 5 | +VITE_GLOB_API_URL = /api | ||
| 6 | + | ||
| 7 | +VITE_GLOB_API_URL_PREFIX = /yt | ||
| 8 | + | ||
| 4 | # 内容安全协议 | 9 | # 内容安全协议 |
| 5 | VITE_GLOB_CONTENT_SECURITY_POLICY = true | 10 | VITE_GLOB_CONTENT_SECURITY_POLICY = true |
| @@ -2,22 +2,27 @@ module.exports = { | @@ -2,22 +2,27 @@ module.exports = { | ||
| 2 | root: true, | 2 | root: true, |
| 3 | parser: 'vue-eslint-parser', | 3 | parser: 'vue-eslint-parser', |
| 4 | globals: { | 4 | globals: { |
| 5 | - postMessage: true | 5 | + postMessage: true, |
| 6 | }, | 6 | }, |
| 7 | parserOptions: { | 7 | parserOptions: { |
| 8 | parser: '@typescript-eslint/parser', | 8 | parser: '@typescript-eslint/parser', |
| 9 | sourceType: 'module', | 9 | sourceType: 'module', |
| 10 | ecmaFeatures: { | 10 | ecmaFeatures: { |
| 11 | jsx: true, | 11 | jsx: true, |
| 12 | - tsx: true | ||
| 13 | - } | 12 | + tsx: true, |
| 13 | + }, | ||
| 14 | }, | 14 | }, |
| 15 | env: { | 15 | env: { |
| 16 | - node: true, | 16 | + 'node': true, |
| 17 | // The Follow config only works with eslint-plugin-vue v8.0.0+ | 17 | // The Follow config only works with eslint-plugin-vue v8.0.0+ |
| 18 | - 'vue/setup-compiler-macros': true | 18 | + 'vue/setup-compiler-macros': true, |
| 19 | }, | 19 | }, |
| 20 | - extends: ['plugin:vue/vue3-essential', 'eslint:recommended'], | 20 | + extends: [ |
| 21 | + 'plugin:vue/vue3-essential', | ||
| 22 | + 'eslint:recommended', | ||
| 23 | + 'plugin:import/typescript', | ||
| 24 | + 'plugin:@typescript-eslint/recommended', | ||
| 25 | + ], | ||
| 21 | rules: { | 26 | rules: { |
| 22 | 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', | 27 | 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', |
| 23 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off', | 28 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off', |
| @@ -25,6 +30,6 @@ module.exports = { | @@ -25,6 +30,6 @@ module.exports = { | ||
| 25 | 'vue/no-unused-vars': 'off', | 30 | 'vue/no-unused-vars': 'off', |
| 26 | 'vue/multi-word-component-names': 'off', | 31 | 'vue/multi-word-component-names': 'off', |
| 27 | 'vue/valid-template-root': 'off', | 32 | 'vue/valid-template-root': 'off', |
| 28 | - 'vue/no-mutating-props': 'off' | ||
| 29 | - } | 33 | + 'vue/no-mutating-props': 'off', |
| 34 | + }, | ||
| 30 | } | 35 | } |
build/external/globConfig/useGlobSetting.ts
deleted
100644 → 0
| 1 | -import { getGlobalConfigName } from "./getGlobConfigName"; | ||
| 2 | - | ||
| 3 | - | ||
| 4 | -export function getAppEnvConfig() { | ||
| 5 | - const ENV_NAME = getGlobalConfigName(import.meta.env); | ||
| 6 | - | ||
| 7 | - const ENV = (import.meta.env.DEV | ||
| 8 | - ? // Get the global configuration (the configuration will be extracted independently when packaging) | ||
| 9 | - (import.meta.env as unknown as GlobEnvConfig) | ||
| 10 | - : window[ENV_NAME as any]) as unknown as GlobEnvConfig; | ||
| 11 | - const { | ||
| 12 | - VITE_GLOB_APP_TITLE, | ||
| 13 | - VITE_GLOB_APP_SHORT_NAME, | ||
| 14 | - VITE_GLOB_CONTENT_SECURITY_POLICY, | ||
| 15 | - } = ENV; | ||
| 16 | - | ||
| 17 | - if (!/^[a-zA-Z\_]*$/.test(VITE_GLOB_APP_SHORT_NAME)) { | ||
| 18 | - console.warn( | ||
| 19 | - `VITE_GLOB_APP_SHORT_NAME Variables can only be characters/underscores, please modify in the environment variables and re-running.` | ||
| 20 | - ); | ||
| 21 | - } | ||
| 22 | - | ||
| 23 | - return { | ||
| 24 | - VITE_GLOB_APP_TITLE, | ||
| 25 | - VITE_GLOB_APP_SHORT_NAME, | ||
| 26 | - VITE_GLOB_CONTENT_SECURITY_POLICY, | ||
| 27 | - }; | ||
| 28 | -} | ||
| 29 | - | ||
| 30 | -export const useGlobSetting = (): Readonly<GlobConfig> => { | ||
| 31 | - const { | ||
| 32 | - VITE_GLOB_APP_TITLE, | ||
| 33 | - VITE_GLOB_APP_SHORT_NAME, | ||
| 34 | - VITE_GLOB_CONTENT_SECURITY_POLICY, | ||
| 35 | - } = getAppEnvConfig(); | ||
| 36 | - | ||
| 37 | - if (!/[a-zA-Z\_]*/.test(VITE_GLOB_APP_SHORT_NAME)) { | ||
| 38 | - console.warn( | ||
| 39 | - `VITE_GLOB_APP_SHORT_NAME Variables can only be characters/underscores, please modify in the environment variables and re-running.` | ||
| 40 | - ); | ||
| 41 | - } | ||
| 42 | - | ||
| 43 | - // Take global configuration | ||
| 44 | - const glob: Readonly<GlobConfig> = { | ||
| 45 | - title: VITE_GLOB_APP_TITLE, | ||
| 46 | - securityPolicy: VITE_GLOB_CONTENT_SECURITY_POLICY, | ||
| 47 | - }; | ||
| 48 | - | ||
| 49 | - return glob as Readonly<GlobConfig>; | ||
| 50 | -}; |
| @@ -53,7 +53,7 @@ | @@ -53,7 +53,7 @@ | ||
| 53 | "@types/node": "^16.11.26", | 53 | "@types/node": "^16.11.26", |
| 54 | "@types/qs": "^6.9.7", | 54 | "@types/qs": "^6.9.7", |
| 55 | "@types/three": "^0.144.0", | 55 | "@types/three": "^0.144.0", |
| 56 | - "@typescript-eslint/eslint-plugin": "^5.18.0", | 56 | + "@typescript-eslint/eslint-plugin": "^5.28.0", |
| 57 | "@typescript-eslint/parser": "^5.18.0", | 57 | "@typescript-eslint/parser": "^5.18.0", |
| 58 | "@vicons/carbon": "^0.12.0", | 58 | "@vicons/carbon": "^0.12.0", |
| 59 | "@vicons/ionicons5": "~0.11.0", | 59 | "@vicons/ionicons5": "~0.11.0", |
| @@ -12,7 +12,7 @@ specifiers: | @@ -12,7 +12,7 @@ specifiers: | ||
| 12 | '@types/node': ^16.11.26 | 12 | '@types/node': ^16.11.26 |
| 13 | '@types/qs': ^6.9.7 | 13 | '@types/qs': ^6.9.7 |
| 14 | '@types/three': ^0.144.0 | 14 | '@types/three': ^0.144.0 |
| 15 | - '@typescript-eslint/eslint-plugin': ^5.18.0 | 15 | + '@typescript-eslint/eslint-plugin': ^5.28.0 |
| 16 | '@typescript-eslint/parser': ^5.18.0 | 16 | '@typescript-eslint/parser': ^5.18.0 |
| 17 | '@vicons/carbon': ^0.12.0 | 17 | '@vicons/carbon': ^0.12.0 |
| 18 | '@vicons/ionicons5': ~0.11.0 | 18 | '@vicons/ionicons5': ~0.11.0 |
| @@ -7,14 +7,11 @@ export const useGlobSetting = (): Readonly<GlobConfig> => { | @@ -7,14 +7,11 @@ export const useGlobSetting = (): Readonly<GlobConfig> => { | ||
| 7 | VITE_GLOB_API_URL, | 7 | VITE_GLOB_API_URL, |
| 8 | VITE_GLOB_APP_SHORT_NAME, | 8 | VITE_GLOB_APP_SHORT_NAME, |
| 9 | VITE_GLOB_API_URL_PREFIX, | 9 | VITE_GLOB_API_URL_PREFIX, |
| 10 | - VITE_GLOB_UPLOAD_URL, | ||
| 11 | - VITE_GLOB_CONFIGURATION, | 10 | + VITE_GLOB_UPLOAD_URL, |
| 12 | VITE_GLOB_WEB_SOCKET, | 11 | VITE_GLOB_WEB_SOCKET, |
| 13 | - VITE_GLOB_CONTENT_SECURITY_POLICY, | ||
| 14 | - VITE_GLOB_ALARM_NOTIFY_POLLING_INTERVAL_TIME, | ||
| 15 | - VITE_GLOB_ALARM_NOTIFY_DURATION, | 12 | + VITE_GLOB_CONTENT_SECURITY_POLICY, |
| 16 | } = getAppEnvConfig(); | 13 | } = getAppEnvConfig(); |
| 17 | - | 14 | + |
| 18 | if (!/[a-zA-Z_]*/.test(VITE_GLOB_APP_SHORT_NAME)) { | 15 | if (!/[a-zA-Z_]*/.test(VITE_GLOB_APP_SHORT_NAME)) { |
| 19 | console.warn( | 16 | console.warn( |
| 20 | `VITE_GLOB_APP_SHORT_NAME Variables can only be characters/underscores, please modify in the environment variables and re-running.` | 17 | `VITE_GLOB_APP_SHORT_NAME Variables can only be characters/underscores, please modify in the environment variables and re-running.` |
| @@ -27,12 +24,10 @@ export const useGlobSetting = (): Readonly<GlobConfig> => { | @@ -27,12 +24,10 @@ export const useGlobSetting = (): Readonly<GlobConfig> => { | ||
| 27 | apiUrl: VITE_GLOB_API_URL, | 24 | apiUrl: VITE_GLOB_API_URL, |
| 28 | shortName: VITE_GLOB_APP_SHORT_NAME, | 25 | shortName: VITE_GLOB_APP_SHORT_NAME, |
| 29 | urlPrefix: VITE_GLOB_API_URL_PREFIX, | 26 | urlPrefix: VITE_GLOB_API_URL_PREFIX, |
| 30 | - uploadUrl: VITE_GLOB_UPLOAD_URL, | ||
| 31 | - configurationPrefix: VITE_GLOB_CONFIGURATION, | 27 | + uploadUrl: VITE_GLOB_UPLOAD_URL, |
| 32 | socketUrl: VITE_GLOB_WEB_SOCKET, | 28 | socketUrl: VITE_GLOB_WEB_SOCKET, |
| 33 | securityPolicy: VITE_GLOB_CONTENT_SECURITY_POLICY, | 29 | securityPolicy: VITE_GLOB_CONTENT_SECURITY_POLICY, |
| 34 | - alarmNotifyDuration: VITE_GLOB_ALARM_NOTIFY_DURATION, | ||
| 35 | - alarmPollingInterval: VITE_GLOB_ALARM_NOTIFY_POLLING_INTERVAL_TIME, | ||
| 36 | }; | 30 | }; |
| 31 | + | ||
| 37 | return glob as Readonly<GlobConfig>; | 32 | return glob as Readonly<GlobConfig>; |
| 38 | }; | 33 | }; |
| @@ -14,7 +14,7 @@ export const groupTitle = "分组" | @@ -14,7 +14,7 @@ export const groupTitle = "分组" | ||
| 14 | // 主题配置 | 14 | // 主题配置 |
| 15 | export const theme = { | 15 | export const theme = { |
| 16 | // 默认是否开启深色主题 | 16 | // 默认是否开启深色主题 |
| 17 | - darkTheme: true, | 17 | + darkTheme: false, |
| 18 | //默认主题色 | 18 | //默认主题色 |
| 19 | appTheme: '#51d6a9', | 19 | appTheme: '#51d6a9', |
| 20 | appThemeDetail: null, | 20 | appThemeDetail: null, |
| @@ -12,7 +12,7 @@ import { | @@ -12,7 +12,7 @@ import { | ||
| 12 | RefreshTokenParams, | 12 | RefreshTokenParams, |
| 13 | SmsLoginParams, | 13 | SmsLoginParams, |
| 14 | } from '@/api/external/sys/model/userModel'; | 14 | } from '@/api/external/sys/model/userModel'; |
| 15 | -import { doRefreshToken, loginApi } from '@/api/external/sys/user'; | 15 | +import { doRefreshToken, getMyInfo, loginApi } from '@/api/external/sys/user'; |
| 16 | import router from '@/router'; | 16 | import router from '@/router'; |
| 17 | import { createLocalStorage } from '@/utils/external/cache'; | 17 | import { createLocalStorage } from '@/utils/external/cache'; |
| 18 | import { useI18n } from 'vue-i18n'; | 18 | import { useI18n } from 'vue-i18n'; |
| @@ -133,12 +133,25 @@ export const useUserStore = defineStore({ | @@ -133,12 +133,25 @@ export const useUserStore = defineStore({ | ||
| 133 | try { | 133 | try { |
| 134 | const { goHome = true, mode, ...loginParams } = params; | 134 | const { goHome = true, mode, ...loginParams } = params; |
| 135 | const data = await loginApi(loginParams, mode); | 135 | const data = await loginApi(loginParams, mode); |
| 136 | + return this.process(data, goHome); | ||
| 136 | } catch (error) { | 137 | } catch (error) { |
| 137 | return Promise.reject(error); | 138 | return Promise.reject(error); |
| 138 | } | 139 | } |
| 139 | }, | 140 | }, |
| 140 | async process(data: LoginResultModel, goHome?: boolean) { | 141 | async process(data: LoginResultModel, goHome?: boolean) { |
| 142 | + const { token, refreshToken } = data; | ||
| 143 | + this.storeToken(token, refreshToken); | ||
| 144 | + // get user info | ||
| 145 | + const userInfo = await this.getMyUserInfoAction(); | ||
| 141 | 146 | ||
| 147 | + const sessionTimeout = this.sessionTimeout; | ||
| 148 | + if (sessionTimeout) { | ||
| 149 | + this.setSessionTimeout(false); | ||
| 150 | + } else if (goHome) { | ||
| 151 | + | ||
| 152 | + await router.replace(userInfo.homePath || PageEnum.BASE_HOME); | ||
| 153 | + } | ||
| 154 | + return userInfo; | ||
| 142 | }, | 155 | }, |
| 143 | async smsCodelogin( | 156 | async smsCodelogin( |
| 144 | params: SmsLoginParams & { | 157 | params: SmsLoginParams & { |
| @@ -149,7 +162,12 @@ export const useUserStore = defineStore({ | @@ -149,7 +162,12 @@ export const useUserStore = defineStore({ | ||
| 149 | 162 | ||
| 150 | }, | 163 | }, |
| 151 | async getMyUserInfoAction() { | 164 | async getMyUserInfoAction() { |
| 152 | - | 165 | + const userInfo = await getMyInfo(); |
| 166 | + this.setUserInfo(userInfo); | ||
| 167 | + const { roles } = userInfo; | ||
| 168 | + const roleList = roles.map((item) => item) as RoleEnum[]; | ||
| 169 | + this.setRoleList(roleList); | ||
| 170 | + return userInfo; | ||
| 153 | }, | 171 | }, |
| 154 | /** | 172 | /** |
| 155 | * @description: logout | 173 | * @description: logout |
| 1 | import type { GlobEnvConfig } from '/#/external/config'; | 1 | import type { GlobEnvConfig } from '/#/external/config'; |
| 2 | - | ||
| 3 | -import pkg from '../../../../package.json'; | ||
| 4 | -import { getGlobalConfigName } from 'build/external/globConfig/getGlobConfigName'; | 2 | + |
| 3 | +import pkg from '../../../../package.json'; | ||
| 4 | +import { getGlobalConfigName } from '../../../../build/external/globConfig/getGlobConfigName'; | ||
| 5 | 5 | ||
| 6 | export function getCommonStoragePrefix() { | 6 | export function getCommonStoragePrefix() { |
| 7 | const { VITE_GLOB_APP_SHORT_NAME } = getAppEnvConfig(); | 7 | const { VITE_GLOB_APP_SHORT_NAME } = getAppEnvConfig(); |
| @@ -18,8 +18,9 @@ export function getAppEnvConfig() { | @@ -18,8 +18,9 @@ export function getAppEnvConfig() { | ||
| 18 | 18 | ||
| 19 | const ENV = (import.meta.env.DEV | 19 | const ENV = (import.meta.env.DEV |
| 20 | ? // Get the global configuration (the configuration will be extracted independently when packaging) | 20 | ? // Get the global configuration (the configuration will be extracted independently when packaging) |
| 21 | - (import.meta.env as unknown as GlobEnvConfig) | 21 | + (import.meta.env as unknown as GlobEnvConfig) |
| 22 | : window[ENV_NAME as any]) as unknown as GlobEnvConfig; | 22 | : window[ENV_NAME as any]) as unknown as GlobEnvConfig; |
| 23 | + | ||
| 23 | const { | 24 | const { |
| 24 | VITE_GLOB_APP_TITLE, | 25 | VITE_GLOB_APP_TITLE, |
| 25 | VITE_GLOB_API_URL, | 26 | VITE_GLOB_API_URL, |
| 1 | import type { ErrorMessageMode } from '/#/external/axios'; | 1 | import type { ErrorMessageMode } from '/#/external/axios'; |
| 2 | import { useUserStoreWithOut } from '@/store/external/module/user'; | 2 | import { useUserStoreWithOut } from '@/store/external/module/user'; |
| 3 | -import { useI18n } from 'vue-i18n'; | ||
| 4 | -import { useMessage } from 'naive-ui'; | ||
| 5 | 3 | ||
| 6 | -const { error } = useMessage() | ||
| 7 | export function checkStatus( | 4 | export function checkStatus( |
| 8 | status: number, | 5 | status: number, |
| 9 | msg: string, | 6 | msg: string, |
| 10 | errorMessageMode: ErrorMessageMode = 'message' | 7 | errorMessageMode: ErrorMessageMode = 'message' |
| 11 | -): void { | ||
| 12 | - const { t } = useI18n(); | 8 | +): void { |
| 13 | const userStore = useUserStoreWithOut(); | 9 | const userStore = useUserStoreWithOut(); |
| 14 | let errMessage = msg; | 10 | let errMessage = msg; |
| 15 | switch (status) { | 11 | switch (status) { |
| @@ -20,8 +16,9 @@ export function checkStatus( | @@ -20,8 +16,9 @@ export function checkStatus( | ||
| 20 | // Jump to the login page if not logged in, and carry the path of the current page | 16 | // Jump to the login page if not logged in, and carry the path of the current page |
| 21 | // Return to the current page after successful login. This step needs to be operated on the login page. | 17 | // Return to the current page after successful login. This step needs to be operated on the login page. |
| 22 | case 401: | 18 | case 401: |
| 23 | - errMessage = ''; | ||
| 24 | - userStore.logout() | 19 | + errMessage = '没有权限'; |
| 20 | + userStore.setToken(undefined); | ||
| 21 | + userStore.setSessionTimeout(true); | ||
| 25 | break; | 22 | break; |
| 26 | case 403: | 23 | case 403: |
| 27 | errMessage = '未授权'; | 24 | errMessage = '未授权'; |
| @@ -56,8 +53,10 @@ export function checkStatus( | @@ -56,8 +53,10 @@ export function checkStatus( | ||
| 56 | break; | 53 | break; |
| 57 | default: | 54 | default: |
| 58 | } | 55 | } |
| 59 | - if (errMessage) { | 56 | + |
| 57 | + if (errMessage) { | ||
| 60 | if (errorMessageMode === 'message') { | 58 | if (errorMessageMode === 'message') { |
| 59 | + const { error } = window['$message'] | ||
| 61 | error(errMessage); | 60 | error(errMessage); |
| 62 | } | 61 | } |
| 63 | } | 62 | } |
| @@ -14,12 +14,10 @@ import { setObjToUrlParams, deepMerge } from '@/utils/external'; | @@ -14,12 +14,10 @@ import { setObjToUrlParams, deepMerge } from '@/utils/external'; | ||
| 14 | import { joinTimestamp, formatRequestDate } from './helper'; | 14 | import { joinTimestamp, formatRequestDate } from './helper'; |
| 15 | import { PageEnum } from '@/enums/external/pageEnum'; | 15 | import { PageEnum } from '@/enums/external/pageEnum'; |
| 16 | import router from '@/router'; | 16 | import router from '@/router'; |
| 17 | -import { useDialog } from 'naive-ui'; | ||
| 18 | 17 | ||
| 19 | const globSetting = useGlobSetting(); | 18 | const globSetting = useGlobSetting(); |
| 20 | const urlPrefix = globSetting.urlPrefix; | 19 | const urlPrefix = globSetting.urlPrefix; |
| 21 | 20 | ||
| 22 | -const { success, error } = useDialog() | ||
| 23 | /** | 21 | /** |
| 24 | * @description: 数据处理,方便区分多种处理方式 | 22 | * @description: 数据处理,方便区分多种处理方式 |
| 25 | */ | 23 | */ |
| @@ -47,6 +45,7 @@ const transform: AxiosTransform = { | @@ -47,6 +45,7 @@ const transform: AxiosTransform = { | ||
| 47 | if (apiUrl && isString(apiUrl)) { | 45 | if (apiUrl && isString(apiUrl)) { |
| 48 | config.url = `${apiUrl}${config.url}`; | 46 | config.url = `${apiUrl}${config.url}`; |
| 49 | } | 47 | } |
| 48 | + | ||
| 50 | const params = config.params || {}; | 49 | const params = config.params || {}; |
| 51 | const data = config.data || false; | 50 | const data = config.data || false; |
| 52 | formatDate && data && !isString(data) && formatRequestDate(data); | 51 | formatDate && data && !isString(data) && formatRequestDate(data); |
src/utils/external/to.ts
0 → 100644
| 1 | +/** | ||
| 2 | + * @description use to function capture await throw error | ||
| 3 | + * @param promise | ||
| 4 | + * @param errorExt - Additional Information you can pass to the err object | ||
| 5 | + */ | ||
| 6 | +export function to<T, E = any>( | ||
| 7 | + promise: Promise<T>, | ||
| 8 | + errorExt?: string | ||
| 9 | +): Promise<[Nullable<E>, T | undefined]> { | ||
| 10 | + return promise | ||
| 11 | + .then((data) => [null, data] as [null, T]) | ||
| 12 | + .catch((err) => { | ||
| 13 | + if (errorExt) { | ||
| 14 | + const parsedError = Object.assign({}, err, errorExt) | ||
| 15 | + return [parsedError, undefined] | ||
| 16 | + } | ||
| 17 | + return [err, undefined] | ||
| 18 | + }); | ||
| 19 | +} |
src/views/login/external/useLogin.ts
0 → 100644
| 1 | +import { PageEnum } from "@/enums/pageEnum" | ||
| 2 | +import { useUserStore } from "@/store/external/module/user" | ||
| 3 | +import { cryptoEncode, routerTurnByName, setLocalStorage } from "@/utils" | ||
| 4 | +import { to } from "@/utils/external/to" | ||
| 5 | +import { StorageEnum } from '@/enums/storageEnum' | ||
| 6 | +import { ref } from "vue" | ||
| 7 | + | ||
| 8 | +export const useLogin = () => { | ||
| 9 | + const userStore = useUserStore() | ||
| 10 | + const t = window['$t'] | ||
| 11 | + const loading = ref(false) | ||
| 12 | + | ||
| 13 | + const login = async (params: Record<'password' | 'username', string>) => { | ||
| 14 | + loading.value = true | ||
| 15 | + const [err, data] = await to<AwaitToResult<typeof userStore['login']>>(userStore.login({ | ||
| 16 | + ...params, | ||
| 17 | + mode: 'message' | ||
| 18 | + })) | ||
| 19 | + loading.value = false | ||
| 20 | + if (err) { | ||
| 21 | + return | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + setLocalStorage( | ||
| 25 | + StorageEnum.GO_LOGIN_INFO_STORE, | ||
| 26 | + cryptoEncode( | ||
| 27 | + JSON.stringify(params) | ||
| 28 | + ) | ||
| 29 | + ) | ||
| 30 | + | ||
| 31 | + window['$message'].success(`${t('login.login_success')}!`) | ||
| 32 | + routerTurnByName(PageEnum.BASE_HOME_NAME, true) | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + return { login, loading } | ||
| 36 | +} |
| @@ -24,18 +24,9 @@ | @@ -24,18 +24,9 @@ | ||
| 24 | </layout-header> | 24 | </layout-header> |
| 25 | <div class="go-login"> | 25 | <div class="go-login"> |
| 26 | <div class="go-login-carousel"> | 26 | <div class="go-login-carousel"> |
| 27 | - <n-carousel | ||
| 28 | - autoplay | ||
| 29 | - dot-type="line" | ||
| 30 | - :interval="Number(carouselInterval)" | ||
| 31 | - > | ||
| 32 | - <img | ||
| 33 | - v-for="(item, i) in carouselImgList" | ||
| 34 | - :key="i" | ||
| 35 | - class="go-login-carousel-img" | ||
| 36 | - :src="getImageUrl(item, 'login')" | ||
| 37 | - alt="image" | ||
| 38 | - /> | 27 | + <n-carousel autoplay dot-type="line" :interval="Number(carouselInterval)"> |
| 28 | + <img v-for="(item, i) in carouselImgList" :key="i" class="go-login-carousel-img" | ||
| 29 | + :src="getImageUrl(item, 'login')" alt="image" /> | ||
| 39 | </n-carousel> | 30 | </n-carousel> |
| 40 | </div> | 31 | </div> |
| 41 | <div class="login-account"> | 32 | <div class="login-account"> |
| @@ -43,24 +34,11 @@ | @@ -43,24 +34,11 @@ | ||
| 43 | <n-collapse-transition :appear="true" :show="show"> | 34 | <n-collapse-transition :appear="true" :show="show"> |
| 44 | <n-card class="login-account-card" :title="$t('login.desc')"> | 35 | <n-card class="login-account-card" :title="$t('login.desc')"> |
| 45 | <div class="login-account-top"> | 36 | <div class="login-account-top"> |
| 46 | - <img | ||
| 47 | - class="login-account-top-logo" | ||
| 48 | - src="~@/assets/images/login/input.png" | ||
| 49 | - alt="展示图片" | ||
| 50 | - /> | 37 | + <img class="login-account-top-logo" src="~@/assets/images/login/input.png" alt="展示图片" /> |
| 51 | </div> | 38 | </div> |
| 52 | - <n-form | ||
| 53 | - ref="formRef" | ||
| 54 | - label-placement="left" | ||
| 55 | - size="large" | ||
| 56 | - :model="formInline" | ||
| 57 | - :rules="rules" | ||
| 58 | - > | 39 | + <n-form ref="formRef" label-placement="left" size="large" :model="formInline" :rules="rules"> |
| 59 | <n-form-item path="username"> | 40 | <n-form-item path="username"> |
| 60 | - <n-input | ||
| 61 | - v-model:value="formInline.username" | ||
| 62 | - :placeholder="$t('global.form_account')" | ||
| 63 | - > | 41 | + <n-input v-model:value="formInline.username" :placeholder="$t('global.form_account')"> |
| 64 | <template #prefix> | 42 | <template #prefix> |
| 65 | <n-icon size="18"> | 43 | <n-icon size="18"> |
| 66 | <PersonOutlineIcon></PersonOutlineIcon> | 44 | <PersonOutlineIcon></PersonOutlineIcon> |
| @@ -69,12 +47,8 @@ | @@ -69,12 +47,8 @@ | ||
| 69 | </n-input> | 47 | </n-input> |
| 70 | </n-form-item> | 48 | </n-form-item> |
| 71 | <n-form-item path="password"> | 49 | <n-form-item path="password"> |
| 72 | - <n-input | ||
| 73 | - v-model:value="formInline.password" | ||
| 74 | - type="password" | ||
| 75 | - show-password-on="click" | ||
| 76 | - :placeholder="$t('global.form_password')" | ||
| 77 | - > | 50 | + <n-input v-model:value="formInline.password" type="password" show-password-on="click" |
| 51 | + :placeholder="$t('global.form_password')"> | ||
| 78 | <template #prefix> | 52 | <template #prefix> |
| 79 | <n-icon size="18"> | 53 | <n-icon size="18"> |
| 80 | <LockClosedOutlineIcon></LockClosedOutlineIcon> | 54 | <LockClosedOutlineIcon></LockClosedOutlineIcon> |
| @@ -92,14 +66,9 @@ | @@ -92,14 +66,9 @@ | ||
| 92 | </div> | 66 | </div> |
| 93 | </n-form-item> | 67 | </n-form-item> |
| 94 | <n-form-item> | 68 | <n-form-item> |
| 95 | - <n-button | ||
| 96 | - type="primary" | ||
| 97 | - @click="handleSubmit" | ||
| 98 | - size="large" | ||
| 99 | - :loading="loading" | ||
| 100 | - block | ||
| 101 | - >{{ $t('login.form_button') }}</n-button | ||
| 102 | - > | 69 | + <!-- YUN_TENG loading修改 --> |
| 70 | + <n-button type="primary" @click="handleSubmit" size="large" :loading="loginLoading" block>{{ | ||
| 71 | + $t('login.form_button') }}</n-button> | ||
| 103 | </n-form-item> | 72 | </n-form-item> |
| 104 | </n-form> | 73 | </n-form> |
| 105 | </n-card> | 74 | </n-card> |
| @@ -127,6 +96,7 @@ import { PageEnum } from '@/enums/pageEnum' | @@ -127,6 +96,7 @@ import { PageEnum } from '@/enums/pageEnum' | ||
| 127 | import { icon } from '@/plugins' | 96 | import { icon } from '@/plugins' |
| 128 | import { StorageEnum } from '@/enums/storageEnum' | 97 | import { StorageEnum } from '@/enums/storageEnum' |
| 129 | import { routerTurnByName, cryptoEncode, setLocalStorage } from '@/utils' | 98 | import { routerTurnByName, cryptoEncode, setLocalStorage } from '@/utils' |
| 99 | +import { useLogin } from './external/useLogin' | ||
| 130 | const { GO_LOGIN_INFO_STORE } = StorageEnum | 100 | const { GO_LOGIN_INFO_STORE } = StorageEnum |
| 131 | 101 | ||
| 132 | const { PersonOutlineIcon, LockClosedOutlineIcon } = icon.ionicons5 | 102 | const { PersonOutlineIcon, LockClosedOutlineIcon } = icon.ionicons5 |
| @@ -203,6 +173,9 @@ const shuffleHandle = () => { | @@ -203,6 +173,9 @@ const shuffleHandle = () => { | ||
| 203 | }, carouselInterval) | 173 | }, carouselInterval) |
| 204 | } | 174 | } |
| 205 | 175 | ||
| 176 | +// YUN_TENG 登录钩子 | ||
| 177 | +const { login, loading: loginLoading } = useLogin() | ||
| 178 | + | ||
| 206 | // 点击事件 | 179 | // 点击事件 |
| 207 | const handleSubmit = (e: Event) => { | 180 | const handleSubmit = (e: Event) => { |
| 208 | e.preventDefault() | 181 | e.preventDefault() |
| @@ -210,17 +183,20 @@ const handleSubmit = (e: Event) => { | @@ -210,17 +183,20 @@ const handleSubmit = (e: Event) => { | ||
| 210 | if (!errors) { | 183 | if (!errors) { |
| 211 | const { username, password } = formInline | 184 | const { username, password } = formInline |
| 212 | loading.value = true | 185 | loading.value = true |
| 213 | - setLocalStorage( | ||
| 214 | - GO_LOGIN_INFO_STORE, | ||
| 215 | - cryptoEncode( | ||
| 216 | - JSON.stringify({ | ||
| 217 | - username, | ||
| 218 | - password, | ||
| 219 | - }) | ||
| 220 | - ) | ||
| 221 | - ) | ||
| 222 | - window['$message'].success(`${t('login.login_success')}!`) | ||
| 223 | - routerTurnByName(PageEnum.BASE_HOME_NAME, true) | 186 | + // YUN_TENG 登录接口 |
| 187 | + await login({ username, password }) | ||
| 188 | + // setLocalStorage( | ||
| 189 | + // GO_LOGIN_INFO_STORE, | ||
| 190 | + // cryptoEncode( | ||
| 191 | + // JSON.stringify({ | ||
| 192 | + // username, | ||
| 193 | + // password, | ||
| 194 | + // }) | ||
| 195 | + // ) | ||
| 196 | + // ) | ||
| 197 | + // window['$message'].success(`${t('login.login_success')}!`) | ||
| 198 | + // routerTurnByName(PageEnum.BASE_HOME_NAME, true) | ||
| 199 | + | ||
| 224 | } else { | 200 | } else { |
| 225 | window['$message'].error(`${t('login.login_message')}!`) | 201 | window['$message'].error(`${t('login.login_message')}!`) |
| 226 | } | 202 | } |
| @@ -243,10 +219,12 @@ $carousel-image-height: 60vh; | @@ -243,10 +219,12 @@ $carousel-image-height: 60vh; | ||
| 243 | * { | 219 | * { |
| 244 | box-sizing: border-box; | 220 | box-sizing: border-box; |
| 245 | } | 221 | } |
| 222 | + | ||
| 246 | @include go(login-box) { | 223 | @include go(login-box) { |
| 247 | height: $go-login-height; | 224 | height: $go-login-height; |
| 248 | overflow: hidden; | 225 | overflow: hidden; |
| 249 | @include background-image('background-image'); | 226 | @include background-image('background-image'); |
| 227 | + | ||
| 250 | &-header { | 228 | &-header { |
| 251 | display: flex; | 229 | display: flex; |
| 252 | justify-content: space-between; | 230 | justify-content: space-between; |
| @@ -254,6 +232,7 @@ $carousel-image-height: 60vh; | @@ -254,6 +232,7 @@ $carousel-image-height: 60vh; | ||
| 254 | padding: 0 40px; | 232 | padding: 0 40px; |
| 255 | height: $--header-height; | 233 | height: $--header-height; |
| 256 | } | 234 | } |
| 235 | + | ||
| 257 | &-divider { | 236 | &-divider { |
| 258 | margin: 0; | 237 | margin: 0; |
| 259 | padding-top: 0; | 238 | padding-top: 0; |
| @@ -267,20 +246,24 @@ $carousel-image-height: 60vh; | @@ -267,20 +246,24 @@ $carousel-image-height: 60vh; | ||
| 267 | margin-top: -$--header-height; | 246 | margin-top: -$--header-height; |
| 268 | height: $go-login-height; | 247 | height: $go-login-height; |
| 269 | width: 100vw; | 248 | width: 100vw; |
| 249 | + | ||
| 270 | &-carousel { | 250 | &-carousel { |
| 271 | width: $carousel-width; | 251 | width: $carousel-width; |
| 272 | margin-top: 100px; | 252 | margin-top: 100px; |
| 273 | min-width: 500px; | 253 | min-width: 500px; |
| 254 | + | ||
| 274 | &-img { | 255 | &-img { |
| 275 | display: block; | 256 | display: block; |
| 276 | margin: 0 auto; | 257 | margin: 0 auto; |
| 277 | height: $carousel-image-height; | 258 | height: $carousel-image-height; |
| 278 | } | 259 | } |
| 279 | } | 260 | } |
| 261 | + | ||
| 280 | .login-account { | 262 | .login-account { |
| 281 | display: flex; | 263 | display: flex; |
| 282 | flex-direction: column; | 264 | flex-direction: column; |
| 283 | margin: 0 160px; | 265 | margin: 0 160px; |
| 266 | + | ||
| 284 | &-container { | 267 | &-container { |
| 285 | width: $width; | 268 | width: $width; |
| 286 | } | 269 | } |
| @@ -316,15 +299,18 @@ $carousel-image-height: 60vh; | @@ -316,15 +299,18 @@ $carousel-image-height: 60vh; | ||
| 316 | width: 100vw; | 299 | width: 100vw; |
| 317 | height: 100vh; | 300 | height: 100vh; |
| 318 | background: url('@/assets/images/login/login-bg.png') no-repeat 0 -120px; | 301 | background: url('@/assets/images/login/login-bg.png') no-repeat 0 -120px; |
| 302 | + | ||
| 319 | .bg-slot { | 303 | .bg-slot { |
| 320 | width: $carousel-width; | 304 | width: $carousel-width; |
| 321 | } | 305 | } |
| 306 | + | ||
| 322 | .bg-img-box { | 307 | .bg-img-box { |
| 323 | position: relative; | 308 | position: relative; |
| 324 | display: flex; | 309 | display: flex; |
| 325 | flex-wrap: wrap; | 310 | flex-wrap: wrap; |
| 326 | width: 770px; | 311 | width: 770px; |
| 327 | margin-right: -20px; | 312 | margin-right: -20px; |
| 313 | + | ||
| 328 | &-li { | 314 | &-li { |
| 329 | img { | 315 | img { |
| 330 | margin-right: 20px; | 316 | margin-right: 20px; |
| @@ -337,12 +323,15 @@ $carousel-image-height: 60vh; | @@ -337,12 +323,15 @@ $carousel-image-height: 60vh; | ||
| 337 | } | 323 | } |
| 338 | } | 324 | } |
| 339 | } | 325 | } |
| 326 | + | ||
| 340 | @media only screen and (max-width: 1200px) { | 327 | @media only screen and (max-width: 1200px) { |
| 328 | + | ||
| 341 | .bg-img-box, | 329 | .bg-img-box, |
| 342 | .bg-slot, | 330 | .bg-slot, |
| 343 | .go-login-carousel { | 331 | .go-login-carousel { |
| 344 | display: none !important; | 332 | display: none !important; |
| 345 | } | 333 | } |
| 334 | + | ||
| 346 | .go-login-box-footer { | 335 | .go-login-box-footer { |
| 347 | position: relative; | 336 | position: relative; |
| 348 | } | 337 | } |
| @@ -10,16 +10,41 @@ | @@ -10,16 +10,41 @@ | ||
| 10 | "resolveJsonModule": true, | 10 | "resolveJsonModule": true, |
| 11 | "esModuleInterop": true, | 11 | "esModuleInterop": true, |
| 12 | "skipLibCheck": true, | 12 | "skipLibCheck": true, |
| 13 | - "lib": ["es6", "ESNext", "dom"], | ||
| 14 | - "types": ["vite/client"], | 13 | + "lib": [ |
| 14 | + "es6", | ||
| 15 | + "ESNext", | ||
| 16 | + "dom" | ||
| 17 | + ], | ||
| 18 | + "types": [ | ||
| 19 | + "vite/client" | ||
| 20 | + ], | ||
| 21 | + "typeRoots": [ | ||
| 22 | + "./node_modules/@types/", | ||
| 23 | + "./types" | ||
| 24 | + ], | ||
| 15 | "paths": { | 25 | "paths": { |
| 16 | - "@/*": ["src/*"], | ||
| 17 | - "/#/*": ["types/*"] | 26 | + "@/*": [ |
| 27 | + "src/*" | ||
| 28 | + ], | ||
| 29 | + "/#/*": [ | ||
| 30 | + "types/*" | ||
| 31 | + ] | ||
| 18 | }, | 32 | }, |
| 19 | "noImplicitAny": true, //不允许使用any | 33 | "noImplicitAny": true, //不允许使用any |
| 20 | // "strictNullChecks": true, //不允许使用null | 34 | // "strictNullChecks": true, //不允许使用null |
| 21 | "noImplicitThis": true //不允许往this上面挂属性 | 35 | "noImplicitThis": true //不允许往this上面挂属性 |
| 22 | }, | 36 | }, |
| 23 | - "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue", "types/**/*", "build/**/*"], | ||
| 24 | - "exclude": ["node_modules", "dist", "**/*.js"] | 37 | + "include": [ |
| 38 | + "src/**/*.ts", | ||
| 39 | + "src/**/*.d.ts", | ||
| 40 | + "src/**/*.tsx", | ||
| 41 | + "src/**/*.vue", | ||
| 42 | + "types/**/*", | ||
| 43 | + "build/**/*" | ||
| 44 | + ], | ||
| 45 | + "exclude": [ | ||
| 46 | + "node_modules", | ||
| 47 | + "dist", | ||
| 48 | + "**/*.js" | ||
| 49 | + ] | ||
| 25 | } | 50 | } |
| @@ -146,14 +146,8 @@ export interface GlobConfig { | @@ -146,14 +146,8 @@ export interface GlobConfig { | ||
| 146 | urlPrefix?: string; | 146 | urlPrefix?: string; |
| 147 | // Project abbreviation | 147 | // Project abbreviation |
| 148 | shortName: string; | 148 | shortName: string; |
| 149 | - // configuration center proxy prefix | ||
| 150 | - configurationPrefix: string; | ||
| 151 | // socket url | 149 | // socket url |
| 152 | socketUrl: string; | 150 | socketUrl: string; |
| 153 | - // alarm notify alarm duration | ||
| 154 | - alarmNotifyDuration: string; | ||
| 155 | - // alarm notify polling interval | ||
| 156 | - alarmPollingInterval: string; | ||
| 157 | // upgrade your http policy to https | 151 | // upgrade your http policy to https |
| 158 | securityPolicy: string; | 152 | securityPolicy: string; |
| 159 | } | 153 | } |
| @@ -168,14 +162,8 @@ export interface GlobEnvConfig { | @@ -168,14 +162,8 @@ export interface GlobEnvConfig { | ||
| 168 | VITE_GLOB_APP_SHORT_NAME: string; | 162 | VITE_GLOB_APP_SHORT_NAME: string; |
| 169 | // Upload url | 163 | // Upload url |
| 170 | VITE_GLOB_UPLOAD_URL?: string; | 164 | VITE_GLOB_UPLOAD_URL?: string; |
| 171 | - // configuration | ||
| 172 | - VITE_GLOB_CONFIGURATION: string; | ||
| 173 | // socket | 165 | // socket |
| 174 | VITE_GLOB_WEB_SOCKET: string; | 166 | VITE_GLOB_WEB_SOCKET: string; |
| 175 | - // force transform http to https | ||
| 176 | - VITE_GLOB_CONTENT_SECURITY_POLICY: string; | ||
| 177 | - // notify polling interval time | ||
| 178 | - VITE_GLOB_ALARM_NOTIFY_POLLING_INTERVAL_TIME: string; | ||
| 179 | // notify duration | 167 | // notify duration |
| 180 | VITE_GLOB_ALARM_NOTIFY_DURATION: string; | 168 | VITE_GLOB_ALARM_NOTIFY_DURATION: string; |
| 181 | } | 169 | } |
| 1 | import type { | 1 | import type { |
| 2 | + ComponentPublicInstance, | ||
| 2 | ComponentRenderProxy, | 3 | ComponentRenderProxy, |
| 4 | + FunctionalComponent, | ||
| 3 | VNode, | 5 | VNode, |
| 4 | VNodeChild, | 6 | VNodeChild, |
| 5 | - ComponentPublicInstance, | ||
| 6 | - FunctionalComponent, | ||
| 7 | PropType as VuePropType, | 7 | PropType as VuePropType, |
| 8 | -} from 'vue'; | 8 | +} from 'vue' |
| 9 | 9 | ||
| 10 | declare global { | 10 | declare global { |
| 11 | const __APP_INFO__: { | 11 | const __APP_INFO__: { |
| 12 | pkg: { | 12 | pkg: { |
| 13 | - name: string; | ||
| 14 | - version: string; | ||
| 15 | - dependencies: Recordable<string>; | ||
| 16 | - devDependencies: Recordable<string>; | ||
| 17 | - }; | ||
| 18 | - lastBuildTime: string; | ||
| 19 | - }; | 13 | + name: string |
| 14 | + version: string | ||
| 15 | + dependencies: Recordable<string> | ||
| 16 | + devDependencies: Recordable<string> | ||
| 17 | + } | ||
| 18 | + lastBuildTime: string | ||
| 19 | + } | ||
| 20 | // declare interface Window { | 20 | // declare interface Window { |
| 21 | // // Global vue app instance | 21 | // // Global vue app instance |
| 22 | // __APP__: App<Element>; | 22 | // __APP__: App<Element>; |
| 23 | // } | 23 | // } |
| 24 | 24 | ||
| 25 | // vue | 25 | // vue |
| 26 | - declare type PropType<T> = VuePropType<T>; | ||
| 27 | - declare type VueNode = VNodeChild | JSX.Element; | 26 | + declare type PropType<T> = VuePropType<T> |
| 27 | + declare type VueNode = VNodeChild | JSX.Element | ||
| 28 | 28 | ||
| 29 | export type Writable<T> = { | 29 | export type Writable<T> = { |
| 30 | -readonly [P in keyof T]: T[P]; | 30 | -readonly [P in keyof T]: T[P]; |
| 31 | - }; | 31 | + } |
| 32 | 32 | ||
| 33 | - declare type Nullable<T> = T | null; | ||
| 34 | - declare type NonNullable<T> = T extends null | undefined ? never : T; | ||
| 35 | - declare type Recordable<T = any> = Record<string, T>; | ||
| 36 | - declare type ReadonlyRecordable<T = any> = { | ||
| 37 | - readonly [key: string]: T; | ||
| 38 | - }; | ||
| 39 | - declare type Indexable<T = any> = { | ||
| 40 | - [key: string]: T; | ||
| 41 | - }; | 33 | + declare type Nullable<T> = T | null |
| 34 | + declare type NonNullable<T> = T extends null | undefined ? never : T | ||
| 35 | + declare type Recordable<T = any> = Record<string, T> | ||
| 36 | + type ReadonlyRecordable<T> = Readonly<Record<string, T>> | ||
| 37 | + type Indexable<T> = Record<string, T> | ||
| 42 | declare type DeepPartial<T> = { | 38 | declare type DeepPartial<T> = { |
| 43 | [P in keyof T]?: DeepPartial<T[P]>; | 39 | [P in keyof T]?: DeepPartial<T[P]>; |
| 44 | - }; | ||
| 45 | - declare type TimeoutHandle = ReturnType<typeof setTimeout>; | ||
| 46 | - declare type IntervalHandle = ReturnType<typeof setInterval>; | 40 | + } |
| 41 | + declare type TimeoutHandle = ReturnType<typeof setTimeout> | ||
| 42 | + declare type IntervalHandle = ReturnType<typeof setInterval> | ||
| 47 | 43 | ||
| 48 | declare interface ChangeEvent extends Event { | 44 | declare interface ChangeEvent extends Event { |
| 49 | - target: HTMLInputElement; | 45 | + target: HTMLInputElement |
| 50 | } | 46 | } |
| 51 | 47 | ||
| 52 | declare interface WheelEvent { | 48 | declare interface WheelEvent { |
| 53 | - path?: EventTarget[]; | 49 | + path?: EventTarget[] |
| 54 | } | 50 | } |
| 55 | interface ImportMetaEnv extends ViteEnv { | 51 | interface ImportMetaEnv extends ViteEnv { |
| 56 | - __: unknown; | 52 | + __: unknown |
| 57 | } | 53 | } |
| 58 | 54 | ||
| 59 | declare interface ViteEnv { | 55 | declare interface ViteEnv { |
| 60 | - VITE_PORT: number; | ||
| 61 | - VITE_GLOB_USE_MOCK: boolean; | ||
| 62 | - VITE_USE_PWA: boolean; | ||
| 63 | - VITE_GLOB_PUBLIC_PATH: string; | ||
| 64 | - VITE_PROXY: [string, string][]; | ||
| 65 | - VITE_GLOB_APP_TITLE: string; | ||
| 66 | - VITE_GLOB_APP_SHORT_NAME: string; | ||
| 67 | - VITE_USE_CDN: boolean; | ||
| 68 | - VITE_GLOB_DROP_CONSOLE: boolean; | ||
| 69 | - VITE_GLOB_BUILD_COMPRESS: 'gzip' | 'brotli' | 'none'; | ||
| 70 | - VITE_GLOB_BUILD_COMPRESS_DELETE_ORIGIN_FILE: boolean; | ||
| 71 | - VITE_LEGACY: boolean; | ||
| 72 | - VITE_GLOB_USE_IMAGEMIN: boolean; | ||
| 73 | - VITE_GENERATE_UI: string; | ||
| 74 | - VITE_GLOB_CONTENT_SECURITY_POLICY: boolean; | ||
| 75 | - VITE_GLOB_ALARM_NOTIFY_POLLING_INTERVAL_TIME: number; | ||
| 76 | - VITE_GLOB_ALARM_NOTIFY_DURATION: number; | 56 | + VITE_PORT: number |
| 57 | + VITE_GLOB_USE_MOCK: boolean | ||
| 58 | + VITE_USE_PWA: boolean | ||
| 59 | + VITE_GLOB_PUBLIC_PATH: string | ||
| 60 | + VITE_PROXY: [string, string][] | ||
| 61 | + VITE_GLOB_APP_TITLE: string | ||
| 62 | + VITE_GLOB_APP_SHORT_NAME: string | ||
| 63 | + VITE_USE_CDN: boolean | ||
| 64 | + VITE_GLOB_DROP_CONSOLE: boolean | ||
| 65 | + VITE_GLOB_BUILD_COMPRESS: 'gzip' | 'brotli' | 'none' | ||
| 66 | + VITE_GLOB_BUILD_COMPRESS_DELETE_ORIGIN_FILE: boolean | ||
| 67 | + VITE_LEGACY: boolean | ||
| 68 | + VITE_GLOB_USE_IMAGEMIN: boolean | ||
| 69 | + VITE_GENERATE_UI: string | ||
| 70 | + VITE_GLOB_CONTENT_SECURITY_POLICY: boolean | ||
| 71 | + VITE_GLOB_ALARM_NOTIFY_POLLING_INTERVAL_TIME: number | ||
| 72 | + VITE_GLOB_ALARM_NOTIFY_DURATION: number | ||
| 77 | } | 73 | } |
| 78 | 74 | ||
| 79 | - declare function parseInt(s: string | number, radix?: number): number; | 75 | + declare function parseInt(s: string | number, radix?: number): number |
| 80 | 76 | ||
| 81 | - declare function parseFloat(string: string | number): number; | 77 | + declare function parseFloat(string: string | number): number |
| 82 | 78 | ||
| 83 | namespace JSX { | 79 | namespace JSX { |
| 84 | // tslint:disable no-empty-interface | 80 | // tslint:disable no-empty-interface |
| 85 | - type Element = VNode; | 81 | + type Element = VNode |
| 86 | // tslint:disable no-empty-interface | 82 | // tslint:disable no-empty-interface |
| 87 | - type ElementClass = ComponentRenderProxy; | 83 | + type ElementClass = ComponentRenderProxy |
| 88 | interface ElementAttributesProperty { | 84 | interface ElementAttributesProperty { |
| 89 | - $props: any; | ||
| 90 | - } | ||
| 91 | - interface IntrinsicElements { | ||
| 92 | - [elem: string]: any; | ||
| 93 | - } | ||
| 94 | - interface IntrinsicAttributes { | ||
| 95 | - [elem: string]: any; | 85 | + $props: any |
| 96 | } | 86 | } |
| 87 | + | ||
| 88 | + type IntrinsicElements = Record<string, any> | ||
| 89 | + type IntrinsicAttributes = Record<string, any> | ||
| 97 | } | 90 | } |
| 91 | + | ||
| 92 | + type AwaitToResult<T> = Awaited<ReturnType<T>> | ||
| 98 | } | 93 | } |
| 99 | 94 | ||
| 100 | declare module 'vue' { | 95 | declare module 'vue' { |
| 101 | export type JSXComponent<Props = any> = | 96 | export type JSXComponent<Props = any> = |
| 102 | - | { new (): ComponentPublicInstance<Props> } | ||
| 103 | - | FunctionalComponent<Props>; | 97 | + | { new(): ComponentPublicInstance<Props> } |
| 98 | + | FunctionalComponent<Props> | ||
| 104 | } | 99 | } |
| @@ -16,8 +16,8 @@ function pathResolve(dir: string) { | @@ -16,8 +16,8 @@ function pathResolve(dir: string) { | ||
| 16 | export default defineConfig(({ mode, command }) => { | 16 | export default defineConfig(({ mode, command }) => { |
| 17 | 17 | ||
| 18 | const root = process.cwd() | 18 | const root = process.cwd() |
| 19 | - | ||
| 20 | - const env = loadEnv(mode, root) | 19 | + |
| 20 | + const env = loadEnv(mode, root) | ||
| 21 | 21 | ||
| 22 | const viteEnv = parseEnv(env) | 22 | const viteEnv = parseEnv(env) |
| 23 | 23 |