优化进件查询
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<el-dialog title="签约码" width="350px" v-model="visible">
|
||||
<div class="wrap">
|
||||
<el-image :src="url" style="width: 200px;height: 200px;"></el-image>
|
||||
<el-image :src="srcUrl" style="width: 200px;height: 200px;"></el-image>
|
||||
<el-text>请前往{{ type == 1 ? '支付宝' : '微信' }}进行扫码</el-text>
|
||||
</div>
|
||||
</el-dialog>
|
||||
@@ -9,16 +9,41 @@
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import QRCode from 'qrcode'
|
||||
|
||||
const visible = ref(false)
|
||||
|
||||
const url = ref('')
|
||||
const srcUrl = ref('')
|
||||
const type = ref(1)
|
||||
|
||||
function show(url, type) {
|
||||
// 手动生成二维码
|
||||
async function generateQrcode(text) {
|
||||
try {
|
||||
// 生成 Base64 格式的二维码图片
|
||||
const base64 = await QRCode.toDataURL(text, {
|
||||
width: 200,
|
||||
margin: 1,
|
||||
color: {
|
||||
dark: '#000',
|
||||
light: '#fff'
|
||||
}
|
||||
})
|
||||
url.value = base64
|
||||
} catch (err) {
|
||||
console.error('生成二维码失败:', err)
|
||||
}
|
||||
}
|
||||
|
||||
function show(url, t) {
|
||||
console.log(url);
|
||||
visible.value = true
|
||||
url.value = url
|
||||
type.value = type
|
||||
type.value = t
|
||||
|
||||
if (t == 2) {
|
||||
srcUrl.value = url
|
||||
} else {
|
||||
generateQrcode(url)
|
||||
}
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
|
||||
Reference in New Issue
Block a user