@ebiz/designer-components 0.1.103 → 0.1.105
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/dist/designer-components.css +1 -1
- package/dist/index.mjs +10023 -9923
- package/package.json +1 -1
- package/src/components/EbizQrCode.vue +98 -7
- package/src/components/LaunchInterview.vue +3 -1
package/package.json
CHANGED
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
3
|
<t-qrcode :bg-color="bgColor" :border-less="borderless" :color="color" :icon="icon" :icon-size="iconSize"
|
|
4
|
-
:level="level" :size="size" :type="type" :value="value" @refresh="onRefresh"
|
|
4
|
+
:level="level" :size="size" :type="type" :value="value" @refresh="onRefresh"
|
|
5
|
+
@click="onClick" :class="{ 'cursor-pointer': props.dialogShow }">
|
|
5
6
|
</t-qrcode>
|
|
7
|
+
<t-dialog v-model:visible="dialogVisible" :width="dialogWidth" :confirm-btn="null" :cancel-btn="null">
|
|
8
|
+
<div style="display: flex; justify-content: center;">
|
|
9
|
+
<t-space direction="vertical" :align="dialogAlign">
|
|
10
|
+
<t-qrcode :bg-color="bgColor" :border-less="borderless" :color="color" :icon="icon" :icon-size="iconSize"
|
|
11
|
+
:level="level" :size="dialogQrCodeSize" :type="type" :value="value" id="QRCode">
|
|
12
|
+
</t-qrcode>
|
|
13
|
+
<t-button v-if="showDownloadBtn" @click="handleDownload">{{ downloadBtnText }}</t-button>
|
|
14
|
+
</t-space>
|
|
15
|
+
</div>
|
|
16
|
+
</t-dialog>
|
|
6
17
|
</div>
|
|
7
18
|
</template>
|
|
8
19
|
|
|
9
20
|
|
|
10
21
|
<script setup>
|
|
11
|
-
import { defineProps, defineEmits } from 'vue';
|
|
12
|
-
import { QRCode as TQrcode } from 'tdesign-vue-next';
|
|
22
|
+
import { defineProps, defineEmits, ref } from 'vue';
|
|
23
|
+
import { QRCode as TQrcode, Dialog as TDialog, Button as TButton, Space as TSpace } from 'tdesign-vue-next';
|
|
13
24
|
|
|
14
25
|
const props = defineProps({
|
|
15
26
|
// 二维码背景颜色
|
|
@@ -56,9 +67,45 @@ const props = defineProps({
|
|
|
56
67
|
value: {
|
|
57
68
|
type: String,
|
|
58
69
|
default: ''
|
|
59
|
-
}
|
|
70
|
+
},
|
|
71
|
+
// 是否点击弹窗显示大图
|
|
72
|
+
dialogShow: {
|
|
73
|
+
type: Boolean,
|
|
74
|
+
default: false
|
|
75
|
+
},
|
|
76
|
+
// 弹窗宽度
|
|
77
|
+
dialogWidth: {
|
|
78
|
+
type: [String, Number],
|
|
79
|
+
default: '500px'
|
|
80
|
+
},
|
|
81
|
+
// 弹窗二维码大小
|
|
82
|
+
dialogQrCodeSize: {
|
|
83
|
+
type: Number,
|
|
84
|
+
default: 380
|
|
85
|
+
},
|
|
86
|
+
// 是否显示下载按钮
|
|
87
|
+
showDownloadBtn: {
|
|
88
|
+
type: Boolean,
|
|
89
|
+
default: false
|
|
90
|
+
},
|
|
91
|
+
// 下载按钮文字
|
|
92
|
+
downloadBtnText: {
|
|
93
|
+
type: String,
|
|
94
|
+
default: '下载二维码'
|
|
95
|
+
},
|
|
96
|
+
// 下载文件名
|
|
97
|
+
downloadFileName: {
|
|
98
|
+
type: String,
|
|
99
|
+
default: '二维码'
|
|
100
|
+
},
|
|
101
|
+
// 二维码、按钮对齐方式
|
|
102
|
+
dialogAlign: {
|
|
103
|
+
type: String,
|
|
104
|
+
default: 'center'
|
|
105
|
+
},
|
|
60
106
|
})
|
|
61
107
|
|
|
108
|
+
const dialogVisible = ref(false)
|
|
62
109
|
const emit = defineEmits(['refresh'])
|
|
63
110
|
|
|
64
111
|
// 点击"点击刷新"的回调
|
|
@@ -66,9 +113,53 @@ const onRefresh = () => {
|
|
|
66
113
|
emit('refresh')
|
|
67
114
|
}
|
|
68
115
|
|
|
116
|
+
const onClick = () => {
|
|
117
|
+
if (props.dialogShow) {
|
|
118
|
+
dialogVisible.value = true
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const downloadFile = (url, fileName) => {
|
|
123
|
+
const a = document.createElement('a');
|
|
124
|
+
a.download = fileName;
|
|
125
|
+
a.href = url;
|
|
126
|
+
document.body.appendChild(a);
|
|
127
|
+
a.click();
|
|
128
|
+
document.body.removeChild(a);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const downloadCanvas = () => {
|
|
132
|
+
const canvas = document.getElementById('QRCode').querySelector('canvas');
|
|
133
|
+
if (canvas) {
|
|
134
|
+
const url = canvas.toDataURL();
|
|
135
|
+
console.log(url);
|
|
136
|
+
downloadFile(url, props.downloadFileName + '.png');
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
const downloadSvg = () => {
|
|
141
|
+
const svg = document.getElementById('QRCode').querySelector('svg');
|
|
142
|
+
const svgData = new XMLSerializer().serializeToString(svg);
|
|
143
|
+
const blob = new Blob([svgData], { type: 'image/svg+xml;charset=utf-8' });
|
|
144
|
+
const url = URL.createObjectURL(blob);
|
|
145
|
+
console.log(url);
|
|
146
|
+
downloadFile(url, props.downloadFileName + '.svg');
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
const handleDownload = () => {
|
|
150
|
+
if (props.type === 'canvas') {
|
|
151
|
+
downloadCanvas();
|
|
152
|
+
}
|
|
153
|
+
if (props.type === 'svg') {
|
|
154
|
+
downloadSvg();
|
|
155
|
+
}
|
|
156
|
+
};
|
|
69
157
|
</script>
|
|
70
|
-
<!--
|
|
71
158
|
|
|
72
|
-
|
|
159
|
+
|
|
160
|
+
<style scoped>
|
|
73
161
|
/* 自定义样式 */
|
|
74
|
-
|
|
162
|
+
.cursor-pointer {
|
|
163
|
+
cursor: pointer;
|
|
164
|
+
}
|
|
165
|
+
</style>
|
|
@@ -258,7 +258,8 @@ const props = defineProps({
|
|
|
258
258
|
employeeId: { type: Number, default: 0 },
|
|
259
259
|
no: { type: String, default: '' },
|
|
260
260
|
btnText: { type: String, default: '' },
|
|
261
|
-
kind: { type: String, default: 'DAILY' }
|
|
261
|
+
kind: { type: String, default: 'DAILY' },
|
|
262
|
+
name: { type: String, default: '' }
|
|
262
263
|
})
|
|
263
264
|
|
|
264
265
|
const {employeeId}=vue.toRefs(props)
|
|
@@ -313,6 +314,7 @@ const state = vue.reactive({
|
|
|
313
314
|
},
|
|
314
315
|
questionList: [],
|
|
315
316
|
queryParams: {
|
|
317
|
+
name: props.name,
|
|
316
318
|
kind: props.kind,
|
|
317
319
|
status: true
|
|
318
320
|
},
|