bxs-tools-ui 3.2.0 → 3.3.0
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/README.md +20 -20
- package/es/add-and-take/index.css +1 -1
- package/es/add-and-take/index.js +283 -64
- package/es/adjust-baoe/index.css +1 -1
- package/es/adjust-baoe/index.js +444 -195
- package/es/business-card/index.css +1 -1
- package/es/business-card/index.js +1 -0
- package/es/canvas-poster/index.css +1 -1
- package/es/canvas-poster/index.js +1 -0
- package/es/index.css +1 -1
- package/es/index.js +936 -824
- package/es/insure-calculate/index.css +1 -1
- package/es/insure-calculate/index.js +438 -265
- package/es/person-info/index.css +1 -1
- package/es/person-info/index.js +296 -1370
- package/es/product-info/index.css +1 -1
- package/es/product-info/index.js +644 -548
- package/es/share-sheet/index.css +1 -1
- package/es/share-sheet/index.js +313 -21
- package/es/utils/index.js +530 -429
- package/lib/add-and-take/index.css +1 -1
- package/lib/add-and-take/index.js +283 -64
- package/lib/adjust-baoe/index.css +1 -1
- package/lib/adjust-baoe/index.js +441 -194
- package/lib/business-card/index.css +1 -1
- package/lib/business-card/index.js +1 -0
- package/lib/canvas-poster/index.css +1 -1
- package/lib/canvas-poster/index.js +1 -0
- package/lib/index.css +1 -1
- package/lib/index.js +939 -826
- package/lib/insure-calculate/index.css +1 -1
- package/lib/insure-calculate/index.js +438 -268
- package/lib/person-info/index.css +1 -1
- package/lib/person-info/index.js +295 -1372
- package/lib/product-info/index.css +1 -1
- package/lib/product-info/index.js +645 -550
- package/lib/share-sheet/index.css +1 -1
- package/lib/share-sheet/index.js +313 -25
- package/lib/utils/index.js +531 -433
- package/package.json +9 -7
- package/packages/add-and-take/components/interest-form.less +144 -0
- package/packages/add-and-take/components/interest-form.vue +179 -179
- package/packages/add-and-take/components/interest-items.less +87 -0
- package/packages/add-and-take/components/interest-items.vue +67 -80
- package/packages/add-and-take/components/interest-table.less +111 -0
- package/packages/add-and-take/components/interest-table.vue +31 -31
- package/packages/add-and-take/constant.ts +2 -2
- package/packages/add-and-take/demo/index.vue +89 -86
- package/packages/add-and-take/handler.ts +52 -57
- package/packages/add-and-take/index.less +69 -0
- package/packages/add-and-take/index.vue +156 -156
- package/packages/add-and-take/readme.md +87 -98
- package/packages/adjust-baoe/demo/index.vue +37 -47
- package/packages/adjust-baoe/index.less +125 -0
- package/packages/adjust-baoe/index.vue +134 -147
- package/packages/adjust-baoe/readme.md +35 -45
- package/packages/business-card/demo/index.vue +7 -7
- package/packages/business-card/index.less +100 -0
- package/packages/business-card/index.vue +18 -21
- package/packages/business-card/readme.md +46 -53
- package/packages/bxs-utils/demo/index.vue +2 -2
- package/packages/bxs-utils/index.ts +5 -5
- package/packages/bxs-utils/planbook/common.ts +56 -92
- package/packages/bxs-utils/planbook/index.ts +4 -4
- package/packages/bxs-utils/planbook/insurance.ts +137 -127
- package/packages/bxs-utils/planbook/person.ts +143 -147
- package/packages/bxs-utils/planbook/product.ts +473 -509
- package/packages/bxs-utils/readme.md +94 -84
- package/packages/bxs-utils/trade/index.js +1 -1
- package/packages/bxs-utils/trade/insureCalculate.js +91 -204
- package/packages/canvas-poster/demo/index.vue +9 -13
- package/packages/canvas-poster/index.less +5 -0
- package/packages/canvas-poster/index.vue +68 -79
- package/packages/canvas-poster/readme.md +106 -109
- package/packages/index.ts +1 -1
- package/packages/insure-calculate/demo/index.vue +20 -20
- package/packages/insure-calculate/index.less +366 -0
- package/packages/insure-calculate/index.vue +305 -329
- package/packages/insure-calculate/readme.md +99 -106
- package/packages/person-info/crm-popup.vue +81 -80
- package/packages/person-info/demo/index.vue +25 -37
- package/packages/person-info/index-inline.less +11 -0
- package/packages/person-info/index.vue +53 -83
- package/packages/person-info/readme.md +109 -115
- package/packages/planbook-input/components/footer.less +54 -0
- package/packages/planbook-input/components/footer.vue +8 -64
- package/packages/planbook-input/components/handler.js +33 -44
- package/packages/planbook-input/components/product-table.less +235 -0
- package/packages/planbook-input/components/product-table.vue +114 -108
- package/packages/planbook-input/demo/index.vue +3 -3
- package/packages/planbook-input/helper.js +852 -465
- package/packages/planbook-input/index.less +30 -0
- package/packages/planbook-input/index.vue +86 -103
- package/packages/planbook-input/readme.md +72 -90
- package/packages/product-info/demo/constant.js +1 -1
- package/packages/product-info/demo/index.vue +31 -43
- package/packages/product-info/index.less +271 -0
- package/packages/product-info/index.vue +198 -210
- package/packages/product-info/readme.md +72 -75
- package/packages/share-sheet/constant.js +4 -4
- package/packages/share-sheet/demo/index.vue +10 -10
- package/packages/share-sheet/handler.js +14 -14
- package/packages/share-sheet/index.less +201 -0
- package/packages/share-sheet/index.vue +39 -39
- package/packages/share-sheet/readme.md +121 -127
- package/src/api/add-and-take.js +45 -0
- package/src/api/adjust-baoe.js +16 -0
- package/src/api/index.js +6 -0
- package/src/api/planbook.js +93 -0
- package/src/api/request.js +211 -0
- package/src/api/trade.js +56 -0
- package/src/api/user.js +18 -0
- package/src/components/common/common-age-birthday.less +66 -0
- package/src/components/common/common-age-birthday.vue +27 -95
- package/src/components/common/common-popup.less +81 -0
- package/src/components/common/common-popup.vue +12 -96
- package/src/components/common/common-radio.less +75 -0
- package/src/components/common/common-radio.vue +13 -91
- package/src/components/common/common-select.less +13 -0
- package/src/components/common/common-select.vue +21 -38
- package/src/components/common/common-title.less +115 -0
- package/src/components/common/common-title.vue +24 -24
- package/src/js/loading.js +6 -6
- package/src/js/md5Token.js +38 -44
- package/src/js/utils.js +45 -53
- package/src/js/variables.js +47 -25
- package/src/style/base.less +18 -0
- package/src/style/color.less +40 -0
- package/src/style/variables.less +21 -42
- package/packages/add-and-take/api.ts +0 -70
- package/packages/add-and-take/components/interest-form.css +0 -146
- package/packages/add-and-take/components/interest-items.css +0 -87
- package/packages/add-and-take/components/interest-table.css +0 -113
- package/packages/add-and-take/index.css +0 -70
- package/packages/adjust-baoe/index.css +0 -123
- package/packages/business-card/index.css +0 -101
- package/packages/canvas-poster/index.css +0 -5
- package/packages/insure-calculate/index.css +0 -368
- package/packages/planbook-input/api.js +0 -29
- package/packages/planbook-input/components/product-table.css +0 -236
- package/packages/planbook-input/index.css +0 -31
- package/packages/product-info/index.css +0 -264
- package/packages/share-sheet/index.css +0 -203
- package/src/components/common/common-title.css +0 -116
- package/src/js/request.js +0 -64
- package/src/style/apply.css +0 -25
- package/src/style/base.css +0 -36
- package/src/style/color.css +0 -74
|
@@ -6,92 +6,93 @@
|
|
|
6
6
|
</div>
|
|
7
7
|
</template>
|
|
8
8
|
<script lang="ts">
|
|
9
|
-
import Vue from 'vue'
|
|
10
|
-
import { Component, Prop } from 'vue-property-decorator'
|
|
9
|
+
import Vue from 'vue'
|
|
10
|
+
import { Component, Prop } from 'vue-property-decorator'
|
|
11
|
+
import './index.less'
|
|
11
12
|
|
|
12
13
|
@Component({})
|
|
13
14
|
export default class CanvasPoster extends Vue {
|
|
14
15
|
@Prop({
|
|
15
16
|
default: window.innerWidth
|
|
16
17
|
})
|
|
17
|
-
canvasWidth!: number
|
|
18
|
+
canvasWidth!: number
|
|
18
19
|
|
|
19
20
|
@Prop({
|
|
20
21
|
default: window.innerHeight
|
|
21
22
|
})
|
|
22
|
-
canvasHeight!: number
|
|
23
|
+
canvasHeight!: number
|
|
23
24
|
|
|
24
25
|
@Prop({
|
|
25
26
|
default() {
|
|
26
|
-
return []
|
|
27
|
+
return []
|
|
27
28
|
}
|
|
28
29
|
})
|
|
29
|
-
posterData!: Array<any
|
|
30
|
+
posterData!: Array<any>
|
|
30
31
|
|
|
31
32
|
created() {}
|
|
32
33
|
mounted() {
|
|
33
|
-
this.drawPoster()
|
|
34
|
+
this.drawPoster()
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
drawPoster() {
|
|
37
|
-
let sequence: any = Promise.resolve()
|
|
38
|
+
let sequence: any = Promise.resolve()
|
|
38
39
|
this.posterData.map(ele => {
|
|
39
40
|
sequence = sequence.then(() => {
|
|
40
|
-
let drawFn: any = null
|
|
41
|
+
let drawFn: any = null
|
|
41
42
|
switch (ele.type) {
|
|
42
43
|
case 'image':
|
|
43
|
-
drawFn = this.drawImage
|
|
44
|
-
break
|
|
44
|
+
drawFn = this.drawImage
|
|
45
|
+
break
|
|
45
46
|
case 'text':
|
|
46
|
-
drawFn = this.drawText
|
|
47
|
-
break
|
|
47
|
+
drawFn = this.drawText
|
|
48
|
+
break
|
|
48
49
|
case 'rect':
|
|
49
|
-
drawFn = this.drawRect
|
|
50
|
-
break
|
|
50
|
+
drawFn = this.drawRect
|
|
51
|
+
break
|
|
51
52
|
}
|
|
52
|
-
return drawFn(ele)
|
|
53
|
-
})
|
|
54
|
-
})
|
|
53
|
+
return drawFn(ele)
|
|
54
|
+
})
|
|
55
|
+
})
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
drawImage({ type, url, crossOrigin, point = [0, 0], width, height, radius }) {
|
|
58
59
|
return new Promise((resolve: any) => {
|
|
59
|
-
const canvas: any = document.getElementById('canvasPoster')
|
|
60
|
+
const canvas: any = document.getElementById('canvasPoster')
|
|
60
61
|
if (canvas.getContext) {
|
|
61
|
-
const ctx: any = canvas.getContext('2d')
|
|
62
|
-
const image: any = new Image()
|
|
62
|
+
const ctx: any = canvas.getContext('2d')
|
|
63
|
+
const image: any = new Image()
|
|
63
64
|
if (crossOrigin) {
|
|
64
|
-
image.crossOrigin = crossOrigin
|
|
65
|
+
image.crossOrigin = crossOrigin
|
|
65
66
|
}
|
|
66
67
|
image.onload = () => {
|
|
67
68
|
if (radius) {
|
|
68
|
-
ctx.save()
|
|
69
|
-
this.roundRect(ctx, point[0], point[1], width || image.width, height || image.height, radius)
|
|
70
|
-
ctx.clip()
|
|
71
|
-
ctx.drawImage(image, point[0], point[1], width || image.width, height || image.height)
|
|
72
|
-
ctx.restore()
|
|
69
|
+
ctx.save()
|
|
70
|
+
this.roundRect(ctx, point[0], point[1], width || image.width, height || image.height, radius)
|
|
71
|
+
ctx.clip()
|
|
72
|
+
ctx.drawImage(image, point[0], point[1], width || image.width, height || image.height)
|
|
73
|
+
ctx.restore()
|
|
73
74
|
} else {
|
|
74
|
-
ctx.drawImage(image, point[0], point[1], width || image.width, height || image.height)
|
|
75
|
+
ctx.drawImage(image, point[0], point[1], width || image.width, height || image.height)
|
|
75
76
|
}
|
|
76
|
-
resolve()
|
|
77
|
-
}
|
|
78
|
-
image.src = url
|
|
77
|
+
resolve()
|
|
78
|
+
}
|
|
79
|
+
image.src = url
|
|
79
80
|
}
|
|
80
|
-
})
|
|
81
|
+
})
|
|
81
82
|
}
|
|
82
83
|
roundRect(ctx, x, y, w, h, r) {
|
|
83
|
-
const min_size = Math.min(w, h)
|
|
84
|
+
const min_size = Math.min(w, h)
|
|
84
85
|
if (r > min_size / 2) {
|
|
85
|
-
r = min_size / 2
|
|
86
|
+
r = min_size / 2
|
|
86
87
|
}
|
|
87
|
-
ctx.beginPath()
|
|
88
|
-
ctx.moveTo(x + r, y)
|
|
89
|
-
ctx.arcTo(x + w, y, x + w, y + h, r)
|
|
90
|
-
ctx.arcTo(x + w, y + h, x, y + h, r)
|
|
91
|
-
ctx.arcTo(x, y + h, x, y, r)
|
|
92
|
-
ctx.arcTo(x, y, x + w, y, r)
|
|
93
|
-
ctx.closePath()
|
|
94
|
-
return Promise.resolve()
|
|
88
|
+
ctx.beginPath()
|
|
89
|
+
ctx.moveTo(x + r, y)
|
|
90
|
+
ctx.arcTo(x + w, y, x + w, y + h, r)
|
|
91
|
+
ctx.arcTo(x + w, y + h, x, y + h, r)
|
|
92
|
+
ctx.arcTo(x, y + h, x, y, r)
|
|
93
|
+
ctx.arcTo(x, y, x + w, y, r)
|
|
94
|
+
ctx.closePath()
|
|
95
|
+
return Promise.resolve()
|
|
95
96
|
}
|
|
96
97
|
|
|
97
98
|
drawText({
|
|
@@ -108,65 +109,53 @@ export default class CanvasPoster extends Vue {
|
|
|
108
109
|
point = [0, 0]
|
|
109
110
|
}) {
|
|
110
111
|
return new Promise((resolve: any) => {
|
|
111
|
-
const canvas: any = document.getElementById('canvasPoster')
|
|
112
|
+
const canvas: any = document.getElementById('canvasPoster')
|
|
112
113
|
if (canvas.getContext) {
|
|
113
|
-
const ctx: any = canvas.getContext('2d')
|
|
114
|
-
ctx.fillStyle = color
|
|
115
|
-
ctx.font = `normal normal ${fontWeight} ${fontSize}px ${fontFamily}
|
|
116
|
-
ctx.textAlign = textAlign
|
|
114
|
+
const ctx: any = canvas.getContext('2d')
|
|
115
|
+
ctx.fillStyle = color
|
|
116
|
+
ctx.font = `normal normal ${fontWeight} ${fontSize}px ${fontFamily}`
|
|
117
|
+
ctx.textAlign = textAlign
|
|
117
118
|
if (autoLine) {
|
|
118
|
-
this.drawTextAutoLine(
|
|
119
|
-
ctx,
|
|
120
|
-
tx,
|
|
121
|
-
point[0],
|
|
122
|
-
point[1] + fontSize,
|
|
123
|
-
right,
|
|
124
|
-
lineHeight || fontSize,
|
|
125
|
-
this.canvasWidth
|
|
126
|
-
);
|
|
119
|
+
this.drawTextAutoLine(ctx, tx, point[0], point[1] + fontSize, right, lineHeight || fontSize, this.canvasWidth)
|
|
127
120
|
} else {
|
|
128
|
-
ctx.fillText(tx, point[0], point[1] + fontSize)
|
|
121
|
+
ctx.fillText(tx, point[0], point[1] + fontSize)
|
|
129
122
|
}
|
|
130
|
-
resolve()
|
|
123
|
+
resolve()
|
|
131
124
|
}
|
|
132
|
-
})
|
|
125
|
+
})
|
|
133
126
|
}
|
|
134
127
|
drawTextAutoLine(ctx, str, x, y, right, lineHeight, canvasWidth) {
|
|
135
|
-
let lineWidth = 0
|
|
136
|
-
let lastSubStrIndex = 0
|
|
128
|
+
let lineWidth = 0
|
|
129
|
+
let lastSubStrIndex = 0
|
|
137
130
|
for (let i = 0; i < str.length; i++) {
|
|
138
|
-
lineWidth += ctx.measureText(str[i]).width
|
|
131
|
+
lineWidth += ctx.measureText(str[i]).width
|
|
139
132
|
if (lineWidth > canvasWidth - (x + right)) {
|
|
140
|
-
ctx.fillText(str.substring(lastSubStrIndex, i), x, y)
|
|
141
|
-
y += lineHeight
|
|
142
|
-
lineWidth = ctx.measureText(str[i]).width
|
|
143
|
-
lastSubStrIndex = i
|
|
133
|
+
ctx.fillText(str.substring(lastSubStrIndex, i), x, y)
|
|
134
|
+
y += lineHeight
|
|
135
|
+
lineWidth = ctx.measureText(str[i]).width
|
|
136
|
+
lastSubStrIndex = i
|
|
144
137
|
}
|
|
145
138
|
if (i == str.length - 1) {
|
|
146
|
-
ctx.fillText(str.substring(lastSubStrIndex, i + 1), x, y)
|
|
139
|
+
ctx.fillText(str.substring(lastSubStrIndex, i + 1), x, y)
|
|
147
140
|
}
|
|
148
141
|
}
|
|
149
142
|
}
|
|
150
143
|
|
|
151
144
|
drawRect({ type, color, point = [0, 0], width = window.innerWidth, height = window.innerHeight, radius }) {
|
|
152
145
|
return new Promise((resolve: any) => {
|
|
153
|
-
const canvas: any = document.getElementById('canvasPoster')
|
|
146
|
+
const canvas: any = document.getElementById('canvasPoster')
|
|
154
147
|
if (canvas.getContext) {
|
|
155
|
-
const ctx: any = canvas.getContext('2d')
|
|
156
|
-
ctx.fillStyle = color
|
|
148
|
+
const ctx: any = canvas.getContext('2d')
|
|
149
|
+
ctx.fillStyle = color
|
|
157
150
|
if (radius) {
|
|
158
|
-
this.roundRect(ctx, point[0], point[1], width, height, radius)
|
|
159
|
-
ctx.fill()
|
|
151
|
+
this.roundRect(ctx, point[0], point[1], width, height, radius)
|
|
152
|
+
ctx.fill()
|
|
160
153
|
} else {
|
|
161
|
-
ctx.fillRect(point[0], point[1], width, height)
|
|
154
|
+
ctx.fillRect(point[0], point[1], width, height)
|
|
162
155
|
}
|
|
163
|
-
resolve()
|
|
156
|
+
resolve()
|
|
164
157
|
}
|
|
165
|
-
})
|
|
158
|
+
})
|
|
166
159
|
}
|
|
167
160
|
}
|
|
168
161
|
</script>
|
|
169
|
-
<style>
|
|
170
|
-
@import 'base.css';
|
|
171
|
-
@import './index.css';
|
|
172
|
-
</style>
|
|
@@ -31,72 +31,72 @@ export default {
|
|
|
31
31
|
</template>
|
|
32
32
|
|
|
33
33
|
<script>
|
|
34
|
-
import { CanvasPoster } from 'bxs-tools-ui';
|
|
35
|
-
|
|
36
|
-
export default {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
};
|
|
34
|
+
import { CanvasPoster } from 'bxs-tools-ui';
|
|
35
|
+
|
|
36
|
+
export default {
|
|
37
|
+
components: { CanvasPoster },
|
|
38
|
+
data() {
|
|
39
|
+
return {
|
|
40
|
+
posterData: [
|
|
41
|
+
{
|
|
42
|
+
type: 'image',
|
|
43
|
+
url: 'https://media.winbaoxian.com/xxx.jpeg',
|
|
44
|
+
width: window.innerWidth,
|
|
45
|
+
height: window.innerHeight
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
type: 'image',
|
|
49
|
+
url: 'https://media.winbaoxian.com/avatar.jpeg',
|
|
50
|
+
point: [200, 250],
|
|
51
|
+
width: 100,
|
|
52
|
+
height: 100,
|
|
53
|
+
radius: 50
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
type: 'text',
|
|
57
|
+
tx: '单行标题文本',
|
|
58
|
+
textAlign: 'center',
|
|
59
|
+
point: [window.innerWidth / 2, 20]
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
type: 'text',
|
|
63
|
+
tx: '支持自动换行的长文本内容,超出宽度后会自动折行显示。',
|
|
64
|
+
color: '#fff',
|
|
65
|
+
fontWeight: 'bold',
|
|
66
|
+
fontSize: 18,
|
|
67
|
+
fontFamily: 'Times',
|
|
68
|
+
lineHeight: 36,
|
|
69
|
+
autoLine: true,
|
|
70
|
+
right: 50,
|
|
71
|
+
point: [50, 60]
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
type: 'rect',
|
|
75
|
+
color: '#267a9a',
|
|
76
|
+
point: [50, window.innerHeight - 250],
|
|
77
|
+
width: window.innerWidth * 0.4,
|
|
78
|
+
height: 100,
|
|
79
|
+
radius: 20
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
type: 'rect',
|
|
83
|
+
color: 'rgba(255, 255, 0, 0.5)',
|
|
84
|
+
point: [0, window.innerHeight - 130],
|
|
85
|
+
width: window.innerWidth,
|
|
86
|
+
height: 130
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
type: 'image',
|
|
90
|
+
url: 'https://media.winbaoxian.com/QR_code.jpeg',
|
|
91
|
+
point: [window.innerWidth - 115, window.innerHeight - 115],
|
|
92
|
+
width: 100,
|
|
93
|
+
height: 100,
|
|
94
|
+
radius: 5
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
100
|
</script>
|
|
101
101
|
```
|
|
102
102
|
|
|
@@ -106,61 +106,58 @@ export default {
|
|
|
106
106
|
|
|
107
107
|
#### 根级 props
|
|
108
108
|
|
|
109
|
-
| 参数
|
|
110
|
-
|
|
|
111
|
-
| `poster-data`
|
|
112
|
-
| `canvas-width`
|
|
113
|
-
| `canvas-height` | 可选,Canvas 画布高度
|
|
114
|
-
|
|
109
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
110
|
+
| --------------- | ---------------------- | ------ | -------------------- |
|
|
111
|
+
| `poster-data` | 必传,海报绘制元素数组 | Array | `[]` |
|
|
112
|
+
| `canvas-width` | 可选,Canvas 画布宽度 | Number | `window.innerWidth` |
|
|
113
|
+
| `canvas-height` | 可选,Canvas 画布高度 | Number | `window.innerHeight` |
|
|
115
114
|
|
|
116
115
|
#### 绘制元素:image(图片)
|
|
117
116
|
|
|
118
|
-
| 参数
|
|
119
|
-
|
|
|
120
|
-
| `type`
|
|
121
|
-
| `url`
|
|
122
|
-
| `crossOrigin` | 允许跨源加载,可解除 `getImageData` / `toBlob` / `toDataURL` 限制 | String | —
|
|
123
|
-
| `point`
|
|
124
|
-
| `width`
|
|
125
|
-
| `height`
|
|
126
|
-
| `radius`
|
|
127
|
-
|
|
117
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
118
|
+
| ------------- | ----------------------------------------------------------------- | ------ | ------------ |
|
|
119
|
+
| `type` | 必传,固定值 `'image'` | String | — |
|
|
120
|
+
| `url` | 必传,图片地址 | String | — |
|
|
121
|
+
| `crossOrigin` | 允许跨源加载,可解除 `getImageData` / `toBlob` / `toDataURL` 限制 | String | — |
|
|
122
|
+
| `point` | 绘制起点坐标 `[x, y]` | Array | `[0, 0]` |
|
|
123
|
+
| `width` | 图片宽度 | Number | 图片自身宽度 |
|
|
124
|
+
| `height` | 图片高度 | Number | 图片自身高度 |
|
|
125
|
+
| `radius` | 圆角半径 | Number | — |
|
|
128
126
|
|
|
129
127
|
#### 绘制元素:text(文本)
|
|
130
128
|
|
|
131
|
-
| 参数
|
|
132
|
-
|
|
|
133
|
-
| `type`
|
|
134
|
-
| `tx`
|
|
135
|
-
| `color`
|
|
136
|
-
| `fontWeight` | 字体加粗(如 `'bold'`)
|
|
137
|
-
| `fontSize`
|
|
138
|
-
| `fontFamily` | 字体族
|
|
139
|
-
| `textAlign`
|
|
140
|
-
| `point`
|
|
141
|
-
| `autoLine`
|
|
142
|
-
| `right`
|
|
143
|
-
| `lineHeight` | 行距,仅 `autoLine` 为 `true` 时有效
|
|
144
|
-
|
|
129
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
130
|
+
| ------------ | -------------------------------------------------- | ------- | ------------------ |
|
|
131
|
+
| `type` | 必传,固定值 `'text'` | String | — |
|
|
132
|
+
| `tx` | 必传,绘制的文本内容 | String | — |
|
|
133
|
+
| `color` | 字体颜色 | String | `'#333'` |
|
|
134
|
+
| `fontWeight` | 字体加粗(如 `'bold'`) | String | — |
|
|
135
|
+
| `fontSize` | 字体大小(px) | Number | `12` |
|
|
136
|
+
| `fontFamily` | 字体族 | String | `'Arial'` |
|
|
137
|
+
| `textAlign` | 文本对齐方式 | String | `'start'` |
|
|
138
|
+
| `point` | 绘制起点坐标 `[x, y]` | Array | `[0, 0]` |
|
|
139
|
+
| `autoLine` | 是否自动换行 | Boolean | `false` |
|
|
140
|
+
| `right` | 文本与右边界的距离,仅 `autoLine` 为 `true` 时有效 | Number | `0` |
|
|
141
|
+
| `lineHeight` | 行距,仅 `autoLine` 为 `true` 时有效 | Number | 与 `fontSize` 相同 |
|
|
145
142
|
|
|
146
143
|
#### 绘制元素:rect(矩形)
|
|
147
144
|
|
|
148
|
-
| 参数
|
|
149
|
-
|
|
|
150
|
-
| `type`
|
|
151
|
-
| `color`
|
|
152
|
-
| `point`
|
|
153
|
-
| `width`
|
|
154
|
-
| `height` | 矩形高度
|
|
155
|
-
| `radius` | 圆角半径
|
|
145
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
146
|
+
| -------- | --------------------------- | ------ | -------------------- |
|
|
147
|
+
| `type` | 必传,固定值 `'rect'` | String | — |
|
|
148
|
+
| `color` | 必传,填充颜色,支持 `rgba` | String | — |
|
|
149
|
+
| `point` | 绘制起点坐标 `[x, y]` | Array | `[0, 0]` |
|
|
150
|
+
| `width` | 矩形宽度 | Number | `window.innerWidth` |
|
|
151
|
+
| `height` | 矩形高度 | Number | `window.innerHeight` |
|
|
152
|
+
| `radius` | 圆角半径 | Number | — |
|
|
156
153
|
|
|
157
154
|
---
|
|
158
155
|
|
|
159
156
|
### Methods
|
|
160
157
|
|
|
161
|
-
| 方法名
|
|
162
|
-
|
|
|
163
|
-
| `drawPoster` | 按 `posterData` 顺序依次绘制所有元素(`mounted` 时自动调用一次);**`posterData` 变更后不会自动重绘**,需通过 `$refs` 手动调用此方法或重新挂载组件 | —
|
|
158
|
+
| 方法名 | 说明 | 参数 |
|
|
159
|
+
| ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------- | ---- |
|
|
160
|
+
| `drawPoster` | 按 `posterData` 顺序依次绘制所有元素(`mounted` 时自动调用一次);**`posterData` 变更后不会自动重绘**,需通过 `$refs` 手动调用此方法或重新挂载组件 | — |
|
|
164
161
|
|
|
165
162
|
> **注意**:组件 canvas 的 `id` 固定为 `canvasPoster`,同一页面中存在多个实例时会发生 DOM id 冲突,请避免同时渲染多个实例。
|
|
166
163
|
|
|
@@ -174,6 +171,6 @@ export default {
|
|
|
174
171
|
|
|
175
172
|
### Slot
|
|
176
173
|
|
|
177
|
-
| 插槽名
|
|
178
|
-
|
|
|
174
|
+
| 插槽名 | 说明 |
|
|
175
|
+
| --------- | -------------------------------------------------------------- |
|
|
179
176
|
| `default` | 位于 `<canvas>` 标签内部,作为浏览器不支持 Canvas 时的降级内容 |
|
package/packages/index.ts
CHANGED
|
@@ -14,14 +14,14 @@
|
|
|
14
14
|
</div>
|
|
15
15
|
</template>
|
|
16
16
|
<script lang="ts">
|
|
17
|
-
import { Component, Vue } from 'vue-property-decorator'
|
|
18
|
-
import Vant, { Dialog } from 'vant'
|
|
19
|
-
import { get as _get } from 'lodash'
|
|
20
|
-
import InsureCalculate from '../index.vue'
|
|
17
|
+
import { Component, Vue } from 'vue-property-decorator'
|
|
18
|
+
import Vant, { Dialog } from 'vant'
|
|
19
|
+
import { get as _get } from 'lodash'
|
|
20
|
+
import InsureCalculate from '../index.vue'
|
|
21
21
|
|
|
22
|
-
import { insureCalculate, checkInsureCalculate } from 'packages/bxs-utils/index'
|
|
22
|
+
import { insureCalculate, checkInsureCalculate } from 'packages/bxs-utils/index'
|
|
23
23
|
|
|
24
|
-
Vue.use(Vant)
|
|
24
|
+
Vue.use(Vant)
|
|
25
25
|
|
|
26
26
|
@Component({
|
|
27
27
|
components: {
|
|
@@ -29,22 +29,22 @@ Vue.use(Vant);
|
|
|
29
29
|
}
|
|
30
30
|
})
|
|
31
31
|
export default class InsureCalculateDemo extends Vue {
|
|
32
|
-
productId: number | string = 110019
|
|
33
|
-
uuid = ''
|
|
32
|
+
productId: number | string = 110019 // 104367 100585 104733 102805 104931 110019;
|
|
33
|
+
uuid = ''
|
|
34
34
|
planParams = {
|
|
35
35
|
detail_age: '',
|
|
36
36
|
detail_sex: '2',
|
|
37
37
|
detail_relation: '1',
|
|
38
38
|
detail_applicant_age: '2',
|
|
39
39
|
detail_applicant_sex: '2'
|
|
40
|
-
}
|
|
40
|
+
}
|
|
41
41
|
planParams2 = {
|
|
42
42
|
detail_age: '39周岁',
|
|
43
43
|
detail_sex: '1',
|
|
44
44
|
detail_relation: '14',
|
|
45
45
|
detail_applicant_age: '35周岁',
|
|
46
46
|
detail_applicant_sex: '2'
|
|
47
|
-
}
|
|
47
|
+
}
|
|
48
48
|
postParams = {
|
|
49
49
|
product_id: '104367',
|
|
50
50
|
current_data: [
|
|
@@ -89,10 +89,10 @@ export default class InsureCalculateDemo extends Vue {
|
|
|
89
89
|
{ risk: '1876', k: 'detail_applicant_sex', v: '2' }
|
|
90
90
|
],
|
|
91
91
|
scenario: 'h5Widget'
|
|
92
|
-
}
|
|
92
|
+
}
|
|
93
93
|
postParams2 = {
|
|
94
94
|
product_id: '104367'
|
|
95
|
-
}
|
|
95
|
+
}
|
|
96
96
|
created() {
|
|
97
97
|
// insureCalculate(null, this.postParams, this.planParams)
|
|
98
98
|
// .then(res => {
|
|
@@ -111,20 +111,20 @@ export default class InsureCalculateDemo extends Vue {
|
|
|
111
111
|
// );
|
|
112
112
|
}
|
|
113
113
|
sureInsureCalculate() {
|
|
114
|
-
const vmCalculate = this.$refs.calculate
|
|
114
|
+
const vmCalculate = this.$refs.calculate
|
|
115
115
|
if (vmCalculate && vmCalculate['confirm']) {
|
|
116
116
|
vmCalculate['confirm']().then(res => {
|
|
117
|
-
const currentData = _get(res, 'data.current_data') || []
|
|
117
|
+
const currentData = _get(res, 'data.current_data') || []
|
|
118
118
|
const resultData = currentData.reduce((acc, item) => {
|
|
119
|
-
acc[item.k] = item.v
|
|
120
|
-
return acc
|
|
121
|
-
}, {})
|
|
119
|
+
acc[item.k] = item.v
|
|
120
|
+
return acc
|
|
121
|
+
}, {})
|
|
122
122
|
Dialog.alert({
|
|
123
123
|
title: '试算结果',
|
|
124
124
|
message: JSON.stringify(resultData)
|
|
125
|
-
})
|
|
126
|
-
console.log('组件试算结果获取:', res)
|
|
127
|
-
})
|
|
125
|
+
})
|
|
126
|
+
console.log('组件试算结果获取:', res)
|
|
127
|
+
})
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
}
|