@ctzy-web-client/create-web-client 1.0.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 (31) hide show
  1. package/bin/create-web-client.js +225 -0
  2. package/bin/utils/index.js +105 -0
  3. package/index.js +2 -0
  4. package/lib/download.js +184 -0
  5. package/lib/generator.js +142 -0
  6. package/package.json +30 -0
  7. package/templates/qiankun-subapp-vue-template/.env +5 -0
  8. package/templates/qiankun-subapp-vue-template/index.html +16 -0
  9. package/templates/qiankun-subapp-vue-template/jsconfig.json +5 -0
  10. package/templates/qiankun-subapp-vue-template/mocks/test.js +60 -0
  11. package/templates/qiankun-subapp-vue-template/package.json +34 -0
  12. package/templates/qiankun-subapp-vue-template/public/vite.svg +1 -0
  13. package/templates/qiankun-subapp-vue-template/src/interceptors/AppRequestInterceptors.js +50 -0
  14. package/templates/qiankun-subapp-vue-template/src/interceptors/AppRouterInterceptors.js +25 -0
  15. package/templates/qiankun-subapp-vue-template/src/main.js +23 -0
  16. package/templates/qiankun-subapp-vue-template/src/models/TestDataModel.js +45 -0
  17. package/templates/qiankun-subapp-vue-template/src/pages/form/index.vue +120 -0
  18. package/templates/qiankun-subapp-vue-template/src/pages/home/index.vue +57 -0
  19. package/templates/qiankun-subapp-vue-template/src/services/TestServices.js +21 -0
  20. package/templates/qiankun-subapp-vue-template/vite.config.ts +54 -0
  21. package/templates/qiankun-vue-template/.env +4 -0
  22. package/templates/qiankun-vue-template/index.html +16 -0
  23. package/templates/qiankun-vue-template/jsconfig.json +5 -0
  24. package/templates/qiankun-vue-template/package.json +33 -0
  25. package/templates/qiankun-vue-template/public/vite.svg +1 -0
  26. package/templates/qiankun-vue-template/src/main.js +21 -0
  27. package/templates/qiankun-vue-template/src/pages/app/index.vue +15 -0
  28. package/templates/qiankun-vue-template/src/services/ApplicaitionService.js +6 -0
  29. package/templates/qiankun-vue-template/src/services/UserService.js +4 -0
  30. package/templates/qiankun-vue-template/vite.config.ts +35 -0
  31. package/templates/web-client-vue-template/package.json +18 -0
@@ -0,0 +1,5 @@
1
+ {
2
+ "compilerOptions": {
3
+ "experimentalDecorators": true
4
+ }
5
+ }
@@ -0,0 +1,60 @@
1
+ export default [
2
+ {
3
+ url: '/api/app1/test',
4
+ method: 'post',
5
+ response: () => {
6
+ return {
7
+ status: 0,
8
+ totalRecCount: 100,
9
+ data: [
10
+ {
11
+ id: 1,
12
+ coverImagePath:
13
+ 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fww1.sinaimg.cn%2Fmw690%2F008jVjSaly1h7qs2falb6j30xc0hiaby.jpg&refer=http%3A%2F%2Fwww.sina.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1670167112&t=b697bd35640101f031b63a210638111c',
14
+ price: 1.1,
15
+ desc: '一二三四五六七八就',
16
+ },
17
+ {
18
+ id: 2,
19
+ coverImagePath: '',
20
+ price: 2,
21
+ desc: '大萨达大大大大所大大所大所大所大所大多撒所大',
22
+ },
23
+ {
24
+ id: 3,
25
+ coverImagePath:
26
+ 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fww1.sinaimg.cn%2Fmw690%2F008jVjSaly1h7qs2falb6j30xc0hiaby.jpg&refer=http%3A%2F%2Fwww.sina.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1670167112&t=b697bd35640101f031b63a210638111c',
27
+ price: 12.234,
28
+ desc: '奥术大师大所多奥术大师大',
29
+ },
30
+ {
31
+ id: 4,
32
+ coverImagePath:
33
+ 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fww1.sinaimg.cn%2Fmw690%2F008jVjSaly1h7qs2falb6j30xc0hiaby.jpg&refer=http%3A%2F%2Fwww.sina.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1670167112&t=b697bd35640101f031b63a210638111c',
34
+ price: 15,
35
+ desc: '的点点滴滴多多多多多多多多多多的点点滴滴的毒打所所大',
36
+ },
37
+ ],
38
+ };
39
+ },
40
+ },
41
+ {
42
+ url: '/api/app1/test/get',
43
+ method: 'post',
44
+ response: () => {
45
+ return {
46
+ status: 0,
47
+ totalRecCount: 100,
48
+ data: [
49
+ {
50
+ id: 1,
51
+ coverImagePath:
52
+ 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fww1.sinaimg.cn%2Fmw690%2F008jVjSaly1h7qs2falb6j30xc0hiaby.jpg&refer=http%3A%2F%2Fwww.sina.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1670167112&t=b697bd35640101f031b63a210638111c',
53
+ price: 1.1,
54
+ desc: '一二三四五六七八就',
55
+ },
56
+ ],
57
+ };
58
+ },
59
+ },
60
+ ];
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "web-client-app-starter",
3
+ "private": true,
4
+ "version": "0.0.0",
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "vite build",
9
+ "preview": "vite preview"
10
+ },
11
+ "devDependencies": {
12
+ "@babel/core": "^7.19.6",
13
+ "@babel/plugin-proposal-class-properties": "^7.18.6",
14
+ "@babel/plugin-proposal-decorators": "^7.19.6",
15
+ "@types/node": "^18.11.9",
16
+ "@vitejs/plugin-vue": "^3.1.2",
17
+ "typescript": "^4.6.4",
18
+ "unplugin-vue-macros": "^0.16.0",
19
+ "mockjs": "^1.1.0",
20
+ "vite": "^3.1.0",
21
+ "vite-plugin-babel": "^1.1.2",
22
+ "vite-plugin-mock": "^2.9.6",
23
+ "vite-plugin-externals": "^0.5.1"
24
+ },
25
+ "dependencies": {
26
+ "@ctzy-web-client/ioc-annotations": "^1.0.6",
27
+ "@ctzy-web-client/plugin-component-vue": "^1.0.5",
28
+ "element-plus": "^2.2.19",
29
+ "vue": "^3.2.41",
30
+ "vue-router": "^4.1.6",
31
+ "web-base-client-vue": "^1.0.7",
32
+ "vite-plugin-qiankun": "^1.0.15"
33
+ }
34
+ }
@@ -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,50 @@
1
+ import { service } from '@ctzy-web-client/ioc-annotations';
2
+ import { RequestInterceptors } from 'web-base-client-vue';
3
+
4
+ @service(RequestInterceptors)
5
+ export default class AppRequestInterceptors extends RequestInterceptors {
6
+ /**
7
+ * 请求发起的处理程序
8
+ * @param {Object} config 请求配置
9
+ * @returns
10
+ */
11
+ request(config) {
12
+ return config;
13
+ }
14
+
15
+ /**
16
+ * 处理请求发起的错误
17
+ * @param {Error} e 错误
18
+ */
19
+ requestError(e) {
20
+ return Promise.reject(new Error('请求错误'));
21
+ }
22
+
23
+ /**
24
+ * 响应处理程序
25
+ * @param {Object} response 响应对象
26
+ * @param {Object} response.config 请求配置
27
+ * @param {Object} response.data 请求结果
28
+ * @param {Number} response.status 请求状态
29
+ * @param {String} response.statusText 请求状态描述
30
+ * @param {Object} response.request 请求对象
31
+ * @returns
32
+ */
33
+ response(response) {
34
+ let { data, status, statusText } = response;
35
+
36
+ if (status === 200) {
37
+ return data;
38
+ } else {
39
+ throw new Error(`请求异常:[${status}] ${statusText}`);
40
+ }
41
+ }
42
+
43
+ /**
44
+ * 处理系统级别响应错误 404 等等
45
+ * @param {Error} e 错误
46
+ */
47
+ responseError(e) {
48
+ return Promise.reject(new Error('请求错误'));
49
+ }
50
+ }
@@ -0,0 +1,25 @@
1
+ import { service } from '@ctzy-web-client/ioc-annotations';
2
+ import { RouterInterceptors } from 'web-base-client-vue';
3
+
4
+ @service(RouterInterceptors)
5
+ export default class AppRouterInterceptors extends RouterInterceptors {
6
+ /**
7
+ * 设置一个导航守卫,在任何导航前执行。
8
+ * @param {*} to 我们要导航到的路由地址
9
+ * @param {*} from 我们从哪里来的路由地址
10
+ * @param {*} next next (可选) - 回调以验证导航
11
+ */
12
+ beforeEach(to, from, next) {
13
+ return next();
14
+ }
15
+
16
+ /**
17
+ * 设置一个导航守卫,在导航即将解析之前执行。在这个状态下,所有的组件都已经被获取,并且其他导航守卫也已经成功。
18
+ * @param {*} to 我们要导航到的路由地址
19
+ * @param {*} from 我们从哪里来的路由地址
20
+ * @param {*} next next (可选) - 回调以验证导航
21
+ */
22
+ beforeResolve(to, from, next) {
23
+ return next();
24
+ }
25
+ }
@@ -0,0 +1,23 @@
1
+ import { Application } from 'web-base-client-vue';
2
+ import { qiankunWindow } from 'vite-plugin-qiankun/es/helper';
3
+ import WebClientComponent from '@ctzy-web-client/plugin-component-vue';
4
+ import "@ctzy-web-client/plugin-component-vue/style"
5
+
6
+ //自动加载拦截器
7
+ import.meta.glob('./interceptors/**/*.js', { eager: true });
8
+ //自动加载服务
9
+ import.meta.glob('./services/**/*.js', { eager: true });
10
+
11
+ const appName = import.meta.env.VITE_APPLICATION_NAME;
12
+
13
+ const applicaiton = new Application(appName, {
14
+ global: qiankunWindow,
15
+ routeBaseUrl: `/${appName}`,
16
+ request: {
17
+ baseURL: import.meta.env.VITE_REQUEST_BASE_URL,
18
+ timeout: import.meta.env.VITE_REQUEST_TIMEOUT * 1000,
19
+ },
20
+ pages: import.meta.glob('./pages/*/index.vue'),
21
+ });
22
+
23
+ applicaiton.use(WebClientComponent).mount('#app');
@@ -0,0 +1,45 @@
1
+ import { dataTable, tableColumn, dataForm, formColumn } from 'web-base-client-vue';
2
+
3
+ @dataTable({ name: 'test', title: '测试数据模型' })
4
+ @dataForm({ name: 'test', title: '测试' })
5
+ export default class TestDataModel {
6
+ @formColumn({ title: '编号', visible: false })
7
+ @tableColumn({ title: '编号', visible: false })
8
+ id = '';
9
+
10
+ @formColumn({ title: '封面图', name: 'coverImagePath' })
11
+ @tableColumn({
12
+ title: '封面图',
13
+ name: 'coverImagePath',
14
+ type: 'image',
15
+ width: '100px',
16
+ })
17
+ coverImage = '';
18
+
19
+ @formColumn({
20
+ title: '价格',
21
+ type: 'number',
22
+ rules: [
23
+ { pattern: /\d{1,10}(\.\d{1,2})?$/, message: '请输入正确的价格格式!' },
24
+ ],
25
+ })
26
+ @tableColumn({
27
+ title: '价格',
28
+ type: 'number',
29
+ rule: 'd:2',
30
+ width: '100px',
31
+ template: '¥${value} - adas',
32
+ })
33
+ price = '';
34
+
35
+ @formColumn({
36
+ title: '描述',
37
+ submitName: 'title',
38
+ rules: [{ type: 'string', max: 10, message: '描述不能超过10个字符!' }],
39
+ })
40
+ @tableColumn({ title: '描述', rule: 's:10', width: '200px' })
41
+ desc = '';
42
+
43
+ @formColumn({ title: '状态' })
44
+ status = '';
45
+ }
@@ -0,0 +1,120 @@
1
+ <template>
2
+ <el-card>
3
+ <template #header>
4
+ <el-page-header class="page-header" :icon="null">
5
+ <template #title>
6
+ <el-button link @click="$router.back()"> 返回</el-button>
7
+ </template>
8
+ <template #content>默认表单 </template>
9
+ <template #extra>
10
+ <el-button type="primary" @click="dataForm1.submit()"
11
+ >保存表单</el-button
12
+ >
13
+ </template>
14
+ </el-page-header>
15
+ </template>
16
+ <BwaDataForm
17
+ ref="dataForm1"
18
+ :dataForm="dataForm"
19
+ :recID="'1'"
20
+ labelWidth="200px"
21
+ >
22
+ <!-- 使用(form-item-字段名)的插槽可用于自定义指定字段的输入框 -->
23
+ <template v-slot:form-item-status="{ record, column, dataForm }">
24
+ <ElSelect v-model="record.status" clearable>
25
+ <ElOption :value="1">1</ElOption>
26
+ <ElOption :value="2">2</ElOption>
27
+ <ElOption :value="3">3</ElOption>
28
+ </ElSelect>
29
+ </template>
30
+ </BwaDataForm>
31
+ <el-main> 表单结果:{{ dataForm1 ? dataForm1.dataForm.data : '' }} </el-main>
32
+ </el-card>
33
+ <el-card style="margin-top: 20px">
34
+ <template #header>
35
+ <el-page-header class="page-header" :icon="null">
36
+ <template #title>
37
+ <el-button link @click="$router.back()"> 返回</el-button>
38
+ </template>
39
+ <template #content>自由布局表单 </template>
40
+ <template #extra>
41
+ <el-button type="primary" @click="dataForm2.submit()"
42
+ >保存表单</el-button
43
+ >
44
+ </template>
45
+ </el-page-header>
46
+ </template>
47
+ <!-- <BwaDataForm
48
+ ref="dataForm2"
49
+ :dataForm="dataForm"
50
+ :recID="id"
51
+ labelPosition="top"
52
+ >
53
+ <el-container>
54
+ <el-main>
55
+ <BwaDataFormItem name="desc" />
56
+ </el-main>
57
+ <el-aside width="400px">
58
+ <el-main>
59
+ <BwaDataFormItem name="price" />
60
+ <BwaDataFormItem name="coverImage" />
61
+ <BwaDataFormItem name="status">
62
+ <template v-slot="{ record, column, dataForm }">
63
+ <ElSelect v-model="record.status" clearable>
64
+ <ElOption :value="1">1</ElOption>
65
+ <ElOption :value="2">2</ElOption>
66
+ <ElOption :value="3">3</ElOption>
67
+ </ElSelect>
68
+ </template>
69
+ </BwaDataFormItem>
70
+ </el-main>
71
+ </el-aside>
72
+ </el-container>
73
+ </BwaDataForm> -->
74
+ <el-main> 表单结果:{{ dataForm2 ? dataForm2.dataForm.data : '' }} </el-main>
75
+ </el-card>
76
+ </template>
77
+ <script>
78
+ import { ref, reactive, watch, computed } from 'vue';
79
+ import { useDataForm } from 'web-base-client-vue';
80
+ import TestDataModel from '../../models/TestDataModel';
81
+ export const route = '/form/:id?';
82
+ export const parent = '';
83
+ export const meta = {};
84
+ export default {
85
+ name: 'data-from',
86
+ props: {
87
+ id: String,
88
+ },
89
+ setup() {
90
+ const dataForm1 = ref();
91
+ const dataForm2 = ref();
92
+
93
+ const dataForm = useDataForm(TestDataModel);
94
+
95
+ const columnNames = ['coverImage', 'price', 'desc'];
96
+ // 获取当前显示的列列表
97
+ const columns = dataForm.value.getDisplayColumns();
98
+
99
+ watch(
100
+ computed(() => dataForm.value.data.status),
101
+ (status) => {
102
+ // 显示所有列
103
+ for (const column of columns) {
104
+ column.show();
105
+ }
106
+
107
+ if (typeof status !== 'number') {
108
+ return;
109
+ }
110
+
111
+ // 隐藏选中列
112
+ dataForm.value.getColumn(columnNames[status - 1]).hide();
113
+ }
114
+ );
115
+
116
+ return { dataForm, dataForm1, dataForm2 };
117
+ },
118
+ };
119
+ </script>
120
+ <style scoped></style>
@@ -0,0 +1,57 @@
1
+ <template>
2
+ <BwaDataTable :dataTable="dataTable">
3
+ <template #header="{ dataTable }">
4
+ <el-page-header class="page-header" :icon="null">
5
+ <template #breadcrumb>
6
+ <el-breadcrumb separator="/">
7
+ <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
8
+ <el-breadcrumb-item>测试二级页面</el-breadcrumb-item>
9
+ <el-breadcrumb-item>测试三级页面</el-breadcrumb-item>
10
+ </el-breadcrumb>
11
+ </template>
12
+ <template #title>
13
+ {{ dataTable.title }}
14
+ </template>
15
+ <template #content></template>
16
+ <template #extra>
17
+ <el-button type="primary" @click="$router.push('/form')"
18
+ >新增</el-button
19
+ >
20
+ </template>
21
+ </el-page-header>
22
+ </template>
23
+
24
+ <template v-slot:table-col-price="{ row, index, column, dataTable }">
25
+ {{ row.price }} {{ index }}
26
+ </template>
27
+
28
+ <template v-slot:column-append>
29
+ <BwaDataTableColumn label="ddd">
30
+ <template v-slot="{ row }"> dsadsadsadsada </template>
31
+ </BwaDataTableColumn>
32
+ </template>
33
+ </BwaDataTable>
34
+ </template>
35
+ <script>
36
+ import { useService, useDataTable } from 'web-base-client-vue';
37
+ import TestServices from '../../services/TestServices';
38
+ import TestDataModel from '../../models/TestDataModel';
39
+ export const route = '/';
40
+ export const parent = '';
41
+ export const meta = {};
42
+ export default {
43
+ name: 'home',
44
+ setup() {
45
+ const testServices = useService(TestServices);
46
+ const dataTable = useDataTable(TestDataModel);
47
+
48
+ testServices.value.loadData();
49
+
50
+ return {
51
+ TestDataModel,
52
+ dataTable,
53
+ };
54
+ },
55
+ };
56
+ </script>
57
+ <style scoped></style>
@@ -0,0 +1,21 @@
1
+ import { service, inject } from '@ctzy-web-client/ioc-annotations';
2
+ import { SimpleOrm } from 'web-base-client-vue';
3
+ import TestDataModel from '../models/TestDataModel';
4
+
5
+ /**
6
+ * 测试服务
7
+ */
8
+ @service()
9
+ export default class TestServices {
10
+ /**
11
+ * @type {SimpleOrm}
12
+ */
13
+ @inject(SimpleOrm)
14
+ orm = null;
15
+
16
+ async loadData() {
17
+ const testDataList = await this.orm.fill(TestDataModel);
18
+
19
+ console.log(testDataList);
20
+ }
21
+ }
@@ -0,0 +1,54 @@
1
+ import { defineConfig, loadEnv } from "vite";
2
+ import babel from "vite-plugin-babel";
3
+ import { viteMockServe } from "vite-plugin-mock";
4
+ import vue from "@vitejs/plugin-vue";
5
+ import vueMacros from "unplugin-vue-macros/vite";
6
+ import qiankunPlugin from "vite-plugin-qiankun";
7
+ import { viteExternalsPlugin } from "vite-plugin-externals";
8
+
9
+ // https://vitejs.dev/config/
10
+ export default defineConfig(({ mode, command }) => {
11
+ const applicationName = loadEnv(mode, process.cwd()).VITE_APPLICATION_NAME;
12
+
13
+ const plugins = [
14
+ qiankunPlugin(applicationName, { useDevMode: true }),
15
+ babel({
16
+ babelConfig: {
17
+ babelrc: false,
18
+ configFile: false,
19
+ plugins: [
20
+ ["@babel/plugin-proposal-decorators", { version: "legacy" }],
21
+ ["@babel/plugin-proposal-class-properties", { loose: true }],
22
+ ],
23
+ },
24
+ }),
25
+ viteMockServe({
26
+ mockPath: "./mocks",
27
+ localEnabled: command === "serve",
28
+ }),
29
+ vueMacros({
30
+ plugins: {
31
+ vue: vue(),
32
+ },
33
+ }),
34
+ ];
35
+
36
+ if (process.env.NODE_ENV === "production") {
37
+ plugins.unshift(
38
+ viteExternalsPlugin({
39
+ 'vue': "Vue",
40
+ 'vue-router': "VueRouter",
41
+ "web-base-client-vue": "WebClientVue",
42
+ "@ctzy-web-client/plugin-component-vue": "WebClientPluginComponentVue",
43
+ })
44
+ );
45
+ }
46
+
47
+ return {
48
+ base: `/${applicationName}/`,
49
+ server: {
50
+ port: 5001,
51
+ },
52
+ plugins,
53
+ };
54
+ });
@@ -0,0 +1,4 @@
1
+ # 请求相关 默认超时时间 单位秒
2
+ VITE_REQUEST_TIMEOUT = 10
3
+ # 请求相关 默认请求前缀
4
+ VITE_REQUEST_BASE_URL = /api
@@ -0,0 +1,16 @@
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>test</title>
8
+ </head>
9
+ <body>
10
+ <script>
11
+ window.__DELAY_REGISTER_SERVICES__ = [];
12
+ </script>
13
+ <div id="app"></div>
14
+ <script type="module" src="./src/main.js"></script>
15
+ </body>
16
+ </html>
@@ -0,0 +1,5 @@
1
+ {
2
+ "compilerOptions": {
3
+ "experimentalDecorators": true
4
+ }
5
+ }
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "web-client-app-starter",
3
+ "private": true,
4
+ "version": "0.0.0",
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "vite build",
9
+ "preview": "vite preview"
10
+ },
11
+ "devDependencies": {
12
+ "@babel/core": "^7.19.6",
13
+ "@babel/plugin-proposal-class-properties": "^7.18.6",
14
+ "@babel/plugin-proposal-decorators": "^7.19.6",
15
+ "@babel/preset-env": "^7.19.4",
16
+ "@rollup/plugin-babel": "^6.0.0",
17
+ "@vitejs/plugin-vue": "^3.1.2",
18
+ "mockjs": "^1.1.0",
19
+ "unplugin-vue-macros": "^0.16.0",
20
+ "vite": "^3.1.0",
21
+ "vite-plugin-babel": "^1.1.2",
22
+ "vite-plugin-mock": "^2.9.6"
23
+ },
24
+ "dependencies": {
25
+ "@ctzy-web-client/ioc-annotations": "^1.0.6",
26
+ "@ctzy-web-client/plugin-component-vue": "^1.0.5",
27
+ "element-plus": "^2.2.19",
28
+ "vite-plugin-qiankun": "^1.0.15",
29
+ "vue": "^3.2.41",
30
+ "vue-router": "^4.1.6",
31
+ "web-base-client-vue": "^1.0.7"
32
+ }
33
+ }
@@ -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,21 @@
1
+ import * as WebClientVue from 'web-base-client-vue';
2
+ import { Application } from 'web-base-client-vue';
3
+ import WebClientPluginComponentVue from '@ctzy-web-client/plugin-component-vue';
4
+ import { qiankunWindow } from 'vite-plugin-qiankun/es/helper';
5
+ import '@ctzy-web-client/plugin-component-vue/style/index.css';
6
+
7
+ //自动加载拦截器
8
+ import.meta.glob('./interceptors/**/*.js', { eager: true });
9
+ //自动加载服务
10
+ import.meta.glob('./services/**/*.js', { eager: true });
11
+
12
+ qiankunWindow.WebClientVue = WebClientVue;
13
+ qiankunWindow.WebClientPluginComponentVue = WebClientPluginComponentVue;
14
+
15
+
16
+ const applicaiton = new Application('base', {
17
+ global: qiankunWindow,
18
+ pages: import.meta.glob('./pages/*/index.vue'),
19
+ });
20
+
21
+ applicaiton.mount('#app');
@@ -0,0 +1,15 @@
1
+ <template>
2
+ <BwaMicroApplication entry="http://localhost:5001/app1/" name="app1" />
3
+ </template>
4
+
5
+ <script setup>
6
+ import { BwaMicroApplication } from 'web-base-client-vue';
7
+
8
+ defineOptions({
9
+ name: 'App',
10
+ });
11
+ </script>
12
+
13
+ <script>
14
+ export const route = '/:appName*';
15
+ </script>
@@ -0,0 +1,6 @@
1
+ import { service } from "@ctzy-web-client/ioc-annotations";
2
+
3
+ @service()
4
+ export class ApplicationService {
5
+
6
+ }
@@ -0,0 +1,4 @@
1
+ import { service } from '@ctzy-web-client/ioc-annotations';
2
+
3
+ @service()
4
+ export class UserService {}
@@ -0,0 +1,35 @@
1
+ import { defineConfig } from 'vite';
2
+ import babel from 'vite-plugin-babel';
3
+ import vue from '@vitejs/plugin-vue';
4
+ import vueMacros from 'unplugin-vue-macros/vite';
5
+ import { viteMockServe } from 'vite-plugin-mock';
6
+
7
+ // https://vitejs.dev/config/
8
+ export default defineConfig(({ mode, command }) => {
9
+ return {
10
+ server: {
11
+ port: 5002,
12
+ },
13
+ plugins: [
14
+ babel({
15
+ babelConfig: {
16
+ babelrc: false,
17
+ configFile: false,
18
+ plugins: [
19
+ ['@babel/plugin-proposal-decorators', { version: 'legacy' }],
20
+ ['@babel/plugin-proposal-class-properties', { loose: true }],
21
+ ],
22
+ },
23
+ }),
24
+ viteMockServe({
25
+ mockPath: './mocks',
26
+ localEnabled: command === 'serve',
27
+ }),
28
+ vueMacros({
29
+ plugins: {
30
+ vue: vue(),
31
+ },
32
+ }),
33
+ ],
34
+ };
35
+ });