feat: 前端增加 msg-info 组件

pull/203/head
zhengkunwang223 2023-03-13 14:27:49 +08:00 committed by zhengkunwang223
parent 2fbddf3f30
commit e36cbb0eb7
5 changed files with 54 additions and 13 deletions

View File

@ -80,6 +80,7 @@ declare module 'vue' {
Loading: typeof import('element-plus/es')['ElLoadingDirective'] Loading: typeof import('element-plus/es')['ElLoadingDirective']
Logo: typeof import('./src/components/app-layout/menu/components/Logo.vue')['default'] Logo: typeof import('./src/components/app-layout/menu/components/Logo.vue')['default']
Menu: typeof import('./src/components/app-layout/menu/index.vue')['default'] Menu: typeof import('./src/components/app-layout/menu/index.vue')['default']
MsgInfo: typeof import('./src/components/msg-info/index.vue')['default']
Popover: typeof import('element-plus/es')['ElPopoverDirective'] Popover: typeof import('element-plus/es')['ElPopoverDirective']
RouterButton: typeof import('./src/components/router-button/index.vue')['default'] RouterButton: typeof import('./src/components/router-button/index.vue')['default']
Status: typeof import('./src/components/status/index.vue')['default'] Status: typeof import('./src/components/status/index.vue')['default']

View File

@ -0,0 +1,34 @@
<template>
<el-tooltip placement="top-start">
<template #content>
<div class="info-break" :style="{ width: width + 'px' }">{{ info }}</div>
</template>
<div class="info-hidden" :style="{ width: width + 'px' }">{{ info }}</div>
</el-tooltip>
</template>
<script lang="ts" setup>
defineProps({
width: {
type: String,
default: '100',
},
info: {
type: String,
default: '',
},
});
</script>
<style scoped>
.info-hidden {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.info-break {
width: 100px;
word-break: break-all;
word-wrap: break-word;
}
</style>

View File

@ -286,3 +286,4 @@
font-size: 14px; font-size: 14px;
color: #646a73; color: #646a73;
} }

View File

@ -7,9 +7,8 @@
:title="$t('file.downloadProcess')" :title="$t('file.downloadProcess')"
> >
<div v-for="(value, index) in res" :key="index"> <div v-for="(value, index) in res" :key="index">
<span> <span>{{ value['percent'] === 100 ? $t('file.downlodSuccess') : $t('file.downloading') }}</span>
{{ value['percent'] === 100 ? $t('file.downlodSuccess') : $t('file.downloading') }} {{ value['name'] }} <MsgInfo :info="value['name']" width="250" />
</span>
<el-progress v-if="value['total'] == 0" :percentage="100" :indeterminate="true" :duration="1" /> <el-progress v-if="value['total'] == 0" :percentage="100" :indeterminate="true" :duration="1" />
<el-progress v-else :text-inside="true" :stroke-width="15" :percentage="value['percent']"></el-progress> <el-progress v-else :text-inside="true" :stroke-width="15" :percentage="value['percent']"></el-progress>
<span> <span>
@ -24,6 +23,7 @@
import { FileKeys } from '@/api/modules/files'; import { FileKeys } from '@/api/modules/files';
import { computeSize } from '@/utils/util'; import { computeSize } from '@/utils/util';
import { onBeforeUnmount, ref, toRefs } from 'vue'; import { onBeforeUnmount, ref, toRefs } from 'vue';
import MsgInfo from '@/components/msg-info/index.vue';
const props = defineProps({ const props = defineProps({
open: { open: {
@ -63,8 +63,8 @@ const onClose = () => {};
const initProcess = () => { const initProcess = () => {
let href = window.location.href; let href = window.location.href;
let protocol = href.split('//')[0] === 'http:' ? 'ws' : 'wss'; let protocol = href.split('//')[0] === 'http:' ? 'ws' : 'wss';
let ipLocal = href.split('//')[1].split('/')[0]; // let ipLocal = href.split('//')[1].split('/')[0];
processSocket = new WebSocket(`${protocol}://${ipLocal}/api/v1/files/ws`); processSocket = new WebSocket(`${protocol}://localhost:9999/api/v1/files/ws`);
processSocket.onopen = onOpenProcess; processSocket.onopen = onOpenProcess;
processSocket.onmessage = onMessage; processSocket.onmessage = onMessage;
processSocket.onerror = onerror; processSocket.onerror = onerror;

View File

@ -76,8 +76,13 @@
<template #default="{ row }"> <template #default="{ row }">
<el-button link :icon="Promotion" @click="openUrl(row)"></el-button> <el-button link :icon="Promotion" @click="openUrl(row)"></el-button>
<span> <span>
<el-link type="primary" :underline="false" @click="openConfig(row.id)"> <el-link
<span style="margin-left: 10px">{{ row.primaryDomain }}</span> style="margin-left: 10px"
type="primary"
:underline="false"
@click="openConfig(row.id)"
>
<MsgInfo :info="row.primaryDomain" width="120" />
</el-link> </el-link>
</span> </span>
</template> </template>
@ -104,12 +109,11 @@
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column :label="$t('website.remark')" fix prop="remark">
:label="$t('website.remark')" <template #default="{ row }">
show-overflow-tooltip <MsgInfo :info="row.remark" width="120" />
fix </template>
prop="remark" </el-table-column>
></el-table-column>
<el-table-column :label="$t('website.protocol')" prop="protocol"></el-table-column> <el-table-column :label="$t('website.protocol')" prop="protocol"></el-table-column>
<el-table-column :label="$t('website.expireDate')"> <el-table-column :label="$t('website.expireDate')">
<template #default="{ row, $index }"> <template #default="{ row, $index }">
@ -187,6 +191,7 @@ import { dateFormatSimple } from '@/utils/util';
import { MsgSuccess } from '@/utils/message'; import { MsgSuccess } from '@/utils/message';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { Promotion, VideoPlay, VideoPause } from '@element-plus/icons-vue'; import { Promotion, VideoPlay, VideoPause } from '@element-plus/icons-vue';
import MsgInfo from '@/components/msg-info/index.vue';
const shortcuts = [ const shortcuts = [
{ {