|
@@ -1,4 +1,4 @@
|
|
|
-import { defineComponent, onMounted, reactive, ref } from 'vue';
|
|
|
+import { defineComponent, onMounted, reactive, ref, nextTick } from 'vue';
|
|
|
import styles from './index.module.less';
|
|
|
import {
|
|
|
Cell,
|
|
@@ -65,7 +65,7 @@ export default defineComponent({
|
|
|
rows: 20,
|
|
|
isClick: false,
|
|
|
qrcodeStatus: false,
|
|
|
- url: '', // 二维码
|
|
|
+ url: '1', // 二维码
|
|
|
urlItem: {} as any
|
|
|
});
|
|
|
|
|
@@ -164,25 +164,28 @@ export default defineComponent({
|
|
|
}
|
|
|
imgs.saveLoading = true;
|
|
|
// 判断是否已经生成图片
|
|
|
- if (imgs.image) {
|
|
|
- saveImg();
|
|
|
- } else {
|
|
|
- const container: any = document.getElementById(`preview-container`);
|
|
|
-
|
|
|
- html2canvas(container, {
|
|
|
- allowTaint: true,
|
|
|
- useCORS: true,
|
|
|
- backgroundColor: null
|
|
|
+ // if (imgs.image) {
|
|
|
+ // saveImg();
|
|
|
+ // } else {
|
|
|
+ const container: any = document.getElementById(`preview-container`);
|
|
|
+ console.log('1212121');
|
|
|
+ html2canvas(container, {
|
|
|
+ allowTaint: true,
|
|
|
+ useCORS: true,
|
|
|
+ backgroundColor: null
|
|
|
+ })
|
|
|
+ .then(async canvas => {
|
|
|
+ const url = canvas.toDataURL('image/png');
|
|
|
+ imgs.image = url;
|
|
|
+ // saveImg();
|
|
|
+ forms.qrcodeStatus = true;
|
|
|
+ imgs.saveLoading = false;
|
|
|
})
|
|
|
- .then(async canvas => {
|
|
|
- const url = canvas.toDataURL('image/png');
|
|
|
- imgs.image = url;
|
|
|
- saveImg();
|
|
|
- })
|
|
|
- .catch(() => {
|
|
|
- imgs.saveLoading = false;
|
|
|
- });
|
|
|
- }
|
|
|
+ .catch(() => {
|
|
|
+ imgs.saveLoading = false;
|
|
|
+ console.log('222');
|
|
|
+ });
|
|
|
+ // }
|
|
|
};
|
|
|
|
|
|
const saveImg = async () => {
|
|
@@ -346,9 +349,12 @@ export default defineComponent({
|
|
|
</div>
|
|
|
<div
|
|
|
onClick={() => {
|
|
|
- forms.qrcodeStatus = true;
|
|
|
forms.urlItem = item;
|
|
|
forms.url = `${location.origin}/classroom-app/#/tenantDataShool?id=${item.schoolId}&name=${item.schoolName}`;
|
|
|
+
|
|
|
+ nextTick(() => {
|
|
|
+ downImg();
|
|
|
+ });
|
|
|
}}>
|
|
|
<p class={styles.personNum}>
|
|
|
<img src={iconQrcode} />
|
|
@@ -433,6 +439,22 @@ export default defineComponent({
|
|
|
<i
|
|
|
class={styles.iconClose}
|
|
|
onClick={() => (forms.qrcodeStatus = false)}></i>
|
|
|
+
|
|
|
+ <img src={imgs.image} class={styles.image} />
|
|
|
+ {/*
|
|
|
+
|
|
|
+ <Button
|
|
|
+ type="primary"
|
|
|
+ round
|
|
|
+ block
|
|
|
+ class={styles.downloadBtn}
|
|
|
+ onClick={downImg}>
|
|
|
+ 下载二维码
|
|
|
+ </Button> */}
|
|
|
+ <p class={styles.btnText}>长按或截图保存二维码</p>
|
|
|
+ </Popup>
|
|
|
+
|
|
|
+ <div class={styles.templateSection}>
|
|
|
<div class={[styles.shareContaienr]} id="preview-container">
|
|
|
<img src={qrcodeBg} class={styles.qrcodeBg} />
|
|
|
<div class={styles.sectionGroup}>
|
|
@@ -450,16 +472,7 @@ export default defineComponent({
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
- <Button
|
|
|
- type="primary"
|
|
|
- round
|
|
|
- block
|
|
|
- class={styles.downloadBtn}
|
|
|
- onClick={downImg}>
|
|
|
- 下载二维码
|
|
|
- </Button>
|
|
|
- </Popup>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
);
|
|
|
}
|