update:消息提示

This commit is contained in:
lan
2023-08-14 22:25:00 +08:00
parent 9a053c1839
commit 3df49615e3
22 changed files with 65 additions and 40 deletions
+24 -2
View File
@@ -7,6 +7,7 @@ const fileBoxStore = useFileBoxStore();
import QrcodeVue from "qrcode.vue";
import { useRoute } from "vue-router";
import { ref } from "vue";
import { ElMessage } from "element-plus";
const openUrl = (url: string) => {
if (url.startsWith('/')) {
url = window.location.origin + url;
@@ -16,6 +17,7 @@ const openUrl = (url: string) => {
const route = useRoute();
const copyText = (text: any, style = 0) => {
ElMessage.success('复制成功')
if (style === 1) {
text = window.location.origin + '/#/?code=' + text;
}
@@ -28,6 +30,13 @@ const copyText = (text: any, style = 0) => {
}
document.body.removeChild(temp);
};
const nowText = ref('');
const showTextDetail = (text: any) => {
showTextDetailVisible.value = true;
nowText.value = text;
};
const showTextDetailVisible = ref(false);
</script>
<template>
@@ -38,6 +47,18 @@ const copyText = (text: any, style = 0) => {
</template>
<template #default>
<div v-if="route.name=='home'" style="display: flex;flex-wrap: wrap;justify-content: center">
<el-dialog
append-to-body
align-center
title="文本详情"
v-model="showTextDetailVisible"
>
<div v-html="nowText"></div>
<template #footer>
<el-button type="success" @click="copyText(nowText);showTextDetailVisible = false"> </el-button>
<el-button type="primary" @click="showTextDetailVisible = false"> </el-button>
</template>
</el-dialog>
<el-card v-for="(value,index) in fileStore.receiveData" :key="index" style="margin: 0.5rem">
<template #header>
<div style="display: flex;justify-content: space-between">
@@ -47,13 +68,14 @@ const copyText = (text: any, style = 0) => {
</template>
<div style="width: 200px;">
<div style="display: flex;justify-content: space-between">
<qrcode-vue :value="value.text" :size="100"></qrcode-vue>
<qrcode-vue v-if="value.name!=='文本分享'" :value="value.text" :size="100"></qrcode-vue>
<div style="width: 100px;height: 100px;flex-wrap: wrap;overflow-y:scroll ">{{value.text}}</div>
<div style="display: flex;flex-direction: column;justify-content: space-around">
<el-tag size="large" style="cursor: pointer" @click="copyText(value.code)">{{ value.code }}</el-tag>
<el-tag v-if="value.name!=='文本分享'" size="large" type="success" style="cursor: pointer" @click="openUrl(value.text);">
点击下载
</el-tag>
<el-tag v-else size="large" type="success" style="cursor: pointer" @click="copyText(value.text);">点击复制</el-tag>
<el-tag v-else size="large" type="success" style="cursor: pointer" @click="showTextDetail(value.text);">查看详情</el-tag>
</div>
</div>
</div>
@@ -86,7 +86,6 @@ function pasteLister(event: any) {
} else {
const file: any = items[i].getAsFile();
if (file) {
console.log(file);
const uid = Date.now();
file.uid = uid;
fileStore.addShareData({
+2 -1
View File
@@ -4,6 +4,7 @@ import { request } from "@/utils/request";
const shareText = ref('')
import { useFileDataStore } from "@/stores/fileData";
import { useFileBoxStore } from "@/stores/fileBox";
import { ElMessage } from "element-plus";
const fileBoxStore = useFileBoxStore();
const fileStore = useFileDataStore();
const props = defineProps({
@@ -19,7 +20,7 @@ const props = defineProps({
})
const handleSubmitShareText = ()=>{
if (shareText.value === '') {
alert('请输入您要分享的文本');
ElMessage.warning('请输入您要分享的文本');
} else {
const formData = new FormData();
formData.append('text', shareText.value);