diff --git a/package.json b/package.json index 60adc1d..e20c450 100644 --- a/package.json +++ b/package.json @@ -33,11 +33,11 @@ "@pureadmin/descriptions": "^1.1.0", "@pureadmin/table": "^1.2.0", "@pureadmin/utils": "^1.1.5", - "@vueuse/core": "^9.3.0", + "@vueuse/core": "^9.4.0", "@vueuse/motion": "^2.0.0-beta.12", - "@vueuse/shared": "^9.1.1", + "@vueuse/shared": "^9.4.0", "animate.css": "^4.1.1", - "axios": "^0.27.2", + "axios": "^1.1.3", "dayjs": "^1.11.4", "echarts": "^5.3.3", "element-plus": "^2.2.16", @@ -56,7 +56,7 @@ "responsive-storage": "^2.1.0", "vue": "^3.2.40", "vue-i18n": "^9.2.2", - "vue-router": "^4.1.5", + "vue-router": "^4.1.6", "vue-types": "^4.2.1", "vxe-table": "^4.3.2", "xe-utils": "^3.5.6" @@ -111,7 +111,7 @@ "stylelint-config-recommended": "^6.0.0", "stylelint-config-standard": "^24.0.0", "stylelint-order": "^5.0.0", - "tailwindcss": "^3.1.8", + "tailwindcss": "^3.2.1", "terser": "^5.15.0", "typescript": "^4.7.4", "unplugin-vue-define-options": "0.7.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8e44745..cf9bd64 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -29,12 +29,12 @@ specifiers: "@vue/eslint-config-prettier": ^7.0.0 "@vue/eslint-config-typescript": ^10.0.0 "@vue/runtime-core": ^3.2.40 - "@vueuse/core": ^9.3.0 + "@vueuse/core": ^9.4.0 "@vueuse/motion": ^2.0.0-beta.12 - "@vueuse/shared": ^9.1.1 + "@vueuse/shared": ^9.4.0 animate.css: ^4.1.1 autoprefixer: ^10.4.12 - axios: ^0.27.2 + axios: ^1.1.3 cloc: ^2.10.0 cssnano: ^5.1.13 dayjs: ^1.11.4 @@ -76,7 +76,7 @@ specifiers: stylelint-config-recommended: ^6.0.0 stylelint-config-standard: ^24.0.0 stylelint-order: ^5.0.0 - tailwindcss: ^3.1.8 + tailwindcss: ^3.2.1 terser: ^5.15.0 typescript: ^4.7.4 unplugin-vue-define-options: 0.7.3 @@ -87,7 +87,7 @@ specifiers: vue: ^3.2.40 vue-eslint-parser: ^8.2.0 vue-i18n: ^9.2.2 - vue-router: ^4.1.5 + vue-router: ^4.1.6 vue-tsc: ^0.40.13 vue-types: ^4.2.1 vxe-table: ^4.3.2 @@ -99,11 +99,11 @@ dependencies: "@pureadmin/descriptions": 1.1.1 "@pureadmin/table": 1.2.0 "@pureadmin/utils": 1.1.5_7f78bda4b8c80174b50d3da38250cc61 - "@vueuse/core": 9.3.1_vue@3.2.41 + "@vueuse/core": 9.4.0_vue@3.2.41 "@vueuse/motion": 2.0.0-beta.12_vue@3.2.41 - "@vueuse/shared": 9.3.1_vue@3.2.41 + "@vueuse/shared": 9.4.0_vue@3.2.41 animate.css: 4.1.1 - axios: 0.27.2 + axios: 1.1.3 dayjs: 1.11.5 echarts: 5.4.0 element-plus: 2.2.18_vue@3.2.41 @@ -122,7 +122,7 @@ dependencies: responsive-storage: 2.1.0 vue: 3.2.41 vue-i18n: 9.2.2_vue@3.2.41 - vue-router: 4.1.5_vue@3.2.41 + vue-router: 4.1.6_vue@3.2.41 vue-types: 4.2.1_vue@3.2.41 vxe-table: 4.3.5_vue@3.2.41+xe-utils@3.5.7 xe-utils: 3.5.7 @@ -177,7 +177,7 @@ devDependencies: stylelint-config-recommended: 6.0.0_stylelint@14.14.0 stylelint-config-standard: 24.0.0_stylelint@14.14.0 stylelint-order: 5.0.0_stylelint@14.14.0 - tailwindcss: 3.1.8 + tailwindcss: 3.2.1 terser: 5.15.1 typescript: 4.8.4 unplugin-vue-define-options: 0.7.3_vite@3.1.8+vue@3.2.41 @@ -1947,15 +1947,15 @@ packages: vue-demi: 0.13.11_vue@3.2.41 dev: false - /@vueuse/core/9.3.1_vue@3.2.41: + /@vueuse/core/9.4.0_vue@3.2.41: resolution: { - integrity: sha512-xriyD+v3D2ObH/UtnkEl+1sbcLBVHNaZaLi/rqoNEe/B92hggDEFQIGXoQUjdRzYOjASHSezf9uCDtmd7LeWyA== + integrity: sha512-JzgenGj1ZF2BHOen5rsFiAyyI9sXAv7aKhNLlm9b7SwYQeKTcxTWdhudonURCSP3Egl9NQaRBzes2lv/1JUt/Q== } dependencies: "@types/web-bluetooth": 0.0.16 - "@vueuse/metadata": 9.3.1 - "@vueuse/shared": 9.3.1_vue@3.2.41 + "@vueuse/metadata": 9.4.0 + "@vueuse/shared": 9.4.0_vue@3.2.41 vue-demi: 0.13.11_vue@3.2.41 transitivePeerDependencies: - "@vue/composition-api" @@ -1969,10 +1969,10 @@ packages: } dev: false - /@vueuse/metadata/9.3.1: + /@vueuse/metadata/9.4.0: resolution: { - integrity: sha512-G1BPhtx3OHaL/y4OZBofh6Xt02G1VA9PuOO8nac9sTKMkMqfyez5VfkF3D9GUjSRNO7cVWyH4rceeGXfr2wdMg== + integrity: sha512-7GKMdGAsJyQJl35MYOz/RDpP0FxuiZBRDSN79QIPbdqYx4Sd0sVTnIC68KJ6Oln0t0SouvSUMvRHuno216Ud2Q== } dev: false @@ -2015,10 +2015,10 @@ packages: vue-demi: 0.13.11_vue@3.2.41 dev: false - /@vueuse/shared/9.3.1_vue@3.2.41: + /@vueuse/shared/9.4.0_vue@3.2.41: resolution: { - integrity: sha512-YFu3qcnVeu0S2L4XdQJtBpDcjz6xwqHZtTv/XRhu66/yge1XVhxskUcc7VZbX52xF9A34V6KCfwncP9YDqYFiw== + integrity: sha512-fTuem51KwMCnqUKkI8B57qAIMcFovtGgsCtAeqxIzH3i6nE9VYge+gVfneNHAAy7lj8twbkNfqQSygOPJTm4tQ== } dependencies: vue-demi: 0.13.11_vue@3.2.41 @@ -2315,14 +2315,15 @@ packages: postcss-value-parser: 4.2.0 dev: true - /axios/0.27.2: + /axios/1.1.3: resolution: { - integrity: sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ== + integrity: sha512-00tXVRwKx/FZr/IDVFt4C+f9FYairX517WoGCL6dpOntqLkZofjhu43F/Xl44UOpqa+9sLFDrG/XAnFsUYgkDA== } dependencies: follow-redirects: 1.15.2 form-data: 4.0.0 + proxy-from-env: 1.1.0 transitivePeerDependencies: - debug dev: false @@ -3245,7 +3246,7 @@ packages: "@popperjs/core": /@sxzz/popperjs-es/2.11.7 "@types/lodash": 4.14.186 "@types/lodash-es": 4.17.6 - "@vueuse/core": 9.3.1_vue@3.2.41 + "@vueuse/core": 9.4.0_vue@3.2.41 async-validator: 4.2.5 dayjs: 1.11.5 escape-html: 1.0.3 @@ -5947,10 +5948,10 @@ packages: postcss-selector-parser: 6.0.10 dev: true - /postcss-nested/5.0.6_postcss@8.4.18: + /postcss-nested/6.0.0_postcss@8.4.18: resolution: { - integrity: sha512-rKqm2Fk0KbA8Vt3AdGN0FB9OBOMDVajMG6ZCf/GoHgdxUJ4sBFp0A/uMIRm+MJUdo33YXEtjqIz8u7DAp8B7DA== + integrity: sha512-0DkamqrPcmkBDsLn+vQDIrtkSbNkv5AD/M322ySo9kqFkCIYklym2xEmWkwo+Y3/qZo34tzEPNUw4y7yMCdv5w== } engines: { node: ">=12.0" } peerDependencies: @@ -6271,6 +6272,13 @@ packages: engines: { node: ">= 0.6.0" } dev: false + /proxy-from-env/1.1.0: + resolution: + { + integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== + } + dev: false + /pump/3.0.0: resolution: { @@ -7143,10 +7151,10 @@ packages: strip-ansi: 6.0.1 dev: true - /tailwindcss/3.1.8: + /tailwindcss/3.2.1: resolution: { - integrity: sha512-YSneUCZSFDYMwk+TGq8qYFdCA3yfBRdBlS7txSq0LUmzyeqRe3a8fBQzbz9M3WS/iFT4BNf/nmw9mEzrnSaC0g== + integrity: sha512-Uw+GVSxp5CM48krnjHObqoOwlCt5Qo6nw1jlCRwfGy68dSYb/LwS9ZFidYGRiM+w6rMawkZiu1mEMAsHYAfoLg== } engines: { node: ">=12.13.0" } hasBin: true @@ -7161,6 +7169,7 @@ packages: glob-parent: 6.0.2 is-glob: 4.0.3 lilconfig: 2.0.6 + micromatch: 4.0.5 normalize-path: 3.0.0 object-hash: 3.0.0 picocolors: 1.0.0 @@ -7168,7 +7177,7 @@ packages: postcss-import: 14.1.0_postcss@8.4.18 postcss-js: 4.0.0_postcss@8.4.18 postcss-load-config: 3.1.4_postcss@8.4.18 - postcss-nested: 5.0.6_postcss@8.4.18 + postcss-nested: 6.0.0_postcss@8.4.18 postcss-selector-parser: 6.0.10 postcss-value-parser: 4.2.0 quick-lru: 5.1.1 @@ -7620,10 +7629,10 @@ packages: vue: 3.2.41 dev: false - /vue-router/4.1.5_vue@3.2.41: + /vue-router/4.1.6_vue@3.2.41: resolution: { - integrity: sha512-IsvoF5D2GQ/EGTs/Th4NQms9gd2NSqV+yylxIyp/OYp8xOwxmU8Kj/74E9DTSYAyH5LX7idVUngN3JSj1X4xcQ== + integrity: sha512-DYWYwsG6xNPmLq/FmZn8Ip+qrhFEzA14EI12MsMgVxvHFDYvlr4NXpVF5hrRH1wVcDP8fGi5F4rxuJSl8/r+EQ== } peerDependencies: vue: ^3.2.0 diff --git a/src/router/utils.ts b/src/router/utils.ts index 9889b0c..caddb0a 100644 --- a/src/router/utils.ts +++ b/src/router/utils.ts @@ -270,9 +270,9 @@ function addAsyncRoutes(arrRoutes: Array) { // 父级的redirect属性取值:如果子级存在且父级的redirect属性不存在,默认取第一个子级的path;如果子级存在且父级的redirect属性存在,取存在的redirect属性,会覆盖默认值 if (v?.children && v.children.length && !v.redirect) v.redirect = v.children[0].path; - // 父级的name属性取值:如果子级存在且父级的name属性不存在,默认取第一个子级的name;如果子级存在且父级的name属性存在,取存在的name属性,会覆盖默认值 + // 父级的name属性取值:如果子级存在且父级的name属性不存在,默认取第一个子级的name;如果子级存在且父级的name属性存在,取存在的name属性,会覆盖默认值(注意:测试中发现父级的name不能和子级name重复,如果重复会造成重定向无效(跳转404),所以这里给父级的name起名的时候后面会自动加上`Parent`,避免重复) if (v?.children && v.children.length && !v.name) - v.name = v.children[0].name; + v.name = (v.children[0].name as string) + "Parent"; if (v.meta?.frameSrc) { v.component = IFrame; } else { diff --git a/src/utils/http/index.ts b/src/utils/http/index.ts index 3cfdf43..b539595 100644 --- a/src/utils/http/index.ts +++ b/src/utils/http/index.ts @@ -1,11 +1,15 @@ -import Axios, { AxiosInstance, AxiosRequestConfig } from "axios"; +import Axios, { + AxiosInstance, + AxiosRequestConfig, + CustomParamsSerializer +} from "axios"; import { PureHttpError, RequestMethods, PureHttpResponse, PureHttpRequestConfig } from "./types.d"; -import qs from "qs"; +import { stringify } from "qs"; import NProgress from "../progress"; // import { loadEnv } from "@build/index"; import { getToken } from "/@/utils/auth"; @@ -20,7 +24,7 @@ const defaultConfig: AxiosRequestConfig = { // process.env.NODE_ENV === "production" // ? VITE_PROXY_DOMAIN_REAL // : VITE_PROXY_DOMAIN, - // 当前使用mock模拟请求,将baseURL制空,如果你的环境用到了http请求,请删除下面的baseURL启用上面的baseURL,并将第10行、15行代码注释取消 + // 当前使用mock模拟请求,将baseURL制空,如果你的环境用到了http请求,请删除下面的baseURL启用上面的baseURL,并将第14行、19行代码注释取消 baseURL: "", timeout: 10000, headers: { @@ -28,8 +32,10 @@ const defaultConfig: AxiosRequestConfig = { "Content-Type": "application/json", "X-Requested-With": "XMLHttpRequest" }, - // 数组格式参数序列化 - paramsSerializer: params => qs.stringify(params, { indices: false }) + // 数组格式参数序列化(https://github.com/axios/axios/issues/5142) + paramsSerializer: { + serialize: stringify as unknown as CustomParamsSerializer + } }; class PureHttp {