Skip to content

Commit

Permalink
Merge pull request #2 from sdmu-gaoqi/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
sdmu-gaoqi authored Jan 19, 2024
2 parents 0f6ae63 + 1b09307 commit 6e6d99b
Show file tree
Hide file tree
Showing 36 changed files with 7,997 additions and 5,862 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ dist-ssr
# Editor directories and files
.vscode/*
!.vscode/extensions.json
!.vscode/settings.json
.idea
.DS_Store
*.suo
Expand Down
7 changes: 6 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
{
"recommendations": ["Vue.volar", "Vue.vscode-typescript-vue-plugin"]
"recommendations": [
"Vue.volar",
"Vue.vscode-typescript-vue-plugin",
"wa.wa-language-tip",
"wa.wa-menus"
]
}
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": false,
"source.fixAll.stylelint": false
},
"editor.formatOnSave": true,
"typescript.tsdk": "node_modules/typescript/lib"
}
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
│   ├── menu.ts // 菜单配置
│   ├── route.ts // route配置
│   ├── utils // 工具函数集合
│   ├── mock // mock接口
│   └── logo.svg
├── index.html
├── package.json
Expand All @@ -39,6 +40,7 @@ export type WARoute = RouteRecordRaw & {
meta: {
permission?: string[] // 权限标识
key: string // 唯一标识
notNeedLogin?: boolean // 是否需要登录(route跳转不需要判断是否登录参数)
}

/**
Expand All @@ -62,7 +64,7 @@ const initPerms = async () => {
路由的定义遵从的规则
1. 需要关联权限的需要吧权限点写在permission中
1. 需要关联权限的需要把权限点写在permission中
2. 如果菜单与路由需要根据接口过滤权限 逻辑写在 initPerms
(其中 authRouter表示需要有权限点的菜单)
3. 路由与菜单的配置是两份 没有做一份呼转的逻辑
Expand Down Expand Up @@ -103,6 +105,17 @@ export type WAMenu = (ItemType & {
## 关于环境
不同环境配置再 env目录下
不同环境配置在 env目录下
注意 暴露给页面使用的需要加VITE前缀
package里有不同环境的打包方式
## 关于mock
mock预设为 test 与 prod(根据import.meta.env.MODE 决定 prod模式时 使用的是prod文件下的mock 其他的都是用的test下的mock)
需要增加更多环境支持可以在 mock/index.ts修改
## 关于插件
内设了几款插件
wa-menu 右键 src/locales/lang.xlsx可以 执行xlsx自动转ts的脚本
wa-language-tip 丰富i18n 在编写时的提示能力
2 changes: 1 addition & 1 deletion env/.env.development
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
NODE_ENV: development
VITE_BASE_REQUEST: https: //store-operations-admin-dev.yuque.com
VITE_BASE_REQUEST: /
2 changes: 1 addition & 1 deletion env/.env.production
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
NODE_ENV: production
VITE_BASE_REQUEST: https: //store-operations-admin.yuque.com
VITE_BASE_REQUEST: https://store-operations-admin.yuque.com
2 changes: 1 addition & 1 deletion env/.env.staging
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
NODE_ENV: production
VITE_BASE_REQUEST: https: //store-operations-admin-staging.yuque.com
VITE_BASE_REQUEST: https://store-operations-admin-staging.yuque.com
2 changes: 1 addition & 1 deletion env/.env.test
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
NODE_ENV: production
VITE_BASE_REQUEST: https: //store-operations-admin-test.yuque.com
VITE_BASE_REQUEST: https://store-operations-admin-test.yuque.com
Empty file added mock/prod/user.ts
Empty file.
43 changes: 43 additions & 0 deletions mock/test/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { MockMethod } from 'vite-plugin-mock'

// @ts-ignore
const testMock: MockMethod = [
{
url: '/api/login',
method: 'post',
timeout: 1000,
response: ({ data }: any) => {
console.log('登录请求数据 =>', data)
return {
code: 0,
data: {
token: 'thisIsToken'
}
}
}
},
{
url: '/api/perm',
method: 'get',
timeout: 1000,
response: ({ data }: any) => {
console.log('登录请求数据 =>', data)
return {
code: 0,
data: ['perm-1']
}
}
},
{
url: '/api/logout',
method: 'get',
timeout: 1000,
response: () => {
return {
code: 0
}
}
}
]

export default testMock
12 changes: 11 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"build:test": "vue-tsc && vite build --mode test",
"build:pre": "vue-tsc && vite build --mode staging",
"build:dev": "vue-tsc && vite build --mode development",
"dev": "vite",
"dev": "pnpm vite",
"preview": "vite preview",
"prepare": "husky install",
"prettier": "prettier -c --write **/*",
Expand Down Expand Up @@ -42,16 +42,23 @@
"config": {
"commitizen": {
"path": "node_modules/cz-git"
},
"wa-menus": {
"xlsxDefaultLan": "zh-CN",
"xlsxTransformPath": "src/locales",
"xlsxTransformType": "ts"
}
},
"dependencies": {
"@types/vue": "^2.0.0",
"add": "^2.0.6",
"ant-design-vue": "^4.0.0",
"axios": "^1.6.5",
"babel-eslint": "^10.1.0",
"dayjs": "^1.11.10",
"echarts": "^5.4.3",
"eslint-plugin-import": "^2.25.2",
"mockjs": "^1.1.0",
"path": "^0.12.7",
"postcss": "^8.0.0",
"prettier": "^3.0.0",
Expand All @@ -61,6 +68,7 @@
"vite-plugin-mkcert": "^1.16.0",
"vue": "^3.3.4",
"vue-hooks-plus": "^1.8.6",
"vue-i18n": "^9.9.0",
"vue-router": "^4.2.4",
"vuex": "^4.1.0",
"wa-utils": "^0.2.6"
Expand All @@ -81,13 +89,15 @@
"eslint-plugin-n": "^15.0.0 || ^16.0.0 ",
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-vue": "^9.17.0",
"glob": "^10.3.10",
"husky": "^8.0.3",
"lint-staged": "^13.0.3",
"stylelint": "^15.10.2",
"stylelint-config-standard-scss": "^10.0.0",
"tailwindcss": "^3.3.3",
"typescript": "*",
"vite": "^4.4.7",
"vite-plugin-mock": "^2.9.6",
"vite-svg-loader": "^4.0.0",
"vue-tsc": "^1.8.5",
"wa-postcss-pxtorem": "^0.0.1"
Expand Down
Loading

0 comments on commit 6e6d99b

Please sign in to comment.