Compare commits

..

64 Commits

Author SHA1 Message Date
c2b0e49f7b feat(custom): 多API版本
All checks were successful
continuous-integration/drone/push Build is passing
2025-09-23 18:31:11 +08:00
e791fef430 refactor(custom): 地图服务商更换 2025-09-23 18:31:10 +08:00
3b9cee3a65 refactor(custom): 地图Key变更 2025-09-23 18:31:10 +08:00
68e02ecc84 refactor(custom): 地图服务商更换
All checks were successful
continuous-integration/drone/push Build is passing
2025-06-16 18:02:55 +08:00
646ba7165f refactor(custom): 地图Key变更
All checks were successful
continuous-integration/drone/push Build is passing
2025-05-29 15:57:46 +08:00
6c69a1b296 Merge branch 'test'
All checks were successful
continuous-integration/drone/push Build is passing
2024-10-18 19:49:16 +08:00
8a885d9c5e Merge branch 'dev' into test
All checks were successful
continuous-integration/drone/push Build is passing
2024-10-14 22:11:19 +08:00
64d1923336 Merge branch 'test'
All checks were successful
continuous-integration/drone/push Build is passing
2024-09-12 01:43:43 +08:00
ec3d7e20e5 Merge branch 'dev' into test
All checks were successful
continuous-integration/drone/push Build is passing
2024-09-09 16:07:57 +08:00
c5f299d4aa Merge branch 'test'
All checks were successful
continuous-integration/drone/push Build is passing
2024-09-06 21:39:30 +08:00
13d6bdd5f0 Merge branch 'dev' into test
All checks were successful
continuous-integration/drone/push Build is passing
2024-09-06 21:10:44 +08:00
59de06f8e8 Merge branch 'dev' into test
All checks were successful
continuous-integration/drone/push Build is passing
2024-09-05 20:30:36 +08:00
dc70eb3000 Merge branch 'dev' into test
All checks were successful
continuous-integration/drone/push Build is passing
2024-09-05 16:42:24 +08:00
6756f80cd6 Merge branch 'dev' into test
All checks were successful
continuous-integration/drone/push Build is passing
2024-09-03 22:22:13 +08:00
0c47b09064 Merge branch 'test'
All checks were successful
continuous-integration/drone/push Build is passing
2024-08-05 18:10:50 +08:00
c97f3c655f Merge branch 'dev' into test
All checks were successful
continuous-integration/drone/push Build is passing
2024-08-05 18:10:42 +08:00
630dad47dc Merge branch 'test'
All checks were successful
continuous-integration/drone/push Build is passing
2024-08-05 05:35:10 +08:00
c0d46d3b7b Merge branch 'dev' into test
All checks were successful
continuous-integration/drone/push Build is passing
2024-08-05 05:35:00 +08:00
b87ae167bb Merge branch 'dev' into test
All checks were successful
continuous-integration/drone/push Build is passing
2024-08-01 21:43:42 +08:00
ca60223245 Merge branch 'test'
All checks were successful
continuous-integration/drone/push Build is passing
2024-07-31 21:04:43 +08:00
1306e2acf6 Merge branch 'dev' into test
All checks were successful
continuous-integration/drone/push Build is passing
2024-07-29 15:12:03 +08:00
537e155050 Merge branch 'test'
All checks were successful
continuous-integration/drone/push Build is passing
2024-07-28 10:47:13 +08:00
11386f9864 Merge branch 'dev' into test
All checks were successful
continuous-integration/drone/push Build is passing
2024-07-28 10:47:07 +08:00
627d618b65 Merge branch 'test'
All checks were successful
continuous-integration/drone/push Build is passing
2024-07-22 18:23:19 +08:00
592fb2ede7 Merge branch 'dev' into test
All checks were successful
continuous-integration/drone/push Build is passing
2024-07-22 18:23:11 +08:00
85b592adec Merge branch 'test'
All checks were successful
continuous-integration/drone/push Build is passing
2024-05-20 16:08:28 +08:00
f868be28a3 Merge branch 'dev' into test
All checks were successful
continuous-integration/drone/push Build is passing
2024-05-20 16:08:18 +08:00
8751b78d8d Merge branch 'test'
All checks were successful
continuous-integration/drone/push Build is passing
2024-05-17 18:49:08 +08:00
346930fac9 Merge branch 'dev' into test
All checks were successful
continuous-integration/drone/push Build is passing
2024-05-17 18:48:56 +08:00
e7e050d107 Merge branch 'test'
All checks were successful
continuous-integration/drone/push Build is passing
2024-05-17 18:16:09 +08:00
0744da45f6 Merge branch 'dev' into test
All checks were successful
continuous-integration/drone/push Build is passing
2024-05-17 18:16:01 +08:00
8f8e024cfe Merge branch 'dev' into test
All checks were successful
continuous-integration/drone/push Build is passing
2024-04-15 17:31:37 +08:00
1f963a84f7 Merge branch 'dev' into test
All checks were successful
continuous-integration/drone/push Build is passing
2024-04-12 18:55:29 +08:00
79f34be500 Merge branch 'dev' into test
All checks were successful
continuous-integration/drone/push Build is passing
2024-03-20 16:37:56 +08:00
c563bf8cd6 Merge branch 'test'
All checks were successful
continuous-integration/drone/push Build is passing
2024-03-15 16:09:37 +08:00
760c843060 Merge branch 'dev' into test
All checks were successful
continuous-integration/drone/push Build is passing
2024-03-09 18:18:27 +08:00
af20de8776 Merge branch 'dev' into test
All checks were successful
continuous-integration/drone/push Build is passing
2024-03-08 20:55:00 +08:00
a53552943a Merge branch 'dev' into test
Some checks failed
continuous-integration/drone Build is failing
2024-03-08 18:59:17 +08:00
c8974937ff Merge branch 'dev' into test 2024-03-07 18:58:37 +08:00
011284c5dc Merge branch 'dev' into test 2024-03-05 21:20:39 +08:00
a0f1d29597 Merge branch 'dev' into test 2024-03-04 21:20:31 +08:00
528c405f63 Merge branch 'test' 2024-01-27 14:13:47 +08:00
74a4aa3ab2 Merge branch 'dev' into test 2024-01-25 22:48:31 +08:00
fca2672393 Merge branch 'dev' into test 2024-01-22 22:25:25 +08:00
aa3220186e Merge branch 'test' 2023-12-25 17:05:52 +08:00
28a6b326e4 Merge branch 'dev' into test 2023-12-17 21:49:22 +08:00
936fbca87e Merge branch 'test' 2023-12-15 20:48:25 +08:00
c9b590fcb2 Merge branch 'dev' into test 2023-12-15 20:48:04 +08:00
462047d560 Merge branch 'test' 2023-12-13 13:21:21 +08:00
40d27d2032 Merge branch 'dev' into test 2023-12-13 13:21:05 +08:00
5cf8469009 Merge branch 'test' 2023-12-03 22:24:39 +08:00
99336f5304 Merge branch 'dev' into test 2023-12-03 22:24:19 +08:00
66589f52b3 Merge branch 'test' 2023-12-03 21:37:54 +08:00
fd5bc032a6 Merge branch 'dev' into test 2023-12-03 21:37:21 +08:00
7d1cc49a6d mod(custom): merge branch 'test' 2023-11-29 15:38:06 +08:00
8fbe2c84b7 Merge branch 'dev' into test 2023-11-21 19:13:33 +08:00
871988a9b3 Merge branch 'dev' into test 2023-11-21 18:35:57 +08:00
9c95725969 Merge branch 'dev' into 'test'
fix(custom): 订单列表统计小数点后两位不显示

See merge request xinling/jdt-mer!6
2023-10-20 21:07:17 +08:00
8bf7cc8a31 Merge branch 'test' into 'main'
Merge branch 'dev' into 'test'

See merge request xinling/jdt-mer!5
2023-10-10 18:06:39 +08:00
1b2a0d7bc6 Revert "Merge branch 'dev' into 'main'"
This reverts merge request !3
2023-10-10 18:05:21 +08:00
f6fa59a1c3 Merge branch 'dev' into 'test'
fix(custom): 隐藏添加/编辑商品的log打印

See merge request xinling/jdt-mer!4
2023-10-10 18:04:27 +08:00
58deecbf36 Merge branch 'dev' into 'main'
fix(custom): 隐藏添加/编辑商品的log打印

See merge request xinling/jdt-mer!3
2023-10-10 18:03:41 +08:00
0a4169d750 Merge branch 'test' into 'main'
fix(custom): 修复Upload组件上传成功但未取到值的问题

See merge request xinling/jdt-mer!2
2023-10-10 16:03:15 +08:00
db9a56dade Merge branch 'dev' into 'test'
fix(custom): 修复Upload组件上传成功但未取到值的问题

See merge request xinling/jdt-mer!1
2023-10-10 16:00:25 +08:00
11 changed files with 6620 additions and 3663 deletions

158
.drone.yml Normal file
View 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-mer-dev
- tar -xzvf dist.tar -C /www/builder/jdt-mer-dev
- rm -rf dist.tar
- cd jdt-mer-dev
- docker build -t jdt-mer-dev .
- docker stop jdt-mer-dev
- docker rm jdt-mer-dev
- docker run -d -p 8083:80 --restart=always --name jdt-mer-dev jdt-mer-dev
- cd ..
- rm -rf jdt-mer-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-mer-prod
- tar -xzvf dist.tar -C /www/builder/jdt-mer-prod
- rm -rf dist.tar
- cd jdt-mer-prod
- docker build -t jdt-mer-prod .
- docker stop jdt-mer-prod
- docker rm jdt-mer-prod
- docker run -d -p 8083:80 --restart=always --name jdt-mer-prod jdt-mer-prod
- cd ..
- rm -rf jdt-mer-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 }}
"
}
}

View File

@@ -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-mer-dev
mkdir -p jdt-mer-dev
tar -xzvf dist.tar -C /www/builder/jdt-mer-dev
rm -rf dist.tar
cd jdt-mer-dev
docker build -t jdt-mer-dev .
docker stop jdt-mer-dev || true
docker rm jdt-mer-dev || true
docker run -d -p 8083:80 --restart=always --name jdt-mer-dev jdt-mer-dev
cd ..
rm -rf jdt-mer-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-mer-prod
mkdir -p jdt-mer-prod
tar -xzvf dist.tar -C /www/builder/jdt-mer-prod
rm -rf dist.tar
cd jdt-mer-prod
docker build -t jdt-mer-prod .
docker stop jdt-mer-prod || true
docker rm jdt-mer-prod || true
docker run -d -p 8083:80 --restart=always --name jdt-mer-prod jdt-mer-prod
cd ..
rm -rf jdt-mer-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}"

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022 Ronnie Zhang
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

40
mock/api/auth.js Normal file
View File

@@ -0,0 +1,40 @@
import { resolveToken } from '../utils'
const token = {
admin: 'admin',
editor: 'editor',
}
export default [
{
url: '/api/auth/login',
method: 'post',
response: ({ body }) => {
if (['admin', 'editor'].includes(body?.name)) {
return {
code: 0,
data: {
token: token[body.name],
},
}
} else {
return {
code: -1,
message: '没有此用户',
}
}
},
},
{
url: '/api/auth/refreshToken',
method: 'post',
response: ({ headers }) => {
return {
code: 0,
data: {
token: resolveToken(headers?.authorization),
},
}
},
},
]

5
mock/api/index.js Normal file
View File

@@ -0,0 +1,5 @@
import auth from './auth'
import user from './user'
import post from './post'
export default [...auth, ...user, ...post]

138
mock/api/post.js Normal file
View File

@@ -0,0 +1,138 @@
const posts = [
{
title: '使用纯css优雅配置移动端rem布局',
author: '大脸怪',
category: 'Css',
description: '通常配置rem布局会使用js进行处理比如750的设计稿会这样...',
content: '通常配置rem布局会使用js进行处理比如750的设计稿会这样',
isRecommend: true,
isPublish: true,
createDate: '2021-11-04T04:03:36.000Z',
updateDate: '2021-11-04T04:03:36.000Z',
},
{
title: 'Vue2&Vue3项目风格指南',
author: 'Ronnie',
category: 'Vue',
description: '总结的Vue2和Vue3的项目风格',
content: '### 1. 命名风格\n\n> 文件夹如果是由多个单词组成,应该始终是横线连接 ',
isRecommend: true,
isPublish: true,
createDate: '2021-10-25T08:57:47.000Z',
updateDate: '2022-02-28T04:02:39.000Z',
},
{
title: '如何优雅的给图片添加水印',
author: '大脸怪',
category: 'JavaScript',
description: '优雅的给图片添加水印',
content: '我之前写过一篇文章记录了一次上传图片的优化史',
isRecommend: true,
isPublish: true,
createDate: '2021-06-24T18:46:19.000Z',
updateDate: '2021-09-23T07:51:22.000Z',
},
{
title: '前端缓存的理解',
author: '大脸怪',
category: 'Http',
description: '谈谈前端缓存的理解',
content:
'> 背景\n\n公司有个vue-cli3移动端web项目发版更新后发现部分用户手机在钉钉内置浏览器打开出现了缓存',
isRecommend: true,
isPublish: true,
createDate: '2021-06-10T18:51:19.000Z',
updateDate: '2021-09-17T09:33:24.000Z',
},
{
title: 'Promise的五个静态方法',
author: '大脸怪',
category: 'JavaScript',
description: '简单介绍下在 Promise 类中有5 种静态方法及它们的使用场景',
content:
'## 1. Promise.all\n\n并行执行多个 promise并等待所有 promise 都准备就绪。再对它们进行处理。',
isRecommend: true,
isPublish: true,
createDate: '2021-02-22T22:37:06.000Z',
updateDate: '2021-09-17T09:33:24.000Z',
},
]
export default [
{
url: '/api/posts',
method: 'get',
response: (data = {}) => {
const { title, pageNo, pageSize } = data.query
let pageData = []
let total = 60
const filterData = posts.filter(
(item) => item.title.includes(title) || (!title && title !== 0)
)
if (filterData.length) {
if (pageSize) {
while (pageData.length < pageSize) {
pageData.push(filterData[Math.round(Math.random() * (filterData.length - 1))])
}
} else {
pageData = filterData
}
pageData = pageData.map((item, index) => ({
id: pageSize * (pageNo - 1) + index + 1,
...item,
}))
} else {
total = 0
}
return {
code: 0,
message: 'ok',
data: {
pageData,
total,
pageNo,
pageSize,
},
}
},
},
{
url: '/api/post',
method: 'post',
response: ({ body }) => {
return {
code: 0,
message: 'ok',
data: body,
}
},
},
{
url: '/api/post/:id',
method: 'put',
response: ({ query, body }) => {
return {
code: 0,
message: 'ok',
data: {
id: query.id,
body,
},
}
},
},
{
url: '/api/post/:id',
method: 'delete',
response: ({ query }) => {
return {
code: 0,
message: 'ok',
data: {
id: query.id,
},
}
},
},
]

39
mock/api/user.js Normal file
View File

@@ -0,0 +1,39 @@
import { resolveToken } from '../utils'
const users = {
admin: {
id: 1,
name: '大脸怪(admin)',
avatar: 'https://assets.qszone.com/images/avatar.jpg',
email: 'Ronnie@123.com',
role: ['admin'],
},
editor: {
id: 2,
name: '大脸怪(editor)',
avatar: 'https://assets.qszone.com/images/avatar.jpg',
email: 'Ronnie@123.com',
role: ['editor'],
},
guest: {
id: 3,
name: '访客(guest)',
avatar: 'https://assets.qszone.com/images/avatar.jpg',
role: [],
},
}
export default [
{
url: '/api/user',
method: 'get',
response: ({ headers }) => {
const token = resolveToken(headers?.authorization)
return {
code: 0,
data: {
...(users[token] || users.guest),
},
}
},
},
]

6
mock/index.js Normal file
View File

@@ -0,0 +1,6 @@
import { createProdMockServer } from 'vite-plugin-mock/es/createProdMockServer'
import api from './api'
export function setupProdMockServer() {
createProdMockServer(api)
}

12
mock/utils.js Normal file
View File

@@ -0,0 +1,12 @@
export function resolveToken(authorization) {
/**
* * jwt token
* * Bearer + token
* ! 认证方案: Bearer
*/
const reqTokenSplit = authorization.split(' ')
if (reqTokenSplit.length === 2) {
return reqTokenSplit[1]
}
return ''
}

View File

@@ -33,50 +33,50 @@
}, },
"dependencies": { "dependencies": {
"@unocss/eslint-config": "^0.55.7", "@unocss/eslint-config": "^0.55.7",
"@vueuse/core": "^10.11.1", "@vueuse/core": "^10.9.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.6.8",
"dayjs": "^1.11.19", "dayjs": "^1.11.10",
"echarts": "^5.6.0", "echarts": "^5.5.0",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"md-editor-v3": "^4.21.3", "md-editor-v3": "^4.13.0",
"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.6.9",
"vue-router": "^4.6.3", "vue-router": "^4.3.0",
"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.199",
"@iconify/vue": "^4.3.0", "@iconify/vue": "^4.1.1",
"@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.21",
"@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.0.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": "^14.0.1", "lint-staged": "^14.0.1",
"naive-ui": "^2.43.1", "naive-ui": "^2.38.1",
"rollup-plugin-visualizer": "^5.14.0", "rollup-plugin-visualizer": "^5.12.0",
"sass": "^1.93.2", "sass": "^1.75.0",
"unocss": "0.55.3", "unocss": "0.55.3",
"unplugin-auto-import": "^0.16.7", "unplugin-auto-import": "^0.16.7",
"unplugin-icons": "^0.16.6", "unplugin-icons": "^0.16.6",
"unplugin-vue-components": "^0.25.2", "unplugin-vue-components": "^0.25.2",
"vite-plugin-compression": "^0.5.1", "vite-plugin-compression": "^0.5.1",
"vite-plugin-html": "^3.2.2", "vite-plugin-html": "^3.2.2",
"vite-plugin-mkcert": "^1.17.9", "vite-plugin-mkcert": "^1.17.5",
"vite-plugin-mock": "2.9.6", "vite-plugin-mock": "2.9.6",
"vite-plugin-svg-icons": "^2.0.1" "vite-plugin-svg-icons": "^2.0.1"
}, },

9660
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff