update:消息提示
This commit is contained in:
@@ -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({
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import './assets/main.css'
|
||||
import 'element-plus/dist/index.css'
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css'
|
||||
import { createApp } from 'vue'
|
||||
import { createPinia } from 'pinia'
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
// @ts-ignore
|
||||
import axios from "axios";
|
||||
import { ElMessage } from "element-plus";
|
||||
|
||||
const instance = axios.create({
|
||||
baseURL: "/",
|
||||
baseURL: import.meta.env.DEV ? "http://localhost:12345" : "/",
|
||||
timeout: 6000000,
|
||||
headers:{
|
||||
'Authorization':localStorage.getItem('auth')
|
||||
@@ -14,11 +15,11 @@ instance.interceptors.response.use(
|
||||
if (response.data.code === 200) {
|
||||
return response.data;
|
||||
} else {
|
||||
alert(response.data.detail);
|
||||
ElMessage.error(response.data.detail);
|
||||
return Promise.reject(response.data);
|
||||
}
|
||||
}, (error:any) => {
|
||||
alert(error.response.data.detail);
|
||||
ElMessage.error(error.response.data.detail);
|
||||
return Promise.reject(error);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user