vue2-client 1.8.32 → 1.8.33
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.
- package/.env +1 -0
- package/.eslintrc.js +22 -14
- package/CHANGELOG.md +55 -0
- package/babel.config.js +8 -2
- package/docs/index.md +2 -1
- package/index.js +1 -1
- package/jest-transform-stub.js +8 -0
- package/jest.config.js +20 -2
- package/jest.setup.js +7 -0
- package/package.json +36 -27
- package/src/App.vue +33 -7
- package/src/base-client/components/common/AMisRender/index.js +3 -0
- package/src/base-client/components/common/AMisRender/index.vue +257 -0
- package/src/base-client/components/common/AddressSearchCombobox/AddressSearchCombobox.vue +2 -2
- package/src/base-client/components/common/AmapMarker/AmapPointRendering.vue +3 -3
- package/src/base-client/components/common/CreateQuery/CreateQuery.vue +32 -37
- package/src/base-client/components/common/CreateQuery/CreateQueryItem.vue +80 -12
- package/src/base-client/components/common/CreateSimpleFormQuery/CreateSimpleFormQuery.vue +53 -70
- package/src/base-client/components/common/FormGroupEdit/FormGroupEdit.vue +5 -5
- package/src/base-client/components/common/FormGroupQuery/FormGroupQuery.vue +19 -18
- package/src/base-client/components/common/JSONToTree/jsontotree.vue +4 -8
- package/src/base-client/components/common/PersonSetting/PersonSetting.vue +4 -6
- package/src/base-client/components/common/Tree/Tree.vue +149 -0
- package/src/base-client/components/common/Tree/index.js +2 -0
- package/src/base-client/components/common/Upload/Upload.vue +1 -1
- package/src/base-client/components/common/XAddForm/XAddForm.vue +21 -5
- package/src/base-client/components/common/XAddNativeForm/XAddNativeForm.vue +88 -53
- package/src/base-client/components/common/XCard/XCard.vue +1 -1
- package/src/base-client/components/common/XDataDrawer/XDataDrawer.vue +2 -2
- package/src/base-client/components/common/XDescriptions/XDescriptions.vue +117 -0
- package/src/base-client/components/common/XDescriptions/index.js +3 -0
- package/src/base-client/components/common/XDescriptions/index.md +83 -0
- package/src/base-client/components/common/XForm/XForm.vue +2 -0
- package/src/base-client/components/common/XFormTable/XFormTable.vue +49 -24
- package/src/base-client/components/common/XFormTable/index.md +1 -0
- package/src/base-client/components/common/XImportExcel/XImportExcel.vue +131 -132
- package/src/base-client/components/common/XStepView/XStepView.vue +252 -0
- package/src/base-client/components/common/XStepView/index.js +3 -0
- package/src/base-client/components/common/XStepView/index.md +31 -0
- package/src/base-client/components/common/XTable/XTable.vue +16 -8
- package/src/base-client/components/index.js +11 -5
- package/src/base-client/components/system/DictionaryDetailsView/DictionaryDetailsView.vue +4 -3
- package/src/base-client/plugins/AppData.js +1 -2
- package/src/base-client/plugins/Config.js +0 -1
- package/src/base-client/plugins/GetLoginInfoService.js +6 -3
- package/src/base-client/plugins/tabs-page-plugin.js +5 -4
- package/src/bootstrap.js +2 -2
- package/src/components/FilePreview/FilePreview.vue +2 -2
- package/src/components/NumberInfo/NumberInfo.vue +1 -1
- package/src/components/checkbox/ColorCheckbox.vue +1 -1
- package/src/components/checkbox/ImgCheckbox.vue +2 -2
- package/src/components/menu/SideMenu.vue +2 -2
- package/src/components/menu/menu.js +1 -1
- package/src/components/tool/AStepItem.vue +1 -1
- package/src/config/CreateQueryConfig.js +12 -2
- package/src/config/default/antd.config.js +11 -6
- package/src/config/default/setting.config.js +7 -4
- package/src/layouts/PageLayout.vue +1 -1
- package/src/layouts/SinglePageView.vue +24 -2
- package/src/layouts/header/AdminHeader.vue +4 -4
- package/src/layouts/header/HeaderNotice.vue +3 -2
- package/src/layouts/tabs/TabsHead.vue +1 -2
- package/src/layouts/tabs/TabsView.vue +18 -10
- package/src/main.js +40 -12
- package/src/mock/extend/index.js +2 -1
- package/src/mock/goods/index.js +6 -6
- package/src/pages/AMisDemo/AMisDemo.vue +223 -0
- package/src/pages/AMisDemo/AMisDemo2.vue +74 -0
- package/src/pages/CreateQueryPage.vue +11 -3
- package/src/pages/login/Login.vue +2 -2
- package/src/pages/resourceManage/orgListManage.vue +2 -2
- package/src/pages/system/dictionary/index.vue +1 -0
- package/src/pages/system/monitor/loginInfor/index.vue +2 -1
- package/src/pages/system/monitor/operLog/index.vue +2 -1
- package/src/pages/system/settings/modifyPassword.vue +1 -1
- package/src/pages/system/ticket/index.vue +3 -2
- package/src/pages/system/ticket/submitTicketSuccess.vue +8 -2
- package/src/router/async/router.map.js +2 -0
- package/src/router/guards.js +29 -0
- package/src/router.js +15 -0
- package/src/services/api/cas.js +1 -1
- package/src/services/api/common.js +39 -23
- package/src/services/apiService.js +2 -2
- package/src/theme/default/style.less +2 -2
- package/src/utils/authority-utils.js +12 -12
- package/src/utils/errorCode.js +4 -4
- package/src/utils/login.js +8 -5
- package/src/utils/map-utils.js +20 -12
- package/src/utils/request.js +15 -5
- package/src/utils/routerUtil.js +12 -8
- package/src/utils/util.js +3 -2
- package/test/Amis.spec.js +163 -0
- package/test/Tree.spec.js +167 -0
- package/test/myDialog.spec.js +46 -0
- package/vue.config.js +66 -24
- package//350/277/201/347/247/273/346/227/245/345/277/227.md +15 -0
- package/webpack.config.js +0 -12
package/.env
CHANGED
package/.eslintrc.js
CHANGED
|
@@ -3,7 +3,7 @@ module.exports = {
|
|
|
3
3
|
env: {
|
|
4
4
|
node: true
|
|
5
5
|
},
|
|
6
|
-
|
|
6
|
+
extends: [
|
|
7
7
|
'plugin:vue/essential',
|
|
8
8
|
'plugin:vue/strongly-recommended',
|
|
9
9
|
'@vue/standard'
|
|
@@ -17,10 +17,11 @@ module.exports = {
|
|
|
17
17
|
'vue/max-attributes-per-line': [
|
|
18
18
|
2,
|
|
19
19
|
{
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
singleline: {
|
|
21
|
+
max: 5
|
|
22
|
+
},
|
|
23
|
+
multiline: {
|
|
24
|
+
max: 1,
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
27
|
],
|
|
@@ -35,38 +36,45 @@ module.exports = {
|
|
|
35
36
|
'vue/html-closing-bracket-newline': 0,
|
|
36
37
|
'vue/no-parsing-error': 0,
|
|
37
38
|
'vue/name-property-casing': 0,
|
|
39
|
+
'vue/multi-word-component-names': 0,
|
|
40
|
+
'vue/require-valid-default-prop': 0,
|
|
41
|
+
'no-template-curly-in-string': 0,
|
|
42
|
+
'vue/no-mutating-props': 0,
|
|
43
|
+
'no-useless-escape': 0,
|
|
38
44
|
'no-tabs': 0,
|
|
39
|
-
'
|
|
45
|
+
'multiline-ternary': 0,
|
|
46
|
+
'object-shorthand': 0,
|
|
47
|
+
quotes: [
|
|
40
48
|
2,
|
|
41
49
|
'single',
|
|
42
50
|
{
|
|
43
|
-
|
|
44
|
-
|
|
51
|
+
avoidEscape: true,
|
|
52
|
+
allowTemplateLiterals: true
|
|
45
53
|
}
|
|
46
54
|
],
|
|
47
|
-
|
|
55
|
+
semi: [
|
|
48
56
|
2,
|
|
49
57
|
'never',
|
|
50
58
|
{
|
|
51
|
-
|
|
59
|
+
beforeStatementContinuationChars: 'never'
|
|
52
60
|
}
|
|
53
61
|
],
|
|
54
62
|
'no-delete-var': 2,
|
|
55
63
|
'prefer-const': [
|
|
56
64
|
2,
|
|
57
65
|
{
|
|
58
|
-
|
|
66
|
+
ignoreReadBeforeAssign: false
|
|
59
67
|
}
|
|
60
68
|
],
|
|
61
69
|
'template-curly-spacing': 'off',
|
|
62
|
-
|
|
70
|
+
indent: 'off',
|
|
63
71
|
// 必须使用全等: false
|
|
64
|
-
|
|
72
|
+
eqeqeq: 0,
|
|
65
73
|
// 可以使用!! 双重否定
|
|
66
74
|
'no-extra-boolean-cast': 'off'
|
|
67
75
|
},
|
|
68
76
|
parserOptions: {
|
|
69
|
-
parser: 'babel-
|
|
77
|
+
parser: '@babel/eslint-parser'
|
|
70
78
|
},
|
|
71
79
|
overrides: [
|
|
72
80
|
{
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,61 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
> 所有关于本项目的变化都在该文档里。
|
|
3
3
|
|
|
4
|
+
**1.8.33 -2024-1-18 @江超**
|
|
5
|
+
- 获取配置改为openApi方式
|
|
6
|
+
|
|
7
|
+
**1.8.30 -2024-1-10 @张振宇**
|
|
8
|
+
- 微前端兼容
|
|
9
|
+
|
|
10
|
+
**1.8.26 -2024-1-10 @杨亚文**
|
|
11
|
+
- 解决单页面为首页时首次登录不加载问题
|
|
12
|
+
|
|
13
|
+
**1.8.23 -2023-12-28 @杨亚文**
|
|
14
|
+
- 解决条件导出功能bug
|
|
15
|
+
|
|
16
|
+
**1.8.22 -2023-12-27 @江超**
|
|
17
|
+
- 解决导出功能在v4环境下的地址错误问题
|
|
18
|
+
|
|
19
|
+
**1.8.20 -2023-12-21 @江超**
|
|
20
|
+
- 修复滚动条样式问题
|
|
21
|
+
- 售后问题登记页面增加处理结果
|
|
22
|
+
|
|
23
|
+
**1.8.19 -2023-12-07 @江超**
|
|
24
|
+
- 鉴权相关修改
|
|
25
|
+
|
|
26
|
+
**1.8.18 -2023-12-07 @江超**
|
|
27
|
+
- 完善单页面组件功能
|
|
28
|
+
|
|
29
|
+
**1.8.15 - 1.8.17 -2023-11-23 @张振宇**
|
|
30
|
+
- 调整配置化组件
|
|
31
|
+
|
|
32
|
+
**1.8.14 - 1.8.15 -2023-11-23 @江超**
|
|
33
|
+
- 完善导入功能的返回值
|
|
34
|
+
|
|
35
|
+
**1.8.13 -2023-11-21 @张振宇**
|
|
36
|
+
- 配置中心增加动态表名功能
|
|
37
|
+
|
|
38
|
+
**1.8.12 -2023-11-20 @江超**
|
|
39
|
+
- 完成查询配置通用导入和模板下载功能
|
|
40
|
+
|
|
41
|
+
**1.8.11 -2023-11-08 @刘懿**
|
|
42
|
+
- XStepView接入琉璃配置中心错误修改
|
|
43
|
+
|
|
44
|
+
**1.8.10 -2023-11-07 @江超**
|
|
45
|
+
- XStepView接入琉璃配置中心
|
|
46
|
+
|
|
47
|
+
**1.8.9 -2023-10-27 @江超**
|
|
48
|
+
- 完成webpack5的切换
|
|
49
|
+
|
|
50
|
+
**1.7.20 -2023-10-11 @江超**
|
|
51
|
+
- 跳转首页问题修改
|
|
52
|
+
|
|
53
|
+
**1.7.19 -2023-10-11 @江超**
|
|
54
|
+
- 菜单头部可配置
|
|
55
|
+
|
|
56
|
+
**1.7.15 - 1.7.18 -2023-10-11 @江超**
|
|
57
|
+
- 查询配置生成界面调整
|
|
58
|
+
|
|
4
59
|
**1.7.14 -2023-10-10 @江超**
|
|
5
60
|
- webConfig在开发环境下不存储到indexedDB中
|
|
6
61
|
|
package/babel.config.js
CHANGED
|
@@ -9,7 +9,13 @@ if (IS_PROD) {
|
|
|
9
9
|
module.exports = {
|
|
10
10
|
presets: [
|
|
11
11
|
'@vue/cli-plugin-babel/preset',
|
|
12
|
-
['@vue/babel-preset-jsx', {
|
|
12
|
+
['@vue/babel-preset-jsx', { injectH: false }]
|
|
13
13
|
],
|
|
14
|
-
plugins
|
|
14
|
+
plugins,
|
|
15
|
+
env: {
|
|
16
|
+
test: {
|
|
17
|
+
presets: ['@babel/preset-env'],
|
|
18
|
+
plugins: ['istanbul']
|
|
19
|
+
}
|
|
20
|
+
}
|
|
15
21
|
}
|
package/docs/index.md
CHANGED
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
* [XFormCol 适用于表单的通用响应式栅格a-col封装](../src/base-client/components/common/XFormCol/index.md)
|
|
13
13
|
* [XFormTable 动态查询控件,进一步整合了XTable和XForm](../src/base-client/components/common/XFormTable/index.md)
|
|
14
14
|
* [XTable 动态表格控件,根据JSON配置生成一个完整的动态表格](../src/base-client/components/common/XTable/index.md)
|
|
15
|
-
|
|
15
|
+
* [XTable 动态表格控件,根据JSON配置生成一个完整的动态表格](../src/base-client/components/common/XTable/index.md)
|
|
16
|
+
*
|
|
16
17
|
### iot
|
|
17
18
|
* [CustomerDetailsView 客户详情页](../src/base-client/components/iot/CustomerDetailsView/index.md)
|
|
18
19
|
* [DeviceDetailsView 档案详情页](../src/base-client/components/iot/DeviceDetailsView/index.md)
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Vue from 'vue'
|
|
2
|
-
import { initRouter } from '@vue2-client/router'
|
|
2
|
+
import { initRouter } from '@vue2-client/router/index.js'
|
|
3
3
|
import { initI18n } from '@vue2-client/utils/i18n'
|
|
4
4
|
import bootstrap from '@vue2-client/bootstrap'
|
|
5
5
|
import { modules } from '@vue2-client/store'
|
package/jest.config.js
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
const path = require('path')
|
|
2
|
+
require('dotenv').config({ path: path.resolve(__dirname, '.env') })
|
|
3
|
+
|
|
1
4
|
module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
5
|
+
setupFiles: ['<rootDir>/jest.setup.js'],
|
|
6
|
+
moduleNameMapper: {
|
|
7
|
+
'^@vue2-client/(.*)$': '<rootDir>/src/$1',
|
|
8
|
+
'\\.(css|less)$': 'identity-obj-proxy',
|
|
9
|
+
},
|
|
10
|
+
moduleFileExtensions: ['js', 'json', 'jsx', 'ts', 'tsx', 'node', 'vue'], // 注意 'vue' 在这里
|
|
11
|
+
testEnvironment: 'jsdom',
|
|
12
|
+
transform: {
|
|
13
|
+
'^.+\\.js$': 'babel-jest',
|
|
14
|
+
'^.+\\.vue$': 'vue-jest',
|
|
15
|
+
'^.+\\.less$': 'jest-transform-stub', // 添加这一行
|
|
16
|
+
},
|
|
17
|
+
transformIgnorePatterns: [
|
|
18
|
+
'/node_modules/(?!ant-design-vue)',
|
|
19
|
+
]
|
|
20
|
+
// 其他 Jest 配置项...
|
|
21
|
+
}
|
package/jest.setup.js
ADDED
package/package.json
CHANGED
|
@@ -1,40 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue2-client",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.33",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
|
-
"serve": "vue-cli-service serve",
|
|
6
|
+
"serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
|
|
7
|
+
"mac-serve": "vue-cli-service serve --no-eslint --mode mac",
|
|
7
8
|
"build": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build",
|
|
8
9
|
"test:unit": "vue-cli-service test:unit",
|
|
9
10
|
"lint": "vue-cli-service lint",
|
|
10
11
|
"build:preview": "vue-cli-service build --mode preview",
|
|
11
|
-
"lint:nofix": "vue-cli-service lint --no-fix"
|
|
12
|
+
"lint:nofix": "vue-cli-service lint --no-fix",
|
|
13
|
+
"test": "jest"
|
|
12
14
|
},
|
|
13
15
|
"dependencies": {
|
|
14
16
|
"@amap/amap-jsapi-loader": "^1.0.1",
|
|
15
17
|
"@antv/data-set": "^0.11.8",
|
|
16
18
|
"@antv/g2plot": "^2.4.29",
|
|
17
19
|
"@vue/babel-preset-jsx": "^1.4.0",
|
|
20
|
+
"amis": "^3.4.3",
|
|
18
21
|
"animate.css": "^4.1.1",
|
|
19
22
|
"ant-design-vue": "^1.7.8",
|
|
20
23
|
"axios": "^0.27.2",
|
|
21
24
|
"clipboard": "^2.0.11",
|
|
22
|
-
"core-js": "^3.
|
|
25
|
+
"core-js": "^3.33.0",
|
|
23
26
|
"crypto-js": "^4.1.1",
|
|
24
27
|
"date-fns": "^2.29.3",
|
|
25
28
|
"default-passive-events": "^2.0.0",
|
|
29
|
+
"dotenv": "^16.3.1",
|
|
26
30
|
"enquire.js": "^2.1.6",
|
|
27
31
|
"file-saver": "^2.0.5",
|
|
28
32
|
"highlight.js": "^11.7.0",
|
|
29
33
|
"js-base64": "^3.7.5",
|
|
30
34
|
"js-cookie": "^2.2.1",
|
|
31
35
|
"jsencrypt": "^3.3.2",
|
|
36
|
+
"lodash.clonedeep": "^4.5.0",
|
|
32
37
|
"lodash.get": "^4.4.2",
|
|
33
38
|
"mockjs": "^1.1.0",
|
|
34
39
|
"nprogress": "^0.2.0",
|
|
40
|
+
"qs": "^6.11.2",
|
|
41
|
+
"regenerator-runtime": "^0.14.0",
|
|
35
42
|
"videojs-contrib-hls": "^5.15.0",
|
|
36
43
|
"viser-vue": "^2.4.8",
|
|
37
|
-
"vue": "2.
|
|
44
|
+
"vue": "^2.7.14",
|
|
38
45
|
"vue-i18n": "^8.28.2",
|
|
39
46
|
"vue-json-viewer": "^2.2.22",
|
|
40
47
|
"vue-router": "^3.6.5",
|
|
@@ -45,39 +52,41 @@
|
|
|
45
52
|
},
|
|
46
53
|
"devDependencies": {
|
|
47
54
|
"@ant-design/colors": "^7.0.0",
|
|
48
|
-
"@babel/core": "^7.
|
|
49
|
-
"@
|
|
50
|
-
"@
|
|
51
|
-
"@vue/cli-
|
|
52
|
-
"@vue/
|
|
53
|
-
"@
|
|
54
|
-
"
|
|
55
|
+
"@babel/core": "^7.22.20",
|
|
56
|
+
"@babel/eslint-parser": "^7.22.15",
|
|
57
|
+
"@babel/preset-env": "^7.22.20",
|
|
58
|
+
"@vue/cli-plugin-babel": "^5.0.8",
|
|
59
|
+
"@vue/cli-plugin-eslint": "^5.0.8",
|
|
60
|
+
"@vue/cli-service": "^5.0.8",
|
|
61
|
+
"@vue/eslint-config-standard": "^8.0.1",
|
|
62
|
+
"@vue/test-utils": "^1.3.6",
|
|
63
|
+
"babel-jest": "^26.6.3",
|
|
55
64
|
"babel-plugin-transform-remove-console": "^6.9.4",
|
|
56
|
-
"
|
|
57
|
-
"
|
|
65
|
+
"compression-webpack-plugin": "^10.0.0",
|
|
66
|
+
"copy-webpack-plugin": "^11.0.0",
|
|
67
|
+
"css-minimizer-webpack-plugin": "^5.0.1",
|
|
58
68
|
"deepmerge": "^4.3.1",
|
|
59
|
-
"
|
|
60
|
-
"eslint": "^
|
|
61
|
-
"eslint-plugin-import": "^2.26.0",
|
|
62
|
-
"eslint-plugin-node": "^11.1.0",
|
|
63
|
-
"eslint-plugin-promise": "^4.3.1",
|
|
64
|
-
"eslint-plugin-standard": "^4.1.0",
|
|
65
|
-
"eslint-plugin-vue": "^6.2.2",
|
|
69
|
+
"eslint": "^8.51.0",
|
|
70
|
+
"eslint-plugin-vue": "^9.17.0",
|
|
66
71
|
"fast-deep-equal": "^3.1.3",
|
|
72
|
+
"jest": "^26.6.3",
|
|
73
|
+
"jest-environment-jsdom": "^26.6.2",
|
|
74
|
+
"jest-transform-stub": "^2.0.0",
|
|
67
75
|
"less-loader": "^6.2.0",
|
|
68
76
|
"script-loader": "^0.7.2",
|
|
77
|
+
"ignore-loader": "^0.1.2",
|
|
69
78
|
"style-resources-loader": "^1.5.0",
|
|
70
79
|
"vue-cli-plugin-style-resources-loader": "^0.1.5",
|
|
71
|
-
"vue-
|
|
72
|
-
"vue-template-compiler": "2.
|
|
73
|
-
"
|
|
74
|
-
"webpack": "^4.46.0",
|
|
80
|
+
"vue-jest": "^4.0.1",
|
|
81
|
+
"vue-template-compiler": "^2.7.14",
|
|
82
|
+
"webpack": "^5.88.2",
|
|
75
83
|
"webpack-theme-color-replacer": "^1.4.7",
|
|
76
|
-
"whatwg-fetch": "^3.6.
|
|
84
|
+
"whatwg-fetch": "^3.6.19"
|
|
77
85
|
},
|
|
78
86
|
"browserslist": [
|
|
79
87
|
"> 1%",
|
|
80
88
|
"last 2 versions",
|
|
81
|
-
"not
|
|
89
|
+
"not dead",
|
|
90
|
+
"not ie 11"
|
|
82
91
|
]
|
|
83
92
|
}
|
package/src/App.vue
CHANGED
|
@@ -27,6 +27,8 @@ export default {
|
|
|
27
27
|
this.setWeekModeTheme(this.weekMode)
|
|
28
28
|
// 设置系统版本
|
|
29
29
|
setSystemVersion(this.compatible)
|
|
30
|
+
// 获取基座应用得路由地址
|
|
31
|
+
this.setBaseAppRouting()
|
|
30
32
|
},
|
|
31
33
|
watch: {
|
|
32
34
|
weekMode (val) {
|
|
@@ -42,18 +44,26 @@ export default {
|
|
|
42
44
|
'theme.mode': {
|
|
43
45
|
immediate: true,
|
|
44
46
|
handler: function (val) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
if (process.env.NODE_ENV === 'production') {
|
|
48
|
+
const closeMessage = this.$message.loading(`您选择了主题模式 ${val}, 正在切换...`)
|
|
49
|
+
themeUtil.changeThemeColor(this.theme.color, val).then(closeMessage)
|
|
50
|
+
} else {
|
|
51
|
+
console.info('为保证构建性能,关闭开发环境下的主题模式切换')
|
|
52
|
+
}
|
|
47
53
|
}
|
|
48
54
|
},
|
|
49
55
|
'theme.color': {
|
|
50
56
|
immediate: true,
|
|
51
57
|
handler: function (val) {
|
|
52
|
-
|
|
53
|
-
|
|
58
|
+
if (process.env.NODE_ENV === 'production') {
|
|
59
|
+
const closeMessage = this.$message.loading(`您选择了主题色 ${val}, 正在切换...`)
|
|
60
|
+
themeUtil.changeThemeColor(val, this.theme.mode).then(closeMessage)
|
|
61
|
+
} else {
|
|
62
|
+
console.info('为保证构建性能,关闭开发环境下的主题色切换')
|
|
63
|
+
}
|
|
54
64
|
}
|
|
55
65
|
},
|
|
56
|
-
|
|
66
|
+
layout: function () {
|
|
57
67
|
window.dispatchEvent(new Event('resize'))
|
|
58
68
|
}
|
|
59
69
|
},
|
|
@@ -69,6 +79,22 @@ export default {
|
|
|
69
79
|
document.body.classList.remove('week-mode')
|
|
70
80
|
}
|
|
71
81
|
},
|
|
82
|
+
setBaseAppRouting () {
|
|
83
|
+
let baseApp = '/login'
|
|
84
|
+
if (window.__MICRO_APP_ENVIRONMENT__) {
|
|
85
|
+
const data = window.microApp.getData() // 获取主应用下发的data数据
|
|
86
|
+
if (data.baseroute) {
|
|
87
|
+
baseApp = data.baseroute
|
|
88
|
+
}
|
|
89
|
+
window.microApp.addDataListener((_data) => {
|
|
90
|
+
if (_data.baseroute) {
|
|
91
|
+
baseApp = _data.baseroute
|
|
92
|
+
}
|
|
93
|
+
})
|
|
94
|
+
console.log('microApp', window.microApp)
|
|
95
|
+
this.$router.push({ path: baseApp })
|
|
96
|
+
}
|
|
97
|
+
},
|
|
72
98
|
setLanguage (lang) {
|
|
73
99
|
this.$i18n.locale = lang
|
|
74
100
|
switch (lang) {
|
|
@@ -97,6 +123,6 @@ export default {
|
|
|
97
123
|
</script>
|
|
98
124
|
|
|
99
125
|
<style lang="less" scoped>
|
|
100
|
-
|
|
101
|
-
|
|
126
|
+
#id {
|
|
127
|
+
}
|
|
102
128
|
</style>
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
<template><div ref="domRef">Loading...</div></template>
|
|
2
|
+
|
|
3
|
+
<script>
|
|
4
|
+
// import "amis/sdk/sdk.js";
|
|
5
|
+
// import "amis/sdk/sdk.css";
|
|
6
|
+
// import "amis/sdk/iconfont.css";
|
|
7
|
+
|
|
8
|
+
// 可以不引用, 如果你不想要任何辅助类样式的话 (比如 `m-t-xs` 这种)
|
|
9
|
+
// https://aisuda.bce.baidu.com/amis/zh-CN/style/index
|
|
10
|
+
// import 'amis/sdk/helper.css'
|
|
11
|
+
import qs from 'qs'
|
|
12
|
+
import Vue from 'vue'
|
|
13
|
+
import Index from '@vue2-client/base-client/components/index.js'
|
|
14
|
+
let React
|
|
15
|
+
let amisLib
|
|
16
|
+
let scoped
|
|
17
|
+
const apps = {}
|
|
18
|
+
function loadScript (src, callback) {
|
|
19
|
+
const script = document.createElement('script')
|
|
20
|
+
script.setAttribute('type', 'text/javascript')
|
|
21
|
+
script.setAttribute('src', src)
|
|
22
|
+
script.onload = () => callback()
|
|
23
|
+
script.onerror = () => callback(new Error(`Failed to load ${src}`))
|
|
24
|
+
document.body.appendChild(script)
|
|
25
|
+
}
|
|
26
|
+
const vueList = {}
|
|
27
|
+
|
|
28
|
+
// eslint-disable-next-line no-unused-vars
|
|
29
|
+
function CustomComponent (props, dom) {
|
|
30
|
+
const store = Vue.$store
|
|
31
|
+
const router = Vue.$router
|
|
32
|
+
const i18n = Vue.$i18n
|
|
33
|
+
console.log('props', props)
|
|
34
|
+
React.useEffect(function () {
|
|
35
|
+
vueList[props.$schema.name] = new Vue({
|
|
36
|
+
router,
|
|
37
|
+
store,
|
|
38
|
+
i18n,
|
|
39
|
+
render: h => h(Index[props.$schema.type], {
|
|
40
|
+
props: props.$schema
|
|
41
|
+
})
|
|
42
|
+
}).$mount(dom.current)
|
|
43
|
+
}, [])
|
|
44
|
+
const app = React.createElement('div', {
|
|
45
|
+
ref: dom
|
|
46
|
+
})
|
|
47
|
+
if (apps[props.name] !== undefined) {
|
|
48
|
+
const vue = vueList[props.$schema.name]
|
|
49
|
+
vue.$children[0].active(props.data)
|
|
50
|
+
} else {
|
|
51
|
+
apps[props.name] = app
|
|
52
|
+
}
|
|
53
|
+
return app
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function loadStyles (styles) {
|
|
57
|
+
for (const path of styles) {
|
|
58
|
+
const style = document.createElement('link')
|
|
59
|
+
style.setAttribute('rel', 'stylesheet')
|
|
60
|
+
style.setAttribute('type', 'text/css')
|
|
61
|
+
style.setAttribute('href', path)
|
|
62
|
+
document.head.appendChild(style)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// eslint-disable-next-line no-unused-vars
|
|
66
|
+
function appstyle (data) {
|
|
67
|
+
console.log('111111111111')
|
|
68
|
+
}
|
|
69
|
+
// 动态导入组件
|
|
70
|
+
|
|
71
|
+
function loadSDK () {
|
|
72
|
+
return new Promise((resolve, reject) => {
|
|
73
|
+
if (window.amisRequire) {
|
|
74
|
+
resolve()
|
|
75
|
+
return
|
|
76
|
+
}
|
|
77
|
+
loadStyles([
|
|
78
|
+
'/amis/sdk/sdk.css',
|
|
79
|
+
'/amis/sdk/helper.css',
|
|
80
|
+
'/amis/sdk/iconfont.css',
|
|
81
|
+
])
|
|
82
|
+
loadScript('/amis/sdk/sdk.js', (err) => {
|
|
83
|
+
if (err) {
|
|
84
|
+
reject(err)
|
|
85
|
+
return
|
|
86
|
+
}
|
|
87
|
+
resolve()
|
|
88
|
+
})
|
|
89
|
+
})
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export default {
|
|
93
|
+
name: 'AMISRenderer',
|
|
94
|
+
components: {},
|
|
95
|
+
props: {
|
|
96
|
+
schema: {
|
|
97
|
+
type: Object,
|
|
98
|
+
default: {
|
|
99
|
+
type: 'page',
|
|
100
|
+
body: 'Hello World!',
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
locals: {
|
|
104
|
+
type: Object,
|
|
105
|
+
default: () => ({}),
|
|
106
|
+
},
|
|
107
|
+
props: {
|
|
108
|
+
type: Object,
|
|
109
|
+
default: () => ({}),
|
|
110
|
+
},
|
|
111
|
+
env: {
|
|
112
|
+
type: Object,
|
|
113
|
+
default: () => ({}),
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
data () {
|
|
117
|
+
const router = this.$router
|
|
118
|
+
return {
|
|
119
|
+
// 这里面的数据所有 amis 页面都可以获取到
|
|
120
|
+
// 可以用来放一下公共数据,比如用户信息等
|
|
121
|
+
// 不要放受控数据,受控数据应该通过 data 下发
|
|
122
|
+
context: {
|
|
123
|
+
siteName: 'AMIS DEMO',
|
|
124
|
+
},
|
|
125
|
+
get location () {
|
|
126
|
+
const current = router.history.current
|
|
127
|
+
return {
|
|
128
|
+
pathname: current.path,
|
|
129
|
+
hash: current.hash,
|
|
130
|
+
query: current.query,
|
|
131
|
+
search: `?${qs.stringify(current.query)}`,
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
loading: false,
|
|
135
|
+
amisInstance: null,
|
|
136
|
+
unmounted: false,
|
|
137
|
+
applist: {}
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
watch: {
|
|
142
|
+
locals: function () {
|
|
143
|
+
this.updateProps()
|
|
144
|
+
},
|
|
145
|
+
props: function () {
|
|
146
|
+
this.updateProps()
|
|
147
|
+
},
|
|
148
|
+
$route: function () {
|
|
149
|
+
this.updateProps()
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
async mounted () {
|
|
153
|
+
try {
|
|
154
|
+
this.loading = true
|
|
155
|
+
await loadSDK()
|
|
156
|
+
} finally {
|
|
157
|
+
this.loading = false
|
|
158
|
+
}
|
|
159
|
+
if (this.unmounted) {
|
|
160
|
+
return
|
|
161
|
+
}
|
|
162
|
+
React = window.amisRequire('react')
|
|
163
|
+
amisLib = window.amisRequire('amis')
|
|
164
|
+
scoped = window.amisRequire('amis/embed')
|
|
165
|
+
const { normalizeLink } = amisLib
|
|
166
|
+
const router = this.$router
|
|
167
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
168
|
+
// console.log('this.schema.type', this.schema.type)
|
|
169
|
+
|
|
170
|
+
amisLib.Renderer({
|
|
171
|
+
test: new RegExp(`(^|\/)${this.schema.type}`)
|
|
172
|
+
})(props => CustomComponent(props, this.$el))
|
|
173
|
+
|
|
174
|
+
const instance = scoped.embed(
|
|
175
|
+
this.$el,
|
|
176
|
+
this.schema,
|
|
177
|
+
{
|
|
178
|
+
data: {
|
|
179
|
+
...this.locals,
|
|
180
|
+
},
|
|
181
|
+
context: this.context,
|
|
182
|
+
location: this.location,
|
|
183
|
+
|
|
184
|
+
// todo 下发 location 对象
|
|
185
|
+
...this.props,
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
// 覆盖 amis env
|
|
189
|
+
// 参考 https://aisuda.bce.baidu.com/amis/zh-CN/docs/start/getting-started#sdk
|
|
190
|
+
jumpTo: (to, action) => {
|
|
191
|
+
if (to === 'goBack') {
|
|
192
|
+
return router.go(-1)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
to = normalizeLink(to, this.location)
|
|
196
|
+
|
|
197
|
+
if (action?.actionType === 'url') {
|
|
198
|
+
action.blank === false ? router.push(to) : window.open(to)
|
|
199
|
+
return
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// 主要是支持 nav 中的跳转
|
|
203
|
+
if (action && to && action.target) {
|
|
204
|
+
window.open(to, action.target)
|
|
205
|
+
return
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
if (/^https?:\/\//.test(to)) {
|
|
209
|
+
window.location.replace(to)
|
|
210
|
+
} else {
|
|
211
|
+
router.push(to)
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
|
|
215
|
+
updateLocation: (location, replace) => {
|
|
216
|
+
if (location === 'goBack') {
|
|
217
|
+
return router.go(-1)
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
location = normalizeLink(location, this.location)
|
|
221
|
+
replace ? router.replace(location) : router.replace(location)
|
|
222
|
+
},
|
|
223
|
+
|
|
224
|
+
...this.env,
|
|
225
|
+
},
|
|
226
|
+
() => {
|
|
227
|
+
this.$emit('ready', {
|
|
228
|
+
instance,
|
|
229
|
+
})
|
|
230
|
+
}
|
|
231
|
+
)
|
|
232
|
+
this.amisInstance = instance
|
|
233
|
+
},
|
|
234
|
+
|
|
235
|
+
methods: {
|
|
236
|
+
updateProps () {
|
|
237
|
+
// eslint-disable-next-line no-unused-expressions
|
|
238
|
+
this.amisInstance?.updateProps({
|
|
239
|
+
data: {
|
|
240
|
+
...this.locals,
|
|
241
|
+
},
|
|
242
|
+
context: this.context,
|
|
243
|
+
...this.props,
|
|
244
|
+
})
|
|
245
|
+
},
|
|
246
|
+
initConfig () {
|
|
247
|
+
console.warn('initConfig')
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
|
|
251
|
+
destroyed () {
|
|
252
|
+
this.unmounted = true
|
|
253
|
+
// eslint-disable-next-line no-unused-expressions
|
|
254
|
+
this.amisInstance?.unmount()
|
|
255
|
+
},
|
|
256
|
+
}
|
|
257
|
+
</script>
|