add:fronted
This commit is contained in:
Vendored
-2
@@ -11,11 +11,9 @@ declare module 'vue' {
|
||||
ElButton: typeof import('element-plus/es')['ElButton']
|
||||
ElCard: typeof import('element-plus/es')['ElCard']
|
||||
ElCol: typeof import('element-plus/es')['ElCol']
|
||||
ElDialog: typeof import('element-plus/es')['ElDialog']
|
||||
ElDrawer: typeof import('element-plus/es')['ElDrawer']
|
||||
ElIcon: typeof import('element-plus/es')['ElIcon']
|
||||
ElInput: typeof import('element-plus/es')['ElInput']
|
||||
ElModal: typeof import('element-plus/es')['ElModal']
|
||||
ElOption: typeof import('element-plus/es')['ElOption']
|
||||
ElProgress: typeof import('element-plus/es')['ElProgress']
|
||||
ElRadio: typeof import('element-plus/es')['ElRadio']
|
||||
|
||||
@@ -50,7 +50,8 @@ const copyText = (text: any, style = 0) => {
|
||||
<qrcode-vue :value="value.text" :size="100"></qrcode-vue>
|
||||
<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 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>
|
||||
</div>
|
||||
|
||||
@@ -11,8 +11,8 @@ const props = defineProps({
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
expireValue: 1,
|
||||
expireStyle: 'day',
|
||||
expire_value: 1,
|
||||
expire_style: 'day',
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,8 +36,8 @@ const handleHttpRequest = (options: any) => {
|
||||
fileBoxStore.showFileBox = true;
|
||||
const formData = new FormData();
|
||||
formData.append('file', options.file);
|
||||
formData.append('expireValue', props.shareData.expireValue);
|
||||
formData.append('expireStyle', props.shareData.expireStyle);
|
||||
formData.append('expire_value', props.shareData.expireValue);
|
||||
formData.append('expire_style', props.shareData.expireStyle);
|
||||
request(
|
||||
{
|
||||
url: "share/file/",
|
||||
@@ -54,7 +54,7 @@ const handleHttpRequest = (options: any) => {
|
||||
}
|
||||
}
|
||||
).then((res: any) => {
|
||||
const data = res.data.data;
|
||||
const data = res.detail;
|
||||
fileStore.shareData.forEach((file: any) => {
|
||||
if (file.uid === options.file.uid) {
|
||||
file.status = 'success';
|
||||
|
||||
@@ -11,35 +11,39 @@ const props = defineProps({
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
expireValue: 1,
|
||||
expireStyle: 'day',
|
||||
expire_value: 1,
|
||||
expire_style: 'day',
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
const handleSubmitShareText = ()=>{
|
||||
const formData = new FormData();
|
||||
formData.append('text', shareText.value);
|
||||
formData.append('expireValue', props.shareData.expireValue);
|
||||
formData.append('expireStyle', props.shareData.expireStyle);
|
||||
request({
|
||||
'url': 'share/text/',
|
||||
'method': 'post',
|
||||
'data': formData,
|
||||
}).then((res: any) => {
|
||||
const data = res.data.data;
|
||||
fileBoxStore.showFileBox = true;
|
||||
fileStore.addShareData({
|
||||
'name': '文本分享',
|
||||
'text': data.text,
|
||||
'code': data.code,
|
||||
'status': 'success',
|
||||
'percentage': 100,
|
||||
'size': shareText.value.length,
|
||||
'type': 'text',
|
||||
'uid': Date.now(),
|
||||
})
|
||||
})
|
||||
if (shareText.value === '') {
|
||||
alert('请输入您要分享的文本');
|
||||
} else {
|
||||
const formData = new FormData();
|
||||
formData.append('text', shareText.value);
|
||||
formData.append('expire_value', props.shareData.expireValue);
|
||||
formData.append('expire_style', props.shareData.expireStyle);
|
||||
request({
|
||||
'url': 'share/text/',
|
||||
'method': 'post',
|
||||
'data': formData,
|
||||
}).then((res: any) => {
|
||||
const data = res.detail;
|
||||
fileBoxStore.showFileBox = true;
|
||||
fileStore.addShareData({
|
||||
'name': '文本分享',
|
||||
'text': data.text,
|
||||
'code': data.code,
|
||||
'status': 'success',
|
||||
'percentage': 100,
|
||||
'size': shareText.value.length,
|
||||
'type': 'text',
|
||||
'uid': Date.now(),
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -2,17 +2,24 @@
|
||||
import axios from "axios";
|
||||
|
||||
const instance = axios.create({
|
||||
baseURL: "",
|
||||
baseURL: "http://localhost:12345",
|
||||
timeout: 6000000,
|
||||
headers:{
|
||||
'Authorization':localStorage.getItem('auth')
|
||||
}
|
||||
});
|
||||
// 对响应进行拦截
|
||||
instance.interceptors.response.use(
|
||||
(response:any) => {
|
||||
if (response.data.code === 200) {
|
||||
return response.data;
|
||||
} else {
|
||||
alert(response.data.detail);
|
||||
return Promise.reject(response.data);
|
||||
}
|
||||
}, (error:any) => {
|
||||
alert(error.response.data.detail);
|
||||
return Promise.reject(error);
|
||||
});
|
||||
|
||||
const Request = axios.create({
|
||||
baseURL: "http://localhost:12345",
|
||||
timeout: 6000000,
|
||||
});
|
||||
|
||||
export const request = Request;
|
||||
export const http = instance;
|
||||
export const request = instance;
|
||||
|
||||
@@ -33,24 +33,21 @@ watch(code, (newVal) => {
|
||||
'code': newVal
|
||||
}
|
||||
}).then((res: any) => {
|
||||
fileBoxStore.showFileBox = true;
|
||||
let flag = true;
|
||||
fileStore.receiveData.forEach((file: any) => {
|
||||
if (file.code === res.detail.code) {
|
||||
flag = false;
|
||||
return;
|
||||
}
|
||||
});
|
||||
if (flag) {
|
||||
fileStore.addReceiveData(res.detail);
|
||||
}
|
||||
}).finally(() => {
|
||||
input_status.readonly = false;
|
||||
input_status.loading = false;
|
||||
code.value = '';
|
||||
if (res.data.code === 200) {
|
||||
fileBoxStore.showFileBox = true;
|
||||
let flag = true;
|
||||
fileStore.receiveData.forEach((file: any) => {
|
||||
if (file.code === res.data.data.code) {
|
||||
flag = false;
|
||||
return;
|
||||
}
|
||||
});
|
||||
if (flag) {
|
||||
fileStore.addReceiveData(res.data.data);
|
||||
}
|
||||
} else {
|
||||
alert(res.data.msg||'未知错误')
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user