Commit 890412b9 by lijiabin

【需求 17679】 feat: 继续优化等

parent 0a8b3a2e
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
"lint": "eslint . --fix --cache", "lint": "eslint . --fix --cache",
"format": "prettier --write src/", "format": "prettier --write src/",
"build-only": "vite build", "build-only": "vite build",
"build:dev": "nvm use 20 && vite build --mode development",
"build:test": "nvm use 20 && vite build --mode test", "build:test": "nvm use 20 && vite build --mode test",
"deploy:test": "node deploy/deploytest.js", "deploy:test": "node deploy/deploytest.js",
"build:prod": "nvm use 20 && vite build --mode production", "build:prod": "nvm use 20 && vite build --mode production",
...@@ -45,6 +46,7 @@ ...@@ -45,6 +46,7 @@
"jiti": "^2.6.1", "jiti": "^2.6.1",
"npm-run-all2": "^8.0.4", "npm-run-all2": "^8.0.4",
"prettier": "3.6.2", "prettier": "3.6.2",
"rollup-plugin-visualizer": "^6.0.5",
"sass-embedded": "^1.93.2", "sass-embedded": "^1.93.2",
"typescript": "~5.9.0", "typescript": "~5.9.0",
"unocss": "^66.5.4", "unocss": "^66.5.4",
......
...@@ -78,6 +78,9 @@ importers: ...@@ -78,6 +78,9 @@ importers:
prettier: prettier:
specifier: 3.6.2 specifier: 3.6.2
version: 3.6.2 version: 3.6.2
rollup-plugin-visualizer:
specifier: ^6.0.5
version: 6.0.5(rollup@4.52.5)
sass-embedded: sass-embedded:
specifier: ^1.93.2 specifier: ^1.93.2
version: 1.93.2 version: 1.93.2
...@@ -1329,6 +1332,10 @@ packages: ...@@ -1329,6 +1332,10 @@ packages:
resolution: {integrity: sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==} resolution: {integrity: sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==}
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}
cliui@8.0.1:
resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==}
engines: {node: '>=12'}
clone@2.1.2: clone@2.1.2:
resolution: {integrity: sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==} resolution: {integrity: sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==}
engines: {node: '>=0.8'} engines: {node: '>=0.8'}
...@@ -1491,6 +1498,10 @@ packages: ...@@ -1491,6 +1498,10 @@ packages:
resolution: {integrity: sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==} resolution: {integrity: sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==}
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
define-lazy-prop@2.0.0:
resolution: {integrity: sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==}
engines: {node: '>=8'}
define-lazy-prop@3.0.0: define-lazy-prop@3.0.0:
resolution: {integrity: sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==} resolution: {integrity: sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==}
engines: {node: '>=12'} engines: {node: '>=12'}
...@@ -1863,6 +1874,10 @@ packages: ...@@ -1863,6 +1874,10 @@ packages:
resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==} resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==}
engines: {node: '>=6.9.0'} engines: {node: '>=6.9.0'}
get-caller-file@2.0.5:
resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==}
engines: {node: 6.* || 8.* || >= 10.*}
get-intrinsic@1.3.0: get-intrinsic@1.3.0:
resolution: {integrity: sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==} resolution: {integrity: sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==}
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
...@@ -2067,6 +2082,11 @@ packages: ...@@ -2067,6 +2082,11 @@ packages:
resolution: {integrity: sha512-JCNNGbwWZEVaSPtS45mdtrneRWJFp07LLmykxeFV5F6oBvNF8vHSfJuJgoT472pSfk+Mf8VnlrspaFBHWM8JAw==} resolution: {integrity: sha512-JCNNGbwWZEVaSPtS45mdtrneRWJFp07LLmykxeFV5F6oBvNF8vHSfJuJgoT472pSfk+Mf8VnlrspaFBHWM8JAw==}
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
is-docker@2.2.1:
resolution: {integrity: sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==}
engines: {node: '>=8'}
hasBin: true
is-docker@3.0.0: is-docker@3.0.0:
resolution: {integrity: sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==} resolution: {integrity: sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==}
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
...@@ -2181,6 +2201,10 @@ packages: ...@@ -2181,6 +2201,10 @@ packages:
resolution: {integrity: sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==} resolution: {integrity: sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==}
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}
is-wsl@2.2.0:
resolution: {integrity: sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==}
engines: {node: '>=8'}
is-wsl@3.1.0: is-wsl@3.1.0:
resolution: {integrity: sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==} resolution: {integrity: sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==}
engines: {node: '>=16'} engines: {node: '>=16'}
...@@ -2499,6 +2523,10 @@ packages: ...@@ -2499,6 +2523,10 @@ packages:
resolution: {integrity: sha512-YgBpdJHPyQ2UE5x+hlSXcnejzAvD0b22U2OuAP+8OnlJT+PjWPxtgmGqKKc+RgTM63U9gN0YzrYc71R2WT/hTA==} resolution: {integrity: sha512-YgBpdJHPyQ2UE5x+hlSXcnejzAvD0b22U2OuAP+8OnlJT+PjWPxtgmGqKKc+RgTM63U9gN0YzrYc71R2WT/hTA==}
engines: {node: '>=18'} engines: {node: '>=18'}
open@8.4.2:
resolution: {integrity: sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ==}
engines: {node: '>=12'}
optionator@0.9.4: optionator@0.9.4:
resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==} resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==}
engines: {node: '>= 0.8.0'} engines: {node: '>= 0.8.0'}
...@@ -2712,6 +2740,10 @@ packages: ...@@ -2712,6 +2740,10 @@ packages:
resolution: {integrity: sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w==} resolution: {integrity: sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w==}
engines: {node: '>=0.10'} engines: {node: '>=0.10'}
require-directory@2.1.1:
resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==}
engines: {node: '>=0.10.0'}
resolve-from@4.0.0: resolve-from@4.0.0:
resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==}
engines: {node: '>=4'} engines: {node: '>=4'}
...@@ -2731,6 +2763,19 @@ packages: ...@@ -2731,6 +2763,19 @@ packages:
rfdc@1.4.1: rfdc@1.4.1:
resolution: {integrity: sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==} resolution: {integrity: sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==}
rollup-plugin-visualizer@6.0.5:
resolution: {integrity: sha512-9+HlNgKCVbJDs8tVtjQ43US12eqaiHyyiLMdBwQ7vSZPiHMysGNo2E88TAp1si5wx8NAoYriI2A5kuKfIakmJg==}
engines: {node: '>=18'}
hasBin: true
peerDependencies:
rolldown: 1.x || ^1.0.0-beta
rollup: 2.x || 3.x || 4.x
peerDependenciesMeta:
rolldown:
optional: true
rollup:
optional: true
rollup@4.52.5: rollup@4.52.5:
resolution: {integrity: sha512-3GuObel8h7Kqdjt0gxkEzaifHTqLVW56Y/bjN7PSQtkKr0w3V/QYSdt6QWYtd7A1xUtYQigtdUfgj1RvWVtorw==} resolution: {integrity: sha512-3GuObel8h7Kqdjt0gxkEzaifHTqLVW56Y/bjN7PSQtkKr0w3V/QYSdt6QWYtd7A1xUtYQigtdUfgj1RvWVtorw==}
engines: {node: '>=18.0.0', npm: '>=8.0.0'} engines: {node: '>=18.0.0', npm: '>=8.0.0'}
...@@ -2980,6 +3025,10 @@ packages: ...@@ -2980,6 +3025,10 @@ packages:
resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==}
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}
source-map@0.7.6:
resolution: {integrity: sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ==}
engines: {node: '>= 12'}
speakingurl@14.0.1: speakingurl@14.0.1:
resolution: {integrity: sha512-1POYv7uv2gXoyGFpBCmpDVSNV74IfsWlDW216UPjbWufNf+bSU6GdbDsxdcxtfwb4xlI3yxzOTKClUosxARYrQ==} resolution: {integrity: sha512-1POYv7uv2gXoyGFpBCmpDVSNV74IfsWlDW216UPjbWufNf+bSU6GdbDsxdcxtfwb4xlI3yxzOTKClUosxARYrQ==}
engines: {node: '>=0.10.0'} engines: {node: '>=0.10.0'}
...@@ -3449,9 +3498,21 @@ packages: ...@@ -3449,9 +3498,21 @@ packages:
resolution: {integrity: sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==} resolution: {integrity: sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==}
engines: {node: '>=12'} engines: {node: '>=12'}
y18n@5.0.8:
resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==}
engines: {node: '>=10'}
yallist@3.1.1: yallist@3.1.1:
resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==} resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==}
yargs-parser@21.1.1:
resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==}
engines: {node: '>=12'}
yargs@17.7.2:
resolution: {integrity: sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==}
engines: {node: '>=12'}
yocto-queue@0.1.0: yocto-queue@0.1.0:
resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==}
engines: {node: '>=10'} engines: {node: '>=10'}
...@@ -4806,6 +4867,12 @@ snapshots: ...@@ -4806,6 +4867,12 @@ snapshots:
isobject: 3.0.1 isobject: 3.0.1
static-extend: 0.1.2 static-extend: 0.1.2
cliui@8.0.1:
dependencies:
string-width: 4.2.3
strip-ansi: 6.0.1
wrap-ansi: 7.0.0
clone@2.1.2: {} clone@2.1.2: {}
collection-visit@1.0.0: collection-visit@1.0.0:
...@@ -4954,6 +5021,8 @@ snapshots: ...@@ -4954,6 +5021,8 @@ snapshots:
es-errors: 1.3.0 es-errors: 1.3.0
gopd: 1.2.0 gopd: 1.2.0
define-lazy-prop@2.0.0: {}
define-lazy-prop@3.0.0: {} define-lazy-prop@3.0.0: {}
define-properties@1.2.1: define-properties@1.2.1:
...@@ -5431,6 +5500,8 @@ snapshots: ...@@ -5431,6 +5500,8 @@ snapshots:
gensync@1.0.0-beta.2: {} gensync@1.0.0-beta.2: {}
get-caller-file@2.0.5: {}
get-intrinsic@1.3.0: get-intrinsic@1.3.0:
dependencies: dependencies:
call-bind-apply-helpers: 1.0.2 call-bind-apply-helpers: 1.0.2
...@@ -5640,6 +5711,8 @@ snapshots: ...@@ -5640,6 +5711,8 @@ snapshots:
is-accessor-descriptor: 1.0.1 is-accessor-descriptor: 1.0.1
is-data-descriptor: 1.0.1 is-data-descriptor: 1.0.1
is-docker@2.2.1: {}
is-docker@3.0.0: {} is-docker@3.0.0: {}
is-extendable@0.1.1: {} is-extendable@0.1.1: {}
...@@ -5738,6 +5811,10 @@ snapshots: ...@@ -5738,6 +5811,10 @@ snapshots:
is-windows@1.0.2: {} is-windows@1.0.2: {}
is-wsl@2.2.0:
dependencies:
is-docker: 2.2.1
is-wsl@3.1.0: is-wsl@3.1.0:
dependencies: dependencies:
is-inside-container: 1.0.0 is-inside-container: 1.0.0
...@@ -6047,6 +6124,12 @@ snapshots: ...@@ -6047,6 +6124,12 @@ snapshots:
is-inside-container: 1.0.0 is-inside-container: 1.0.0
wsl-utils: 0.1.0 wsl-utils: 0.1.0
open@8.4.2:
dependencies:
define-lazy-prop: 2.0.0
is-docker: 2.2.1
is-wsl: 2.2.0
optionator@0.9.4: optionator@0.9.4:
dependencies: dependencies:
deep-is: 0.1.4 deep-is: 0.1.4
...@@ -6268,6 +6351,8 @@ snapshots: ...@@ -6268,6 +6351,8 @@ snapshots:
repeat-string@1.6.1: {} repeat-string@1.6.1: {}
require-directory@2.1.1: {}
resolve-from@4.0.0: {} resolve-from@4.0.0: {}
resolve-url@0.2.1: {} resolve-url@0.2.1: {}
...@@ -6278,6 +6363,15 @@ snapshots: ...@@ -6278,6 +6363,15 @@ snapshots:
rfdc@1.4.1: {} rfdc@1.4.1: {}
rollup-plugin-visualizer@6.0.5(rollup@4.52.5):
dependencies:
open: 8.4.2
picomatch: 4.0.3
source-map: 0.7.6
yargs: 17.7.2
optionalDependencies:
rollup: 4.52.5
rollup@4.52.5: rollup@4.52.5:
dependencies: dependencies:
'@types/estree': 1.0.8 '@types/estree': 1.0.8
...@@ -6560,6 +6654,8 @@ snapshots: ...@@ -6560,6 +6654,8 @@ snapshots:
source-map@0.6.1: {} source-map@0.6.1: {}
source-map@0.7.6: {}
speakingurl@14.0.1: {} speakingurl@14.0.1: {}
split-string@3.1.0: split-string@3.1.0:
...@@ -7163,8 +7259,22 @@ snapshots: ...@@ -7163,8 +7259,22 @@ snapshots:
xml-name-validator@4.0.0: {} xml-name-validator@4.0.0: {}
y18n@5.0.8: {}
yallist@3.1.1: {} yallist@3.1.1: {}
yargs-parser@21.1.1: {}
yargs@17.7.2:
dependencies:
cliui: 8.0.1
escalade: 3.2.0
get-caller-file: 2.0.5
require-directory: 2.1.1
string-width: 4.2.3
y18n: 5.0.8
yargs-parser: 21.1.1
yocto-queue@0.1.0: {} yocto-queue@0.1.0: {}
zip-stream@6.0.1: zip-stream@6.0.1:
......
...@@ -8,9 +8,15 @@ ...@@ -8,9 +8,15 @@
<script setup lang="ts"> <script setup lang="ts">
import zhCn from 'element-plus/es/locale/lang/zh-cn' import zhCn from 'element-plus/es/locale/lang/zh-cn'
import { useUserStore } from '@/stores/user' import { useUserStore } from '@/stores/user'
import { initWxConfig } from '@/utils/wxUtil/initWXConfig'
const locale = ref(zhCn) const locale = ref(zhCn)
// const userStore = useUserStore() // const userStore = useUserStore()
// userStore.fetchUserInfo().then((res) => { // userStore.fetchUserInfo().then((res) => {
// console.log(res) // console.log(res)
// }) // })
onMounted(() => {
const userStore = useUserStore()
alert('token' + userStore.token)
initWxConfig()
})
</script> </script>
import service from '@/utils/request/index' import service from '@/utils/request/index'
import type { LoginParams, LoginResponseDto } from './types' import type { LoginParams, LoginResponseDto } from './types'
import { app_config } from '@/config'
/** /**
* 登录 —— 根据 邮箱密码登录 * 登录 —— 根据 邮箱密码登录
...@@ -53,3 +54,18 @@ export const generateLoginKey = (data: GenerateLoginKeyData) => { ...@@ -53,3 +54,18 @@ export const generateLoginKey = (data: GenerateLoginKeyData) => {
data, data,
}) })
} }
/**
* 企业微信获取密钥
*/
export const getWxSignature = (url: string) => {
const loginType = app_config[import.meta.env.MODE]?.loginType
return service.request({
url: '/api/auth/getSign',
method: 'POST',
data: {
url,
reqType: loginType,
},
})
}
...@@ -25,4 +25,5 @@ export interface LoginResponseDto { ...@@ -25,4 +25,5 @@ export interface LoginResponseDto {
credentialsNonExpired: boolean credentialsNonExpired: boolean
accountNonLocked: boolean accountNonLocked: boolean
token: string token: string
userId: number
} }
...@@ -3,34 +3,31 @@ interface IConfig { ...@@ -3,34 +3,31 @@ interface IConfig {
baseUrl: string baseUrl: string
/** 用户登录 type */ /** 用户登录 type */
loginType: number loginType: number
/** 微信登录跳转路径 */ // /** 微信登录跳转路径 */
wxRedirect: string // wxRedirect: string
} }
export const app_config: { [key: string]: IConfig } = { export const app_config: { [key: string]: IConfig } = {
// 正式环境 // 正式环境
production: { production: {
baseUrl: 'https://culture.yswg.com.cn:8089', baseUrl: 'http://culture.yswg.com.cn:8089',
loginType: 3, loginType: 1, // 3
wxRedirect: 'oa3.yswg.com.cn', // wxRedirect: 'oa3.yswg.com.cn',
}, },
// 测试环境 暂时无测试环境部署 // 测试环境 暂时无测试环境部署
test: { test: {
baseUrl: 'http://192.168.2.55:8089', // 首拥本地 baseUrl: 'http://192.168.2.55:8089', // 首拥本地
loginType: 1, loginType: 1,
wxRedirect: 'oatest.yswg.com.cn:3457', // wxRedirect: 'oatest.yswg.com.cn:3457',
}, },
// 开发环境 // 开发环境
development: { development: {
// baseUrl: 'http://oa.yswg.com.cn:8082', // 正式环境
baseUrl: '/api1', // 线上测试机
// baseUrl: 'http://192.168.2.110:8082', // 线上测试机 // baseUrl: 'http://192.168.2.110:8082', // 线上测试机
// baseUrl: 'http://192.168.2.85:8080', // 洋倍 baseUrl: 'http://192.168.2.168:8089', // 立鹏本地
// baseUrl: 'http://192.168.2.12:8084', // 立鹏 // baseUrl: 'http://192.168.2.55:8089', // 首拥本地
// baseUrl: 'http://192.168.2.55:8089', // 首拥
loginType: 1, loginType: 1,
wxRedirect: 'oatest.yswg.com.cn:3457', // wxRedirect: 'oatest.yswg.com.cn:3457',
}, },
} }
...@@ -3,13 +3,14 @@ import type { Router } from 'vue-router' ...@@ -3,13 +3,14 @@ import type { Router } from 'vue-router'
import { saveScrollPosition } from './scrollStorage' import { saveScrollPosition } from './scrollStorage'
import { parseCode, parseIsCodeLogin, parseIsCutEmail } from '@/utils/wxUtil' import { parseCode, parseIsCodeLogin, parseIsCutEmail } from '@/utils/wxUtil'
import { useUserStore } from '@/stores' import { useUserStore } from '@/stores'
import { fa } from 'element-plus/es/locales.mjs'
// 白名单 // 白名单
const WHITE_LIST: string[] = ['/aa'] const WHITE_LIST: string[] = ['/aa']
export function registerRouterGuard(router: Router) { export function registerRouterGuards(router: Router) {
router.beforeEach(async (to, from) => { router.beforeEach(async (to, from) => {
console.log('to', to)
console.log('from', from)
// 保存当前页面的滚动位置 // 保存当前页面的滚动位置
if (from.fullPath) { if (from.fullPath) {
saveScrollPosition(from.fullPath, window.scrollY) saveScrollPosition(from.fullPath, window.scrollY)
...@@ -18,18 +19,21 @@ export function registerRouterGuard(router: Router) { ...@@ -18,18 +19,21 @@ export function registerRouterGuard(router: Router) {
return true return true
} }
const code = parseCode() const code = parseCode(to.fullPath)
// code是否来自企业微信 1 不是 0 是 2 开发人员登录方式 // code是否来自企业微信 1 不是 0 是 2 开发人员登录方式
const isCodeLogin = parseIsCodeLogin() const isCodeLogin = parseIsCodeLogin()
const cutEmail = parseIsCutEmail() const cutEmail = parseIsCutEmail()
console.log(code, isCodeLogin, cutEmail) console.log(code, isCodeLogin, cutEmail)
const userStore = useUserStore() const userStore = useUserStore()
if (code) { if (code) {
console.log('code', code) console.log('code', code)
await userStore.getUserInfoByCode(code) await userStore.getUserInfoByCode(code, 0)
return true // 去除url里面的code
return {
path: '/', // 重定向到首页 去除code 重定向到首页 没有code 不会进入到这里了
replace: true,
}
} else { } else {
return true return true
} }
......
import { createRouter, createWebHistory } from 'vue-router' import { createRouter, createWebHistory } from 'vue-router'
import layoutCulture from '@/layoutCulture/index.vue' import layoutCulture from '@/layoutCulture/index.vue'
import { scrollBehavior } from './scrollStorage' import { scrollBehavior } from './scrollStorage'
import { registerRouterGuard } from './regards' import { registerRouterGuards } from './guards'
const routes = [ const routes = [
{ {
path: '/', path: '/',
...@@ -225,5 +225,5 @@ const router = createRouter({ ...@@ -225,5 +225,5 @@ const router = createRouter({
// } // }
// next() // next()
// }) // })
registerRouterGuard(router) registerRouterGuards(router)
export default router export default router
...@@ -30,8 +30,8 @@ export const useUserStore = defineStore('user', () => { ...@@ -30,8 +30,8 @@ export const useUserStore = defineStore('user', () => {
} }
// 根据code 获取用户信息 // 根据code 获取用户信息
const getUserInfoByCode = async (code: string) => { const getUserInfoByCode = async (code: string, isCodeLogin: number) => {
const { data } = await loginByCode({ code, isCodeLogin: 0 }) const { data } = await loginByCode({ code, isCodeLogin })
console.log(data) console.log(data)
setUserInfo(data) setUserInfo(data)
setToken(data.token) setToken(data.token)
......
...@@ -54,6 +54,9 @@ export default class DhRequest { ...@@ -54,6 +54,9 @@ export default class DhRequest {
} }
return response.data return response.data
} else { } else {
if (response.status === 401) {
alert(JSON.stringify(response))
}
// 处理请求成功后错误 // 处理请求成功后错误
return handleResponseError(response) return handleResponseError(response)
} }
......
...@@ -71,7 +71,9 @@ export function handleRequestError(axiosError: AxiosError<BackendServiceResult>) ...@@ -71,7 +71,9 @@ export function handleRequestError(axiosError: AxiosError<BackendServiceResult>)
// 请求出错,如404, 403 // 请求出错,如404, 403
else { else {
const errorCode: ErrorStatus = axiosError.response?.status as ErrorStatus const errorCode: ErrorStatus = axiosError.response?.status as ErrorStatus
if (errorCode === 401) {
alert(JSON.stringify(axiosError))
}
const msg = const msg =
axiosError.response?.data.message || ERROR_STATUS[errorCode] || DEFAULT_REQUEST_ERROR_MSG axiosError.response?.data.message || ERROR_STATUS[errorCode] || DEFAULT_REQUEST_ERROR_MSG
Object.assign(error, { code: errorCode || DEFAULT_REQUEST_ERROR_CODE, msg }) Object.assign(error, { code: errorCode || DEFAULT_REQUEST_ERROR_CODE, msg })
......
/* 企业微信js配置 */ /* 企业微信js配置 */
//注意:如果要在页面调用企业微信内部方法,请现在下面的jsApiList数组中添加方法 //注意:如果要在页面调用企业微信内部方法,请现在下面的jsApiList数组中添加方法
// import { getWxSignature } from '@/api' import { getWxSignature } from '@/api'
// import wx from 'weixin-js-sdk' // import wx from 'weixin-js-sdk'
export async function initWxConfig() { export async function initWxConfig() {
const url = location.href.split('#')[0] const url = location.href.split('#')[0]
const response = await getWxSignature(url) const response = await getWxSignature(url)
console.log('response', response)
const timestamp = response.data.timestamp //时间戳 const timestamp = response.data.timestamp //时间戳
const nonceStr = response.data.nonceStr //随机字符串 const nonceStr = response.data.nonceStr //随机字符串
const signature = response.data.signature //签名 const signature = response.data.signature //签名
......
...@@ -15,14 +15,14 @@ export function wxLogin(fullPath: string) { ...@@ -15,14 +15,14 @@ export function wxLogin(fullPath: string) {
} }
/** /**
* 解析地址栏 code * 解析地址栏 code beforeEach的时候 location.href 还是旧的 会一直进入到code 一直重定向循环
* *
* ?code=ODwKMle878L26YftD85-nJQwDyQmSDyKeEpODM6qMMM&state= * ?code=ODwKMle878L26YftD85-nJQwDyQmSDyKeEpODM6qMMM&state=
* @param search * @param search
*/ */
export function parseCode() { export function parseCode(path: string) {
const reg = new RegExp('(^|\\\\?|&)' + 'code' + '=([^&]*)(\\\\s|&|$)', 'i') const reg = new RegExp('(^|\\\\?|&)' + 'code' + '=([^&]*)(\\\\s|&|$)', 'i')
if (reg.test(window.location.href)) { if (reg.test(path)) {
return unescape(RegExp.$2.replace(/\+/g, ' ')) return unescape(RegExp.$2.replace(/\+/g, ' '))
} }
return '' return ''
......
...@@ -358,6 +358,9 @@ const userRecordData = ref({} as UserRecordDataDto) ...@@ -358,6 +358,9 @@ const userRecordData = ref({} as UserRecordDataDto)
const onDailySign = async () => { const onDailySign = async () => {
await dailySign() await dailySign()
await refreshTaskData(true) await refreshTaskData(true)
const { data } = await getUserAccountData()
userAccountData.value = data
ElMessage.success('签到成功')
} }
const handleTask = (item: TaskItemDto) => { const handleTask = (item: TaskItemDto) => {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div class="box relative h-200px bg-gradient-to-r from-purple-400 via-pink-300 to-blue-300"> <div class="box relative h-200px bg-gradient-to-r from-purple-400 via-pink-300 to-blue-300">
<!-- 顶部操作按钮 --> <!-- 顶部操作按钮 -->
<div class="absolute top-4 right-4 flex gap-2"> <div class="absolute top-4 right-4 flex gap-2">
<el-button type="info" plain size="small">清除缓存</el-button> <el-button type="info" plain size="small" @click="handleClearCache">清除缓存</el-button>
<el-button type="info" plain size="small" @click="handleSwitchAccount">切换账号</el-button> <el-button type="info" plain size="small" @click="handleSwitchAccount">切换账号</el-button>
<el-button type="info" plain size="small" @click="handleAdmin">后台管理</el-button> <el-button type="info" plain size="small" @click="handleAdmin">后台管理</el-button>
</div> </div>
...@@ -168,12 +168,12 @@ const getIsOfficial = () => { ...@@ -168,12 +168,12 @@ const getIsOfficial = () => {
} }
const handleSwitchAccount = async () => { const handleSwitchAccount = async () => {
console.log('切换账号') console.log('切换账号', userInfo)
const { data } = await generateLoginKey({ const { data } = await generateLoginKey({
cutEmail: 'SzTrain@yswg.com.cn', cutEmail: 'SzTrain@yswg.com.cn',
timestamp: Date.now(), timestamp: Date.now(),
type: 2, type: 2,
userId: userInfo.value.id, userId: userInfo.value.userId,
}) })
console.log(data) console.log(data)
} }
...@@ -182,6 +182,13 @@ const handleAdmin = () => { ...@@ -182,6 +182,13 @@ const handleAdmin = () => {
window.open('/backend') window.open('/backend')
} }
const handleClearCache = async () => {
sessionStorage.clear()
// await userStore.getUserInfoByCode()
window.location.reload()
ElMessage.success('清除缓存成功')
}
onMounted(() => { onMounted(() => {
getIsOfficial() getIsOfficial()
}) })
......
...@@ -7,12 +7,14 @@ import AutoImport from 'unplugin-auto-import/vite' ...@@ -7,12 +7,14 @@ import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite' import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers' import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons' import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
import { visualizer } from 'rollup-plugin-visualizer'
import UnoCSS from 'unocss/vite' import UnoCSS from 'unocss/vite'
import path from 'node:path' import path from 'node:path'
// https://vite.dev/config/ // https://vite.dev/config/
export default defineConfig({ export default defineConfig(({ mode }) => {
return {
resolve: { resolve: {
//设置别名 //设置别名
alias: { alias: {
...@@ -43,6 +45,7 @@ export default defineConfig({ ...@@ -43,6 +45,7 @@ export default defineConfig({
// 指定symbolId格式 // 指定symbolId格式
symbolId: 'icon-[dir]-[name]', symbolId: 'icon-[dir]-[name]',
}), }),
mode === 'development' && visualizer(), // 开发环境打包才需要
], ],
server: { server: {
// 是否开启 https // 是否开启 https
...@@ -65,7 +68,20 @@ export default defineConfig({ ...@@ -65,7 +68,20 @@ export default defineConfig({
output: { output: {
assetFileNames: 'assets/[ext]/[name]-[hash][extname]', assetFileNames: 'assets/[ext]/[name]-[hash][extname]',
chunkFileNames: 'assets/js/[name]-[hash].js', chunkFileNames: 'assets/js/[name]-[hash].js',
manualChunks: (id) => {
if (id.includes('node_modules')) {
console.log(id)
if (id.includes('element-plus')) {
return 'element-plus'
} else if (id.includes('vue')) {
return 'vue'
}
return 'vendor'
}
},
}, },
}, },
}, },
}
}) })
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment