Skip to content

Commit c79d8ca

Browse files
committed
first commit
1 parent c0af08b commit c79d8ca

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+9982
-671
lines changed

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
VITE_BASE_API_URL=http://139.180.184.10:9999

.vscode/global.code-snippets

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"import": {
3+
"scope": "javascript,typescript",
4+
"prefix": "im",
5+
"body": ["import { $2 } from '$1';"],
6+
"description": "Import a module",
7+
},
8+
"export-all": {
9+
"scope": "javascript,typescript",
10+
"prefix": "ex",
11+
"body": ["export * from '$1';"],
12+
"description": "Export a module",
13+
},
14+
"vue-script-setup": {
15+
"scope": "vue",
16+
"prefix": "<sc",
17+
"body": [
18+
"<script setup lang=\"ts\">",
19+
"const props = defineProps<{",
20+
" modelValue?: boolean,",
21+
"}>()",
22+
"$1",
23+
"</script>",
24+
"",
25+
"<template>",
26+
" <div>",
27+
" <slot/>",
28+
" </div>",
29+
"</template>",
30+
],
31+
},
32+
"vue-computed": {
33+
"scope": "javascript,typescript,vue",
34+
"prefix": "com",
35+
"body": ["computed(() => { $1 })"],
36+
},
37+
}

eslint.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,9 @@ export default antfu({
44
formatters: true,
55
unocss: true,
66
vue: true,
7+
}, {
8+
// Without `files`, they are general rules for all files
9+
rules: {
10+
'no-console': 'off',
11+
},
712
})

openapi.config.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { writeFileSync } from 'node:fs'
2+
import path from 'node:path'
3+
import { generateApi } from 'swagger-typescript-api'
4+
5+
/* NOTE: all fields are optional expect one of `input`, `url`, `spec` */
6+
generateApi({
7+
output: path.resolve(process.cwd(), './src/api/backend'),
8+
url: 'http://139.180.184.10:9999/openapi.json',
9+
httpClientType: 'axios', // or "fetch"
10+
modular: true,
11+
// generateRouteTypes: true,
12+
moduleNameFirstTag: true,
13+
extractRequestParams: true,
14+
extractRequestBody: true,
15+
extractResponseError: true,
16+
extractResponseBody: true,
17+
extractEnums: true,
18+
unwrapResponseData: true,
19+
cleanOutput: true,
20+
singleHttpClient: true,
21+
generateResponses: true,
22+
hooks: {
23+
onCreateRoute(routeData) {
24+
routeData.namespace = `${routeData.namespace}API`
25+
return routeData
26+
},
27+
},
28+
}).then(({ files }) => {
29+
const content = files.reduce((acc, file) => {
30+
return `${acc}
31+
export * from './${file.fileName}'`
32+
}, '')
33+
// 生成统一导出文件
34+
writeFileSync('./src/api/backend/index.ts', content)
35+
})

package.json

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,16 @@
1515
"generate": "vite-ssg build",
1616
"lint": "eslint .",
1717
"preview": "vite preview",
18-
"typecheck": "vue-tsc --noEmit"
18+
"typecheck": "vue-tsc --noEmit",
19+
"openapi": "tsx openapi.config.ts"
1920
},
2021
"dependencies": {
21-
"@element-plus/icons-vue": "^2.3.1",
22+
"@element-plus/icons-vue": "^2.3.2",
2223
"@vueuse/core": "^13.6.0",
24+
"axios": "^1.11.0",
2325
"element-plus": "^2.10.5",
26+
"pinia": "^3.0.3",
27+
"pinia-plugin-persistedstate": "^4.4.1",
2428
"vue": "^3.5.18",
2529
"vue-router": "^4.5.1"
2630
},
@@ -31,14 +35,18 @@
3135
"@types/node": "^24.1.0",
3236
"@unocss/eslint-plugin": "^66.4.0",
3337
"@vitejs/plugin-vue": "^6.0.1",
38+
"@vitejs/plugin-vue-jsx": "^5.0.1",
3439
"eslint": "^9.32.0",
3540
"eslint-plugin-format": "^1.0.1",
3641
"sass": "^1.89.2",
42+
"swagger-typescript-api": "^13.2.7",
43+
"tsx": "^4.20.3",
3744
"typescript": "^5.9.2",
3845
"unocss": "^66.4.0",
46+
"unplugin-auto-import": "^20.0.0",
3947
"unplugin-vue-components": "^28.8.0",
40-
"unplugin-vue-router": "^0.14.0",
4148
"vite": "^7.0.6",
49+
"vite-plugin-vue-devtools": "^8.0.0",
4250
"vite-ssg": "^28.0.0",
4351
"vue-tsc": "^3.0.5"
4452
}

0 commit comments

Comments
 (0)