create-bubbles 0.1.3 → 0.1.4

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 (46) hide show
  1. package/package.json +1 -1
  2. package/template-react-rsbuild-biome/biome.json +19 -4
  3. package/template-vue-rsbuild-biome/biome.json +33 -5
  4. package/template-vue-vite-biome/biome.json +7 -2
  5. package/template-vue-vite-eslint/.env +3 -1
  6. package/template-vue-vite-eslint/.env.development +2 -1
  7. package/template-vue-vite-eslint/.vscode/settings.json +8 -0
  8. package/template-vue-vite-eslint/eslint.config.js +7 -2
  9. package/template-vue-vite-eslint/package.json +12 -4
  10. package/template-vue-vite-eslint/src/api/index.ts +12 -0
  11. package/template-vue-vite-eslint/src/assets/icon/computer-data.svg +3 -0
  12. package/template-vue-vite-eslint/src/assets/icon/cpu.svg +3 -0
  13. package/template-vue-vite-eslint/src/assets/icon/data-search.svg +3 -0
  14. package/template-vue-vite-eslint/src/assets/icon/home.svg +3 -0
  15. package/template-vue-vite-eslint/src/assets/icon/knowledge-graph.svg +3 -0
  16. package/template-vue-vite-eslint/src/assets/icon/robot.svg +3 -0
  17. package/template-vue-vite-eslint/src/assets/image/.gitkeep +0 -0
  18. package/template-vue-vite-eslint/src/components/Icon/svg-icon.vue +2 -2
  19. package/template-vue-vite-eslint/src/hooks/chart/lib.ts +57 -0
  20. package/template-vue-vite-eslint/src/hooks/chart/useEcharts.ts +65 -0
  21. package/template-vue-vite-eslint/src/layout/default/header/index.vue +12 -0
  22. package/template-vue-vite-eslint/src/layout/default/index.vue +53 -1
  23. package/template-vue-vite-eslint/src/main.ts +1 -0
  24. package/template-vue-vite-eslint/src/router/interface.ts +9 -0
  25. package/template-vue-vite-eslint/src/router/modules/example.ts +21 -0
  26. package/template-vue-vite-eslint/src/router/modules/index.ts +57 -9
  27. package/template-vue-vite-eslint/src/styles/element-plus-variables.css +1 -2
  28. package/template-vue-vite-eslint/src/styles/index.scss +2 -0
  29. package/template-vue-vite-eslint/src/styles/plus-pro-components-variables.css +3 -0
  30. package/template-vue-vite-eslint/src/types/index.d.ts +1 -0
  31. package/template-vue-vite-eslint/src/utils/env.ts +5 -4
  32. package/template-vue-vite-eslint/src/utils/request/core/index.ts +19 -5
  33. package/template-vue-vite-eslint/src/utils/request/index.ts +4 -1
  34. package/template-vue-vite-eslint/src/views/data-statistics/config.ts +11 -0
  35. package/template-vue-vite-eslint/src/views/data-statistics/index.vue +23 -0
  36. package/template-vue-vite-eslint/src/views/data-statistics/right/abc.vue +11 -0
  37. package/template-vue-vite-eslint/src/views/example/echart/config.ts +1794 -0
  38. package/template-vue-vite-eslint/src/views/example/echart/index.vue +22 -0
  39. package/template-vue-vite-eslint/src/views/example/h-full.vue +24 -0
  40. package/template-vue-vite-eslint/src/views/example/tree-chart.vue +94 -0
  41. package/template-vue-vite-eslint/src/views/home/index.vue +3 -2
  42. package/template-vue-vite-eslint/src/views/knowledge-graph/index.vue +11 -0
  43. package/template-vue-vite-eslint/tsconfig.json +1 -1
  44. package/template-vue-vite-eslint/uno.config.ts +6 -2
  45. package/template-vue-vite-eslint/vite.config.ts +13 -4
  46. package/template-vue-vite-eslint/.gitlab-ci.yml +0 -84
@@ -0,0 +1,3 @@
1
+ :root .el-header {
2
+ --el-header-height: 56px;
3
+ }
@@ -0,0 +1 @@
1
+ // 扩展 vue-router 的类型
@@ -3,8 +3,9 @@
3
3
  * @returns
4
4
  */
5
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,
6
+ PORT: import.meta.env.VITE_PORT,
7
+ PATH: import.meta.env.VITE_PATH,
8
+ APP_NAME: import.meta.env.VITE_APP_NAME,
9
+ /** 后端接口前缀 */
10
+ API_AFFIX: import.meta.env.VITE_API_AFFIX,
10
11
  }
@@ -20,6 +20,9 @@ export interface baseRequestOption<AG extends AlovaGenerics> {
20
20
  timeout?: number
21
21
  commonHeaders?: Record<string, string | (() => string)>
22
22
  statusMap?: statusMap
23
+ isWrapped?: boolean
24
+ cacheFor?: AlovaOptions<AG>['cacheFor']
25
+ cacheLogger?: boolean
23
26
  codeMap?: codeMap
24
27
  responseDataKey?: string
25
28
  responseMessageKey?: string
@@ -51,6 +54,9 @@ export function createInstance(option: requestOption) {
51
54
  success: 200,
52
55
  unAuthorized: 401,
53
56
  },
57
+ isWrapped: true,
58
+ cacheFor: null,
59
+ cacheLogger: true,
54
60
  codeMap: {
55
61
  success: [200],
56
62
  unAuthorized: [401],
@@ -73,6 +79,8 @@ export function createInstance(option: requestOption) {
73
79
  const instance = createAlova({
74
80
  baseURL: mergeOption.baseUrl,
75
81
  timeout: mergeOption.timeout,
82
+ cacheFor: mergeOption.cacheFor,
83
+ cacheLogger: mergeOption.cacheLogger,
76
84
  statesHook: mergeOption?.statesHook,
77
85
  requestAdapter: mergeOption.requestAdapter as AlovaOptions<AlovaGenerics>['requestAdapter'],
78
86
  beforeRequest: async (method) => {
@@ -99,12 +107,19 @@ export function createInstance(option: requestOption) {
99
107
  }
100
108
  return Promise.reject(response)
101
109
  }
110
+ const { isWrapped, isShowSuccessMessage, successDefaultMessage } = mergeOption
111
+ if (!isWrapped) {
112
+ if (isShowSuccessMessage) {
113
+ mergeOption?.successMessageFunc?.(successDefaultMessage!)
114
+ }
115
+ return data
116
+ }
102
117
 
103
118
  const {
104
119
  responseDataKey,
105
120
  codeMap,
106
- isShowSuccessMessage,
107
121
  responseMessageKey,
122
+ errorDefaultMessage,
108
123
  isShowErrorMessage,
109
124
  } = mergeOption
110
125
  const {
@@ -120,19 +135,19 @@ export function createInstance(option: requestOption) {
120
135
  }
121
136
  // 其他错误直接打印msg
122
137
 
123
- const errorMessage = data[responseMessageKey as string] ?? mergeOption.errorDefaultMessage
138
+ const errorMessage = data[responseMessageKey as string] ?? errorDefaultMessage
124
139
  if (isShowErrorMessage)
125
140
  mergeOption?.errorMessageFunc?.(errorMessage)
126
141
  return Promise.reject(response)
127
142
  }
128
143
  if (isShowSuccessMessage)
129
- mergeOption?.successMessageFunc?.(responseMessage ?? mergeOption.successDefaultMessage)
144
+ mergeOption?.successMessageFunc?.(responseMessage ?? successDefaultMessage)
130
145
  return responseData
131
146
  },
132
147
  onError: (error) => {
133
148
  if (mergeOption?.isShowErrorMessage) {
134
149
  mergeOption.errorMessageFunc?.(
135
- error.response?.data?.message ?? mergeOption?.errorDefaultMessage,
150
+ mergeOption?.errorDefaultMessage ?? error.message,
136
151
  )
137
152
  }
138
153
  },
@@ -158,7 +173,6 @@ export function createDualCallInstance(baseConfig: baseRequestOption<AlovaGeneri
158
173
  return defaultInstance
159
174
  }
160
175
 
161
- // 🎯 直接绑定 HTTP 方法,无需复杂类型注释
162
176
  dualInstance.Get = defaultInstance.Get.bind(defaultInstance)
163
177
  dualInstance.Post = defaultInstance.Post.bind(defaultInstance)
164
178
  dualInstance.Put = defaultInstance.Put.bind(defaultInstance)
@@ -1,14 +1,17 @@
1
1
  import { axiosRequestAdapter } from '@alova/adapter-axios'
2
2
  import vueHook from 'alova/vue'
3
3
  import { ElMessage } from 'element-plus'
4
+
4
5
  import { router } from '@/router'
6
+
5
7
  import { envVariables } from '../env'
6
8
  import { createDualCallInstance } from './core'
9
+
7
10
  import 'element-plus/es/components/message/style/css'
8
11
 
9
12
  function getBaseConfig(): Parameters<typeof createDualCallInstance>[0] {
10
13
  return {
11
- baseUrl: `/${envVariables.PUBLIC_PORT}`,
14
+ baseUrl: `/${envVariables.API_AFFIX}`,
12
15
  statusMap: {
13
16
  success: 200,
14
17
  unAuthorized: 401,
@@ -0,0 +1,11 @@
1
+ import BCD from './CBC.vue'
2
+
3
+ const Abc = defineAsyncComponent(() =>
4
+ import('.right/abc.vue'),
5
+ )
6
+
7
+ export const data = [
8
+ { label: '1级', value: '1', children: [
9
+ { label: '1-1级', value: '1-1', right: Abc, result: BCD },
10
+ ] },
11
+ ]
@@ -0,0 +1,23 @@
1
+ <script setup lang="ts">
2
+ const treeSelect = ref()
3
+
4
+ const rightComponent = computed(() => {
5
+ return treeSelect.value.right
6
+ })
7
+ </script>
8
+
9
+ <template>
10
+ <div class="index-container" />
11
+
12
+ <el-tree v-model="treeSelect" />
13
+
14
+ <div />
15
+
16
+ <div>
17
+ <component :is="rightComponent" />
18
+ </div>
19
+ </template>
20
+
21
+ <style lang="scss" scoped>
22
+
23
+ </style>
@@ -0,0 +1,11 @@
1
+ <script setup lang="ts">
2
+
3
+ </script>
4
+
5
+ <template>
6
+ <div class="index-container" />
7
+ </template>
8
+
9
+ <style lang="scss" scoped>
10
+
11
+ </style>