create-bubbles 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +1 -1
  3. package/template-vue-rolldown-oxc/.gitlab-ci.yml +10 -2
  4. package/template-vue-rolldown-oxc/.oxlintrc.json +1 -14
  5. package/template-vue-rolldown-oxc/.vscode/settings.json +11 -0
  6. package/template-vue-rolldown-oxc/README.md +2 -30
  7. package/template-vue-rolldown-oxc/package.json +18 -16
  8. package/template-vue-rolldown-oxc/src/App.vue +12 -2
  9. package/template-vue-rolldown-oxc/src/utils/request/index.ts +1 -3
  10. package/template-vue-rolldown-oxc/src/views/home/index.vue +3 -2
  11. package/template-vue-rolldown-oxc/tsconfig.json +34 -2
  12. package/template-vue-rolldown-oxc/uno.config.ts +2 -5
  13. package/template-vue-rolldown-oxc/vite.config.ts +4 -3
  14. package/template-vue-vite-biome/.env +4 -0
  15. package/template-vue-vite-biome/.env.development +1 -0
  16. package/template-vue-vite-biome/.env.production +1 -0
  17. package/template-vue-vite-biome/.gitlab-ci.yml +84 -0
  18. package/template-vue-vite-biome/.vscode/settings.json +10 -0
  19. package/template-vue-vite-biome/README.md +3 -0
  20. package/template-vue-vite-biome/biome.json +104 -0
  21. package/template-vue-vite-biome/commitlint.config.js +1 -0
  22. package/template-vue-vite-biome/index.html +13 -0
  23. package/template-vue-vite-biome/lefthook.yml +11 -0
  24. package/template-vue-vite-biome/package.json +50 -0
  25. package/template-vue-vite-biome/public/vite.svg +1 -0
  26. package/template-vue-vite-biome/src/App.vue +19 -0
  27. package/template-vue-vite-biome/src/assets/icon/vue.svg +1 -0
  28. package/template-vue-vite-biome/src/components/Icon/svg-icon.vue +29 -0
  29. package/template-vue-vite-biome/src/layout/default/index.vue +3 -0
  30. package/template-vue-vite-biome/src/main.ts +15 -0
  31. package/template-vue-vite-biome/src/router/guard/index.ts +7 -0
  32. package/template-vue-vite-biome/src/router/guard/permissionGuard.ts +13 -0
  33. package/template-vue-vite-biome/src/router/index.ts +17 -0
  34. package/template-vue-vite-biome/src/router/modules/index.ts +31 -0
  35. package/template-vue-vite-biome/src/store/index.ts +10 -0
  36. package/template-vue-vite-biome/src/store/modules/user.ts +17 -0
  37. package/template-vue-vite-biome/src/styles/element-plus-variables.css +4 -0
  38. package/template-vue-vite-biome/src/styles/font.scss +0 -0
  39. package/template-vue-vite-biome/src/styles/index.scss +31 -0
  40. package/template-vue-vite-biome/src/styles/variables.scss +3 -0
  41. package/template-vue-vite-biome/src/types/vite-env.d.ts +13 -0
  42. package/template-vue-vite-biome/src/utils/env.ts +10 -0
  43. package/template-vue-vite-biome/src/utils/request/core/index.ts +166 -0
  44. package/template-vue-vite-biome/src/utils/request/core/utils.ts +38 -0
  45. package/template-vue-vite-biome/src/utils/request/index.ts +39 -0
  46. package/template-vue-vite-biome/src/views/home/index.vue +16 -0
  47. package/template-vue-vite-biome/src/views/login/index.vue +11 -0
  48. package/template-vue-vite-biome/src/views/model/index.vue +7 -0
  49. package/{template-vue-rolldown-oxc/tsconfig.app.json → template-vue-vite-biome/tsconfig.json} +15 -4
  50. package/template-vue-vite-biome/uno.config.ts +10 -0
  51. package/template-vue-vite-biome/vite.config.ts +51 -0
  52. package/template-vue-vite-eslint/.env +4 -0
  53. package/template-vue-vite-eslint/.env.development +1 -0
  54. package/template-vue-vite-eslint/.env.production +1 -0
  55. package/template-vue-vite-eslint/.gitlab-ci.yml +84 -0
  56. package/template-vue-vite-eslint/.vscode/settings.json +54 -0
  57. package/template-vue-vite-eslint/README.md +3 -0
  58. package/template-vue-vite-eslint/commitlint.config.js +1 -0
  59. package/template-vue-vite-eslint/eslint.config.js +64 -0
  60. package/template-vue-vite-eslint/index.html +13 -0
  61. package/template-vue-vite-eslint/lefthook.yml +11 -0
  62. package/template-vue-vite-eslint/package.json +54 -0
  63. package/template-vue-vite-eslint/public/vite.svg +1 -0
  64. package/template-vue-vite-eslint/src/App.vue +19 -0
  65. package/template-vue-vite-eslint/src/assets/icon/vue.svg +1 -0
  66. package/template-vue-vite-eslint/src/components/Icon/svg-icon.vue +29 -0
  67. package/template-vue-vite-eslint/src/layout/default/index.vue +3 -0
  68. package/template-vue-vite-eslint/src/main.ts +16 -0
  69. package/template-vue-vite-eslint/src/router/guard/index.ts +7 -0
  70. package/template-vue-vite-eslint/src/router/guard/permissionGuard.ts +13 -0
  71. package/template-vue-vite-eslint/src/router/index.ts +18 -0
  72. package/template-vue-vite-eslint/src/router/modules/index.ts +31 -0
  73. package/template-vue-vite-eslint/src/store/index.ts +11 -0
  74. package/template-vue-vite-eslint/src/store/modules/user.ts +20 -0
  75. package/template-vue-vite-eslint/src/styles/element-plus-variables.css +4 -0
  76. package/template-vue-vite-eslint/src/styles/font.scss +0 -0
  77. package/template-vue-vite-eslint/src/styles/index.scss +30 -0
  78. package/template-vue-vite-eslint/src/styles/variables.scss +3 -0
  79. package/template-vue-vite-eslint/src/types/vite-env.d.ts +15 -0
  80. package/template-vue-vite-eslint/src/utils/env.ts +10 -0
  81. package/template-vue-vite-eslint/src/utils/request/core/index.ts +172 -0
  82. package/template-vue-vite-eslint/src/utils/request/core/utils.ts +41 -0
  83. package/template-vue-vite-eslint/src/utils/request/index.ts +39 -0
  84. package/template-vue-vite-eslint/src/views/home/index.vue +24 -0
  85. package/template-vue-vite-eslint/src/views/login/index.vue +9 -0
  86. package/template-vue-vite-eslint/src/views/model/index.vue +7 -0
  87. package/{template-vue-rolldown-oxc/tsconfig.node.json → template-vue-vite-eslint/tsconfig.json} +20 -9
  88. package/template-vue-vite-eslint/uno.config.ts +17 -0
  89. package/template-vue-vite-eslint/vite.config.ts +53 -0
  90. package/template-vue-rolldown-oxc/components.d.ts +0 -18
  91. package/template-vue-rolldown-oxc/src/types/auto-import.d.ts +0 -78
  92. package/template-vue-rolldown-oxc/src/types/components.d.ts +0 -16
@@ -0,0 +1,84 @@
1
+ .send_dingtalk_notification: &send_dingtalk_notification |
2
+ case "$CI_JOB_STAGE" in
3
+ "build")
4
+ stage_name="构建"
5
+ ;;
6
+ "deploy")
7
+ stage_name="部署"
8
+ ;;
9
+ esac
10
+
11
+ if [ "$CI_JOB_STATUS" == "success" ]; then
12
+ title="==✅ ${stage_name}成功=="
13
+ else
14
+ title="==❌ ${stage_name}失败=="
15
+ fi
16
+
17
+ curl -s -X POST ${DINGTALK_WEBHOOK} \
18
+ -H "Content-Type: application/json" \
19
+ -d "{
20
+ \"msgtype\": \"markdown\",
21
+ \"markdown\": {
22
+ \"title\": \"GitLab CI/CD 通知\",
23
+ \"text\": \"### ${title}\n\n- **项目**: ${CI_PROJECT_NAME}\n- **项目地址**: ${CI_PROJECT_URL}\n- **阶段**: ${stage_name}\n- **任务**: [查看详情](${CI_JOB_URL})\n- **分支**: ${CI_COMMIT_REF_NAME}\n- **提交人**: ${CI_COMMIT_AUTHOR}\n- **提交信息**: ${CI_COMMIT_MESSAGE}\n- **时间**: $(date '+%Y-%m-%d %H:%M:%S')\"
24
+ }
25
+ }"
26
+
27
+ stages:
28
+ - build
29
+ - deploy
30
+
31
+ variables:
32
+ DEPLOY_PATH: /usr/local/bee/web/pipe-network/pipe-network-model
33
+ MOCK_DEPLOY_PATH: /usr/local/bee/web/pipe-network/pipe-network-model-mock
34
+ DINGTALK_WEBHOOK: 'https://oapi.dingtalk.com/robot/send?access_token=${DING_TALK_ACCESS_TOKEN}'
35
+
36
+ cache:
37
+ paths:
38
+ - node_modules/
39
+
40
+ # 打包
41
+ build:
42
+ stage: build
43
+ script:
44
+ - cd ${CI_PROJECT_DIR}
45
+ - whoami
46
+ - echo "===== 开始构建 ====="
47
+ - pnpm install
48
+ - pnpm build
49
+ - echo "===== 构建完成 ====="
50
+ only:
51
+ - dev
52
+ - mock
53
+ artifacts:
54
+ paths:
55
+ - dist/
56
+ after_script:
57
+ # 钉钉通知
58
+ - *send_dingtalk_notification
59
+
60
+ # 部署
61
+ deploy:
62
+ stage: deploy
63
+ needs: [build]
64
+ only:
65
+ - dev
66
+ - mock
67
+ script:
68
+ - echo "-----------------开始部署------------------"
69
+ - |
70
+ if [ "$CI_COMMIT_BRANCH" == "dev" ]; then
71
+ ssh root@192.168.2.245 "rm -rf $DEPLOY_PATH/*" || { echo "❌ 清理245失败"; exit 1; }
72
+ scp -r dist/* root@192.168.2.245:$DEPLOY_PATH || { echo "❌ 传输到245失败"; exit 1; }
73
+ ssh root@192.168.2.57 "rm -rf $DEPLOY_PATH/*" || { echo "❌ 清理57失败"; exit 1; }
74
+ scp -r dist/* root@192.168.2.57:$DEPLOY_PATH || { echo "❌ 传输到57失败"; exit 1; }
75
+ elif [ "$CI_COMMIT_BRANCH" == "mock" ]; then
76
+ ssh root@192.168.2.57 "rm -rf $MOCK_DEPLOY_PATH/*" || { echo "❌ 清理57失败"; exit 1; }
77
+ scp -r dist/* root@192.168.2.57:$MOCK_DEPLOY_PATH || { echo "❌ 传输到57失败"; exit 1; }
78
+ else
79
+ echo "没有匹配到需要部署的分支或标签,跳过部署"
80
+ exit 0
81
+ fi
82
+ after_script:
83
+ # 钉钉通知
84
+ - *send_dingtalk_notification
@@ -0,0 +1,54 @@
1
+ {
2
+ "oxc.enable": false,
3
+ "biome.enabled": false,
4
+ "typescript.tsdk": "node_modules\\typescript\\lib",
5
+ // Disable the default formatter, use eslint instead
6
+ "prettier.enable": false,
7
+ "editor.formatOnSave": false,
8
+
9
+ // Auto fix
10
+ "editor.codeActionsOnSave": {
11
+ "source.fixAll.eslint": "explicit",
12
+ "source.organizeImports": "never"
13
+ },
14
+
15
+ // Silent the stylistic rules in you IDE, but still auto fix them
16
+ "eslint.rules.customizations": [
17
+ { "rule": "style/*", "severity": "off", "fixable": true },
18
+ { "rule": "format/*", "severity": "off", "fixable": true },
19
+ { "rule": "*-indent", "severity": "off", "fixable": true },
20
+ { "rule": "*-spacing", "severity": "off", "fixable": true },
21
+ { "rule": "*-spaces", "severity": "off", "fixable": true },
22
+ { "rule": "*-order", "severity": "off", "fixable": true },
23
+ { "rule": "*-dangle", "severity": "off", "fixable": true },
24
+ { "rule": "*-newline", "severity": "off", "fixable": true },
25
+ { "rule": "*quotes", "severity": "off", "fixable": true },
26
+ { "rule": "*semi", "severity": "off", "fixable": true }
27
+ ],
28
+
29
+ // Enable eslint for all supported languages
30
+ "eslint.validate": [
31
+ "javascript",
32
+ "javascriptreact",
33
+ "typescript",
34
+ "typescriptreact",
35
+ "vue",
36
+ "html",
37
+ "markdown",
38
+ "json",
39
+ "json5",
40
+ "jsonc",
41
+ "yaml",
42
+ "toml",
43
+ "xml",
44
+ "gql",
45
+ "graphql",
46
+ "astro",
47
+ "svelte",
48
+ "css",
49
+ "less",
50
+ "scss",
51
+ "pcss",
52
+ "postcss"
53
+ ]
54
+ }
@@ -0,0 +1,3 @@
1
+ ### ui 组件库
2
+
3
+ element-plus pro-components
@@ -0,0 +1 @@
1
+ export default { extends: ['@commitlint/config-conventional'] }
@@ -0,0 +1,64 @@
1
+ import antfu from '@antfu/eslint-config'
2
+
3
+ export default antfu({
4
+ formatters: {
5
+ css: true, // 启用 CSS、LESS、SCSS 及 Vue <style> 块格式化
6
+ html: true, // 启用 HTML 文件格式化
7
+ },
8
+ vue: true,
9
+ unocss: true,
10
+ }, {
11
+ rules: {
12
+ 'perfectionist/sort-imports': [ // 配置导入排序
13
+ 'error',
14
+ {
15
+ customGroups: {
16
+ type: {
17
+ 'vue-type': ['^vue$', '^vue-.+', '^@vue/.+'],
18
+ },
19
+ value: {
20
+ vue: ['^vue$', '^vue-.+', '^@vue/.+'], // Vue 相关库
21
+ components: ['^@/components/.+', '@/tmui/.+'], // 组件
22
+ stores: ['^@/store/.+'], // 状态管理
23
+ utils: ['^@/utils/.+'], // 工具函数
24
+ constants: ['^@/constants/.+'], // 常量
25
+ hooks: ['^@/hooks/.+'], // 自定义 hooks
26
+ api: ['^@/service/.+'], // API 服务
27
+ },
28
+ },
29
+ environment: 'node',
30
+ groups: [
31
+ // 类型导入
32
+ ['external-type', 'builtin-type', 'type'],
33
+ 'vue-type',
34
+ ['parent-type', 'sibling-type', 'index-type'],
35
+ ['internal-type'],
36
+ // 值导入
37
+ 'builtin',
38
+ 'vue',
39
+ 'external',
40
+ 'internal',
41
+ // 内部模块
42
+ 'components',
43
+ 'stores',
44
+ 'utils',
45
+ 'constants',
46
+ 'hooks',
47
+ 'api',
48
+ // 其他
49
+ ['parent', 'sibling', 'index'],
50
+ 'side-effect',
51
+ 'side-effect-style',
52
+ 'style',
53
+ 'object',
54
+ 'unknown',
55
+ ],
56
+ internalPattern: ['^@/.+'], // 内部模块路径匹配
57
+ newlinesBetween: 'always', // 导入组之间空行
58
+ order: 'asc', // 升序排序
59
+ type: 'natural', // 自然排序
60
+ },
61
+ ],
62
+ },
63
+
64
+ })
@@ -0,0 +1,13 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Vite + Vue + TS</title>
8
+ </head>
9
+ <body>
10
+ <div id="app"></div>
11
+ <script type="module" src="/src/main.ts"></script>
12
+ </body>
13
+ </html>
@@ -0,0 +1,11 @@
1
+ pre-commit:
2
+ commands:
3
+ check:
4
+ glob: '*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc,vue}'
5
+ run: pnpm eslint --fix {staged_files}
6
+ stage_fixed: true
7
+
8
+ commit-msg:
9
+ commands:
10
+ lint commit message:
11
+ run: npx commitlint --edit {1}
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "template-vue-eslint",
3
+ "type": "module",
4
+ "version": "0.0.0",
5
+ "private": true,
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "vue-tsc -b && vite build",
9
+ "preview": "vite preview",
10
+ "lint": "eslint",
11
+ "lint:fix": "eslint --fix"
12
+ },
13
+ "dependencies": {
14
+ "@alova/adapter-axios": "^2.0.16",
15
+ "@element-plus/icons-vue": "^2.3.2",
16
+ "@vueuse/core": "^13.9.0",
17
+ "alova": "^3.3.4",
18
+ "axios": "^1.12.2",
19
+ "dayjs": "^1.11.18",
20
+ "echarts": "^6.0.0",
21
+ "element-plus": "^2.11.5",
22
+ "nprogress": "^0.2.0",
23
+ "pinia": "^3.0.3",
24
+ "pinia-plugin-persistedstate": "^4.5.0",
25
+ "plus-pro-components": "^0.1.30",
26
+ "radashi": "^12.7.0",
27
+ "vue": "^3.5.22",
28
+ "vue-router": "^4.6.3"
29
+ },
30
+ "devDependencies": {
31
+ "@antfu/eslint-config": "^6.0.0",
32
+ "@biomejs/biome": "^2.2.6",
33
+ "@commitlint/cli": "^20.1.0",
34
+ "@commitlint/config-conventional": "^20.0.0",
35
+ "@plus-pro-components/resolver": "^0.0.3",
36
+ "@types/nprogress": "^0.2.3",
37
+ "@unocss/eslint-plugin": "^66.5.4",
38
+ "@vitejs/plugin-vue": "^6.0.1",
39
+ "@vue/tsconfig": "^0.8.1",
40
+ "eslint": "9.38.0",
41
+ "eslint-plugin-format": "^1.0.2",
42
+ "fast-glob": "^3.3.3",
43
+ "lefthook": "^2.0.0",
44
+ "sass": "^1.93.2",
45
+ "typescript": "~5.9.3",
46
+ "unocss": "66.5.4",
47
+ "unplugin-auto-import": "^20.2.0",
48
+ "unplugin-vue-components": "^30.0.0",
49
+ "vite": "npm:rolldown-vite@latest",
50
+ "vite-plugin-inspect": "^11.3.3",
51
+ "vite-plugin-svg-icons": "^2.0.1",
52
+ "vue-tsc": "^3.1.1"
53
+ }
54
+ }
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
@@ -0,0 +1,19 @@
1
+ <script setup lang="ts">
2
+ import zhCn from 'element-plus/es/locale/lang/zh-cn'
3
+ import plusZhCn from 'plus-pro-components/es/locale/lang/zh-cn'
4
+
5
+ const locale = {
6
+ ...zhCn,
7
+ ...plusZhCn,
8
+ }
9
+ </script>
10
+
11
+ <template>
12
+ <el-config-provider
13
+ :locale="locale"
14
+ >
15
+ <RouterView />
16
+ </el-config-provider>
17
+ </template>
18
+
19
+ <style scoped></style>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="currentColor" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="currentColor" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>
@@ -0,0 +1,29 @@
1
+ <script setup lang="ts">
2
+ defineProps<{
3
+ name: string
4
+ }>()
5
+ const attrs = useAttrs()
6
+ </script>
7
+
8
+ <template>
9
+ <svg class="svg-icon" aria-hidden="true" v-bind="attrs">
10
+ <use :href="`#icon-${name}`" />
11
+ </svg>
12
+ </template>
13
+
14
+ <style lang="scss" scoped>
15
+ .svg-icon {
16
+ display: flex;
17
+ justify-content: center;
18
+ align-items: center;
19
+ width: 1em;
20
+ height: 1em;
21
+ fill: currentColor;
22
+ overflow: hidden;
23
+ }
24
+
25
+ .svg-external-icon {
26
+ background-color: currentColor;
27
+ mask-size: cover !important;
28
+ }
29
+ </style>
@@ -0,0 +1,3 @@
1
+ <template>
2
+ <router-view />
3
+ </template>
@@ -0,0 +1,16 @@
1
+ import { createApp } from 'vue'
2
+
3
+ import App from './App.vue'
4
+ import { setupRouter } from './router'
5
+ import { setupStore } from './store'
6
+
7
+ import 'virtual:svg-icons-register'
8
+
9
+ import '@/styles/element-plus-variables.css'
10
+ import '@/styles/index.scss'
11
+ import 'virtual:uno.css'
12
+
13
+ const app = createApp(App)
14
+ setupRouter(app)
15
+ setupStore(app)
16
+ app.mount('#app')
@@ -0,0 +1,7 @@
1
+ import type { Router } from 'vue-router'
2
+
3
+ import { createPermissionGuard } from './permissionGuard'
4
+
5
+ export function setupGuard(router: Router) {
6
+ createPermissionGuard(router)
7
+ }
@@ -0,0 +1,13 @@
1
+ import type { Router } from 'vue-router'
2
+
3
+ import NProgress from 'nprogress'
4
+
5
+ export function createPermissionGuard(router: Router) {
6
+ router.beforeEach((_to, _from, next) => {
7
+ NProgress.start()
8
+ next()
9
+ })
10
+ router.afterEach((_to, _from) => {
11
+ NProgress.done()
12
+ })
13
+ }
@@ -0,0 +1,18 @@
1
+ import type { App } from 'vue'
2
+
3
+ import { createRouter, createWebHistory } from 'vue-router'
4
+
5
+ import { setupGuard } from './guard'
6
+ import { routes } from './modules'
7
+
8
+ export const router = createRouter({
9
+ history: createWebHistory(import.meta.env.PUBLIC_PATH),
10
+ routes,
11
+ strict: true,
12
+ scrollBehavior: () => ({ left: 0, top: 0 }),
13
+ })
14
+
15
+ export function setupRouter(app: App) {
16
+ setupGuard(router)
17
+ app.use(router)
18
+ }
@@ -0,0 +1,31 @@
1
+ import type { RouteRecordRaw } from 'vue-router'
2
+
3
+ /**
4
+ * IsMaskAll 代表 是不是要和模型交互 为true 全部遮罩
5
+ */
6
+
7
+ export const routes: RouteRecordRaw[] = [
8
+ {
9
+ path: '/',
10
+ name: 'layout',
11
+ component: () => import('@/layout/default/index.vue'),
12
+ children: [
13
+ {
14
+ path: '/',
15
+ redirect: '/home',
16
+ },
17
+ {
18
+ path: '/home',
19
+ name: 'Home',
20
+ meta: { title: '研发A区数字孪生可视化大屏' },
21
+ component: () => import('@/views/home/index.vue'),
22
+ },
23
+ ],
24
+ },
25
+ {
26
+ path: '/login',
27
+ name: 'login',
28
+ meta: { title: '登录' },
29
+ component: () => import('@/views/login/index.vue'),
30
+ },
31
+ ]
@@ -0,0 +1,11 @@
1
+ import type { App } from 'vue'
2
+
3
+ import { createPinia } from 'pinia'
4
+ import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
5
+
6
+ export const store = createPinia()
7
+ store.use(piniaPluginPersistedstate)
8
+
9
+ export function setupStore(app: App) {
10
+ app.use(store)
11
+ }
@@ -0,0 +1,20 @@
1
+ import { defineStore } from 'pinia'
2
+
3
+ import { store } from '..'
4
+
5
+ export const useUserStore = defineStore(
6
+ 'user',
7
+ {
8
+ state: () => {
9
+ return {
10
+ name: 'admin',
11
+ token: 'admin',
12
+ avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
13
+ }
14
+ },
15
+ },
16
+ )
17
+
18
+ export function useUserStoreWithOut() {
19
+ return useUserStore(store)
20
+ }
@@ -0,0 +1,4 @@
1
+ :root:has(#app) {
2
+ --el-color-primary: #284471;
3
+ --el-color-primary-light-3: rgb(40, 68, 113, 0.8);
4
+ }
File without changes
@@ -0,0 +1,30 @@
1
+ @use './font.scss';
2
+ @use './variables.scss';
3
+ @use './element-plus-variables.css';
4
+
5
+ html,
6
+ body,
7
+ #root {
8
+ width: 100%;
9
+ height: 100%;
10
+ font-family: 'SourceHanSansCN';
11
+ }
12
+
13
+ *,
14
+ *::before,
15
+ *::after {
16
+ margin: 0;
17
+ padding: 0;
18
+ box-sizing: border-box;
19
+ }
20
+
21
+ //弹窗的标题样式
22
+ .dialog-title {
23
+ border-left: 3px solid #22b5ffff;
24
+ padding-left: 10px;
25
+ height: 16px;
26
+ color: #ffffffb8;
27
+ font: 700;
28
+ font-size: 16px;
29
+ line-height: 16px;
30
+ }
@@ -0,0 +1,3 @@
1
+ :root {
2
+ --header-height: 80px;
3
+ }
@@ -0,0 +1,15 @@
1
+ /// <reference types="vite/client" />
2
+
3
+ /* eslint-disable */
4
+ declare module '*.vue' {
5
+ import type { DefineComponent } from 'vue'
6
+
7
+ const component: DefineComponent<{}, {}, any>
8
+ export default component
9
+ }
10
+
11
+ // vite-plugin-svg-icons 类型声明
12
+ declare module 'virtual:svg-icons-register' {
13
+ const register: () => void
14
+ export default register
15
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * 通过一个文件导出所有的环境变量这样方便统一修改
3
+ * @returns
4
+ */
5
+ export const envVariables = {
6
+ PUBLIC_PORT: import.meta.env.PUBLIC_PORT,
7
+ PUBLIC_PATH: import.meta.env.PUBLIC_PATH,
8
+ PUBLIC_APP_NAME: import.meta.env.PUBLIC_APP_NAME,
9
+ PUBLIC_API_AFFIX: import.meta.env.PUBLIC_API_AFFIX,
10
+ }