add:vue-i18n,admin add file size

This commit is contained in:
lan
2023-09-06 11:06:18 +08:00
parent 5d08819529
commit dcdad7ce2e
40 changed files with 770 additions and 427 deletions
+15 -11
View File
@@ -11,6 +11,10 @@ const fileBoxStore = useFileBoxStore();
import QrcodeVue from "qrcode.vue";
import { useRoute } from "vue-router";
import { ref } from "vue";
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
import { ElMessage } from "element-plus";
const openUrl = (url: string) => {
if (url.startsWith('/')) {
@@ -21,7 +25,7 @@ const openUrl = (url: string) => {
const route = useRoute();
const copyText = (text: any, style = 0) => {
ElMessage.success('复制成功')
ElMessage.success(t('fileBox.copySuccess'));
if (style === 1) {
text = window.location.origin + '/#/?code=' + text;
}
@@ -62,29 +66,29 @@ function renderMarkdown(message: string) {
<el-drawer :append-to-body="true" v-model="fileBoxStore.showFileBox" direction="btt" style="max-width: 1080px;margin: auto;"
size="400">
<template #header>
<h4>文件箱</h4>
<h4>{{t('fileBox.fileBox')}}</h4>
</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="文本详情"
:title="t('fileBox.textDetail')"
width="70%"
style="height: 70%;overflow-y: scroll"
v-model="showTextDetailVisible"
>
<div style="max-width: 100%;overflow-y: scroll" v-html="renderMarkdown(nowText)"></div>
<template #footer>
<el-button type="success" @click="copyText(nowText);showTextDetailVisible = false"> </el-button>
<el-button type="primary" @click="showTextDetailVisible = false"> </el-button>
<el-button type="success" @click="copyText(nowText);showTextDetailVisible = false">{{t('fileBox.copy')}}</el-button>
<el-button type="primary" @click="showTextDetailVisible = false">{{ t('fileBox.close') }}</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">
<h4 style="width: 6rem;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">{{ value.name }}</h4>
<el-button size="small" type="danger" @click="fileStore.deleteReceiveData(index)">删除</el-button>
<el-button size="small" type="danger" @click="fileStore.deleteReceiveData(index)">{{ t('fileBox.delete') }}</el-button>
</div>
</template>
<div style="width: 200px;">
@@ -94,9 +98,9 @@ function renderMarkdown(message: string) {
<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);">
点击下载
{{ t('fileBox.download') }}
</el-tag>
<el-tag v-else size="large" type="success" style="cursor: pointer" @click="showTextDetail(value.text);">查看详情</el-tag>
<el-tag v-else size="large" type="success" style="cursor: pointer" @click="showTextDetail(value.text);">{{ t('fileBox.detail') }}</el-tag>
</div>
</div>
</div>
@@ -107,17 +111,17 @@ function renderMarkdown(message: string) {
<template #header>
<div style="display: flex;justify-content: space-between">
<h4 style="width: 6rem;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">{{ value.name }}</h4>
<el-button size="small" type="danger" @click="fileStore.deleteShareData(index)">删除</el-button>
<el-button size="small" type="danger" @click="fileStore.deleteShareData(index)">{{ t('fileBox.delete') }}</el-button>
</div>
</template>
<div style="width: 200px;">
<el-progress v-if="value.status!='success' && value.status!='fail'" striped :percentage="value.percentage" :text-inside="true"
:stroke-width="20"></el-progress>
<div style="display: flex;justify-content: space-between">
<div v-else style="display: flex;justify-content: space-between">
<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 size="large" type="success" style="cursor: pointer" @click="copyText(value.code,1);">复制链接
<el-tag size="large" type="success" style="cursor: pointer" @click="copyText(value.code,1);">{{ t('fileBox.copyLink') }}
</el-tag>
</div>
</div>