@roki-h5/create-roki-app 0.1.0 → 0.1.2

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 (53) hide show
  1. package/dist/index.js +16 -1
  2. package/package.json +1 -1
  3. package/templates/h5/config/env/.env.development +7 -0
  4. package/templates/h5/config/env/.env.development.local +2 -0
  5. package/templates/h5/config/env/.env.production +9 -0
  6. package/templates/h5/config/env/.env.test +9 -0
  7. package/templates/h5/config/env.ts +10 -0
  8. package/templates/h5/index.html +1 -1
  9. package/templates/h5/node_modules/.bin/autoprefixer +17 -0
  10. package/templates/h5/node_modules/.bin/browserslist +17 -0
  11. package/templates/h5/node_modules/.bin/tsc +17 -0
  12. package/templates/h5/node_modules/.bin/tsserver +17 -0
  13. package/templates/h5/node_modules/.bin/vite +17 -0
  14. package/templates/h5/node_modules/.bin/vue-tsc +17 -0
  15. package/templates/h5/node_modules/.vite/deps/_metadata.json +43 -0
  16. package/templates/h5/node_modules/.vite/deps/axios.js +3370 -0
  17. package/templates/h5/node_modules/.vite/deps/axios.js.map +7 -0
  18. package/templates/h5/node_modules/.vite/deps/chunk-CVVHEZGK.js +162 -0
  19. package/templates/h5/node_modules/.vite/deps/chunk-CVVHEZGK.js.map +7 -0
  20. package/templates/h5/node_modules/.vite/deps/chunk-HFUUWO4F.js +13072 -0
  21. package/templates/h5/node_modules/.vite/deps/chunk-HFUUWO4F.js.map +7 -0
  22. package/templates/h5/node_modules/.vite/deps/chunk-PZ5AY32C.js +9 -0
  23. package/templates/h5/node_modules/.vite/deps/chunk-PZ5AY32C.js.map +7 -0
  24. package/templates/h5/node_modules/.vite/deps/package.json +3 -0
  25. package/templates/h5/node_modules/.vite/deps/pinia.js +1561 -0
  26. package/templates/h5/node_modules/.vite/deps/pinia.js.map +7 -0
  27. package/templates/h5/node_modules/.vite/deps/vue-router.js +2241 -0
  28. package/templates/h5/node_modules/.vite/deps/vue-router.js.map +7 -0
  29. package/templates/h5/node_modules/.vite/deps/vue.js +347 -0
  30. package/templates/h5/node_modules/.vite/deps/vue.js.map +7 -0
  31. package/templates/h5/node_modules/.vue-global-types/vue_3.5_0_0_0.d.ts +118 -0
  32. package/templates/h5/package.json +9 -6
  33. package/templates/h5/scripts/version.js +38 -0
  34. package/templates/h5/src/App.vue +29 -0
  35. package/templates/h5/src/api/index.ts +4 -0
  36. package/templates/h5/src/api/nativeApi.ts +72 -0
  37. package/templates/h5/src/api/request.ts +2 -1
  38. package/templates/h5/src/api/welcome.ts +24 -0
  39. package/templates/h5/src/assets/images/home/img-device.png +0 -0
  40. package/templates/h5/src/assets/images/home/logo-free.png +0 -0
  41. package/templates/h5/src/assets/images/logo.png +0 -0
  42. package/templates/h5/src/components/WelcomeInfo.vue +90 -0
  43. package/templates/h5/src/router/index.ts +1 -1
  44. package/templates/h5/src/stores/index.ts +96 -1
  45. package/templates/h5/src/utils/appInfo.ts +86 -0
  46. package/templates/h5/src/utils/browser.ts +26 -0
  47. package/templates/h5/src/utils/buildInfo.ts +3 -0
  48. package/templates/h5/src/utils/greeting.ts +38 -0
  49. package/templates/h5/src/views/home/index.vue +12 -11
  50. package/templates/h5/src/vite-env.d.ts +26 -0
  51. package/templates/h5/tsconfig.json +3 -2
  52. package/templates/h5/vite.config.ts +56 -11
  53. package/templates/h5/.env.development +0 -1
@@ -0,0 +1,347 @@
1
+ import {
2
+ BaseTransition,
3
+ BaseTransitionPropsValidators,
4
+ Comment,
5
+ DeprecationTypes,
6
+ EffectScope,
7
+ ErrorCodes,
8
+ ErrorTypeStrings,
9
+ Fragment,
10
+ KeepAlive,
11
+ ReactiveEffect,
12
+ Static,
13
+ Suspense,
14
+ Teleport,
15
+ Text,
16
+ TrackOpTypes,
17
+ Transition,
18
+ TransitionGroup,
19
+ TriggerOpTypes,
20
+ VueElement,
21
+ assertNumber,
22
+ callWithAsyncErrorHandling,
23
+ callWithErrorHandling,
24
+ camelize,
25
+ capitalize,
26
+ cloneVNode,
27
+ compatUtils,
28
+ compile,
29
+ computed,
30
+ createApp,
31
+ createBaseVNode,
32
+ createBlock,
33
+ createCommentVNode,
34
+ createElementBlock,
35
+ createHydrationRenderer,
36
+ createPropsRestProxy,
37
+ createRenderer,
38
+ createSSRApp,
39
+ createSlots,
40
+ createStaticVNode,
41
+ createTextVNode,
42
+ createVNode,
43
+ customRef,
44
+ defineAsyncComponent,
45
+ defineComponent,
46
+ defineCustomElement,
47
+ defineEmits,
48
+ defineExpose,
49
+ defineModel,
50
+ defineOptions,
51
+ defineProps,
52
+ defineSSRCustomElement,
53
+ defineSlots,
54
+ devtools,
55
+ effect,
56
+ effectScope,
57
+ getCurrentInstance,
58
+ getCurrentScope,
59
+ getCurrentWatcher,
60
+ getTransitionRawChildren,
61
+ guardReactiveProps,
62
+ h,
63
+ handleError,
64
+ hasInjectionContext,
65
+ hydrate,
66
+ hydrateOnIdle,
67
+ hydrateOnInteraction,
68
+ hydrateOnMediaQuery,
69
+ hydrateOnVisible,
70
+ initCustomFormatter,
71
+ initDirectivesForSSR,
72
+ inject,
73
+ isMemoSame,
74
+ isProxy,
75
+ isReactive,
76
+ isReadonly,
77
+ isRef,
78
+ isRuntimeOnly,
79
+ isShallow,
80
+ isVNode,
81
+ markRaw,
82
+ mergeDefaults,
83
+ mergeModels,
84
+ mergeProps,
85
+ nextTick,
86
+ nodeOps,
87
+ normalizeClass,
88
+ normalizeProps,
89
+ normalizeStyle,
90
+ onActivated,
91
+ onBeforeMount,
92
+ onBeforeUnmount,
93
+ onBeforeUpdate,
94
+ onDeactivated,
95
+ onErrorCaptured,
96
+ onMounted,
97
+ onRenderTracked,
98
+ onRenderTriggered,
99
+ onScopeDispose,
100
+ onServerPrefetch,
101
+ onUnmounted,
102
+ onUpdated,
103
+ onWatcherCleanup,
104
+ openBlock,
105
+ patchProp,
106
+ popScopeId,
107
+ provide,
108
+ proxyRefs,
109
+ pushScopeId,
110
+ queuePostFlushCb,
111
+ reactive,
112
+ readonly,
113
+ ref,
114
+ registerRuntimeCompiler,
115
+ render,
116
+ renderList,
117
+ renderSlot,
118
+ resolveComponent,
119
+ resolveDirective,
120
+ resolveDynamicComponent,
121
+ resolveFilter,
122
+ resolveTransitionHooks,
123
+ setBlockTracking,
124
+ setDevtoolsHook,
125
+ setTransitionHooks,
126
+ shallowReactive,
127
+ shallowReadonly,
128
+ shallowRef,
129
+ ssrContextKey,
130
+ ssrUtils,
131
+ stop,
132
+ toDisplayString,
133
+ toHandlerKey,
134
+ toHandlers,
135
+ toRaw,
136
+ toRef,
137
+ toRefs,
138
+ toValue,
139
+ transformVNodeArgs,
140
+ triggerRef,
141
+ unref,
142
+ useAttrs,
143
+ useCssModule,
144
+ useCssVars,
145
+ useHost,
146
+ useId,
147
+ useModel,
148
+ useSSRContext,
149
+ useShadowRoot,
150
+ useSlots,
151
+ useTemplateRef,
152
+ useTransitionState,
153
+ vModelCheckbox,
154
+ vModelDynamic,
155
+ vModelRadio,
156
+ vModelSelect,
157
+ vModelText,
158
+ vShow,
159
+ version,
160
+ warn,
161
+ watch,
162
+ watchEffect,
163
+ watchPostEffect,
164
+ watchSyncEffect,
165
+ withAsyncContext,
166
+ withCtx,
167
+ withDefaults,
168
+ withDirectives,
169
+ withKeys,
170
+ withMemo,
171
+ withModifiers,
172
+ withScopeId
173
+ } from "./chunk-HFUUWO4F.js";
174
+ import "./chunk-PZ5AY32C.js";
175
+ export {
176
+ BaseTransition,
177
+ BaseTransitionPropsValidators,
178
+ Comment,
179
+ DeprecationTypes,
180
+ EffectScope,
181
+ ErrorCodes,
182
+ ErrorTypeStrings,
183
+ Fragment,
184
+ KeepAlive,
185
+ ReactiveEffect,
186
+ Static,
187
+ Suspense,
188
+ Teleport,
189
+ Text,
190
+ TrackOpTypes,
191
+ Transition,
192
+ TransitionGroup,
193
+ TriggerOpTypes,
194
+ VueElement,
195
+ assertNumber,
196
+ callWithAsyncErrorHandling,
197
+ callWithErrorHandling,
198
+ camelize,
199
+ capitalize,
200
+ cloneVNode,
201
+ compatUtils,
202
+ compile,
203
+ computed,
204
+ createApp,
205
+ createBlock,
206
+ createCommentVNode,
207
+ createElementBlock,
208
+ createBaseVNode as createElementVNode,
209
+ createHydrationRenderer,
210
+ createPropsRestProxy,
211
+ createRenderer,
212
+ createSSRApp,
213
+ createSlots,
214
+ createStaticVNode,
215
+ createTextVNode,
216
+ createVNode,
217
+ customRef,
218
+ defineAsyncComponent,
219
+ defineComponent,
220
+ defineCustomElement,
221
+ defineEmits,
222
+ defineExpose,
223
+ defineModel,
224
+ defineOptions,
225
+ defineProps,
226
+ defineSSRCustomElement,
227
+ defineSlots,
228
+ devtools,
229
+ effect,
230
+ effectScope,
231
+ getCurrentInstance,
232
+ getCurrentScope,
233
+ getCurrentWatcher,
234
+ getTransitionRawChildren,
235
+ guardReactiveProps,
236
+ h,
237
+ handleError,
238
+ hasInjectionContext,
239
+ hydrate,
240
+ hydrateOnIdle,
241
+ hydrateOnInteraction,
242
+ hydrateOnMediaQuery,
243
+ hydrateOnVisible,
244
+ initCustomFormatter,
245
+ initDirectivesForSSR,
246
+ inject,
247
+ isMemoSame,
248
+ isProxy,
249
+ isReactive,
250
+ isReadonly,
251
+ isRef,
252
+ isRuntimeOnly,
253
+ isShallow,
254
+ isVNode,
255
+ markRaw,
256
+ mergeDefaults,
257
+ mergeModels,
258
+ mergeProps,
259
+ nextTick,
260
+ nodeOps,
261
+ normalizeClass,
262
+ normalizeProps,
263
+ normalizeStyle,
264
+ onActivated,
265
+ onBeforeMount,
266
+ onBeforeUnmount,
267
+ onBeforeUpdate,
268
+ onDeactivated,
269
+ onErrorCaptured,
270
+ onMounted,
271
+ onRenderTracked,
272
+ onRenderTriggered,
273
+ onScopeDispose,
274
+ onServerPrefetch,
275
+ onUnmounted,
276
+ onUpdated,
277
+ onWatcherCleanup,
278
+ openBlock,
279
+ patchProp,
280
+ popScopeId,
281
+ provide,
282
+ proxyRefs,
283
+ pushScopeId,
284
+ queuePostFlushCb,
285
+ reactive,
286
+ readonly,
287
+ ref,
288
+ registerRuntimeCompiler,
289
+ render,
290
+ renderList,
291
+ renderSlot,
292
+ resolveComponent,
293
+ resolveDirective,
294
+ resolveDynamicComponent,
295
+ resolveFilter,
296
+ resolveTransitionHooks,
297
+ setBlockTracking,
298
+ setDevtoolsHook,
299
+ setTransitionHooks,
300
+ shallowReactive,
301
+ shallowReadonly,
302
+ shallowRef,
303
+ ssrContextKey,
304
+ ssrUtils,
305
+ stop,
306
+ toDisplayString,
307
+ toHandlerKey,
308
+ toHandlers,
309
+ toRaw,
310
+ toRef,
311
+ toRefs,
312
+ toValue,
313
+ transformVNodeArgs,
314
+ triggerRef,
315
+ unref,
316
+ useAttrs,
317
+ useCssModule,
318
+ useCssVars,
319
+ useHost,
320
+ useId,
321
+ useModel,
322
+ useSSRContext,
323
+ useShadowRoot,
324
+ useSlots,
325
+ useTemplateRef,
326
+ useTransitionState,
327
+ vModelCheckbox,
328
+ vModelDynamic,
329
+ vModelRadio,
330
+ vModelSelect,
331
+ vModelText,
332
+ vShow,
333
+ version,
334
+ warn,
335
+ watch,
336
+ watchEffect,
337
+ watchPostEffect,
338
+ watchSyncEffect,
339
+ withAsyncContext,
340
+ withCtx,
341
+ withDefaults,
342
+ withDirectives,
343
+ withKeys,
344
+ withMemo,
345
+ withModifiers,
346
+ withScopeId
347
+ };
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,118 @@
1
+ // @ts-nocheck
2
+ export {};
3
+
4
+ ; declare global {
5
+ const __VLS_intrinsicElements: __VLS_IntrinsicElements;
6
+ const __VLS_directiveBindingRestFields: { instance: null, oldValue: null, modifiers: any, dir: any };
7
+ const __VLS_unref: typeof import('vue').unref;
8
+ const __VLS_placeholder: any;
9
+
10
+ type __VLS_NativeElements = __VLS_SpreadMerge<SVGElementTagNameMap, HTMLElementTagNameMap>;
11
+ type __VLS_IntrinsicElements = import('vue/jsx-runtime').JSX.IntrinsicElements;
12
+ type __VLS_Element = import('vue/jsx-runtime').JSX.Element;
13
+ type __VLS_GlobalComponents = import('vue').GlobalComponents;
14
+ type __VLS_GlobalDirectives = import('vue').GlobalDirectives;
15
+ type __VLS_IsAny<T> = 0 extends 1 & T ? true : false;
16
+ type __VLS_PickNotAny<A, B> = __VLS_IsAny<A> extends true ? B : A;
17
+ type __VLS_SpreadMerge<A, B> = Omit<A, keyof B> & B;
18
+ type __VLS_WithComponent<N0 extends string, LocalComponents, Self, N1 extends string, N2 extends string, N3 extends string> =
19
+ N1 extends keyof LocalComponents ? N1 extends N0 ? Pick<LocalComponents, N0 extends keyof LocalComponents ? N0 : never> : { [K in N0]: LocalComponents[N1] } :
20
+ N2 extends keyof LocalComponents ? N2 extends N0 ? Pick<LocalComponents, N0 extends keyof LocalComponents ? N0 : never> : { [K in N0]: LocalComponents[N2] } :
21
+ N3 extends keyof LocalComponents ? N3 extends N0 ? Pick<LocalComponents, N0 extends keyof LocalComponents ? N0 : never> : { [K in N0]: LocalComponents[N3] } :
22
+ Self extends object ? { [K in N0]: Self } :
23
+ N1 extends keyof __VLS_GlobalComponents ? N1 extends N0 ? Pick<__VLS_GlobalComponents, N0 extends keyof __VLS_GlobalComponents ? N0 : never> : { [K in N0]: __VLS_GlobalComponents[N1] } :
24
+ N2 extends keyof __VLS_GlobalComponents ? N2 extends N0 ? Pick<__VLS_GlobalComponents, N0 extends keyof __VLS_GlobalComponents ? N0 : never> : { [K in N0]: __VLS_GlobalComponents[N2] } :
25
+ N3 extends keyof __VLS_GlobalComponents ? N3 extends N0 ? Pick<__VLS_GlobalComponents, N0 extends keyof __VLS_GlobalComponents ? N0 : never> : { [K in N0]: __VLS_GlobalComponents[N3] } :
26
+ { [K in N0]: unknown };
27
+ type __VLS_FunctionalComponentProps<T, K> =
28
+ '__ctx' extends keyof __VLS_PickNotAny<K, {}> ? K extends { __ctx?: { props?: infer P } } ? NonNullable<P> : never
29
+ : T extends (props: infer P, ...args: any) => any ? P :
30
+ {};
31
+ type __VLS_IsFunction<T, K> = K extends keyof T
32
+ ? __VLS_IsAny<T[K]> extends false
33
+ ? unknown extends T[K]
34
+ ? false
35
+ : true
36
+ : false
37
+ : false;
38
+ type __VLS_NormalizeComponentEvent<Props, Events, onEvent extends keyof Props, Event extends keyof Events, CamelizedEvent extends keyof Events> = (
39
+ __VLS_IsFunction<Props, onEvent> extends true
40
+ ? Props
41
+ : __VLS_IsFunction<Events, Event> extends true
42
+ ? { [K in onEvent]?: Events[Event] }
43
+ : __VLS_IsFunction<Events, CamelizedEvent> extends true
44
+ ? { [K in onEvent]?: Events[CamelizedEvent] }
45
+ : Props
46
+ ) & Record<string, unknown>;
47
+ // fix https://github.com/vuejs/language-tools/issues/926
48
+ type __VLS_UnionToIntersection<U> = (U extends unknown ? (arg: U) => unknown : never) extends ((arg: infer P) => unknown) ? P : never;
49
+ type __VLS_OverloadUnionInner<T, U = unknown> = U & T extends (...args: infer A) => infer R
50
+ ? U extends T
51
+ ? never
52
+ : __VLS_OverloadUnionInner<T, Pick<T, keyof T> & U & ((...args: A) => R)> | ((...args: A) => R)
53
+ : never;
54
+ type __VLS_OverloadUnion<T> = Exclude<
55
+ __VLS_OverloadUnionInner<(() => never) & T>,
56
+ T extends () => never ? never : () => never
57
+ >;
58
+ type __VLS_ConstructorOverloads<T> = __VLS_OverloadUnion<T> extends infer F
59
+ ? F extends (event: infer E, ...args: infer A) => any
60
+ ? { [K in E & string]: (...args: A) => void; }
61
+ : never
62
+ : never;
63
+ type __VLS_NormalizeEmits<T> = __VLS_PrettifyGlobal<
64
+ __VLS_UnionToIntersection<
65
+ __VLS_ConstructorOverloads<T> & {
66
+ [K in keyof T]: T[K] extends any[] ? { (...args: T[K]): void } : never
67
+ }
68
+ >
69
+ >;
70
+ type __VLS_PrettifyGlobal<T> = { [K in keyof T]: T[K]; } & {};
71
+ type __VLS_PickFunctionalComponentCtx<T, K> = NonNullable<__VLS_PickNotAny<
72
+ '__ctx' extends keyof __VLS_PickNotAny<K, {}> ? K extends { __ctx?: infer Ctx } ? Ctx : never : any
73
+ , T extends (props: any, ctx: infer Ctx) => any ? Ctx : any
74
+ >>;
75
+ type __VLS_UseTemplateRef<T> = Readonly<import('vue').ShallowRef<T | null>>;
76
+
77
+ function __VLS_getVForSourceType<T extends number | string | any[] | Iterable<any>>(source: T): [
78
+ item: T extends number ? number
79
+ : T extends string ? string
80
+ : T extends any[] ? T[number]
81
+ : T extends Iterable<infer T1> ? T1
82
+ : any,
83
+ index: number,
84
+ ][];
85
+ function __VLS_getVForSourceType<T>(source: T): [
86
+ item: T[keyof T],
87
+ key: keyof T,
88
+ index: number,
89
+ ][];
90
+ // @ts-ignore
91
+ function __VLS_getSlotParams<T>(slot: T): Parameters<__VLS_PickNotAny<NonNullable<T>, (...args: any[]) => any>>;
92
+ // @ts-ignore
93
+ function __VLS_getSlotParam<T>(slot: T): Parameters<__VLS_PickNotAny<NonNullable<T>, (...args: any[]) => any>>[0];
94
+ function __VLS_asFunctionalDirective<T>(dir: T): T extends import('vue').ObjectDirective
95
+ ? NonNullable<T['created' | 'beforeMount' | 'mounted' | 'beforeUpdate' | 'updated' | 'beforeUnmount' | 'unmounted']>
96
+ : T extends (...args: any) => any
97
+ ? T
98
+ : (arg1: unknown, arg2: unknown, arg3: unknown, arg4: unknown) => void;
99
+ function __VLS_makeOptional<T>(t: T): { [K in keyof T]?: T[K] };
100
+ function __VLS_asFunctionalComponent<T, K = T extends new (...args: any) => any ? InstanceType<T> : unknown>(t: T, instance?: K):
101
+ T extends new (...args: any) => any
102
+ ? (props: (K extends { $props: infer Props } ? Props : any) & Record<string, unknown>, ctx?: any) => __VLS_Element & {
103
+ __ctx?: {
104
+ attrs?: any;
105
+ slots?: K extends { $slots: infer Slots } ? Slots : any;
106
+ emit?: K extends { $emit: infer Emit } ? Emit : any;
107
+ expose?(exposed: K): void;
108
+ props?: (K extends { $props: infer Props } ? Props : any) & Record<string, unknown>;
109
+ }
110
+ }
111
+ : T extends () => any ? (props: {}, ctx?: any) => ReturnType<T>
112
+ : T extends (...args: any) => any ? T
113
+ : (_: {} & Record<string, unknown>, ctx?: any) => { __ctx?: { attrs?: any, expose?: any, slots?: any, emit?: any, props?: {} & Record<string, unknown> } };
114
+ function __VLS_functionalComponentArgsRest<T extends (...args: any) => any>(t: T): 2 extends Parameters<T>['length'] ? [any] : [];
115
+ function __VLS_asFunctionalElement<T>(tag: T, endTag?: T): (attrs: T & Record<string, unknown>) => void;
116
+ function __VLS_asFunctionalSlot<S>(slot: S): S extends () => infer R ? (props: {}) => R : NonNullable<S>;
117
+ function __VLS_tryAsConstant<const T>(t: T): T;
118
+ }
@@ -1,15 +1,18 @@
1
1
  {
2
- "name": "__PROJECT_NAME__",
2
+ "name": "@roki-h5/scaffold-template",
3
3
  "private": true,
4
- "version": "0.0.0",
4
+ "version": "0.1.0",
5
5
  "type": "module",
6
6
  "scripts": {
7
- "dev": "vite",
8
- "build": "vue-tsc -b && vite build",
9
- "preview": "vite preview"
7
+ "dev": "vite --mode development",
8
+ "build": "vue-tsc -b && node scripts/version.js && vite build --mode production",
9
+ "build:test": "vue-tsc -b && node scripts/version.js && vite build --mode test",
10
+ "build:prod": "vite build --mode production",
11
+ "preview": "vite preview",
12
+ "preview:test": "vite preview --mode test"
10
13
  },
11
14
  "dependencies": {
12
- "@roki-h5/ui": "^0.1.0",
15
+ "@roki-h5/ui": "workspace:*",
13
16
  "axios": "^1.7.9",
14
17
  "pinia": "^2.3.0",
15
18
  "vue": "^3.5.13",
@@ -0,0 +1,38 @@
1
+ import fs from 'node:fs'
2
+ import path from 'node:path'
3
+ import { fileURLToPath } from 'node:url'
4
+
5
+ const __dirname = path.dirname(fileURLToPath(import.meta.url))
6
+
7
+ const packagePath = path.resolve(__dirname, '../package.json')
8
+ const pkg = JSON.parse(fs.readFileSync(packagePath, 'utf8')) as { version: string }
9
+
10
+ const [major, minor, patch] = pkg.version.split('.').map(Number)
11
+
12
+ let newPatch = patch + 1
13
+ let newMinor = minor
14
+ let newMajor = major
15
+
16
+ if (newPatch > 99) {
17
+ newPatch = 0
18
+ newMinor += 1
19
+ }
20
+
21
+ if (newMinor > 99) {
22
+ newMinor = 0
23
+ newMajor += 1
24
+ }
25
+
26
+ const newVersion = `${newMajor}.${newMinor}.${newPatch}`
27
+
28
+ pkg.version = newVersion
29
+ fs.writeFileSync(packagePath, `${JSON.stringify(pkg, null, 2)}\n`)
30
+
31
+ const buildTime = new Date().toLocaleString('zh-CN')
32
+ const constContent = `// 此文件由构建脚本自动生成,请勿手动修改
33
+ export const BUILD_TIME = '${buildTime}'
34
+ export const VERSION = '${newVersion}'
35
+ `
36
+
37
+ const constPath = path.resolve(__dirname, '../src/utils/buildInfo.ts')
38
+ fs.writeFileSync(constPath, constContent)
@@ -1,3 +1,32 @@
1
+ <script setup lang="ts">
2
+ import { onBeforeMount, onMounted } from 'vue'
3
+ import { useAppStore } from '@/stores'
4
+ import { getAppData } from '@/utils/appInfo'
5
+ import { BUILD_TIME, VERSION } from '@/utils/buildInfo'
6
+
7
+ const appStore = useAppStore()
8
+ const appTitle = import.meta.env.VITE_APP_TITLE || 'Roki H5'
9
+
10
+ onBeforeMount(async () => {
11
+ await getAppData()
12
+ void appStore.loadWelcomeMessage()
13
+ })
14
+
15
+ function logBuildInfo() {
16
+ setTimeout(() => {
17
+ console.log(
18
+ `[${appTitle} 版本信息]\n` +
19
+ `版本号:v${VERSION}\n` +
20
+ `构建时间:${BUILD_TIME}`,
21
+ )
22
+ }, 1000)
23
+ }
24
+
25
+ onMounted(() => {
26
+ logBuildInfo()
27
+ })
28
+ </script>
29
+
1
30
  <template>
2
31
  <router-view />
3
32
  </template>
@@ -1,5 +1,9 @@
1
1
  import { devReq } from './request'
2
2
 
3
+ export { getWelcomeMessage } from './welcome'
4
+ export type { WelcomeMessageData, WelcomeMessageParams } from './welcome'
5
+ export { nativeApi } from './nativeApi'
6
+
3
7
  /** 示例:可按业务拆分 api 模块 */
4
8
  export function fetchExample() {
5
9
  return devReq({
@@ -0,0 +1,72 @@
1
+ // jsbridge 参考:https://github.com/lzyzsd/JsBridge
2
+ import { browser } from '@/utils/browser'
3
+
4
+ type BridgeCallback = (responseData: unknown) => void
5
+
6
+ interface WebViewJavascriptBridge {
7
+ callHandler: (
8
+ handlerName: string,
9
+ params: Record<string, unknown>,
10
+ callback: BridgeCallback,
11
+ ) => void
12
+ }
13
+
14
+ /** 原生回调:string 需 JSON.parse,否则直接返回 */
15
+ function parseNativeResponse(responseData: unknown) {
16
+ if (typeof responseData === 'string') {
17
+ return JSON.parse(responseData) as unknown
18
+ }
19
+ return responseData
20
+ }
21
+
22
+ function setupWebViewJavascriptBridge(
23
+ callback: (bridge: WebViewJavascriptBridge) => void,
24
+ ) {
25
+ if (window.WebViewJavascriptBridge) {
26
+ return callback(window.WebViewJavascriptBridge)
27
+ }
28
+
29
+ if (window.WVJBCallbacks) {
30
+ return window.WVJBCallbacks.push(callback)
31
+ }
32
+
33
+ window.WVJBCallbacks = [callback]
34
+
35
+ const { iPhone, iPad, iPod } = browser.versions
36
+ if (iPhone || iPad || iPod) {
37
+ const WVJBIframe = document.createElement('iframe')
38
+ WVJBIframe.style.display = 'none'
39
+ WVJBIframe.src = 'https://__bridge_loaded__'
40
+ document.documentElement.appendChild(WVJBIframe)
41
+ setTimeout(() => {
42
+ document.documentElement.removeChild(WVJBIframe)
43
+ }, 0)
44
+ }
45
+ }
46
+
47
+ export const nativeApi = {
48
+ callNativeHandler<T = unknown>(
49
+ handlerName: string,
50
+ params: Record<string, unknown> = {},
51
+ ) {
52
+ return new Promise<T>((resolve) => {
53
+ setupWebViewJavascriptBridge((bridge) => {
54
+ bridge.callHandler(handlerName, params, (responseData) => {
55
+ const parsed = parseNativeResponse(responseData)
56
+ if (import.meta.env.DEV) {
57
+ console.log(`[nativeApi] ${handlerName}:`, parsed)
58
+ }
59
+ resolve(parsed as T)
60
+ })
61
+ })
62
+ })
63
+ },
64
+
65
+ routerBack() {
66
+ return this.callNativeHandler('routerBackBeforePage', {})
67
+ },
68
+
69
+ skipDeviceMore(uiVersion = '5.0') {
70
+ return this.callNativeHandler('skipDeviceMore', { UIVersion: uiVersion })
71
+ },
72
+ }
@@ -1,4 +1,5 @@
1
1
  import axios, { type AxiosRequestConfig } from 'axios'
2
+ import { apiBase } from '@config/env'
2
3
  import { useAppStore } from '@/stores'
3
4
 
4
5
  function isRequestTimeout(error: unknown) {
@@ -33,7 +34,7 @@ export function devReq<T = unknown>(config: AxiosRequestConfig) {
33
34
  Authorization: `Bearer ${appStore.accessToken}`,
34
35
  },
35
36
  timeout: 10000,
36
- baseURL: config.baseURL || import.meta.env.VITE_BASE_API,
37
+ baseURL: config.baseURL || apiBase,
37
38
  })
38
39
 
39
40
  instance(config)
@@ -0,0 +1,24 @@
1
+ import { devReq } from './request'
2
+
3
+ export interface WelcomeMessageParams {
4
+ date?: string
5
+ [key: string]: unknown
6
+ }
7
+
8
+ export interface WelcomeMessageData {
9
+ prefix?: string
10
+ speech?: string
11
+ }
12
+
13
+ export interface WelcomeMessageResponse {
14
+ data?: WelcomeMessageData
15
+ }
16
+
17
+ /** 获取 AI 欢迎语 */
18
+ export function getWelcomeMessage(params?: WelcomeMessageParams) {
19
+ return devReq<WelcomeMessageResponse>({
20
+ url: '/rest/ops/ai/welcome',
21
+ method: 'get',
22
+ params,
23
+ })
24
+ }