Compare commits
74 Commits
dev
...
5e32c846c7
| Author | SHA1 | Date | |
|---|---|---|---|
| 5e32c846c7 | |||
| 7609765042 | |||
| 96c802be5f | |||
| d520e95b3b | |||
| 667bb80456 | |||
| 7b5bb9b565 | |||
| e9d5ca54a3 | |||
| e7b1992932 | |||
| aee9a2d9c0 | |||
| f031d84745 | |||
| 5128b519b9 | |||
| 94cb709702 | |||
| b2ff663fa8 | |||
| 5c129c35af | |||
| 2d067aae44 | |||
| df831595c9 | |||
| 0f1fa9c932 | |||
| 7dda1e1734 | |||
| a8a3bc4ee9 | |||
| 28021165e2 | |||
| 7fc8762bd9 | |||
| bd1b127306 | |||
| d21b06875a | |||
| 503b077c6b | |||
| 65ade0ef3a | |||
| e051d75d21 | |||
| 8daa1d4925 | |||
| d4ab8720cb | |||
| 3e920e2873 | |||
| 4488180cc9 | |||
| f75d9eef81 | |||
| 0ea8754321 | |||
| b47bc1b35b | |||
| cab4da5b28 | |||
| 7c7d395518 | |||
| 324426ef4a | |||
| d40146c07e | |||
| d3a8a0425c | |||
| 06b43dd14d | |||
| 5c9b248624 | |||
| 9657f989cd | |||
| a7cb1758e2 | |||
| 2c881a2084 | |||
| 25e4185183 | |||
| 233824e959 | |||
| 1f7669f033 | |||
| 45e6c145e5 | |||
| 18b2e7361f | |||
| 2d109b22a0 | |||
| 6256f59fe9 | |||
| 49bbe2a086 | |||
| 929a9e5826 | |||
| a01f94bfb3 | |||
| 5c7a54cfb4 | |||
| 77c7b1e8b9 | |||
| b027215afa | |||
| 165149e0c2 | |||
| f5d75820d7 | |||
| 373e25cf82 | |||
| 6279e8c692 | |||
| ce68556827 | |||
| cb2e68cede | |||
| 9f89ccab42 | |||
| 673a17a817 | |||
| 3fa884fbad | |||
| c733fc1124 | |||
| d15a377710 | |||
| 2c13d9d25d | |||
| 1338ad99ad | |||
| 9416fced28 | |||
| 92b6c6bea2 | |||
| 23dca69b2f | |||
| d8c9c15442 | |||
| bcf6fa4df2 |
158
.drone.yml
Normal file
158
.drone.yml
Normal file
@@ -0,0 +1,158 @@
|
|||||||
|
kind: pipeline
|
||||||
|
type: docker
|
||||||
|
name: default
|
||||||
|
|
||||||
|
platform:
|
||||||
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: 测试服-依赖安装&&编译打包
|
||||||
|
pull: if-not-exists
|
||||||
|
image: node:20-alpine
|
||||||
|
when:
|
||||||
|
branch:
|
||||||
|
- test
|
||||||
|
commands:
|
||||||
|
- npm config set registry https://registry.npmmirror.com/
|
||||||
|
- npm install -g pnpm
|
||||||
|
- pnpm install
|
||||||
|
- pnpm build:test
|
||||||
|
- rm -rf dist.tar
|
||||||
|
- rm -rf node_modules
|
||||||
|
- tar -zcvf dist.tar ./dist ./default.conf ./Dockerfile
|
||||||
|
|
||||||
|
- name: 正式服-依赖安装&&编译打包
|
||||||
|
pull: if-not-exists
|
||||||
|
image: node:20-alpine
|
||||||
|
when:
|
||||||
|
branch:
|
||||||
|
- main
|
||||||
|
commands:
|
||||||
|
- npm config set registry https://registry.npmmirror.com/
|
||||||
|
- npm install -g pnpm
|
||||||
|
- pnpm install
|
||||||
|
- pnpm build:prod
|
||||||
|
- rm -rf dist.tar
|
||||||
|
- rm -rf node_modules
|
||||||
|
- tar -zcvf dist.tar ./dist ./default.conf ./Dockerfile
|
||||||
|
|
||||||
|
- name: 测试服-产物上传
|
||||||
|
pull: if-not-exists
|
||||||
|
image: appleboy/drone-scp
|
||||||
|
when:
|
||||||
|
branch:
|
||||||
|
- test
|
||||||
|
settings:
|
||||||
|
host:
|
||||||
|
from_secret: HOST_DEV
|
||||||
|
username:
|
||||||
|
from_secret: USER_DEV
|
||||||
|
password:
|
||||||
|
from_secret: PWD_DEV
|
||||||
|
port: 22
|
||||||
|
strip_components: 1
|
||||||
|
target: /www/builder
|
||||||
|
source:
|
||||||
|
- ./dist.tar
|
||||||
|
|
||||||
|
- name: 测试服-部署
|
||||||
|
pull: if-not-exists
|
||||||
|
image: appleboy/drone-ssh
|
||||||
|
when:
|
||||||
|
branch:
|
||||||
|
- test
|
||||||
|
settings:
|
||||||
|
host:
|
||||||
|
from_secret: HOST_DEV
|
||||||
|
username:
|
||||||
|
from_secret: USER_DEV
|
||||||
|
password:
|
||||||
|
from_secret: PWD_DEV
|
||||||
|
port: 22
|
||||||
|
script:
|
||||||
|
- cd /www/builder
|
||||||
|
- mkdir jdt-admin-dev
|
||||||
|
- tar -xzvf dist.tar -C /www/builder/jdt-admin-dev
|
||||||
|
- rm -rf dist.tar
|
||||||
|
- cd jdt-admin-dev
|
||||||
|
- docker build -t jdt-admin-dev .
|
||||||
|
- docker stop jdt-admin-dev
|
||||||
|
- docker rm jdt-admin-dev
|
||||||
|
- docker run -d -p 8085:80 --restart=always --name jdt-admin-dev jdt-admin-dev
|
||||||
|
- cd ..
|
||||||
|
- rm -rf jdt-admin-dev
|
||||||
|
|
||||||
|
- name: 正式服-产物上传
|
||||||
|
pull: if-not-exists
|
||||||
|
image: appleboy/drone-scp
|
||||||
|
when:
|
||||||
|
branch:
|
||||||
|
- main
|
||||||
|
settings:
|
||||||
|
host:
|
||||||
|
from_secret: HOST_PROD
|
||||||
|
username:
|
||||||
|
from_secret: USER_PROD
|
||||||
|
password:
|
||||||
|
from_secret: PWD_PROD
|
||||||
|
port: 22
|
||||||
|
strip_components: 1
|
||||||
|
target: /www/builder
|
||||||
|
source:
|
||||||
|
- ./dist.tar
|
||||||
|
|
||||||
|
- name: 正式服-部署
|
||||||
|
pull: if-not-exists
|
||||||
|
image: appleboy/drone-ssh
|
||||||
|
when:
|
||||||
|
branch:
|
||||||
|
- main
|
||||||
|
settings:
|
||||||
|
host:
|
||||||
|
from_secret: HOST_PROD
|
||||||
|
username:
|
||||||
|
from_secret: USER_PROD
|
||||||
|
password:
|
||||||
|
from_secret: PWD_PROD
|
||||||
|
port: 22
|
||||||
|
script:
|
||||||
|
- cd /www/builder
|
||||||
|
- mkdir jdt-admin-prod
|
||||||
|
- tar -xzvf dist.tar -C /www/builder/jdt-admin-prod
|
||||||
|
- rm -rf dist.tar
|
||||||
|
- cd jdt-admin-prod
|
||||||
|
- docker build -t jdt-admin-prod .
|
||||||
|
- docker stop jdt-admin-prod
|
||||||
|
- docker rm jdt-admin-prod
|
||||||
|
- docker run -d -p 8085:80 --restart=always --name jdt-admin-prod jdt-admin-prod
|
||||||
|
- cd ..
|
||||||
|
- rm -rf jdt-admin-prod
|
||||||
|
|
||||||
|
- name: 企业微信通知
|
||||||
|
pull: if-not-exists
|
||||||
|
image: plugins/webhook
|
||||||
|
when:
|
||||||
|
branch:
|
||||||
|
- test
|
||||||
|
- main
|
||||||
|
status:
|
||||||
|
- success
|
||||||
|
- failure
|
||||||
|
settings:
|
||||||
|
urls: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=a2065e21-4f92-4f5b-a432-2c0cd1d965b5
|
||||||
|
content_type: application/json
|
||||||
|
template: |
|
||||||
|
{
|
||||||
|
"msgtype": "markdown",
|
||||||
|
"markdown": {
|
||||||
|
"content": "{{#success build.status}}✅{{else}}❌{{/success}}**{{ repo.owner }}/{{ repo.name }}** (Build #{{build.number}})\n
|
||||||
|
>**构建结果**: {{ build.status }}
|
||||||
|
>**构建详情**: [点击查看]({{ build.link }})
|
||||||
|
>**代码分支**: {{ build.branch }}
|
||||||
|
>**提交标识**: {{ build.commit }}
|
||||||
|
>**提交发起**: {{ build.author }}
|
||||||
|
>**提交信息**: {{ build.message }}
|
||||||
|
"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,12 +8,7 @@ VITE_USE_MOCK=false
|
|||||||
VITE_USE_PROXY=true
|
VITE_USE_PROXY=true
|
||||||
|
|
||||||
# base api
|
# base api
|
||||||
VITE_BASE_API='/api'
|
VITE_BASE_API='https://test.wanzhuanyongcheng.cn/admin'
|
||||||
|
|
||||||
VITE_BASE_API_1='/api1'
|
|
||||||
# VITE_BASE_API='https://test.wanzhuanyongcheng.cn/admin'
|
|
||||||
|
|
||||||
# VITE_BASE_API_1='https://api.gxwzwh.com/admin'
|
|
||||||
|
|
||||||
VITE_WS1_URL='game.wanzhuanyongcheng.cn/dice/home'
|
VITE_WS1_URL='game.wanzhuanyongcheng.cn/dice/home'
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ VITE_USE_MOCK=false
|
|||||||
|
|
||||||
# base api
|
# base api
|
||||||
VITE_BASE_API='//www.wanzhuanyongcheng.cn/admin'
|
VITE_BASE_API='//www.wanzhuanyongcheng.cn/admin'
|
||||||
VITE_BASE_API_1='//api.gxwzwh.com/admin'
|
|
||||||
|
|
||||||
# 是否启用压缩
|
# 是否启用压缩
|
||||||
VITE_USE_COMPRESS=true
|
VITE_USE_COMPRESS=true
|
||||||
|
|||||||
@@ -1,162 +0,0 @@
|
|||||||
name: CI Build & Deploy
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- test
|
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-and-deploy-dev:
|
|
||||||
if: gitea.ref_name == 'test'
|
|
||||||
runs-on: gitea_act_runner
|
|
||||||
container:
|
|
||||||
image: node:24-alpine
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Setup pnpm
|
|
||||||
uses: pnpm/action-setup@v3
|
|
||||||
with:
|
|
||||||
version: 8
|
|
||||||
|
|
||||||
- name: Install deps
|
|
||||||
run: |
|
|
||||||
npm config set registry https://registry.npmmirror.com/
|
|
||||||
pnpm install
|
|
||||||
|
|
||||||
- name: Build (test)
|
|
||||||
run: pnpm build:test
|
|
||||||
|
|
||||||
- name: Pack artifacts
|
|
||||||
run: |
|
|
||||||
rm -rf dist.tar
|
|
||||||
tar -zcvf dist.tar ./dist ./default.conf ./Dockerfile
|
|
||||||
|
|
||||||
- name: Upload artifacts to server
|
|
||||||
uses: appleboy/scp-action@v0.1.7
|
|
||||||
with:
|
|
||||||
host: ${{ secrets.HOST_DEV }}
|
|
||||||
username: ${{ secrets.USER_DEV }}
|
|
||||||
password: ${{ secrets.PWD_DEV }}
|
|
||||||
port: 22
|
|
||||||
source: 'dist.tar'
|
|
||||||
target: '/www/builder'
|
|
||||||
strip_components: 0
|
|
||||||
|
|
||||||
- name: Deploy over SSH
|
|
||||||
uses: appleboy/ssh-action@v1.0.3
|
|
||||||
with:
|
|
||||||
host: ${{ secrets.HOST_DEV }}
|
|
||||||
username: ${{ secrets.USER_DEV }}
|
|
||||||
password: ${{ secrets.PWD_DEV }}
|
|
||||||
port: 22
|
|
||||||
script: |
|
|
||||||
set -e
|
|
||||||
cd /www/builder
|
|
||||||
rm -rf jdt-admin-dev
|
|
||||||
mkdir -p jdt-admin-dev
|
|
||||||
tar -xzvf dist.tar -C /www/builder/jdt-admin-dev
|
|
||||||
rm -rf dist.tar
|
|
||||||
cd jdt-admin-dev
|
|
||||||
docker build -t jdt-admin-dev .
|
|
||||||
docker stop jdt-admin-dev || true
|
|
||||||
docker rm jdt-admin-dev || true
|
|
||||||
docker run -d -p 8085:80 --restart=always --name jdt-admin-dev jdt-admin-dev
|
|
||||||
cd ..
|
|
||||||
rm -rf jdt-admin-dev
|
|
||||||
|
|
||||||
- name: Notify WeCom (Dev)
|
|
||||||
if: always()
|
|
||||||
env:
|
|
||||||
WEBHOOK_KEY: ${{ secrets.QYWX_WEBHOOK_KEY }}
|
|
||||||
STATUS: ${{ job.status }}
|
|
||||||
REPO: ${{ gitea.repository }}
|
|
||||||
RUN_URL: ${{ gitea.server_url }}/${{ gitea.repository }}/actions/runs/${{ gitea.run_id }}
|
|
||||||
BRANCH: ${{ gitea.ref_name }}
|
|
||||||
COMMIT: ${{ gitea.sha }}
|
|
||||||
ACTOR: ${{ gitea.actor }}
|
|
||||||
run: |
|
|
||||||
sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories || true
|
|
||||||
apk add --no-cache curl jq
|
|
||||||
EMOJI=$( [ "$STATUS" = "success" ] && echo "✅" || echo "❌" )
|
|
||||||
MSG="$(printf "%s**%s** (Run #%s)\n>**构建结果**: %s\n>**构建详情**: [点击查看](%s)\n>**代码分支**: %s\n>**提交标识**: %s\n>**提交发起**: %s\n" "$EMOJI" "$REPO" "${{ gitea.run_number }}" "$STATUS" "$RUN_URL" "$BRANCH" "$COMMIT" "$ACTOR")"
|
|
||||||
curl -sS -H 'Content-Type: application/json' -d "{\"msgtype\":\"markdown\",\"markdown\":{\"content\":\"$MSG\"}}" "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=${WEBHOOK_KEY}"
|
|
||||||
|
|
||||||
build-and-deploy-prod:
|
|
||||||
if: gitea.ref_name == 'main'
|
|
||||||
runs-on: gitea_act_runner
|
|
||||||
container:
|
|
||||||
image: node:24-alpine
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Setup pnpm
|
|
||||||
uses: pnpm/action-setup@v3
|
|
||||||
with:
|
|
||||||
version: 8
|
|
||||||
|
|
||||||
- name: Install deps
|
|
||||||
run: |
|
|
||||||
npm config set registry https://registry.npmmirror.com/
|
|
||||||
pnpm install
|
|
||||||
|
|
||||||
- name: Build (prod)
|
|
||||||
run: pnpm build:prod
|
|
||||||
|
|
||||||
- name: Pack artifacts
|
|
||||||
run: |
|
|
||||||
rm -rf dist.tar
|
|
||||||
tar -zcvf dist.tar ./dist ./default.conf ./Dockerfile
|
|
||||||
|
|
||||||
- name: Upload artifacts to server
|
|
||||||
uses: appleboy/scp-action@v0.1.7
|
|
||||||
with:
|
|
||||||
host: ${{ secrets.HOST_PROD }}
|
|
||||||
username: ${{ secrets.USER_PROD }}
|
|
||||||
password: ${{ secrets.PWD_PROD }}
|
|
||||||
port: 22
|
|
||||||
source: 'dist.tar'
|
|
||||||
target: '/www/builder'
|
|
||||||
strip_components: 0
|
|
||||||
|
|
||||||
- name: Deploy over SSH
|
|
||||||
uses: appleboy/ssh-action@v1.0.3
|
|
||||||
with:
|
|
||||||
host: ${{ secrets.HOST_PROD }}
|
|
||||||
username: ${{ secrets.USER_PROD }}
|
|
||||||
password: ${{ secrets.PWD_PROD }}
|
|
||||||
port: 22
|
|
||||||
script: |
|
|
||||||
set -e
|
|
||||||
cd /www/builder
|
|
||||||
rm -rf jdt-admin-prod
|
|
||||||
mkdir -p jdt-admin-prod
|
|
||||||
tar -xzvf dist.tar -C /www/builder/jdt-admin-prod
|
|
||||||
rm -rf dist.tar
|
|
||||||
cd jdt-admin-prod
|
|
||||||
docker build -t jdt-admin-prod .
|
|
||||||
docker stop jdt-admin-prod || true
|
|
||||||
docker rm jdt-admin-prod || true
|
|
||||||
docker run -d -p 8085:80 --restart=always --name jdt-admin-prod jdt-admin-prod
|
|
||||||
cd ..
|
|
||||||
rm -rf jdt-admin-prod
|
|
||||||
|
|
||||||
- name: Notify WeCom (Prod)
|
|
||||||
if: always()
|
|
||||||
env:
|
|
||||||
WEBHOOK_KEY: ${{ secrets.QYWX_WEBHOOK_KEY }}
|
|
||||||
STATUS: ${{ job.status }}
|
|
||||||
REPO: ${{ gitea.repository }}
|
|
||||||
RUN_URL: ${{ gitea.server_url }}/${{ gitea.repository }}/actions/runs/${{ gitea.run_id }}
|
|
||||||
BRANCH: ${{ gitea.ref_name }}
|
|
||||||
COMMIT: ${{ gitea.sha }}
|
|
||||||
ACTOR: ${{ gitea.actor }}
|
|
||||||
run: |
|
|
||||||
sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories || true
|
|
||||||
apk add --no-cache curl jq
|
|
||||||
EMOJI=$( [ "$STATUS" = "success" ] && echo "✅" || echo "❌" )
|
|
||||||
MSG="$(printf "%s**%s** (Run #%s)\n>**构建结果**: %s\n>**构建详情**: [点击查看](%s)\n>**代码分支**: %s\n>**提交标识**: %s\n>**提交发起**: %s\n" "$EMOJI" "$REPO" "${{ gitea.run_number }}" "$STATUS" "$RUN_URL" "$BRANCH" "$COMMIT" "$ACTOR")"
|
|
||||||
curl -sS -H 'Content-Type: application/json' -d "{\"msgtype\":\"markdown\",\"markdown\":{\"content\":\"$MSG\"}}" "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=${WEBHOOK_KEY}"
|
|
||||||
@@ -2,23 +2,32 @@ export const OUTPUT_DIR = 'dist'
|
|||||||
|
|
||||||
export const PROXY_CONFIG = {
|
export const PROXY_CONFIG = {
|
||||||
/**
|
/**
|
||||||
* @desc 主接口代理
|
* @desc 替换匹配值
|
||||||
* @请求路径 http://localhost:3100/api/login
|
* @请求路径 http://localhost:3100/api/user
|
||||||
* @转发路径 http://localhost:3000/api/login
|
* @转发路径 http://localhost:8080/user
|
||||||
*/
|
*/
|
||||||
'/api': {
|
'/admin': {
|
||||||
target: 'https://test.wanzhuanyongcheng.cn',
|
target: 'https://test.wanzhuanyongcheng.cn',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: (path) => path.replace(/^\/api/, '/admin'),
|
// rewrite: (path) => path.replace(new RegExp('^/api'), ''),
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* @desc 备用接口代理
|
* @desc 不替换匹配值
|
||||||
* @请求路径 http://localhost:3100/api1/login
|
* @请求路径 http://localhost:3100/api/v2/user
|
||||||
* @转发路径 http://localhost:3001/api/login
|
* @转发路径 http://localhost:8080/api/v2/user
|
||||||
*/
|
*/
|
||||||
'/api1': {
|
// '/api/v2': {
|
||||||
target: 'https://api.gxwzwh.com',
|
// target: 'http://localhost:8080',
|
||||||
changeOrigin: true,
|
// changeOrigin: true,
|
||||||
rewrite: (path) => path.replace(/^\/api1/, '/admin'),
|
// },
|
||||||
},
|
/**
|
||||||
|
* @desc 替换部分匹配值
|
||||||
|
* @请求路径 http://localhost:3100/api/v3/user
|
||||||
|
* @转发路径 http://localhost:8080/user
|
||||||
|
*/
|
||||||
|
// '/api/v3': {
|
||||||
|
// target: 'http://localhost:8080',
|
||||||
|
// changeOrigin: true,
|
||||||
|
// rewrite: (path) => path.replace(new RegExp('^/api'), ''),
|
||||||
|
// },
|
||||||
}
|
}
|
||||||
|
|||||||
39
package.json
39
package.json
@@ -15,6 +15,7 @@
|
|||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"*.{js,vue}": [
|
"*.{js,vue}": [
|
||||||
|
"npx prettier --write --end-of-line lf .",
|
||||||
"eslint --ext .js,.vue ."
|
"eslint --ext .js,.vue ."
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -32,45 +33,45 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@unocss/eslint-config": "^0.55.7",
|
"@unocss/eslint-config": "^0.55.7",
|
||||||
"@vueuse/core": "^10.11.1",
|
"@vueuse/core": "^10.11.0",
|
||||||
"@wangeditor/editor": "^5.1.23",
|
"@wangeditor/editor": "^5.1.23",
|
||||||
"@wangeditor/editor-for-vue": "^5.1.12",
|
"@wangeditor/editor-for-vue": "^5.1.12",
|
||||||
"axios": "^1.13.1",
|
"axios": "^1.7.2",
|
||||||
"dayjs": "^1.11.19",
|
"dayjs": "^1.11.11",
|
||||||
"echarts": "^5.6.0",
|
"echarts": "^5.5.1",
|
||||||
"file-saver": "^2.0.5",
|
"file-saver": "^2.0.5",
|
||||||
"jszip": "^3.10.1",
|
"jszip": "^3.10.1",
|
||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
"md-editor-v3": "^4.21.3",
|
"md-editor-v3": "^4.17.3",
|
||||||
"mockjs": "^1.1.0",
|
"mockjs": "^1.1.0",
|
||||||
"pinia": "^2.3.1",
|
"pinia": "^2.1.7",
|
||||||
"vite": "^4.5.14",
|
"vite": "^4.5.3",
|
||||||
"vue": "3.3.4",
|
"vue": "3.3.4",
|
||||||
"vue-echarts": "^6.7.3",
|
"vue-echarts": "^6.7.3",
|
||||||
"vue-router": "^4.6.3",
|
"vue-router": "^4.2.5",
|
||||||
"xlsx": "^0.18.5"
|
"xlsx": "^0.18.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@commitlint/cli": "^17.8.1",
|
"@commitlint/cli": "^17.8.1",
|
||||||
"@commitlint/config-conventional": "^17.8.1",
|
"@commitlint/config-conventional": "^17.8.1",
|
||||||
"@iconify/json": "^2.2.402",
|
"@iconify/json": "^2.2.228",
|
||||||
"@iconify/vue": "^4.3.0",
|
"@iconify/vue": "^4.1.2",
|
||||||
"@unocss/preset-rem-to-px": "^0.55.7",
|
"@unocss/preset-rem-to-px": "^0.55.7",
|
||||||
"@vitejs/plugin-vue": "^4.6.2",
|
"@vitejs/plugin-vue": "^4.6.2",
|
||||||
"@vue/compiler-sfc": "^3.5.22",
|
"@vue/compiler-sfc": "^3.4.32",
|
||||||
"@zclzone/eslint-config": "^0.0.4",
|
"@zclzone/eslint-config": "^0.0.4",
|
||||||
"chalk": "^5.6.2",
|
"chalk": "^5.3.0",
|
||||||
"commitizen": "^4.3.1",
|
"commitizen": "^4.3.0",
|
||||||
"cz-conventional-changelog": "^3.3.0",
|
"cz-conventional-changelog": "^3.3.0",
|
||||||
"cz-customizable": "^7.5.1",
|
"cz-customizable": "^7.1.0",
|
||||||
"dotenv": "^16.6.1",
|
"dotenv": "^16.4.5",
|
||||||
"esno": "^0.17.0",
|
"esno": "^0.17.0",
|
||||||
"fs-extra": "^11.3.2",
|
"fs-extra": "^11.2.0",
|
||||||
"husky": "^8.0.3",
|
"husky": "^8.0.3",
|
||||||
"lint-staged": "^13.3.0",
|
"lint-staged": "^13.3.0",
|
||||||
"naive-ui": "^2.43.1",
|
"naive-ui": "^2.39.0",
|
||||||
"rollup-plugin-visualizer": "^5.14.0",
|
"rollup-plugin-visualizer": "^5.12.0",
|
||||||
"sass": "^1.93.2",
|
"sass": "^1.77.8",
|
||||||
"unocss": "0.55.0",
|
"unocss": "0.55.0",
|
||||||
"unplugin-auto-import": "^0.16.7",
|
"unplugin-auto-import": "^0.16.7",
|
||||||
"unplugin-icons": "^0.16.6",
|
"unplugin-icons": "^0.16.6",
|
||||||
|
|||||||
9433
pnpm-lock.yaml
generated
9433
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -9,14 +9,10 @@ import { setupRouter } from '@/router'
|
|||||||
import { setupStore } from '@/store'
|
import { setupStore } from '@/store'
|
||||||
import App from './App.vue'
|
import App from './App.vue'
|
||||||
import { setupNaiveDiscreteApi } from './utils'
|
import { setupNaiveDiscreteApi } from './utils'
|
||||||
import { initApiEndpoint } from '@/utils/api-config'
|
|
||||||
|
|
||||||
async function setupApp() {
|
async function setupApp() {
|
||||||
const app = createApp(App)
|
const app = createApp(App)
|
||||||
|
|
||||||
// 初始化接口配置
|
|
||||||
initApiEndpoint()
|
|
||||||
|
|
||||||
setupStore(app)
|
setupStore(app)
|
||||||
setupNaiveDiscreteApi()
|
setupNaiveDiscreteApi()
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { getToken, isNullOrWhitespace } from '@/utils'
|
import { getToken, isNullOrWhitespace } from '@/utils'
|
||||||
import { addDynamicRoutes } from '@/router'
|
|
||||||
|
|
||||||
const WHITE_LIST = ['/login', '/404']
|
const WHITE_LIST = ['/login', '/404']
|
||||||
export function createPermissionGuard(router) {
|
export function createPermissionGuard(router) {
|
||||||
@@ -15,20 +14,7 @@ export function createPermissionGuard(router) {
|
|||||||
/** 有token的情况 */
|
/** 有token的情况 */
|
||||||
if (to.path === '/login') return { path: '/' }
|
if (to.path === '/login') return { path: '/' }
|
||||||
|
|
||||||
// 确保动态路由已加载
|
// refreshAccessToken()
|
||||||
if (token && !router.hasRoute('Dashboard')) {
|
|
||||||
try {
|
|
||||||
await addDynamicRoutes()
|
|
||||||
// 如果当前路径不存在,重定向到工作台
|
|
||||||
if (to.path !== '/' && !router.hasRoute(to.name)) {
|
|
||||||
return { path: '/workbench' }
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error('动态路由加载失败:', error)
|
|
||||||
return { path: '/login' }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,44 +30,11 @@ export async function addDynamicRoutes() {
|
|||||||
try {
|
try {
|
||||||
const permissionStore = usePermissionStore()
|
const permissionStore = usePermissionStore()
|
||||||
const accessRoutes = permissionStore.generateRoutes()
|
const accessRoutes = permissionStore.generateRoutes()
|
||||||
|
|
||||||
// 确保路由按正确顺序添加
|
|
||||||
accessRoutes.forEach((route) => {
|
accessRoutes.forEach((route) => {
|
||||||
if (!router.hasRoute(route.name)) {
|
!router.hasRoute(route.name) && router.addRoute(route)
|
||||||
router.addRoute(route)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
router.hasRoute(EMPTY_ROUTE.name) && router.removeRoute(EMPTY_ROUTE.name)
|
||||||
// 移除空路由,添加404路由
|
|
||||||
if (router.hasRoute(EMPTY_ROUTE.name)) {
|
|
||||||
router.removeRoute(EMPTY_ROUTE.name)
|
|
||||||
}
|
|
||||||
router.addRoute(NOT_FOUND_ROUTE)
|
router.addRoute(NOT_FOUND_ROUTE)
|
||||||
|
|
||||||
// 确保根路径重定向到工作台
|
|
||||||
// if (!router.hasRoute('workbench')) {
|
|
||||||
// const workbenchRoute = {
|
|
||||||
// name: 'workbench',
|
|
||||||
// path: '/',
|
|
||||||
// component: () => import('@/views/workbench/index.vue'),
|
|
||||||
// redirect: '/workbench',
|
|
||||||
// // children: [
|
|
||||||
// // {
|
|
||||||
// // name: 'Workbench',
|
|
||||||
// // path: 'workbench',
|
|
||||||
// // component: () => import('@/views/workbench/index.vue'),
|
|
||||||
// // meta: {
|
|
||||||
// // title: '工作台',
|
|
||||||
// // icon: 'mdi:index',
|
|
||||||
// // order: 0,
|
|
||||||
// // },
|
|
||||||
// // },
|
|
||||||
// // ],
|
|
||||||
// }
|
|
||||||
// router.addRoute(workbenchRoute)
|
|
||||||
// }
|
|
||||||
|
|
||||||
// console.log(router)
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
throw error
|
throw error
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ function filterAsyncRoutes(routes = [], firstRoute = true) {
|
|||||||
|
|
||||||
const curRoute = {
|
const curRoute = {
|
||||||
path: route.route,
|
path: route.route,
|
||||||
name: route.route,
|
name: route.name,
|
||||||
isHidden,
|
isHidden,
|
||||||
meta,
|
meta,
|
||||||
children: [],
|
children: [],
|
||||||
|
|||||||
@@ -18,7 +18,10 @@ export const useUserStore = defineStore('user', {
|
|||||||
return this.userInfo?.name
|
return this.userInfo?.name
|
||||||
},
|
},
|
||||||
avatar() {
|
avatar() {
|
||||||
return this.userInfo?.avatar || 'https://v2.xxapi.cn/api/head?return=302'
|
return (
|
||||||
|
this.userInfo?.avatar ||
|
||||||
|
'https://pic3.58cdn.com.cn/nowater/webim/big/n_v21bc7874294754e63a22b80febac9cf51.jpg'
|
||||||
|
)
|
||||||
},
|
},
|
||||||
role() {
|
role() {
|
||||||
return this.userInfo?.role || []
|
return this.userInfo?.role || []
|
||||||
|
|||||||
@@ -1,61 +0,0 @@
|
|||||||
// 判断是否为开发环境
|
|
||||||
const isDev = import.meta.env.DEV
|
|
||||||
|
|
||||||
// API接口线路配置管理
|
|
||||||
export const API_ENDPOINTS = {
|
|
||||||
primary: {
|
|
||||||
name: '主要线路',
|
|
||||||
baseURL: import.meta.env.VITE_BASE_API,
|
|
||||||
timeout: 10000,
|
|
||||||
},
|
|
||||||
backup1: {
|
|
||||||
name: '备用线路',
|
|
||||||
baseURL: import.meta.env.VITE_BASE_API_1,
|
|
||||||
timeout: 10000,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
// 调试信息
|
|
||||||
console.log('=== 多接口配置信息 ===')
|
|
||||||
console.log('当前环境:', isDev ? '开发环境' : '生产环境')
|
|
||||||
console.log('API配置:', API_ENDPOINTS)
|
|
||||||
console.log('环境变量 VITE_BASE_API:', import.meta.env.VITE_BASE_API)
|
|
||||||
console.log('环境变量 VITE_BASE_API_1:', import.meta.env.VITE_BASE_API_1)
|
|
||||||
console.log('是否使用代理:', import.meta.env.VITE_USE_PROXY)
|
|
||||||
|
|
||||||
// 当前使用的接口线路
|
|
||||||
let currentEndpoint = 'primary'
|
|
||||||
|
|
||||||
// 获取当前接口配置
|
|
||||||
export function getCurrentEndpoint() {
|
|
||||||
return {
|
|
||||||
key: currentEndpoint,
|
|
||||||
...API_ENDPOINTS[currentEndpoint],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置当前接口
|
|
||||||
export function setCurrentEndpoint(endpoint) {
|
|
||||||
if (API_ENDPOINTS[endpoint]) {
|
|
||||||
currentEndpoint = endpoint
|
|
||||||
localStorage.setItem('api_endpoint', endpoint)
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取所有可用接口
|
|
||||||
export function getAvailableEndpoints() {
|
|
||||||
return Object.entries(API_ENDPOINTS).map(([key, config]) => ({
|
|
||||||
key,
|
|
||||||
...config,
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
|
|
||||||
// 初始化时从本地存储恢复接口选择
|
|
||||||
export function initApiEndpoint() {
|
|
||||||
const savedEndpoint = localStorage.getItem('api_endpoint')
|
|
||||||
if (savedEndpoint && API_ENDPOINTS[savedEndpoint]) {
|
|
||||||
currentEndpoint = savedEndpoint
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { resReject, resResolve, reqReject, reqResolve } from './interceptors'
|
import { resReject, resResolve, reqReject, reqResolve } from './interceptors'
|
||||||
import { getCurrentEndpoint, getAvailableEndpoints } from '../api-config'
|
|
||||||
|
|
||||||
export function createAxios(options = {}) {
|
export function createAxios(options = {}) {
|
||||||
const defaultOptions = {
|
const defaultOptions = {
|
||||||
@@ -15,93 +14,6 @@ export function createAxios(options = {}) {
|
|||||||
return service
|
return service
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建支持多接口的请求实例
|
export const request = createAxios({
|
||||||
export function createMultiEndpointRequest() {
|
baseURL: import.meta.env.VITE_BASE_API,
|
||||||
let instances = null
|
})
|
||||||
|
|
||||||
// 延迟创建axios实例
|
|
||||||
function ensureInstances() {
|
|
||||||
if (!instances) {
|
|
||||||
instances = {}
|
|
||||||
const endpoints = getAvailableEndpoints()
|
|
||||||
|
|
||||||
console.log('创建axios实例,接口列表:', endpoints)
|
|
||||||
|
|
||||||
endpoints.forEach((endpoint) => {
|
|
||||||
console.log(`创建实例 ${endpoint.key}:`, endpoint.baseURL)
|
|
||||||
instances[endpoint.key] = createAxios({
|
|
||||||
baseURL: endpoint.baseURL,
|
|
||||||
timeout: endpoint.timeout,
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return instances
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
// 使用当前选中的接口发送请求
|
|
||||||
async request(config) {
|
|
||||||
const instances = ensureInstances()
|
|
||||||
const currentEndpoint = getCurrentEndpoint()
|
|
||||||
|
|
||||||
console.log('当前接口配置:', currentEndpoint)
|
|
||||||
console.log('可用实例:', Object.keys(instances))
|
|
||||||
|
|
||||||
const instance = instances[currentEndpoint.key]
|
|
||||||
|
|
||||||
if (!instance) {
|
|
||||||
throw new Error(`接口实例不存在: ${currentEndpoint.key}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(`使用接口: ${currentEndpoint.name} (${currentEndpoint.baseURL})`)
|
|
||||||
console.log('请求配置:', config)
|
|
||||||
|
|
||||||
return await instance(config)
|
|
||||||
},
|
|
||||||
|
|
||||||
// 获取当前接口实例
|
|
||||||
getCurrentInstance() {
|
|
||||||
const instances = ensureInstances()
|
|
||||||
const currentEndpoint = getCurrentEndpoint()
|
|
||||||
return instances[currentEndpoint.key]
|
|
||||||
},
|
|
||||||
|
|
||||||
// 获取所有接口实例
|
|
||||||
getAllInstances() {
|
|
||||||
return ensureInstances()
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// export const request = createAxios({
|
|
||||||
// baseURL: import.meta.env.VITE_BASE_API,
|
|
||||||
// })
|
|
||||||
|
|
||||||
// 支持多接口的请求实例
|
|
||||||
export const multiRequest = createMultiEndpointRequest()
|
|
||||||
|
|
||||||
// 创建自动适配多接口的request实例
|
|
||||||
const multiEndpointInstance = createMultiEndpointRequest()
|
|
||||||
|
|
||||||
// 创建支持axios方法的request实例
|
|
||||||
export const request = {
|
|
||||||
// 基础请求方法
|
|
||||||
request: (config) => multiEndpointInstance.request(config),
|
|
||||||
|
|
||||||
// 自动适配axios方法
|
|
||||||
get: (url, config = {}) => multiEndpointInstance.request({ method: 'get', url, ...config }),
|
|
||||||
post: (url, data, config = {}) =>
|
|
||||||
multiEndpointInstance.request({ method: 'post', url, data, ...config }),
|
|
||||||
put: (url, data, config = {}) =>
|
|
||||||
multiEndpointInstance.request({ method: 'put', url, data, ...config }),
|
|
||||||
delete: (url, config = {}) => multiEndpointInstance.request({ method: 'delete', url, ...config }),
|
|
||||||
patch: (url, data, config = {}) =>
|
|
||||||
multiEndpointInstance.request({ method: 'patch', url, data, ...config }),
|
|
||||||
head: (url, config = {}) => multiEndpointInstance.request({ method: 'head', url, ...config }),
|
|
||||||
options: (url, config = {}) =>
|
|
||||||
multiEndpointInstance.request({ method: 'options', url, ...config }),
|
|
||||||
|
|
||||||
// 获取当前接口实例(用于直接访问axios实例)
|
|
||||||
getCurrentInstance: () => multiEndpointInstance.getCurrentInstance(),
|
|
||||||
getAllInstances: () => multiEndpointInstance.getAllInstances(),
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -369,7 +369,7 @@ const columns = ref([
|
|||||||
window.open(
|
window.open(
|
||||||
`${import.meta.env.VITE_MER_LOGIN_URL}?redirect=/workbench&type=${
|
`${import.meta.env.VITE_MER_LOGIN_URL}?redirect=/workbench&type=${
|
||||||
res.data.type
|
res.data.type
|
||||||
}&tk=${res.data.token}&api=${localStorage.getItem('api_endpoint')}`
|
}&tk=${res.data.token}`
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,13 +1,5 @@
|
|||||||
import { request, multiRequest } from '@/utils'
|
import { request } from '@/utils'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
login: (data) => request.post('/login', data, { noNeedToken: true }),
|
login: (data) => request.post('/login', data, { noNeedToken: true }),
|
||||||
// 使用多接口的登录方法
|
|
||||||
loginWithMultiEndpoint: (data) =>
|
|
||||||
multiRequest.request({
|
|
||||||
method: 'post',
|
|
||||||
url: '/login',
|
|
||||||
data,
|
|
||||||
noNeedToken: true,
|
|
||||||
}),
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,17 +14,7 @@
|
|||||||
<img src="@/assets/images/logo.png" height="50" class="mr-10" />
|
<img src="@/assets/images/logo.png" height="50" class="mr-10" />
|
||||||
{{ title }}
|
{{ title }}
|
||||||
</h5>
|
</h5>
|
||||||
<!-- 接口线路选择 -->
|
<div mt-30>
|
||||||
<div mt-20>
|
|
||||||
<n-select
|
|
||||||
v-model:value="selectedEndpoint"
|
|
||||||
:options="endpointOptions"
|
|
||||||
placeholder="选择接口线路"
|
|
||||||
size="large"
|
|
||||||
@update:value="handleEndpointChange"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div mt-10>
|
|
||||||
<n-input
|
<n-input
|
||||||
v-model:value="loginInfo.name"
|
v-model:value="loginInfo.name"
|
||||||
autofocus
|
autofocus
|
||||||
@@ -33,7 +23,7 @@
|
|||||||
:maxlength="20"
|
:maxlength="20"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div mt-10>
|
<div mt-30>
|
||||||
<n-input
|
<n-input
|
||||||
v-model:value="loginInfo.password"
|
v-model:value="loginInfo.password"
|
||||||
class="h-50 items-center pl-10 text-16"
|
class="h-50 items-center pl-10 text-16"
|
||||||
@@ -77,12 +67,6 @@ import { useStorage } from '@vueuse/core'
|
|||||||
import bgImg from '@/assets/images/login_bg.webp'
|
import bgImg from '@/assets/images/login_bg.webp'
|
||||||
import api from './api'
|
import api from './api'
|
||||||
import { addDynamicRoutes } from '@/router'
|
import { addDynamicRoutes } from '@/router'
|
||||||
import {
|
|
||||||
getAvailableEndpoints,
|
|
||||||
setCurrentEndpoint,
|
|
||||||
getCurrentEndpoint,
|
|
||||||
initApiEndpoint,
|
|
||||||
} from '@/utils/api-config'
|
|
||||||
|
|
||||||
const title = import.meta.env.VITE_TITLE
|
const title = import.meta.env.VITE_TITLE
|
||||||
|
|
||||||
@@ -106,61 +90,6 @@ function initLoginInfo() {
|
|||||||
|
|
||||||
const isRemember = useStorage('isRemember', false)
|
const isRemember = useStorage('isRemember', false)
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
|
|
||||||
// 接口线路相关
|
|
||||||
const selectedEndpoint = ref('primary')
|
|
||||||
const endpointOptions = ref([])
|
|
||||||
|
|
||||||
// 初始化接口配置
|
|
||||||
initApiEndpoint()
|
|
||||||
const currentEndpoint = getCurrentEndpoint()
|
|
||||||
selectedEndpoint.value = currentEndpoint.key
|
|
||||||
|
|
||||||
// 加载接口选项
|
|
||||||
function loadEndpointOptions() {
|
|
||||||
const endpoints = getAvailableEndpoints()
|
|
||||||
endpointOptions.value = endpoints.map((endpoint) => ({
|
|
||||||
label: endpoint.name,
|
|
||||||
value: endpoint.key,
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理接口切换
|
|
||||||
function handleEndpointChange(value) {
|
|
||||||
if (setCurrentEndpoint(value)) {
|
|
||||||
selectedEndpoint.value = value
|
|
||||||
$message.success(`已切换到${endpointOptions.value.find((opt) => opt.value === value)?.label}`)
|
|
||||||
} else {
|
|
||||||
$message.error('接口切换失败')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 初始化
|
|
||||||
onMounted(() => {
|
|
||||||
loadEndpointOptions()
|
|
||||||
})
|
|
||||||
|
|
||||||
// 获取第一个可用的路由页面
|
|
||||||
function getFirstAvailableRoute(menuData) {
|
|
||||||
if (!menuData || !Array.isArray(menuData)) return null
|
|
||||||
|
|
||||||
// 递归查找第一个type为2的路由(页面路由)
|
|
||||||
function findFirstPageRoute(routes) {
|
|
||||||
for (const route of routes) {
|
|
||||||
if (route.type === 2 && route.route) {
|
|
||||||
return route.route
|
|
||||||
}
|
|
||||||
if (route.subMenu && route.subMenu.length) {
|
|
||||||
const found = findFirstPageRoute(route.subMenu)
|
|
||||||
if (found) return found
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
return findFirstPageRoute(menuData)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function handleLogin() {
|
async function handleLogin() {
|
||||||
const { name, password } = loginInfo.value
|
const { name, password } = loginInfo.value
|
||||||
if (!name || !password) {
|
if (!name || !password) {
|
||||||
@@ -170,14 +99,7 @@ async function handleLogin() {
|
|||||||
try {
|
try {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
$message.loading('正在验证...')
|
$message.loading('正在验证...')
|
||||||
|
const res = await api.login({ phone: name, password: password.toString() })
|
||||||
console.log('开始登录请求...')
|
|
||||||
console.log('登录数据:', { phone: name, password: password.toString() })
|
|
||||||
console.log('当前选中接口:', selectedEndpoint.value)
|
|
||||||
|
|
||||||
const res = await api.loginWithMultiEndpoint({ phone: name, password: password.toString() })
|
|
||||||
|
|
||||||
console.log('登录响应:', res)
|
|
||||||
$message.success('登录成功')
|
$message.success('登录成功')
|
||||||
window.localStorage.setItem('menu', JSON.stringify(res.data.auth))
|
window.localStorage.setItem('menu', JSON.stringify(res.data.auth))
|
||||||
setToken(res.data.token)
|
setToken(res.data.token)
|
||||||
@@ -186,23 +108,17 @@ async function handleLogin() {
|
|||||||
} else {
|
} else {
|
||||||
lStorage.remove('loginInfo')
|
lStorage.remove('loginInfo')
|
||||||
}
|
}
|
||||||
|
|
||||||
// 先添加动态路由
|
|
||||||
await addDynamicRoutes()
|
await addDynamicRoutes()
|
||||||
|
// console.log(query)
|
||||||
// 获取第一个可用的路由页面
|
|
||||||
const firstRoute = getFirstAvailableRoute(res.data.auth)
|
|
||||||
|
|
||||||
if (query.redirect) {
|
if (query.redirect) {
|
||||||
const path = query.redirect
|
const path = query.redirect
|
||||||
Reflect.deleteProperty(query, 'redirect')
|
Reflect.deleteProperty(query, 'redirect')
|
||||||
router.push({ path, query })
|
router.push({ path, query })
|
||||||
} else {
|
} else {
|
||||||
// 跳转到第一个可用路由,如果没有则跳转到工作台
|
router.push('/workbench')
|
||||||
router.push(firstRoute || '/workbench')
|
|
||||||
}
|
}
|
||||||
|
// router.push('/workbench')
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('登录请求失败:', error)
|
|
||||||
$message.removeMessage()
|
$message.removeMessage()
|
||||||
}
|
}
|
||||||
loading.value = false
|
loading.value = false
|
||||||
|
|||||||
@@ -186,11 +186,12 @@ const selectOptions = ref([
|
|||||||
label: '商家名称',
|
label: '商家名称',
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
||||||
const columns = ref([
|
const columns = ref([
|
||||||
{
|
{
|
||||||
title: '订单号',
|
title: '订单号',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
key: 'jl_oid',
|
key: 'oid',
|
||||||
width: 200,
|
width: 200,
|
||||||
fixed: 'left',
|
fixed: 'left',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -13,13 +13,6 @@ export default defineConfig(({ command, mode }) => {
|
|||||||
const viteEnv = convertEnv(env)
|
const viteEnv = convertEnv(env)
|
||||||
const { VITE_PORT, VITE_PUBLIC_PATH, VITE_USE_PROXY, VITE_BASE_API, VITE_SENTRY } = viteEnv
|
const { VITE_PORT, VITE_PUBLIC_PATH, VITE_USE_PROXY, VITE_BASE_API, VITE_SENTRY } = viteEnv
|
||||||
|
|
||||||
// 调试代理配置
|
|
||||||
console.log('=== Vite代理配置调试 ===')
|
|
||||||
console.log('VITE_USE_PROXY:', VITE_USE_PROXY)
|
|
||||||
console.log('VITE_BASE_API:', VITE_BASE_API)
|
|
||||||
console.log('PROXY_CONFIG:', PROXY_CONFIG)
|
|
||||||
console.log('所有环境变量:', viteEnv)
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
base: VITE_PUBLIC_PATH || '/',
|
base: VITE_PUBLIC_PATH || '/',
|
||||||
resolve: {
|
resolve: {
|
||||||
@@ -33,10 +26,12 @@ export default defineConfig(({ command, mode }) => {
|
|||||||
host: '0.0.0.0',
|
host: '0.0.0.0',
|
||||||
port: VITE_PORT,
|
port: VITE_PORT,
|
||||||
open: false,
|
open: false,
|
||||||
proxy: {
|
proxy: VITE_USE_PROXY
|
||||||
'/api1': PROXY_CONFIG['/api1'],
|
? {
|
||||||
'/api': PROXY_CONFIG['/api'],
|
[VITE_BASE_API]: PROXY_CONFIG[VITE_BASE_API],
|
||||||
},
|
'/api/v2': PROXY_CONFIG['/api/v2'],
|
||||||
|
}
|
||||||
|
: undefined,
|
||||||
},
|
},
|
||||||
build: {
|
build: {
|
||||||
target: 'es2015',
|
target: 'es2015',
|
||||||
|
|||||||
Reference in New Issue
Block a user