up 更新web端依赖包版本,修复潜在错误

This commit is contained in:
孟帅 2024-08-27 17:37:23 +08:00
parent 6cf80ed0fe
commit 33e5252516
11 changed files with 51 additions and 136 deletions

View File

@ -2,7 +2,7 @@
* Generate additional configuration files when used for packaging. The file can be configured with some global variables, so that it can be changed directly externally without repackaging * Generate additional configuration files when used for packaging. The file can be configured with some global variables, so that it can be changed directly externally without repackaging
*/ */
import { GLOB_CONFIG_FILE_NAME, OUTPUT_DIR } from '../constant'; import { GLOB_CONFIG_FILE_NAME, OUTPUT_DIR } from '../constant';
import fs, { writeFileSync } from 'fs-extra'; import fs from 'fs-extra';
import chalk from 'chalk'; import chalk from 'chalk';
import { getRootPath, getEnvConfig } from '../utils'; import { getRootPath, getEnvConfig } from '../utils';
@ -28,7 +28,7 @@ function createConfig(
}); });
`.replace(/\s/g, ''); `.replace(/\s/g, '');
fs.mkdirp(getRootPath(OUTPUT_DIR)); fs.mkdirp(getRootPath(OUTPUT_DIR));
writeFileSync(getRootPath(`${OUTPUT_DIR}/${configFileName}`), configStr); fs.writeFileSync(getRootPath(`${OUTPUT_DIR}/${configFileName}`), configStr);
console.log(chalk.cyan(`✨ [${pkg.name}]`) + ` - configuration file is build successfully:`); console.log(chalk.cyan(`✨ [${pkg.name}]`) + ` - configuration file is build successfully:`);
console.log(chalk.gray(OUTPUT_DIR + '/' + chalk.green(configFileName)) + '\n'); console.log(chalk.gray(OUTPUT_DIR + '/' + chalk.green(configFileName)) + '\n');

View File

@ -2,10 +2,7 @@
* Plugin to minimize and use ejs template syntax in index.html. * Plugin to minimize and use ejs template syntax in index.html.
* https://github.com/anncwb/vite-plugin-html * https://github.com/anncwb/vite-plugin-html
*/ */
import type { Plugin } from 'vite'; import { createHtmlPlugin } from 'vite-plugin-html';
import html from 'vite-plugin-html';
import pkg from '../../../package.json'; import pkg from '../../../package.json';
import { GLOB_CONFIG_FILE_NAME } from '../../constant'; import { GLOB_CONFIG_FILE_NAME } from '../../constant';
@ -18,25 +15,24 @@ export function configHtmlPlugin(env: ViteEnv, isBuild: boolean) {
return `${path || '/'}${GLOB_CONFIG_FILE_NAME}?v=${pkg.version}-${new Date().getTime()}`; return `${path || '/'}${GLOB_CONFIG_FILE_NAME}?v=${pkg.version}-${new Date().getTime()}`;
}; };
const htmlPlugin: Plugin[] = html({ return createHtmlPlugin({
minify: isBuild, minify: isBuild,
inject: { inject: {
// Inject data into ejs template // Inject data into ejs template
injectData: { data: {
title: VITE_GLOB_APP_TITLE, title: VITE_GLOB_APP_TITLE,
}, },
// Embed the generated app.config.js file // Embed the generated app.config.js file
tags: isBuild tags: isBuild
? [ ? [
{ {
tag: 'script', tag: 'script',
attrs: { attrs: {
src: getAppConfigSrc(), src: getAppConfigSrc(),
},
}, },
] },
]
: [], : [],
}, },
}); });
return htmlPlugin;
} }

View File

@ -1,5 +1,6 @@
{ {
"name": "hotgo", "name": "hotgo",
"type": "module",
"version": "2.15.7", "version": "2.15.7",
"author": { "author": {
"name": "MengShuai", "name": "MengShuai",
@ -33,9 +34,9 @@
"@vue/runtime-core": "^3.4.21", "@vue/runtime-core": "^3.4.21",
"@vueup/vue-quill": "^1.2.0", "@vueup/vue-quill": "^1.2.0",
"@vueuse/core": "^10.9.0", "@vueuse/core": "^10.9.0",
"axios": "^1.6.8", "axios": "^1.7.2",
"date-fns": "^2.28.0", "date-fns": "^2.30.0",
"echarts": "^5.5.0", "echarts": "^5.5.1",
"element-resize-detector": "^1.2.4", "element-resize-detector": "^1.2.4",
"fingerprintjs2": "^2.1.4", "fingerprintjs2": "^2.1.4",
"highlight.js": "^11.8.0", "highlight.js": "^11.8.0",
@ -46,33 +47,33 @@
"pinyin-pro": "^3.16.3", "pinyin-pro": "^3.16.3",
"print-js": "^1.6.0", "print-js": "^1.6.0",
"qrcode.vue": "3.3.3", "qrcode.vue": "3.3.3",
"qs": "^6.10.3", "qs": "^6.12.1",
"quill-image-uploader": "^1.3.0", "quill-image-uploader": "^1.3.0",
"quill-magic-url": "^4.2.0", "quill-magic-url": "^4.2.0",
"spark-md5": "^3.0.2", "spark-md5": "^3.0.2",
"throttle-debounce": "^5.0.0", "throttle-debounce": "^5.0.0",
"vue": "^3.4.21", "vue": "^3.4.31",
"vue-router": "^4.3.0", "vue-router": "^4.4.0",
"vue-types": "^5.1.1", "vue-types": "^4.2.1",
"vue-waterfall-plugin-next": "^2.2.3", "vue-waterfall-plugin-next": "^2.2.3",
"vue3-json-viewer": "^2.2.2", "vue3-json-viewer": "^2.2.2",
"vuedraggable": "^4.1.0", "vuedraggable": "^4.1.0",
"weixin-js-sdk": "^1.6.0" "weixin-js-sdk": "^1.6.0"
}, },
"devDependencies": { "devDependencies": {
"@commitlint/cli": "^17.7.0", "@commitlint/cli": "^17.8.1",
"@commitlint/config-conventional": "^17.7.0", "@commitlint/config-conventional": "^17.8.1",
"@types/lodash": "^4.14.197", "@types/lodash": "^4.17.6",
"@types/node": "^18.17.4", "@types/node": "^18.19.39",
"@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0", "@typescript-eslint/parser": "^5.62.0",
"@vitejs/plugin-vue": "^3.2.0", "@vitejs/plugin-vue": "^3.2.0",
"@vitejs/plugin-vue-jsx": "^2.1.1", "@vitejs/plugin-vue-jsx": "^2.1.1",
"@vue/compiler-sfc": "^3.4.21", "@vue/compiler-sfc": "^3.4.31",
"@vue/eslint-config-typescript": "^11.0.3", "@vue/eslint-config-typescript": "^11.0.3",
"autoprefixer": "^10.4.19", "autoprefixer": "^10.4.19",
"commitizen": "^4.3.0", "commitizen": "^4.3.0",
"core-js": "^3.36.1", "core-js": "^3.37.1",
"crypto-js": "^4.2.0", "crypto-js": "^4.2.0",
"dotenv": "^16.4.5", "dotenv": "^16.4.5",
"eslint": "^8.57.0", "eslint": "^8.57.0",
@ -80,7 +81,7 @@
"eslint-define-config": "1.12.0", "eslint-define-config": "1.12.0",
"eslint-plugin-jest": "^27.9.0", "eslint-plugin-jest": "^27.9.0",
"eslint-plugin-prettier": "^4.2.1", "eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-vue": "^9.24.1", "eslint-plugin-vue": "^9.26.0",
"esno": "^0.16.3", "esno": "^0.16.3",
"gh-pages": "^4.0.0", "gh-pages": "^4.0.0",
"husky": "^8.0.3", "husky": "^8.0.3",
@ -97,17 +98,17 @@
"stylelint-config-standard": "^29.0.0", "stylelint-config-standard": "^29.0.0",
"stylelint-order": "^5.0.0", "stylelint-order": "^5.0.0",
"stylelint-scss": "^4.7.0", "stylelint-scss": "^4.7.0",
"tailwindcss": "^2.2.19", "tailwindcss": "^3.4.4",
"typescript": "^5.3.0", "typescript": "^5.3.0",
"unplugin-vue-components": "^0.22.12", "unplugin-vue-components": "^0.22.12",
"vite": "^4.5.3", "vite": "^5.3.2",
"vite-plugin-compression": "^0.5.1", "vite-plugin-compression": "^0.5.1",
"vite-plugin-html": "^2.1.2", "vite-plugin-html": "^3.2.2",
"vite-plugin-require-transform": "^1.0.5", "vite-plugin-require-transform": "^1.0.5",
"vite-plugin-style-import": "^2.0.0", "vite-plugin-style-import": "^2.0.0",
"vite-plugin-top-level-await": "^1.2.2", "vite-plugin-top-level-await": "^1.2.2",
"vite-plugin-vue-setup-extend": "^0.4.0", "vite-plugin-vue-setup-extend": "^0.4.0",
"vue-eslint-parser": "^7.11.0" "vue-eslint-parser": "^9.4.3"
}, },
"lint-staged": { "lint-staged": {
"*.{vue,js,ts,tsx}": "eslint --fix" "*.{vue,js,ts,tsx}": "eslint --fix"

View File

@ -21,16 +21,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { import { getCurrentInstance, ref, nextTick, unref, computed, useAttrs } from 'vue';
getCurrentInstance,
ref,
nextTick,
unref,
computed,
useAttrs,
defineEmits,
defineProps,
} from 'vue';
import { basicProps } from './props'; import { basicProps } from './props';
import startDrag from '@/utils/Drag'; import startDrag from '@/utils/Drag';
import { deepMerge } from '@/utils'; import { deepMerge } from '@/utils';

View File

@ -129,10 +129,9 @@ export const dynamicImport = (
* *
* @param menus * @param menus
*/ */
export const removeHiddenMenus = (menus: RouteRecordRaw[]) => { export const removeHiddenMenus = (menus: any[]) => {
const arr = []; const arr: any[] = [];
for (let j = 0; j < menus.length; j++) { for (let j = 0; j < menus.length; j++) {
// console.log('menus[j]:' + JSON.stringify(menus[j]));
if (menus[j].meta?.type === 3) { if (menus[j].meta?.type === 3) {
continue; continue;
} }
@ -140,19 +139,13 @@ export const removeHiddenMenus = (menus: RouteRecordRaw[]) => {
continue; continue;
} }
// @ts-ignore
if (menus[j].children?.length > 0) { if (menus[j].children?.length > 0) {
// @ts-ignore
menus[j].children = removeHiddenMenus(menus[j].children); menus[j].children = removeHiddenMenus(menus[j].children);
if (menus[j].children?.length === 0) { if (menus[j].children?.length === 0) {
delete menus[j].children; delete menus[j].children;
} }
} }
// @ts-ignore
arr.push(menus[j]); arr.push(menus[j]);
} }
// @ts-ignore
return arr; return arr;
}; };

View File

@ -3,9 +3,10 @@ import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router';
import { RedirectRoute } from '@/router/base'; import { RedirectRoute } from '@/router/base';
import { PageEnum } from '@/enums/pageEnum'; import { PageEnum } from '@/enums/pageEnum';
import { createRouterGuards } from './router-guards'; import { createRouterGuards } from './router-guards';
import { createRouterIcon } from './router-icons';
// @ts-ignore // @ts-ignore
const modules = import.meta.globEager('./modules/**/*.ts'); const modules = import.meta.glob('./modules/**/*.ts');
const routeModuleList: RouteRecordRaw[] = []; const routeModuleList: RouteRecordRaw[] = [];
Object.keys(modules).forEach((key) => { Object.keys(modules).forEach((key) => {
@ -55,6 +56,7 @@ export function setupRouter(app: App) {
app.use(router); app.use(router);
// 创建路由守卫 // 创建路由守卫
createRouterGuards(router); createRouterGuards(router);
createRouterIcon();
} }
export default router; export default router;

View File

@ -1,12 +1,15 @@
import { renderIcon } from '@/utils/index'; import { renderIcon } from '@/utils';
import * as antdIcons from '@vicons/antd'; import * as antdIcons from '@vicons/antd';
// import * as x5Icons from '@vicons/ionicons5'; // import * as x5Icons from '@vicons/ionicons5';
export const constantRouterIcon = {}; export const constantRouterIcon = {};
for (const element of Object.keys(antdIcons)) {
constantRouterIcon[element] = renderIcon(antdIcons[element]);
}
// for (const element of Object.keys(x5Icons)) { export function createRouterIcon() {
// constantRouterIcon[element] = renderIcon(x5Icons[element]); for (const element of Object.keys(antdIcons)) {
// } constantRouterIcon[element] = renderIcon(antdIcons[element]);
}
// for (const element of Object.keys(x5Icons)) {
// constantRouterIcon[element] = renderIcon(x5Icons[element]);
// }
}

View File

@ -19,7 +19,7 @@ import { cloneDeep } from 'lodash-es';
import { VNode } from 'vue'; import { VNode } from 'vue';
import { DictType, useDictStore } from '@/store/modules/dict'; import { DictType, useDictStore } from '@/store/modules/dict';
import { fallbackSrc } from '@/utils/hotgo'; import { fallbackSrc } from '@/utils/hotgo';
import {getFileExt} from "@/utils/urlUtils"; import { getFileExt } from '@/utils/urlUtils';
export const renderTooltip = (trigger, content) => { export const renderTooltip = (trigger, content) => {
return h(NTooltip, null, { return h(NTooltip, null, {

View File

@ -19,7 +19,7 @@
</div> </div>
</template> </template>
<template v-else-if="index === 2" #extra="{ extra }"> <template v-else-if="index === 2" #extra="{ extra }">
<n-progress type="line" :percentage="extra.data" /> <n-progress type="line" :percentage="Number(extra.data)" />
</template> </template>
<template v-else-if="index === 3" #extra> <template v-else-if="index === 3" #extra>
<LoadChart ref="loadChartRef" :data-model="dataSource.load" /> <LoadChart ref="loadChartRef" :data-model="dataSource.load" />

View File

@ -1,78 +1,7 @@
module.exports = { module.exports = {
mode: 'jit', content: ['./index.html', './src/**/*.{vue,ts,tsx}'],
// darkMode: 'class', important: true,
plugins: [createEnterPlugin()],
purge: {
enable: process.env.NODE_ENV === 'production',
content: ['./index.html', './src/**/*.{vue,ts,tsx}'],
},
theme: { theme: {
extend: { extend: {},
zIndex: {
'-1': '-1',
},
colors: {
primary: {
DEFAULT: '#0960bd',
// dark: primaryColorDark,
},
},
screens: {
sm: '576px',
md: '768px',
lg: '992px',
xl: '1200px',
'2xl': '1600px',
},
},
}, },
}; };
/**
* Used for animation when the element is displayed
* @param maxOutput The larger the maxOutput output, the larger the generated css volume
*/
function createEnterPlugin(maxOutput = 6) {
const createCss = (index, d = 'x') => {
const upd = d.toUpperCase();
return {
[`*> .enter-${d}:nth-child(${index})`]: {
transform: `translate${upd}(50px)`,
},
[`*> .-enter-${d}:nth-child(${index})`]: {
transform: `translate${upd}(-50px)`,
},
[`* > .enter-${d}:nth-child(${index}),* > .-enter-${d}:nth-child(${index})`]: {
'z-index': `${10 - index}`,
opacity: '0',
animation: `enter-${d}-animation 0.4s ease-in-out 0.3s`,
'animation-fill-mode': 'forwards',
'animation-delay': `${(index * 1) / 10}s`,
},
};
};
const handler = ({ addBase }) => {
const addRawCss = {};
for (let index = 1; index < maxOutput; index++) {
Object.assign(addRawCss, {
...createCss(index, 'x'),
...createCss(index, 'y'),
});
}
addBase({
...addRawCss,
[`@keyframes enter-x-animation`]: {
to: {
opacity: '1',
transform: 'translateX(0)',
},
},
[`@keyframes enter-y-animation`]: {
to: {
opacity: '1',
transform: 'translateY(0)',
},
},
});
};
return { handler };
}