vue2-client 1.9.98 → 1.9.100
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/package.json +102 -102
- package/src/base-client/components/common/AMisRender/index.js +3 -3
- package/src/base-client/components/common/XReport/index.js +3 -3
- package/src/base-client/components/common/XStepView/XStepView.vue +252 -252
- package/src/base-client/plugins/Recording.js +26 -14
- package/src/pages/DynamicStatistics/FavoriteList.vue +50 -50
- package/src/services/api/entity.js +18 -18
- package/src/utils/waterMark.js +31 -31
package/package.json
CHANGED
|
@@ -1,102 +1,102 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "vue2-client",
|
|
3
|
-
"version": "1.9.
|
|
4
|
-
"private": false,
|
|
5
|
-
"scripts": {
|
|
6
|
-
"serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
|
|
7
|
-
"serve:gaslink": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint --mode gaslink",
|
|
8
|
-
"serve:revenue": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint --mode revenue",
|
|
9
|
-
"serve:his": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint --mode his",
|
|
10
|
-
"mac-serve": "vue-cli-service serve --no-eslint --mode his",
|
|
11
|
-
"build": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build",
|
|
12
|
-
"test:unit": "vue-cli-service test:unit",
|
|
13
|
-
"lint": "vue-cli-service lint",
|
|
14
|
-
"build:preview": "vue-cli-service build --mode preview",
|
|
15
|
-
"lint:nofix": "vue-cli-service lint --no-fix",
|
|
16
|
-
"test": "jest"
|
|
17
|
-
},
|
|
18
|
-
"dependencies": {
|
|
19
|
-
"@amap/amap-jsapi-loader": "^1.0.1",
|
|
20
|
-
"@antv/data-set": "^0.11.8",
|
|
21
|
-
"@antv/g2plot": "^2.4.31",
|
|
22
|
-
"@hufe921/canvas-editor": "^0.9.49",
|
|
23
|
-
"@vue/babel-preset-jsx": "^1.4.0",
|
|
24
|
-
"@afwenming123/vue-easy-tree": "^1.0.1",
|
|
25
|
-
"animate.css": "^4.1.1",
|
|
26
|
-
"ant-design-vue": "^1.7.8",
|
|
27
|
-
"axios": "^0.27.2",
|
|
28
|
-
"clipboard": "^2.0.11",
|
|
29
|
-
"core-js": "^3.33.0",
|
|
30
|
-
"crypto-js": "^4.1.1",
|
|
31
|
-
"date-fns": "^2.29.3",
|
|
32
|
-
"default-passive-events": "^2.0.0",
|
|
33
|
-
"dotenv": "^16.3.1",
|
|
34
|
-
"echarts": "^5.5.0",
|
|
35
|
-
"enquire.js": "^2.1.6",
|
|
36
|
-
"file-saver": "^2.0.5",
|
|
37
|
-
"highlight.js": "^11.7.0",
|
|
38
|
-
"html2canvas": "^1.4.1",
|
|
39
|
-
"js-base64": "^3.7.5",
|
|
40
|
-
"js-cookie": "^2.2.1",
|
|
41
|
-
"jsencrypt": "^3.3.2",
|
|
42
|
-
"jspdf": "^2.5.1",
|
|
43
|
-
"lodash.clonedeep": "^4.5.0",
|
|
44
|
-
"lodash.debounce": "^4",
|
|
45
|
-
"lodash.get": "^4.4.2",
|
|
46
|
-
"mockjs": "^1.1.0",
|
|
47
|
-
"nprogress": "^0.2.0",
|
|
48
|
-
"qs": "^6.11.2",
|
|
49
|
-
"regenerator-runtime": "^0.14.0",
|
|
50
|
-
"videojs-contrib-hls": "^5.15.0",
|
|
51
|
-
"viser-vue": "^2.4.8",
|
|
52
|
-
"vue": "^2.7.14",
|
|
53
|
-
"vue-codemirror": "4.0.6",
|
|
54
|
-
"vue-draggable-resizable": "^2",
|
|
55
|
-
"vue-i18n": "^8.28.2",
|
|
56
|
-
"vue-json-viewer": "^2.2.22",
|
|
57
|
-
"vue-router": "^3.6.5",
|
|
58
|
-
"vue-video-player": "^5.0.2",
|
|
59
|
-
"vue-virtual-scroller": "^1.1.2",
|
|
60
|
-
"vuedraggable": "^2.24.3",
|
|
61
|
-
"vuex": "^3.6.2",
|
|
62
|
-
"xlsx": "0.18.5"
|
|
63
|
-
},
|
|
64
|
-
"devDependencies": {
|
|
65
|
-
"@ant-design/colors": "^7.0.0",
|
|
66
|
-
"@babel/core": "^7.22.20",
|
|
67
|
-
"@babel/eslint-parser": "^7.22.15",
|
|
68
|
-
"@babel/preset-env": "^7.22.20",
|
|
69
|
-
"@vue/cli-plugin-babel": "^5.0.8",
|
|
70
|
-
"@vue/cli-plugin-eslint": "^5.0.8",
|
|
71
|
-
"@vue/cli-service": "^5.0.8",
|
|
72
|
-
"@vue/eslint-config-standard": "^8.0.1",
|
|
73
|
-
"@vue/test-utils": "^1.3.6",
|
|
74
|
-
"babel-jest": "^26.6.3",
|
|
75
|
-
"babel-plugin-transform-remove-console": "^6.9.4",
|
|
76
|
-
"compression-webpack-plugin": "^10.0.0",
|
|
77
|
-
"css-minimizer-webpack-plugin": "^5.0.1",
|
|
78
|
-
"deepmerge": "^4.3.1",
|
|
79
|
-
"eslint": "^8.51.0",
|
|
80
|
-
"eslint-plugin-vue": "^9.17.0",
|
|
81
|
-
"fast-deep-equal": "^3.1.3",
|
|
82
|
-
"ignore-loader": "^0.1.2",
|
|
83
|
-
"jest": "^26.6.3",
|
|
84
|
-
"jest-environment-jsdom": "^26.6.2",
|
|
85
|
-
"jest-transform-stub": "^2.0.0",
|
|
86
|
-
"less-loader": "^6.2.0",
|
|
87
|
-
"script-loader": "^0.7.2",
|
|
88
|
-
"style-resources-loader": "^1.5.0",
|
|
89
|
-
"vue-cli-plugin-style-resources-loader": "^0.1.5",
|
|
90
|
-
"vue-jest": "^4.0.1",
|
|
91
|
-
"vue-template-compiler": "^2.7.14",
|
|
92
|
-
"webpack": "^5.88.2",
|
|
93
|
-
"webpack-theme-color-replacer": "^1.4.7",
|
|
94
|
-
"whatwg-fetch": "^3.6.19"
|
|
95
|
-
},
|
|
96
|
-
"browserslist": [
|
|
97
|
-
"> 1%",
|
|
98
|
-
"last 2 versions",
|
|
99
|
-
"not dead",
|
|
100
|
-
"not ie 11"
|
|
101
|
-
]
|
|
102
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "vue2-client",
|
|
3
|
+
"version": "1.9.100",
|
|
4
|
+
"private": false,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
|
|
7
|
+
"serve:gaslink": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint --mode gaslink",
|
|
8
|
+
"serve:revenue": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint --mode revenue",
|
|
9
|
+
"serve:his": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint --mode his",
|
|
10
|
+
"mac-serve": "vue-cli-service serve --no-eslint --mode his",
|
|
11
|
+
"build": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build",
|
|
12
|
+
"test:unit": "vue-cli-service test:unit",
|
|
13
|
+
"lint": "vue-cli-service lint",
|
|
14
|
+
"build:preview": "vue-cli-service build --mode preview",
|
|
15
|
+
"lint:nofix": "vue-cli-service lint --no-fix",
|
|
16
|
+
"test": "jest"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@amap/amap-jsapi-loader": "^1.0.1",
|
|
20
|
+
"@antv/data-set": "^0.11.8",
|
|
21
|
+
"@antv/g2plot": "^2.4.31",
|
|
22
|
+
"@hufe921/canvas-editor": "^0.9.49",
|
|
23
|
+
"@vue/babel-preset-jsx": "^1.4.0",
|
|
24
|
+
"@afwenming123/vue-easy-tree": "^1.0.1",
|
|
25
|
+
"animate.css": "^4.1.1",
|
|
26
|
+
"ant-design-vue": "^1.7.8",
|
|
27
|
+
"axios": "^0.27.2",
|
|
28
|
+
"clipboard": "^2.0.11",
|
|
29
|
+
"core-js": "^3.33.0",
|
|
30
|
+
"crypto-js": "^4.1.1",
|
|
31
|
+
"date-fns": "^2.29.3",
|
|
32
|
+
"default-passive-events": "^2.0.0",
|
|
33
|
+
"dotenv": "^16.3.1",
|
|
34
|
+
"echarts": "^5.5.0",
|
|
35
|
+
"enquire.js": "^2.1.6",
|
|
36
|
+
"file-saver": "^2.0.5",
|
|
37
|
+
"highlight.js": "^11.7.0",
|
|
38
|
+
"html2canvas": "^1.4.1",
|
|
39
|
+
"js-base64": "^3.7.5",
|
|
40
|
+
"js-cookie": "^2.2.1",
|
|
41
|
+
"jsencrypt": "^3.3.2",
|
|
42
|
+
"jspdf": "^2.5.1",
|
|
43
|
+
"lodash.clonedeep": "^4.5.0",
|
|
44
|
+
"lodash.debounce": "^4",
|
|
45
|
+
"lodash.get": "^4.4.2",
|
|
46
|
+
"mockjs": "^1.1.0",
|
|
47
|
+
"nprogress": "^0.2.0",
|
|
48
|
+
"qs": "^6.11.2",
|
|
49
|
+
"regenerator-runtime": "^0.14.0",
|
|
50
|
+
"videojs-contrib-hls": "^5.15.0",
|
|
51
|
+
"viser-vue": "^2.4.8",
|
|
52
|
+
"vue": "^2.7.14",
|
|
53
|
+
"vue-codemirror": "4.0.6",
|
|
54
|
+
"vue-draggable-resizable": "^2",
|
|
55
|
+
"vue-i18n": "^8.28.2",
|
|
56
|
+
"vue-json-viewer": "^2.2.22",
|
|
57
|
+
"vue-router": "^3.6.5",
|
|
58
|
+
"vue-video-player": "^5.0.2",
|
|
59
|
+
"vue-virtual-scroller": "^1.1.2",
|
|
60
|
+
"vuedraggable": "^2.24.3",
|
|
61
|
+
"vuex": "^3.6.2",
|
|
62
|
+
"xlsx": "0.18.5"
|
|
63
|
+
},
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"@ant-design/colors": "^7.0.0",
|
|
66
|
+
"@babel/core": "^7.22.20",
|
|
67
|
+
"@babel/eslint-parser": "^7.22.15",
|
|
68
|
+
"@babel/preset-env": "^7.22.20",
|
|
69
|
+
"@vue/cli-plugin-babel": "^5.0.8",
|
|
70
|
+
"@vue/cli-plugin-eslint": "^5.0.8",
|
|
71
|
+
"@vue/cli-service": "^5.0.8",
|
|
72
|
+
"@vue/eslint-config-standard": "^8.0.1",
|
|
73
|
+
"@vue/test-utils": "^1.3.6",
|
|
74
|
+
"babel-jest": "^26.6.3",
|
|
75
|
+
"babel-plugin-transform-remove-console": "^6.9.4",
|
|
76
|
+
"compression-webpack-plugin": "^10.0.0",
|
|
77
|
+
"css-minimizer-webpack-plugin": "^5.0.1",
|
|
78
|
+
"deepmerge": "^4.3.1",
|
|
79
|
+
"eslint": "^8.51.0",
|
|
80
|
+
"eslint-plugin-vue": "^9.17.0",
|
|
81
|
+
"fast-deep-equal": "^3.1.3",
|
|
82
|
+
"ignore-loader": "^0.1.2",
|
|
83
|
+
"jest": "^26.6.3",
|
|
84
|
+
"jest-environment-jsdom": "^26.6.2",
|
|
85
|
+
"jest-transform-stub": "^2.0.0",
|
|
86
|
+
"less-loader": "^6.2.0",
|
|
87
|
+
"script-loader": "^0.7.2",
|
|
88
|
+
"style-resources-loader": "^1.5.0",
|
|
89
|
+
"vue-cli-plugin-style-resources-loader": "^0.1.5",
|
|
90
|
+
"vue-jest": "^4.0.1",
|
|
91
|
+
"vue-template-compiler": "^2.7.14",
|
|
92
|
+
"webpack": "^5.88.2",
|
|
93
|
+
"webpack-theme-color-replacer": "^1.4.7",
|
|
94
|
+
"whatwg-fetch": "^3.6.19"
|
|
95
|
+
},
|
|
96
|
+
"browserslist": [
|
|
97
|
+
"> 1%",
|
|
98
|
+
"last 2 versions",
|
|
99
|
+
"not dead",
|
|
100
|
+
"not ie 11"
|
|
101
|
+
]
|
|
102
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import AMisRender from './index.vue'
|
|
2
|
-
|
|
3
|
-
export default AMisRender
|
|
1
|
+
import AMisRender from './index.vue'
|
|
2
|
+
|
|
3
|
+
export default AMisRender
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import XReport from './XReport'
|
|
2
|
-
|
|
3
|
-
export default XReport
|
|
1
|
+
import XReport from './XReport'
|
|
2
|
+
|
|
3
|
+
export default XReport
|
|
@@ -1,252 +1,252 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<a-row type="flex">
|
|
4
|
-
<a-col :span="stepStyle.flex">
|
|
5
|
-
<a-steps
|
|
6
|
-
:type="stepStyle.type"
|
|
7
|
-
:current="current"
|
|
8
|
-
:direction="stepStyle.direction"
|
|
9
|
-
:labelPlacement="stepStyle.labelPlacement"
|
|
10
|
-
:progressDot="stepStyle.false"
|
|
11
|
-
:size="stepStyle.size"
|
|
12
|
-
:initial="initial"
|
|
13
|
-
:status="status"
|
|
14
|
-
@chaneg="onChange"
|
|
15
|
-
>
|
|
16
|
-
<a-step
|
|
17
|
-
v-for="(item, index) in this.configContent.step.steps"
|
|
18
|
-
:key="'step-'+item.name"
|
|
19
|
-
:title="item.title"
|
|
20
|
-
:description="item.description"
|
|
21
|
-
:sub-title="item.subTitle"
|
|
22
|
-
:disabled="item.disabled">
|
|
23
|
-
<a-icon v-if="current === index" slot="icon" :type="iconType" />
|
|
24
|
-
</a-step>
|
|
25
|
-
</a-steps>
|
|
26
|
-
</a-col>
|
|
27
|
-
<a-col :span="panelStyle.flex">
|
|
28
|
-
<template v-for="(item, index) in this.configContent.step.steps">
|
|
29
|
-
<a-card
|
|
30
|
-
v-if="current === index"
|
|
31
|
-
:bordered="false"
|
|
32
|
-
:key="'stepCard-'+item.name">
|
|
33
|
-
<template v-if="item.content.card.type === 'text'">
|
|
34
|
-
<p>{{ item.content.card.value }}</p>
|
|
35
|
-
</template>
|
|
36
|
-
<x-add-native-form v-else-if="item.content.card.type === 'form'" :ref="'XAddNativeForm'+ item.name" @onSubmit="submit"/>
|
|
37
|
-
<x-table v-else-if="item.content.card.type === 'table'" :fixed-query-form="item.content.card.queryFrom" @action="action" :query-params-name="item.content.card.queryParamsName" :ref="'XAddNativeForm'+item.name" />
|
|
38
|
-
<a-button v-if="status === 'error'" @click="success" style="color: v-bind()">下一步</a-button>
|
|
39
|
-
</a-card>
|
|
40
|
-
</template>
|
|
41
|
-
</a-col>
|
|
42
|
-
</a-row>
|
|
43
|
-
</div>
|
|
44
|
-
</template>
|
|
45
|
-
|
|
46
|
-
<script>
|
|
47
|
-
import XAddNativeForm from '@vue2-client/base-client/components/common/XAddNativeForm/XAddNativeForm.vue'
|
|
48
|
-
import { post } from '@vue2-client/services/api'
|
|
49
|
-
import XTable from '@vue2-client/base-client/components/common/XTable/XTable.vue'
|
|
50
|
-
|
|
51
|
-
export default {
|
|
52
|
-
name: 'XStepView',
|
|
53
|
-
components: { XTable, XAddNativeForm },
|
|
54
|
-
computed: {
|
|
55
|
-
stepStyle () {
|
|
56
|
-
const style = this.configContent.step.style
|
|
57
|
-
if (style) {
|
|
58
|
-
return style
|
|
59
|
-
} else {
|
|
60
|
-
return {
|
|
61
|
-
flex: 5,
|
|
62
|
-
type: 'default',
|
|
63
|
-
progressDot: 'false',
|
|
64
|
-
direction: 'horizontal',
|
|
65
|
-
labelPlacement: 'horizontal',
|
|
66
|
-
size: 'default',
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
panelStyle () {
|
|
71
|
-
const style = this.configContent.panelStyle
|
|
72
|
-
if (style) {
|
|
73
|
-
return style
|
|
74
|
-
} else {
|
|
75
|
-
return {
|
|
76
|
-
flex: 19
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
},
|
|
82
|
-
props: {
|
|
83
|
-
params: {
|
|
84
|
-
type: Object,
|
|
85
|
-
required: true,
|
|
86
|
-
},
|
|
87
|
-
configContent: {
|
|
88
|
-
type: Object,
|
|
89
|
-
required: true,
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
data () {
|
|
93
|
-
return {
|
|
94
|
-
current: -1,
|
|
95
|
-
initial: 0,
|
|
96
|
-
status: 'wait',
|
|
97
|
-
iconType: 'loading',
|
|
98
|
-
timeOut: undefined
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
watch: {
|
|
102
|
-
async current (newValue) {
|
|
103
|
-
this.changeIcon()
|
|
104
|
-
if (this.timeOut !== undefined) { window.clearTimeout(this.timeOut) }
|
|
105
|
-
|
|
106
|
-
const setpes = this.configContent.step.steps[newValue]
|
|
107
|
-
const type = setpes.content.card.type
|
|
108
|
-
const formValue = setpes.content.card.value
|
|
109
|
-
console.warn('formValue = ', formValue)
|
|
110
|
-
if (setpes.before) {
|
|
111
|
-
const postName = setpes.before.name.split('@')
|
|
112
|
-
this.timeOut = window.setTimeout(() => {
|
|
113
|
-
post('/api/af-system/' + postName[0] + '/' + postName[1], setpes.before.params).then(res => {
|
|
114
|
-
console.warn(setpes.before.name + '执行结果', res)
|
|
115
|
-
if (res.code === 200) {
|
|
116
|
-
window.clearInterval(this.timeOut)
|
|
117
|
-
this.success()
|
|
118
|
-
} else {
|
|
119
|
-
setpes.content.card.value = res.msg
|
|
120
|
-
}
|
|
121
|
-
}).catch(e => {
|
|
122
|
-
console.warn(setpes.before.name + '执行结果', e)
|
|
123
|
-
window.clearInterval(this.timeOut)
|
|
124
|
-
this.error()
|
|
125
|
-
})
|
|
126
|
-
}, 10 * 1000)
|
|
127
|
-
}
|
|
128
|
-
if (type === 'form') {
|
|
129
|
-
this.$nextTick(() => {
|
|
130
|
-
const stepsss = this.$refs['XAddNativeForm' + setpes.name][0]
|
|
131
|
-
stepsss.init({
|
|
132
|
-
formItems: formValue
|
|
133
|
-
})
|
|
134
|
-
})
|
|
135
|
-
} else if (type === 'table') {
|
|
136
|
-
console.warn('formValue = ', formValue)
|
|
137
|
-
this.$nextTick(() => {
|
|
138
|
-
const stepsss = this.$refs['XAddNativeForm' + setpes.name][0]
|
|
139
|
-
stepsss.init({
|
|
140
|
-
tableColumns: formValue,
|
|
141
|
-
buttonState: {
|
|
142
|
-
add: false,
|
|
143
|
-
edit: true,
|
|
144
|
-
delete: false,
|
|
145
|
-
import: false,
|
|
146
|
-
export: false
|
|
147
|
-
}
|
|
148
|
-
})
|
|
149
|
-
})
|
|
150
|
-
} else {
|
|
151
|
-
if (setpes.run) {
|
|
152
|
-
post('/api/af-system/logic/' + setpes.run.name, setpes.run.params).then(t => {
|
|
153
|
-
console.warn(setpes.run.name + '执行结果', t)
|
|
154
|
-
if (t.code === 200) {
|
|
155
|
-
this.success()
|
|
156
|
-
} else {
|
|
157
|
-
setpes.content.card.value = t.msg
|
|
158
|
-
}
|
|
159
|
-
}).catch(e => {
|
|
160
|
-
console.warn(setpes.run.name + '执行结果', e)
|
|
161
|
-
this.error()
|
|
162
|
-
})
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
},
|
|
167
|
-
mounted () {
|
|
168
|
-
let paramsStr = JSON.stringify(this.configContent.step)
|
|
169
|
-
for (const item in this.params) {
|
|
170
|
-
const regex = new RegExp('\\$\\{' + item + '\\}', 'g')
|
|
171
|
-
paramsStr = paramsStr.replace(regex, this.params[item])
|
|
172
|
-
}
|
|
173
|
-
const params = JSON.parse(paramsStr)
|
|
174
|
-
this.init({ step: params })
|
|
175
|
-
this.current++
|
|
176
|
-
},
|
|
177
|
-
methods: {
|
|
178
|
-
init (params) {
|
|
179
|
-
const {
|
|
180
|
-
style,
|
|
181
|
-
panel,
|
|
182
|
-
step
|
|
183
|
-
} = params
|
|
184
|
-
if (style) {
|
|
185
|
-
this.stepStyle = style
|
|
186
|
-
}
|
|
187
|
-
if (panel) {
|
|
188
|
-
this.panelStyle = panel
|
|
189
|
-
}
|
|
190
|
-
if (step) {
|
|
191
|
-
this.configContent.step = step
|
|
192
|
-
}
|
|
193
|
-
},
|
|
194
|
-
steps () {
|
|
195
|
-
return this.steps
|
|
196
|
-
},
|
|
197
|
-
onChange (current) {
|
|
198
|
-
this.current = current
|
|
199
|
-
},
|
|
200
|
-
submit (res) {
|
|
201
|
-
console.warn('res', res)
|
|
202
|
-
const setpes = this.configContent.step.steps[this.current]
|
|
203
|
-
if (setpes.run) {
|
|
204
|
-
post('/api/af-system/logic/' + setpes.run.name, res.realForm).then(t => {
|
|
205
|
-
console.warn(setpes.run.name + '执行结果', t)
|
|
206
|
-
if (t.code === 200) {
|
|
207
|
-
this.success()
|
|
208
|
-
}
|
|
209
|
-
}).catch(e => {
|
|
210
|
-
console.warn(setpes.run.name + '执行结果', e)
|
|
211
|
-
this.error()
|
|
212
|
-
})
|
|
213
|
-
}
|
|
214
|
-
},
|
|
215
|
-
error () {
|
|
216
|
-
this.status = 'error'
|
|
217
|
-
this.iconType = 'close-circle'
|
|
218
|
-
},
|
|
219
|
-
success () {
|
|
220
|
-
this.changeIcon()
|
|
221
|
-
|
|
222
|
-
this.current++
|
|
223
|
-
},
|
|
224
|
-
changeIcon () {
|
|
225
|
-
this.status = 'wait'
|
|
226
|
-
this.iconType = 'loading'
|
|
227
|
-
},
|
|
228
|
-
previous () {
|
|
229
|
-
this.current--
|
|
230
|
-
},
|
|
231
|
-
action (record, id, actionType) {
|
|
232
|
-
console.warn('record', record)
|
|
233
|
-
console.warn('id', id)
|
|
234
|
-
console.warn('actionType', actionType)
|
|
235
|
-
const setpes = this.configContent.step.steps[this.current]
|
|
236
|
-
if (setpes.run) {
|
|
237
|
-
post('/api/af-system/logic/' + setpes.run.name, { data: record }).then(t => {
|
|
238
|
-
console.warn(setpes.run.name + '执行结果', t)
|
|
239
|
-
if (t.code === 200) {
|
|
240
|
-
this.success()
|
|
241
|
-
}
|
|
242
|
-
}).catch(e => {
|
|
243
|
-
console.warn(setpes.run.name + '执行结果', e)
|
|
244
|
-
this.error()
|
|
245
|
-
})
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
},
|
|
249
|
-
}
|
|
250
|
-
</script>
|
|
251
|
-
|
|
252
|
-
<style lang="less" scoped></style>
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<a-row type="flex">
|
|
4
|
+
<a-col :span="stepStyle.flex">
|
|
5
|
+
<a-steps
|
|
6
|
+
:type="stepStyle.type"
|
|
7
|
+
:current="current"
|
|
8
|
+
:direction="stepStyle.direction"
|
|
9
|
+
:labelPlacement="stepStyle.labelPlacement"
|
|
10
|
+
:progressDot="stepStyle.false"
|
|
11
|
+
:size="stepStyle.size"
|
|
12
|
+
:initial="initial"
|
|
13
|
+
:status="status"
|
|
14
|
+
@chaneg="onChange"
|
|
15
|
+
>
|
|
16
|
+
<a-step
|
|
17
|
+
v-for="(item, index) in this.configContent.step.steps"
|
|
18
|
+
:key="'step-'+item.name"
|
|
19
|
+
:title="item.title"
|
|
20
|
+
:description="item.description"
|
|
21
|
+
:sub-title="item.subTitle"
|
|
22
|
+
:disabled="item.disabled">
|
|
23
|
+
<a-icon v-if="current === index" slot="icon" :type="iconType" />
|
|
24
|
+
</a-step>
|
|
25
|
+
</a-steps>
|
|
26
|
+
</a-col>
|
|
27
|
+
<a-col :span="panelStyle.flex">
|
|
28
|
+
<template v-for="(item, index) in this.configContent.step.steps">
|
|
29
|
+
<a-card
|
|
30
|
+
v-if="current === index"
|
|
31
|
+
:bordered="false"
|
|
32
|
+
:key="'stepCard-'+item.name">
|
|
33
|
+
<template v-if="item.content.card.type === 'text'">
|
|
34
|
+
<p>{{ item.content.card.value }}</p>
|
|
35
|
+
</template>
|
|
36
|
+
<x-add-native-form v-else-if="item.content.card.type === 'form'" :ref="'XAddNativeForm'+ item.name" @onSubmit="submit"/>
|
|
37
|
+
<x-table v-else-if="item.content.card.type === 'table'" :fixed-query-form="item.content.card.queryFrom" @action="action" :query-params-name="item.content.card.queryParamsName" :ref="'XAddNativeForm'+item.name" />
|
|
38
|
+
<a-button v-if="status === 'error'" @click="success" style="color: v-bind()">下一步</a-button>
|
|
39
|
+
</a-card>
|
|
40
|
+
</template>
|
|
41
|
+
</a-col>
|
|
42
|
+
</a-row>
|
|
43
|
+
</div>
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
|
+
<script>
|
|
47
|
+
import XAddNativeForm from '@vue2-client/base-client/components/common/XAddNativeForm/XAddNativeForm.vue'
|
|
48
|
+
import { post } from '@vue2-client/services/api'
|
|
49
|
+
import XTable from '@vue2-client/base-client/components/common/XTable/XTable.vue'
|
|
50
|
+
|
|
51
|
+
export default {
|
|
52
|
+
name: 'XStepView',
|
|
53
|
+
components: { XTable, XAddNativeForm },
|
|
54
|
+
computed: {
|
|
55
|
+
stepStyle () {
|
|
56
|
+
const style = this.configContent.step.style
|
|
57
|
+
if (style) {
|
|
58
|
+
return style
|
|
59
|
+
} else {
|
|
60
|
+
return {
|
|
61
|
+
flex: 5,
|
|
62
|
+
type: 'default',
|
|
63
|
+
progressDot: 'false',
|
|
64
|
+
direction: 'horizontal',
|
|
65
|
+
labelPlacement: 'horizontal',
|
|
66
|
+
size: 'default',
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
panelStyle () {
|
|
71
|
+
const style = this.configContent.panelStyle
|
|
72
|
+
if (style) {
|
|
73
|
+
return style
|
|
74
|
+
} else {
|
|
75
|
+
return {
|
|
76
|
+
flex: 19
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
},
|
|
82
|
+
props: {
|
|
83
|
+
params: {
|
|
84
|
+
type: Object,
|
|
85
|
+
required: true,
|
|
86
|
+
},
|
|
87
|
+
configContent: {
|
|
88
|
+
type: Object,
|
|
89
|
+
required: true,
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
data () {
|
|
93
|
+
return {
|
|
94
|
+
current: -1,
|
|
95
|
+
initial: 0,
|
|
96
|
+
status: 'wait',
|
|
97
|
+
iconType: 'loading',
|
|
98
|
+
timeOut: undefined
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
watch: {
|
|
102
|
+
async current (newValue) {
|
|
103
|
+
this.changeIcon()
|
|
104
|
+
if (this.timeOut !== undefined) { window.clearTimeout(this.timeOut) }
|
|
105
|
+
|
|
106
|
+
const setpes = this.configContent.step.steps[newValue]
|
|
107
|
+
const type = setpes.content.card.type
|
|
108
|
+
const formValue = setpes.content.card.value
|
|
109
|
+
console.warn('formValue = ', formValue)
|
|
110
|
+
if (setpes.before) {
|
|
111
|
+
const postName = setpes.before.name.split('@')
|
|
112
|
+
this.timeOut = window.setTimeout(() => {
|
|
113
|
+
post('/api/af-system/' + postName[0] + '/' + postName[1], setpes.before.params).then(res => {
|
|
114
|
+
console.warn(setpes.before.name + '执行结果', res)
|
|
115
|
+
if (res.code === 200) {
|
|
116
|
+
window.clearInterval(this.timeOut)
|
|
117
|
+
this.success()
|
|
118
|
+
} else {
|
|
119
|
+
setpes.content.card.value = res.msg
|
|
120
|
+
}
|
|
121
|
+
}).catch(e => {
|
|
122
|
+
console.warn(setpes.before.name + '执行结果', e)
|
|
123
|
+
window.clearInterval(this.timeOut)
|
|
124
|
+
this.error()
|
|
125
|
+
})
|
|
126
|
+
}, 10 * 1000)
|
|
127
|
+
}
|
|
128
|
+
if (type === 'form') {
|
|
129
|
+
this.$nextTick(() => {
|
|
130
|
+
const stepsss = this.$refs['XAddNativeForm' + setpes.name][0]
|
|
131
|
+
stepsss.init({
|
|
132
|
+
formItems: formValue
|
|
133
|
+
})
|
|
134
|
+
})
|
|
135
|
+
} else if (type === 'table') {
|
|
136
|
+
console.warn('formValue = ', formValue)
|
|
137
|
+
this.$nextTick(() => {
|
|
138
|
+
const stepsss = this.$refs['XAddNativeForm' + setpes.name][0]
|
|
139
|
+
stepsss.init({
|
|
140
|
+
tableColumns: formValue,
|
|
141
|
+
buttonState: {
|
|
142
|
+
add: false,
|
|
143
|
+
edit: true,
|
|
144
|
+
delete: false,
|
|
145
|
+
import: false,
|
|
146
|
+
export: false
|
|
147
|
+
}
|
|
148
|
+
})
|
|
149
|
+
})
|
|
150
|
+
} else {
|
|
151
|
+
if (setpes.run) {
|
|
152
|
+
post('/api/af-system/logic/' + setpes.run.name, setpes.run.params).then(t => {
|
|
153
|
+
console.warn(setpes.run.name + '执行结果', t)
|
|
154
|
+
if (t.code === 200) {
|
|
155
|
+
this.success()
|
|
156
|
+
} else {
|
|
157
|
+
setpes.content.card.value = t.msg
|
|
158
|
+
}
|
|
159
|
+
}).catch(e => {
|
|
160
|
+
console.warn(setpes.run.name + '执行结果', e)
|
|
161
|
+
this.error()
|
|
162
|
+
})
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
mounted () {
|
|
168
|
+
let paramsStr = JSON.stringify(this.configContent.step)
|
|
169
|
+
for (const item in this.params) {
|
|
170
|
+
const regex = new RegExp('\\$\\{' + item + '\\}', 'g')
|
|
171
|
+
paramsStr = paramsStr.replace(regex, this.params[item])
|
|
172
|
+
}
|
|
173
|
+
const params = JSON.parse(paramsStr)
|
|
174
|
+
this.init({ step: params })
|
|
175
|
+
this.current++
|
|
176
|
+
},
|
|
177
|
+
methods: {
|
|
178
|
+
init (params) {
|
|
179
|
+
const {
|
|
180
|
+
style,
|
|
181
|
+
panel,
|
|
182
|
+
step
|
|
183
|
+
} = params
|
|
184
|
+
if (style) {
|
|
185
|
+
this.stepStyle = style
|
|
186
|
+
}
|
|
187
|
+
if (panel) {
|
|
188
|
+
this.panelStyle = panel
|
|
189
|
+
}
|
|
190
|
+
if (step) {
|
|
191
|
+
this.configContent.step = step
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
steps () {
|
|
195
|
+
return this.steps
|
|
196
|
+
},
|
|
197
|
+
onChange (current) {
|
|
198
|
+
this.current = current
|
|
199
|
+
},
|
|
200
|
+
submit (res) {
|
|
201
|
+
console.warn('res', res)
|
|
202
|
+
const setpes = this.configContent.step.steps[this.current]
|
|
203
|
+
if (setpes.run) {
|
|
204
|
+
post('/api/af-system/logic/' + setpes.run.name, res.realForm).then(t => {
|
|
205
|
+
console.warn(setpes.run.name + '执行结果', t)
|
|
206
|
+
if (t.code === 200) {
|
|
207
|
+
this.success()
|
|
208
|
+
}
|
|
209
|
+
}).catch(e => {
|
|
210
|
+
console.warn(setpes.run.name + '执行结果', e)
|
|
211
|
+
this.error()
|
|
212
|
+
})
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
error () {
|
|
216
|
+
this.status = 'error'
|
|
217
|
+
this.iconType = 'close-circle'
|
|
218
|
+
},
|
|
219
|
+
success () {
|
|
220
|
+
this.changeIcon()
|
|
221
|
+
|
|
222
|
+
this.current++
|
|
223
|
+
},
|
|
224
|
+
changeIcon () {
|
|
225
|
+
this.status = 'wait'
|
|
226
|
+
this.iconType = 'loading'
|
|
227
|
+
},
|
|
228
|
+
previous () {
|
|
229
|
+
this.current--
|
|
230
|
+
},
|
|
231
|
+
action (record, id, actionType) {
|
|
232
|
+
console.warn('record', record)
|
|
233
|
+
console.warn('id', id)
|
|
234
|
+
console.warn('actionType', actionType)
|
|
235
|
+
const setpes = this.configContent.step.steps[this.current]
|
|
236
|
+
if (setpes.run) {
|
|
237
|
+
post('/api/af-system/logic/' + setpes.run.name, { data: record }).then(t => {
|
|
238
|
+
console.warn(setpes.run.name + '执行结果', t)
|
|
239
|
+
if (t.code === 200) {
|
|
240
|
+
this.success()
|
|
241
|
+
}
|
|
242
|
+
}).catch(e => {
|
|
243
|
+
console.warn(setpes.run.name + '执行结果', e)
|
|
244
|
+
this.error()
|
|
245
|
+
})
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
}
|
|
250
|
+
</script>
|
|
251
|
+
|
|
252
|
+
<style lang="less" scoped></style>
|
|
@@ -64,22 +64,14 @@ export default {
|
|
|
64
64
|
}
|
|
65
65
|
if (!this.isRecording) {
|
|
66
66
|
this.ws.close()
|
|
67
|
-
this.resRecordingData()
|
|
68
|
-
|
|
69
|
-
// 停止麦克风流
|
|
70
|
-
if (this.audioStream) {
|
|
71
|
-
this.audioStream.getTracks().forEach((track) => track.stop())
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (this.audioContext) {
|
|
75
|
-
this.audioContext.close()
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
this.resolvePromise(this.inputData)
|
|
79
67
|
}
|
|
80
68
|
}
|
|
81
69
|
|
|
82
|
-
this.ws.onclose = () =>
|
|
70
|
+
this.ws.onclose = () => {
|
|
71
|
+
console.log('WebSocket closed.')
|
|
72
|
+
this.resRecordingData()
|
|
73
|
+
this.resolvePromise(this.inputData)
|
|
74
|
+
}
|
|
83
75
|
this.ws.onerror = (error) => console.error('WebSocket error:', error)
|
|
84
76
|
},
|
|
85
77
|
|
|
@@ -113,7 +105,12 @@ export default {
|
|
|
113
105
|
|
|
114
106
|
// Convert to 16-bit PCM and send via WebSocket
|
|
115
107
|
const byteArray = this.convertTo16BitPCM(resampledData)
|
|
116
|
-
|
|
108
|
+
|
|
109
|
+
const finalData = new Uint8Array(1 + byteArray.length) // 创建最终数据数组
|
|
110
|
+
finalData[0] = 1 // 第一个字节为类型,值为1
|
|
111
|
+
finalData.set(byteArray, 1) // 设置实际数据
|
|
112
|
+
|
|
113
|
+
this.ws.send(finalData) // 发送最终数据
|
|
117
114
|
}
|
|
118
115
|
|
|
119
116
|
source.connect(processor)
|
|
@@ -133,6 +130,21 @@ export default {
|
|
|
133
130
|
|
|
134
131
|
stopRecording () {
|
|
135
132
|
console.log('停止录音')
|
|
133
|
+
|
|
134
|
+
// 停止麦克风流
|
|
135
|
+
if (this.audioStream) {
|
|
136
|
+
this.audioStream.getTracks().forEach((track) => track.stop())
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (this.audioContext) {
|
|
140
|
+
this.audioContext.close()
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// 发送结束信号
|
|
144
|
+
const endSignal = new Uint8Array(1) // 创建一个长度为1的Uint8Array
|
|
145
|
+
endSignal[0] = 2 // 直接发送类型,值为2
|
|
146
|
+
this.ws.send(endSignal) // 发送结束信号
|
|
147
|
+
|
|
136
148
|
this.isRecording = false
|
|
137
149
|
|
|
138
150
|
return {
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<a-list v-show="!loading" size="small" :data-source="data">
|
|
4
|
-
<a-list-item slot="renderItem" slot-scope="item">
|
|
5
|
-
<div>
|
|
6
|
-
<p><a @click="$emit('openFavorites', item.uuid)">{{ item.question }} </a></p>
|
|
7
|
-
<p>{{ item.date }}</p>
|
|
8
|
-
</div>
|
|
9
|
-
<a class="delete_item">
|
|
10
|
-
<a-icon type="close" @click="$emit('saveToFavorites', item.uuid)"/>
|
|
11
|
-
</a>
|
|
12
|
-
</a-list-item>
|
|
13
|
-
</a-list>
|
|
14
|
-
</div>
|
|
15
|
-
</template>
|
|
16
|
-
|
|
17
|
-
<script>
|
|
18
|
-
import { indexedDB } from '@vue2-client/utils/indexedDB'
|
|
19
|
-
|
|
20
|
-
export default {
|
|
21
|
-
name: 'FavoriteList',
|
|
22
|
-
data () {
|
|
23
|
-
return {
|
|
24
|
-
data: [],
|
|
25
|
-
loading: false
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
mounted () {
|
|
29
|
-
this.loadData()
|
|
30
|
-
},
|
|
31
|
-
methods: {
|
|
32
|
-
loadData () {
|
|
33
|
-
indexedDB.getAll((data) => {
|
|
34
|
-
const realData = data.filter(item => item.data && item.data.uuid)
|
|
35
|
-
.map(item => item.data)
|
|
36
|
-
this.data = realData
|
|
37
|
-
})
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
</script>
|
|
42
|
-
<style lang="less" scoped>
|
|
43
|
-
.delete_item {
|
|
44
|
-
margin-left: 8px;
|
|
45
|
-
color: #333;
|
|
46
|
-
}
|
|
47
|
-
p {
|
|
48
|
-
margin: 0
|
|
49
|
-
}
|
|
50
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<a-list v-show="!loading" size="small" :data-source="data">
|
|
4
|
+
<a-list-item slot="renderItem" slot-scope="item">
|
|
5
|
+
<div>
|
|
6
|
+
<p><a @click="$emit('openFavorites', item.uuid)">{{ item.question }} </a></p>
|
|
7
|
+
<p>{{ item.date }}</p>
|
|
8
|
+
</div>
|
|
9
|
+
<a class="delete_item">
|
|
10
|
+
<a-icon type="close" @click="$emit('saveToFavorites', item.uuid)"/>
|
|
11
|
+
</a>
|
|
12
|
+
</a-list-item>
|
|
13
|
+
</a-list>
|
|
14
|
+
</div>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
import { indexedDB } from '@vue2-client/utils/indexedDB'
|
|
19
|
+
|
|
20
|
+
export default {
|
|
21
|
+
name: 'FavoriteList',
|
|
22
|
+
data () {
|
|
23
|
+
return {
|
|
24
|
+
data: [],
|
|
25
|
+
loading: false
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
mounted () {
|
|
29
|
+
this.loadData()
|
|
30
|
+
},
|
|
31
|
+
methods: {
|
|
32
|
+
loadData () {
|
|
33
|
+
indexedDB.getAll((data) => {
|
|
34
|
+
const realData = data.filter(item => item.data && item.data.uuid)
|
|
35
|
+
.map(item => item.data)
|
|
36
|
+
this.data = realData
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
</script>
|
|
42
|
+
<style lang="less" scoped>
|
|
43
|
+
.delete_item {
|
|
44
|
+
margin-left: 8px;
|
|
45
|
+
color: #333;
|
|
46
|
+
}
|
|
47
|
+
p {
|
|
48
|
+
margin: 0
|
|
49
|
+
}
|
|
50
|
+
</style>
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { post } from '@vue2-client/services/api/restTools'
|
|
2
|
-
|
|
3
|
-
const entityApi = {
|
|
4
|
-
// 根据ID查询数据
|
|
5
|
-
getById: (entityName, id, data = {}, serviceName = process.env.VUE_APP_SYSTEM_NAME) => {
|
|
6
|
-
return post(`/api/${serviceName}/entity/query/${entityName}/${id}`, data)
|
|
7
|
-
},
|
|
8
|
-
// 根据ID集合查询所有数据
|
|
9
|
-
findAllByIds: (entityName, data, serviceName = process.env.VUE_APP_SYSTEM_NAME) => {
|
|
10
|
-
return post(`/api/${serviceName}/entity/query/${entityName}`, data)
|
|
11
|
-
},
|
|
12
|
-
// 查询实体的总数量
|
|
13
|
-
getCount: (entityName, serviceName = process.env.VUE_APP_SYSTEM_NAME) => {
|
|
14
|
-
return post(`/api/${serviceName}/entity/queryCount/${entityName}`, {})
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export { entityApi }
|
|
1
|
+
import { post } from '@vue2-client/services/api/restTools'
|
|
2
|
+
|
|
3
|
+
const entityApi = {
|
|
4
|
+
// 根据ID查询数据
|
|
5
|
+
getById: (entityName, id, data = {}, serviceName = process.env.VUE_APP_SYSTEM_NAME) => {
|
|
6
|
+
return post(`/api/${serviceName}/entity/query/${entityName}/${id}`, data)
|
|
7
|
+
},
|
|
8
|
+
// 根据ID集合查询所有数据
|
|
9
|
+
findAllByIds: (entityName, data, serviceName = process.env.VUE_APP_SYSTEM_NAME) => {
|
|
10
|
+
return post(`/api/${serviceName}/entity/query/${entityName}`, data)
|
|
11
|
+
},
|
|
12
|
+
// 查询实体的总数量
|
|
13
|
+
getCount: (entityName, serviceName = process.env.VUE_APP_SYSTEM_NAME) => {
|
|
14
|
+
return post(`/api/${serviceName}/entity/queryCount/${entityName}`, {})
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { entityApi }
|
package/src/utils/waterMark.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description: createWaterMark.js 加水印功能
|
|
3
|
-
*/
|
|
4
|
-
let waterMarkDOM
|
|
5
|
-
|
|
6
|
-
const clearWaterMark = () => {
|
|
7
|
-
if (waterMarkDOM) waterMarkDOM.remove()
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* @description: 创建水印
|
|
11
|
-
* @param waterMarkName 水印内容
|
|
12
|
-
*/
|
|
13
|
-
export default function createWaterMark (waterMarkName) {
|
|
14
|
-
clearWaterMark()
|
|
15
|
-
if (!waterMarkName) {
|
|
16
|
-
return
|
|
17
|
-
}
|
|
18
|
-
const width = window.parseInt(document.body.clientWidth)
|
|
19
|
-
const canvasWidth = width / window.parseInt(width / 320)
|
|
20
|
-
const fontFamily = window.getComputedStyle(document.body)['font-family']
|
|
21
|
-
const fragment = document.createDocumentFragment()
|
|
22
|
-
waterMarkDOM = document.createElement('div')
|
|
23
|
-
waterMarkDOM.className = 'water-mark-wrap'
|
|
24
|
-
let spanStr = ''
|
|
25
|
-
for (let i = 0; i < 100; i++) {
|
|
26
|
-
spanStr += `<span class="water-word" style=width:${canvasWidth}px;height:200px;font: ${fontFamily}>${waterMarkName}</span>`
|
|
27
|
-
}
|
|
28
|
-
waterMarkDOM.innerHTML = spanStr
|
|
29
|
-
fragment.appendChild(waterMarkDOM)
|
|
30
|
-
document.body.appendChild(fragment)
|
|
31
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @description: createWaterMark.js 加水印功能
|
|
3
|
+
*/
|
|
4
|
+
let waterMarkDOM
|
|
5
|
+
|
|
6
|
+
const clearWaterMark = () => {
|
|
7
|
+
if (waterMarkDOM) waterMarkDOM.remove()
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* @description: 创建水印
|
|
11
|
+
* @param waterMarkName 水印内容
|
|
12
|
+
*/
|
|
13
|
+
export default function createWaterMark (waterMarkName) {
|
|
14
|
+
clearWaterMark()
|
|
15
|
+
if (!waterMarkName) {
|
|
16
|
+
return
|
|
17
|
+
}
|
|
18
|
+
const width = window.parseInt(document.body.clientWidth)
|
|
19
|
+
const canvasWidth = width / window.parseInt(width / 320)
|
|
20
|
+
const fontFamily = window.getComputedStyle(document.body)['font-family']
|
|
21
|
+
const fragment = document.createDocumentFragment()
|
|
22
|
+
waterMarkDOM = document.createElement('div')
|
|
23
|
+
waterMarkDOM.className = 'water-mark-wrap'
|
|
24
|
+
let spanStr = ''
|
|
25
|
+
for (let i = 0; i < 100; i++) {
|
|
26
|
+
spanStr += `<span class="water-word" style=width:${canvasWidth}px;height:200px;font: ${fontFamily}>${waterMarkName}</span>`
|
|
27
|
+
}
|
|
28
|
+
waterMarkDOM.innerHTML = spanStr
|
|
29
|
+
fragment.appendChild(waterMarkDOM)
|
|
30
|
+
document.body.appendChild(fragment)
|
|
31
|
+
}
|