gridsum-vue3-pc 1.0.0

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 (57) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/LICENSE +21 -0
  3. package/README.md +88 -0
  4. package/bin/create-vue3-pc.mjs +545 -0
  5. package/package.json +68 -0
  6. package/template/base/.dockerignore +12 -0
  7. package/template/base/.env +5 -0
  8. package/template/base/.env.production +5 -0
  9. package/template/base/.eslintrc.cjs +22 -0
  10. package/template/base/.husky/commit-msg +1 -0
  11. package/template/base/.husky/pre-commit +1 -0
  12. package/template/base/.lintstagedrc +7 -0
  13. package/template/base/.prettierrc +5 -0
  14. package/template/base/.stylelintrc.cjs +6 -0
  15. package/template/base/.vscode/settings.json +26 -0
  16. package/template/base/CHANGELOG.md +6 -0
  17. package/template/base/Dockerfile +19 -0
  18. package/template/base/README.md +87 -0
  19. package/template/base/commitlint.config.cjs +1 -0
  20. package/template/base/index.html +15 -0
  21. package/template/base/mock/user.js +393 -0
  22. package/template/base/nginx.conf +27 -0
  23. package/template/base/package.json +47 -0
  24. package/template/base/public/favicon.svg +9 -0
  25. package/template/base/public/logo.svg +9 -0
  26. package/template/base/src/App.vue +20 -0
  27. package/template/base/src/assets/index.css +83 -0
  28. package/template/base/src/assets/logo.png +0 -0
  29. package/template/base/src/components/LanguageSwitch.vue +65 -0
  30. package/template/base/src/components/basic-layout.vue +484 -0
  31. package/template/base/src/composables/useCrud.ts +172 -0
  32. package/template/base/src/env.d.ts +28 -0
  33. package/template/base/src/env.ts +24 -0
  34. package/template/base/src/locales/en.json +153 -0
  35. package/template/base/src/locales/index.ts +32 -0
  36. package/template/base/src/locales/zh.json +153 -0
  37. package/template/base/src/main.ts +27 -0
  38. package/template/base/src/router/index.ts +91 -0
  39. package/template/base/src/services/http.ts +64 -0
  40. package/template/base/src/services/user.ts +23 -0
  41. package/template/base/src/store/modules/user.ts +45 -0
  42. package/template/base/src/views/Admin.vue +326 -0
  43. package/template/base/src/views/Home.vue +382 -0
  44. package/template/base/src/views/Login.vue +1252 -0
  45. package/template/base/src/views/Role.vue +269 -0
  46. package/template/base/src/views/User.vue +332 -0
  47. package/template/base/src/views/error/Forbidden.vue +62 -0
  48. package/template/base/src/views/error/NotFound.vue +60 -0
  49. package/template/base/src/views/error/ServerError.vue +62 -0
  50. package/template/base/tests/e2e/example.spec.ts +7 -0
  51. package/template/base/tests/unit/user.test.ts +15 -0
  52. package/template/base/vite.config.ts +52 -0
  53. package/template/cicd-github/.github/workflows/ci.yml +123 -0
  54. package/template/cicd-gitlab/.gitlab-ci.yml +103 -0
  55. package/template/cicd-jenkins/Jenkinsfile +107 -0
  56. package/template/ts/shims-vue.d.ts +5 -0
  57. package/template/ts/tsconfig.json +23 -0
@@ -0,0 +1,27 @@
1
+ server {
2
+ listen 80;
3
+ server_name localhost;
4
+ root /usr/share/nginx/html;
5
+ index index.html;
6
+
7
+ add_header X-Frame-Options "SAMEORIGIN" always;
8
+ add_header X-Content-Type-Options "nosniff" always;
9
+ add_header Referrer-Policy "strict-origin-when-cross-origin" always;
10
+
11
+ location / {
12
+ try_files $uri $uri/ /index.html;
13
+ }
14
+
15
+ location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
16
+ expires 1y;
17
+ add_header Cache-Control "public, immutable";
18
+ }
19
+
20
+ gzip on;
21
+ gzip_min_length 1000;
22
+ gzip_comp_level 6;
23
+ gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript image/svg+xml;
24
+ gzip_vary on;
25
+ gzip_proxied any;
26
+ gzip_disable "msie6";
27
+ }
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "<name>",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "vue-tsc && vite build",
9
+ "preview": "vite preview",
10
+ "test": "vitest",
11
+ "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx --fix",
12
+ "typecheck": "vue-tsc --noEmit",
13
+ "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
14
+ "prepare": "husky"
15
+ },
16
+ "dependencies": {
17
+ "vue": "^3.5.0",
18
+ "pinia": "^2.2.0",
19
+ "vue-router": "^4.4.0",
20
+ "axios": "^1.7.0",
21
+ "element-plus": "^2.8.0",
22
+ "@element-plus/icons-vue": "^2.3.0",
23
+ "vue-i18n": "^11.0.0"
24
+ },
25
+ "devDependencies": {
26
+ "@vitejs/plugin-vue": "^5.1.0",
27
+ "@types/node": "^22.0.0",
28
+ "typescript": "^5.5.0",
29
+ "vue-tsc": "^2.1.0",
30
+ "vite": "^5.4.0",
31
+ "vitest": "^2.1.0",
32
+ "@vue/test-utils": "^2.4.0",
33
+ "eslint": "^9.0.0",
34
+ "eslint-plugin-vue": "^9.28.0",
35
+ "prettier": "^3.3.0",
36
+ "stylelint": "^15.11.0",
37
+ "husky": "^9.1.0",
38
+ "lint-staged": "^15.0.0",
39
+ "commitlint": "^19.5.0",
40
+ "@commitlint/config-conventional": "^19.5.0",
41
+ "vite-plugin-mock": "^3.0.0",
42
+ "mockjs": "^1.1.0",
43
+ "sass": "^1.79.0",
44
+ "zod": "^3.23.0",
45
+ "@playwright/test": "^1.48.0"
46
+ }
47
+ }
@@ -0,0 +1,9 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
2
+ <rect width="32" height="32" rx="6" fill="#667eea"/>
3
+ <g stroke="#fff" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" fill="none" transform="translate(4,4) scale(1.5)">
4
+ <path d="M8 0L10 4.5H6L8 0Z" />
5
+ <path d="M8 16L6 11.5H10L8 16Z" />
6
+ <path d="M0 8L4.5 6V10L0 8Z" />
7
+ <path d="M16 8L11.5 10V6L16 8Z" />
8
+ </g>
9
+ </svg>
@@ -0,0 +1,9 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
2
+ <rect width="24" height="24" rx="4.5" fill="#667eea" />
3
+ <g stroke="#fff" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" fill="none" transform="translate(3,3) scale(1.5)">
4
+ <path d="M6 0L7.5 4.5H4.5L6 0Z" />
5
+ <path d="M6 12L4.5 7.5H7.5L6 12Z" />
6
+ <path d="M0 6L4.5 4.5V7.5L0 6Z" />
7
+ <path d="M12 6L7.5 7.5V4.5L12 6Z" />
8
+ </g>
9
+ </svg>
@@ -0,0 +1,20 @@
1
+ <template>
2
+ <el-config-provider :locale="elementLocale">
3
+ <router-view />
4
+ </el-config-provider>
5
+ </template>
6
+
7
+ <script setup lang="ts">
8
+ import { ref, watch } from 'vue';
9
+ import { useI18n } from 'vue-i18n';
10
+ import zhCn from 'element-plus/dist/locale/zh-cn.mjs';
11
+ import en from 'element-plus/dist/locale/en.mjs';
12
+
13
+ const { locale } = useI18n();
14
+
15
+ const elementLocale = ref(locale.value === 'zh' ? zhCn : en);
16
+
17
+ watch(locale, (val) => {
18
+ elementLocale.value = val === 'zh' ? zhCn : en;
19
+ });
20
+ </script>
@@ -0,0 +1,83 @@
1
+ *,
2
+ *::before,
3
+ *::after {
4
+ box-sizing: border-box;
5
+ }
6
+
7
+ body {
8
+ margin: 0;
9
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', 'Noto Sans SC', sans-serif;
10
+ background: #f0f2f5;
11
+ color: #1a1a2e;
12
+ -webkit-font-smoothing: antialiased;
13
+ -moz-osx-font-smoothing: grayscale;
14
+ line-height: 1.5;
15
+ }
16
+
17
+ ::-webkit-scrollbar {
18
+ width: 6px;
19
+ height: 6px;
20
+ }
21
+
22
+ ::-webkit-scrollbar-track {
23
+ background: transparent;
24
+ }
25
+
26
+ ::-webkit-scrollbar-thumb {
27
+ background: #c0c4cc;
28
+ border-radius: 4px;
29
+ transition: background 0.2s;
30
+ }
31
+
32
+ ::-webkit-scrollbar-thumb:hover {
33
+ background: #909399;
34
+ }
35
+
36
+ ::selection {
37
+ background: rgba(64, 158, 255, 0.2);
38
+ }
39
+
40
+ html.dark body {
41
+ background: #0d1117;
42
+ color: #c9d1d9;
43
+ }
44
+
45
+ html.dark ::-webkit-scrollbar-thumb {
46
+ background: #30363d;
47
+ }
48
+
49
+ html.dark ::-webkit-scrollbar-thumb:hover {
50
+ background: #484f58;
51
+ }
52
+
53
+ html.dark ::selection {
54
+ background: rgba(64, 158, 255, 0.4);
55
+ }
56
+
57
+ html.dark {
58
+ --el-bg-color: #0d1117;
59
+ --el-bg-color-overlay: #161b22;
60
+ --el-text-color-primary: #c9d1d9;
61
+ --el-text-color-regular: #8b949e;
62
+ --el-border-color: #21262d;
63
+ --el-border-color-light: #30363d;
64
+ --el-border-color-lighter: #30363d;
65
+ --el-fill-color: #1c2128;
66
+ --el-fill-color-light: #1e2430;
67
+ --el-fill-color-lighter: #21262d;
68
+ --el-table-bg-color: #161b22;
69
+ --el-table-tr-bg-color: transparent;
70
+ --el-table-header-bg-color: #1c2128;
71
+ --el-table-header-text-color: #c9d1d9;
72
+ --el-table-text-color: #c9d1d9;
73
+ --el-table-border-color: #21262d;
74
+ --el-table-row-hover-bg-color: rgba(88, 166, 255, 0.08);
75
+ --el-card-bg-color: #161b22;
76
+ --el-card-border-color: #21262d;
77
+ --el-dialog-bg-color: #161b22;
78
+ --el-dialog-border-color: #30363d;
79
+ --el-menu-bg-color: #161b22;
80
+ --el-menu-text-color: #c9d1d9;
81
+ --el-menu-hover-bg-color: #1c2128;
82
+ --el-menu-active-color: #409eff;
83
+ }
@@ -0,0 +1,65 @@
1
+ <template>
2
+ <el-dropdown @command="handleCommand" trigger="click">
3
+ <el-button text class="lang-btn">
4
+ <el-icon><ArrowDown /></el-icon>
5
+ <span class="lang-text">{{ locale === 'zh' ? $t('language.zh') : $t('language.en') }}</span>
6
+ </el-button>
7
+ <template #dropdown>
8
+ <el-dropdown-menu>
9
+ <el-dropdown-item command="zh">{{ $t('language.zh') }}</el-dropdown-item>
10
+ <el-dropdown-item command="en">{{ $t('language.en') }}</el-dropdown-item>
11
+ </el-dropdown-menu>
12
+ </template>
13
+ </el-dropdown>
14
+ </template>
15
+
16
+ <script setup lang="ts">
17
+ import { watch } from 'vue';
18
+ import { useI18n } from 'vue-i18n';
19
+ import { useRoute } from 'vue-router';
20
+ import { ArrowDown } from '@element-plus/icons-vue';
21
+ import { setLocale } from '@/locales';
22
+
23
+ const { locale, t } = useI18n();
24
+ const route = useRoute();
25
+
26
+ watch(locale, (val) => {
27
+ const titleKey = route.meta.titleKey as string;
28
+ document.title = titleKey
29
+ ? `${t(titleKey)} - ${import.meta.env.VITE_APP_TITLE}`
30
+ : import.meta.env.VITE_APP_TITLE;
31
+ });
32
+
33
+ const handleCommand = (command: string) => {
34
+ locale.value = command;
35
+ setLocale(command);
36
+ };
37
+ </script>
38
+
39
+ <style scoped>
40
+ .lang-btn {
41
+ padding: 6px 8px;
42
+ border-radius: 8px;
43
+ color: #606266;
44
+ transition: all 0.2s;
45
+ }
46
+
47
+ .lang-btn:hover {
48
+ color: #409eff;
49
+ background: rgba(64, 158, 255, 0.06);
50
+ }
51
+
52
+ .lang-text {
53
+ font-size: 13px;
54
+ margin-left: 2px;
55
+ }
56
+
57
+ html.dark .lang-btn {
58
+ color: #8b949e;
59
+ }
60
+
61
+ html.dark .lang-btn:hover {
62
+ color: #58a6ff;
63
+ background: rgba(88, 166, 255, 0.1);
64
+ }
65
+ </style>