Commit c72433774ceb72810cb4b3d33a6d76205bcf4ebf

Authored by ww
1 parent 310dafe8

feat: 项目环境配置, 新增登录相关,新增环境变量

1 1 # Proxy
2 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 11 VITE_GLOB_CONTENT_SECURITY_POLICY = false
... ...
1 1 # Proxy
2 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 10 VITE_GLOB_CONTENT_SECURITY_POLICY = true
... ...
... ... @@ -2,22 +2,27 @@ module.exports = {
2 2 root: true,
3 3 parser: 'vue-eslint-parser',
4 4 globals: {
5   - postMessage: true
  5 + postMessage: true,
6 6 },
7 7 parserOptions: {
8 8 parser: '@typescript-eslint/parser',
9 9 sourceType: 'module',
10 10 ecmaFeatures: {
11 11 jsx: true,
12   - tsx: true
13   - }
  12 + tsx: true,
  13 + },
14 14 },
15 15 env: {
16   - node: true,
  16 + 'node': true,
17 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 26 rules: {
22 27 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
23 28 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
... ... @@ -25,6 +30,6 @@ module.exports = {
25 30 'vue/no-unused-vars': 'off',
26 31 'vue/multi-word-component-names': 'off',
27 32 'vue/valid-template-root': 'off',
28   - 'vue/no-mutating-props': 'off'
29   - }
  33 + 'vue/no-mutating-props': 'off',
  34 + },
30 35 }
... ...
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 53 "@types/node": "^16.11.26",
54 54 "@types/qs": "^6.9.7",
55 55 "@types/three": "^0.144.0",
56   - "@typescript-eslint/eslint-plugin": "^5.18.0",
  56 + "@typescript-eslint/eslint-plugin": "^5.28.0",
57 57 "@typescript-eslint/parser": "^5.18.0",
58 58 "@vicons/carbon": "^0.12.0",
59 59 "@vicons/ionicons5": "~0.11.0",
... ...
... ... @@ -12,7 +12,7 @@ specifiers:
12 12 '@types/node': ^16.11.26
13 13 '@types/qs': ^6.9.7
14 14 '@types/three': ^0.144.0
15   - '@typescript-eslint/eslint-plugin': ^5.18.0
  15 + '@typescript-eslint/eslint-plugin': ^5.28.0
16 16 '@typescript-eslint/parser': ^5.18.0
17 17 '@vicons/carbon': ^0.12.0
18 18 '@vicons/ionicons5': ~0.11.0
... ...
... ... @@ -7,14 +7,11 @@ export const useGlobSetting = (): Readonly<GlobConfig> => {
7 7 VITE_GLOB_API_URL,
8 8 VITE_GLOB_APP_SHORT_NAME,
9 9 VITE_GLOB_API_URL_PREFIX,
10   - VITE_GLOB_UPLOAD_URL,
11   - VITE_GLOB_CONFIGURATION,
  10 + VITE_GLOB_UPLOAD_URL,
12 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 13 } = getAppEnvConfig();
17   -
  14 +
18 15 if (!/[a-zA-Z_]*/.test(VITE_GLOB_APP_SHORT_NAME)) {
19 16 console.warn(
20 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 24 apiUrl: VITE_GLOB_API_URL,
28 25 shortName: VITE_GLOB_APP_SHORT_NAME,
29 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 28 socketUrl: VITE_GLOB_WEB_SOCKET,
33 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 32 return glob as Readonly<GlobConfig>;
38 33 };
... ...
... ... @@ -14,7 +14,7 @@ export const groupTitle = "分组"
14 14 // 主题配置
15 15 export const theme = {
16 16 // 默认是否开启深色主题
17   - darkTheme: true,
  17 + darkTheme: false,
18 18 //默认主题色
19 19 appTheme: '#51d6a9',
20 20 appThemeDetail: null,
... ...
... ... @@ -12,7 +12,7 @@ import {
12 12 RefreshTokenParams,
13 13 SmsLoginParams,
14 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 16 import router from '@/router';
17 17 import { createLocalStorage } from '@/utils/external/cache';
18 18 import { useI18n } from 'vue-i18n';
... ... @@ -133,12 +133,25 @@ export const useUserStore = defineStore({
133 133 try {
134 134 const { goHome = true, mode, ...loginParams } = params;
135 135 const data = await loginApi(loginParams, mode);
  136 + return this.process(data, goHome);
136 137 } catch (error) {
137 138 return Promise.reject(error);
138 139 }
139 140 },
140 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 156 async smsCodelogin(
144 157 params: SmsLoginParams & {
... ... @@ -149,7 +162,12 @@ export const useUserStore = defineStore({
149 162
150 163 },
151 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 173 * @description: logout
... ...
1 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 6 export function getCommonStoragePrefix() {
7 7 const { VITE_GLOB_APP_SHORT_NAME } = getAppEnvConfig();
... ... @@ -18,8 +18,9 @@ export function getAppEnvConfig() {
18 18
19 19 const ENV = (import.meta.env.DEV
20 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 22 : window[ENV_NAME as any]) as unknown as GlobEnvConfig;
  23 +
23 24 const {
24 25 VITE_GLOB_APP_TITLE,
25 26 VITE_GLOB_API_URL,
... ...
1 1 import type { ErrorMessageMode } from '/#/external/axios';
2 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 4 export function checkStatus(
8 5 status: number,
9 6 msg: string,
10 7 errorMessageMode: ErrorMessageMode = 'message'
11   -): void {
12   - const { t } = useI18n();
  8 +): void {
13 9 const userStore = useUserStoreWithOut();
14 10 let errMessage = msg;
15 11 switch (status) {
... ... @@ -20,8 +16,9 @@ export function checkStatus(
20 16 // Jump to the login page if not logged in, and carry the path of the current page
21 17 // Return to the current page after successful login. This step needs to be operated on the login page.
22 18 case 401:
23   - errMessage = '';
24   - userStore.logout()
  19 + errMessage = '没有权限';
  20 + userStore.setToken(undefined);
  21 + userStore.setSessionTimeout(true);
25 22 break;
26 23 case 403:
27 24 errMessage = '未授权';
... ... @@ -56,8 +53,10 @@ export function checkStatus(
56 53 break;
57 54 default:
58 55 }
59   - if (errMessage) {
  56 +
  57 + if (errMessage) {
60 58 if (errorMessageMode === 'message') {
  59 + const { error } = window['$message']
61 60 error(errMessage);
62 61 }
63 62 }
... ...
... ... @@ -14,12 +14,10 @@ import { setObjToUrlParams, deepMerge } from '@/utils/external';
14 14 import { joinTimestamp, formatRequestDate } from './helper';
15 15 import { PageEnum } from '@/enums/external/pageEnum';
16 16 import router from '@/router';
17   -import { useDialog } from 'naive-ui';
18 17
19 18 const globSetting = useGlobSetting();
20 19 const urlPrefix = globSetting.urlPrefix;
21 20
22   -const { success, error } = useDialog()
23 21 /**
24 22 * @description: 数据处理,方便区分多种处理方式
25 23 */
... ... @@ -47,6 +45,7 @@ const transform: AxiosTransform = {
47 45 if (apiUrl && isString(apiUrl)) {
48 46 config.url = `${apiUrl}${config.url}`;
49 47 }
  48 +
50 49 const params = config.params || {};
51 50 const data = config.data || false;
52 51 formatDate && data && !isString(data) && formatRequestDate(data);
... ...
  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 +}
... ...
  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 24 </layout-header>
25 25 <div class="go-login">
26 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 30 </n-carousel>
40 31 </div>
41 32 <div class="login-account">
... ... @@ -43,24 +34,11 @@
43 34 <n-collapse-transition :appear="true" :show="show">
44 35 <n-card class="login-account-card" :title="$t('login.desc')">
45 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 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 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 42 <template #prefix>
65 43 <n-icon size="18">
66 44 <PersonOutlineIcon></PersonOutlineIcon>
... ... @@ -69,12 +47,8 @@
69 47 </n-input>
70 48 </n-form-item>
71 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 52 <template #prefix>
79 53 <n-icon size="18">
80 54 <LockClosedOutlineIcon></LockClosedOutlineIcon>
... ... @@ -92,14 +66,9 @@
92 66 </div>
93 67 </n-form-item>
94 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 72 </n-form-item>
104 73 </n-form>
105 74 </n-card>
... ... @@ -127,6 +96,7 @@ import { PageEnum } from '@/enums/pageEnum'
127 96 import { icon } from '@/plugins'
128 97 import { StorageEnum } from '@/enums/storageEnum'
129 98 import { routerTurnByName, cryptoEncode, setLocalStorage } from '@/utils'
  99 +import { useLogin } from './external/useLogin'
130 100 const { GO_LOGIN_INFO_STORE } = StorageEnum
131 101
132 102 const { PersonOutlineIcon, LockClosedOutlineIcon } = icon.ionicons5
... ... @@ -203,6 +173,9 @@ const shuffleHandle = () => {
203 173 }, carouselInterval)
204 174 }
205 175
  176 +// YUN_TENG 登录钩子
  177 +const { login, loading: loginLoading } = useLogin()
  178 +
206 179 // 点击事件
207 180 const handleSubmit = (e: Event) => {
208 181 e.preventDefault()
... ... @@ -210,17 +183,20 @@ const handleSubmit = (e: Event) => {
210 183 if (!errors) {
211 184 const { username, password } = formInline
212 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 200 } else {
225 201 window['$message'].error(`${t('login.login_message')}!`)
226 202 }
... ... @@ -243,10 +219,12 @@ $carousel-image-height: 60vh;
243 219 * {
244 220 box-sizing: border-box;
245 221 }
  222 +
246 223 @include go(login-box) {
247 224 height: $go-login-height;
248 225 overflow: hidden;
249 226 @include background-image('background-image');
  227 +
250 228 &-header {
251 229 display: flex;
252 230 justify-content: space-between;
... ... @@ -254,6 +232,7 @@ $carousel-image-height: 60vh;
254 232 padding: 0 40px;
255 233 height: $--header-height;
256 234 }
  235 +
257 236 &-divider {
258 237 margin: 0;
259 238 padding-top: 0;
... ... @@ -267,20 +246,24 @@ $carousel-image-height: 60vh;
267 246 margin-top: -$--header-height;
268 247 height: $go-login-height;
269 248 width: 100vw;
  249 +
270 250 &-carousel {
271 251 width: $carousel-width;
272 252 margin-top: 100px;
273 253 min-width: 500px;
  254 +
274 255 &-img {
275 256 display: block;
276 257 margin: 0 auto;
277 258 height: $carousel-image-height;
278 259 }
279 260 }
  261 +
280 262 .login-account {
281 263 display: flex;
282 264 flex-direction: column;
283 265 margin: 0 160px;
  266 +
284 267 &-container {
285 268 width: $width;
286 269 }
... ... @@ -316,15 +299,18 @@ $carousel-image-height: 60vh;
316 299 width: 100vw;
317 300 height: 100vh;
318 301 background: url('@/assets/images/login/login-bg.png') no-repeat 0 -120px;
  302 +
319 303 .bg-slot {
320 304 width: $carousel-width;
321 305 }
  306 +
322 307 .bg-img-box {
323 308 position: relative;
324 309 display: flex;
325 310 flex-wrap: wrap;
326 311 width: 770px;
327 312 margin-right: -20px;
  313 +
328 314 &-li {
329 315 img {
330 316 margin-right: 20px;
... ... @@ -337,12 +323,15 @@ $carousel-image-height: 60vh;
337 323 }
338 324 }
339 325 }
  326 +
340 327 @media only screen and (max-width: 1200px) {
  328 +
341 329 .bg-img-box,
342 330 .bg-slot,
343 331 .go-login-carousel {
344 332 display: none !important;
345 333 }
  334 +
346 335 .go-login-box-footer {
347 336 position: relative;
348 337 }
... ...
... ... @@ -10,16 +10,41 @@
10 10 "resolveJsonModule": true,
11 11 "esModuleInterop": true,
12 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 25 "paths": {
16   - "@/*": ["src/*"],
17   - "/#/*": ["types/*"]
  26 + "@/*": [
  27 + "src/*"
  28 + ],
  29 + "/#/*": [
  30 + "types/*"
  31 + ]
18 32 },
19 33 "noImplicitAny": true, //不允许使用any
20 34 // "strictNullChecks": true, //不允许使用null
21 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 146 urlPrefix?: string;
147 147 // Project abbreviation
148 148 shortName: string;
149   - // configuration center proxy prefix
150   - configurationPrefix: string;
151 149 // socket url
152 150 socketUrl: string;
153   - // alarm notify alarm duration
154   - alarmNotifyDuration: string;
155   - // alarm notify polling interval
156   - alarmPollingInterval: string;
157 151 // upgrade your http policy to https
158 152 securityPolicy: string;
159 153 }
... ... @@ -168,14 +162,8 @@ export interface GlobEnvConfig {
168 162 VITE_GLOB_APP_SHORT_NAME: string;
169 163 // Upload url
170 164 VITE_GLOB_UPLOAD_URL?: string;
171   - // configuration
172   - VITE_GLOB_CONFIGURATION: string;
173 165 // socket
174 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 167 // notify duration
180 168 VITE_GLOB_ALARM_NOTIFY_DURATION: string;
181 169 }
... ...
1 1 import type {
  2 + ComponentPublicInstance,
2 3 ComponentRenderProxy,
  4 + FunctionalComponent,
3 5 VNode,
4 6 VNodeChild,
5   - ComponentPublicInstance,
6   - FunctionalComponent,
7 7 PropType as VuePropType,
8   -} from 'vue';
  8 +} from 'vue'
9 9
10 10 declare global {
11 11 const __APP_INFO__: {
12 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 20 // declare interface Window {
21 21 // // Global vue app instance
22 22 // __APP__: App<Element>;
23 23 // }
24 24
25 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 29 export type Writable<T> = {
30 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 38 declare type DeepPartial<T> = {
43 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 44 declare interface ChangeEvent extends Event {
49   - target: HTMLInputElement;
  45 + target: HTMLInputElement
50 46 }
51 47
52 48 declare interface WheelEvent {
53   - path?: EventTarget[];
  49 + path?: EventTarget[]
54 50 }
55 51 interface ImportMetaEnv extends ViteEnv {
56   - __: unknown;
  52 + __: unknown
57 53 }
58 54
59 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 79 namespace JSX {
84 80 // tslint:disable no-empty-interface
85   - type Element = VNode;
  81 + type Element = VNode
86 82 // tslint:disable no-empty-interface
87   - type ElementClass = ComponentRenderProxy;
  83 + type ElementClass = ComponentRenderProxy
88 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 95 declare module 'vue' {
101 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 16 export default defineConfig(({ mode, command }) => {
17 17
18 18 const root = process.cwd()
19   -
20   - const env = loadEnv(mode, root)
  19 +
  20 + const env = loadEnv(mode, root)
21 21
22 22 const viteEnv = parseEnv(env)
23 23
... ...