parent
51b2d54925
commit
ebc83554ac
|
|
@ -13,7 +13,7 @@
|
|||
</template>
|
||||
</el-image>
|
||||
</div>
|
||||
<div class="flex-row align-c gap-10 size-12">
|
||||
<div v-if="src !== ''" class="flex-row align-c gap-10 size-12">
|
||||
{{ src }}
|
||||
<div class="copy" @click="clipboard_event">复制</div>
|
||||
</div>
|
||||
|
|
@ -42,10 +42,14 @@ const qrCodeUrl = ref('');
|
|||
|
||||
const generateQRCode = async (text: string, margin: number) => {
|
||||
try {
|
||||
const dataUrl = await QRCode.toDataURL(text, { margin });
|
||||
let new_text = text.trim();
|
||||
if (!text) {
|
||||
new_text = '请先选择分组';
|
||||
}
|
||||
const dataUrl = await QRCode.toDataURL(new_text, { margin });
|
||||
qrCodeUrl.value = dataUrl;
|
||||
} catch (error) {
|
||||
console.error('Error generating QR code:', error);
|
||||
console.error('生成二维码时出错:', error);
|
||||
}
|
||||
};
|
||||
const clipboard_event = async () => {
|
||||
|
|
@ -59,13 +63,15 @@ const clipboard_event = async () => {
|
|||
watch(
|
||||
() => props.src,
|
||||
(newValue) => {
|
||||
generateQRCode(newValue.trim(), 2);
|
||||
if (newValue !== '') {
|
||||
generateQRCode(newValue, 2);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// 在组件挂载后自动调用生成二维码方法
|
||||
onMounted(() => {
|
||||
generateQRCode(props.src.trim(), 2);
|
||||
generateQRCode(props.src, 2);
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@
|
|||
</template>
|
||||
<template v-else-if="upload_type == 'file'">
|
||||
<div class="bg-f5 img flex-row jc-c align-c radius h w">
|
||||
<icon :name="ext_file_name_list_map.filter((ext) => ext.type == item.type).length > 0 && ext_file_name_list_map.filter((ext) => ext.type == item.type)[0].type == item.type ? ext_file_name_list_map.filter((ext) => ext.type == item.type)[0].icon : 'file'" size="42" color="9"></icon>
|
||||
<icon :name="ext_file_name_list_map.filter((ext) => ext.type == item.ext).length > 0 && ext_file_name_list_map.filter((ext) => ext.type == item.ext)[0].type == item.ext ? ext_file_name_list_map.filter((ext) => ext.type == item.ext)[0].icon : 'file'" size="42" color="9"></icon>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
|
|
@ -296,6 +296,7 @@ const all_tree = {
|
|||
id: '',
|
||||
pid: '',
|
||||
name: '全部',
|
||||
items: [],
|
||||
path: '',
|
||||
is_enable: 1,
|
||||
sort: '',
|
||||
|
|
@ -338,9 +339,11 @@ const upload_category_confirm = () => {
|
|||
};
|
||||
const category_id = ref('');
|
||||
// 左侧分类树结构节点点击事件
|
||||
const tree_node_event = (data: any) => {
|
||||
const tree_node_event = (data: any, a: any, b: any) => {
|
||||
// 判断是否开启状态,如果关闭则不可操作
|
||||
// if (data.is_enable == 0) return;
|
||||
// 判断是否是子节点,如果不是子节点则不可操作
|
||||
if (data.items.length > 0) return;
|
||||
category_id.value = data.id;
|
||||
get_attachment_list();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
<el-radio-group v-model="form.type" @change="upload_type_change">
|
||||
<el-radio value="loc">本地上传</el-radio>
|
||||
<el-radio value="scan">扫码上传</el-radio>
|
||||
<el-radio v-if="upload_type !== 'file'" value="web">网络上传</el-radio>
|
||||
<el-radio v-if="type !== 'file'" value="web">网络上传</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="上传至分组" prop="category_id">
|
||||
|
|
@ -105,13 +105,27 @@
|
|||
<div class="table-body">
|
||||
<div v-for="(item, index) in scan_file_list" :key="index" class="table-row">
|
||||
<div class="table-cell">
|
||||
<el-image :src="item.url" class="preview-img radius-sm" fit="contain">
|
||||
<template #error>
|
||||
<template v-if="type == 'video'">
|
||||
<div class="preview-img radius-sm">
|
||||
<icon name="video" size="12" color="9"></icon>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="type == 'file'">
|
||||
<div class="preview-img radius-sm">
|
||||
<div class="bg-f5 img flex-row jc-c align-c radius h w">
|
||||
<icon name="error-img" size="12"></icon>
|
||||
<icon :name="ext_file_name_list_map.filter((ext) => ext.type == item.ext).length > 0 && ext_file_name_list_map.filter((ext) => ext.type == item.ext)[0].type == item.ext ? ext_file_name_list_map.filter((ext) => ext.type == item.ext)[0].icon : 'file'" size="12" color="9"></icon>
|
||||
</div>
|
||||
</template>
|
||||
</el-image>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-image :src="item.url" class="preview-img radius-sm" fit="contain">
|
||||
<template #error>
|
||||
<div class="bg-f5 img flex-row jc-c align-c radius h w">
|
||||
<icon name="error-img" size="12"></icon>
|
||||
</div>
|
||||
</template>
|
||||
</el-image>
|
||||
</template>
|
||||
<div class="desc">{{ item.title }}</div>
|
||||
</div>
|
||||
<div class="table-cell">{{ annex_size_to_unit(item.size) }}</div>
|
||||
|
|
@ -173,11 +187,9 @@ const props = defineProps({
|
|||
},
|
||||
});
|
||||
const dialogVisible = defineModel({ type: Boolean, default: false });
|
||||
// 上传类型
|
||||
const upload_type = ref(props.type);
|
||||
// 上传类型转换成name
|
||||
const upload_type_name = computed(() => {
|
||||
return upload_type.value === 'img' ? '图片' : upload_type.value === 'video' ? '视频' : '文件';
|
||||
return props.type === 'img' ? '图片' : props.type === 'video' ? '视频' : '文件';
|
||||
});
|
||||
// 格式限制
|
||||
const exts_text = ref(props.exts.join(','));
|
||||
|
|
@ -199,7 +211,7 @@ const form = ref<formData>({
|
|||
type: 'loc',
|
||||
category_id: [],
|
||||
file: [],
|
||||
qrcode: '******',
|
||||
qrcode: '',
|
||||
web_image: '',
|
||||
});
|
||||
const rules = reactive<FormRules>({
|
||||
|
|
|
|||
Loading…
Reference in New Issue