水印、消息管理
This commit is contained in:
parent
46128c8525
commit
879dfb8a74
@ -17,6 +17,7 @@
|
||||
import { useLockscreenStore } from '@/store/modules/lockscreen';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { PageEnum } from '@/enums/pageEnum';
|
||||
import Watermark from '@/utils/wartermark';
|
||||
|
||||
const route = useRoute();
|
||||
const useLockscreen = useLockscreenStore();
|
||||
@ -49,9 +50,9 @@
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
// document.addEventListener('mousedown', timekeeping);
|
||||
const waterText = import.meta.env.VITE_GLOB_APP_TITLE;
|
||||
Watermark.set(waterText)
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
// document.removeEventListener('mousedown', timekeeping);
|
||||
});
|
||||
|
@ -384,7 +384,7 @@
|
||||
await nextTick();
|
||||
const headEl = tableEl.querySelector('.el-table__header-wrapper');
|
||||
const { bottomIncludeBody } = getViewportOffset(headEl);
|
||||
let headerH = 40;
|
||||
let headerH = 30;
|
||||
let paginationH = 0;
|
||||
let marginH = 0;
|
||||
if (!isBoolean(pagination.value)) {
|
||||
|
47
src/utils/wartermark.ts
Normal file
47
src/utils/wartermark.ts
Normal file
@ -0,0 +1,47 @@
|
||||
// 页面添加水印效果
|
||||
const setWatermark = (str: string) => {
|
||||
const id = '1.23452384164.123412416';
|
||||
if (document.getElementById(id) !== null) document.body.removeChild(<HTMLElement>document.getElementById(id));
|
||||
const can = document.createElement('canvas');
|
||||
can.width = 200;
|
||||
can.height = 130;
|
||||
const cans = <CanvasRenderingContext2D>can.getContext('2d');
|
||||
cans.rotate((-20 * Math.PI) / 180);
|
||||
cans.font = '12px Vedana';
|
||||
cans.fillStyle = 'rgba(200, 200, 200, 0.30)';
|
||||
cans.textBaseline = 'middle';
|
||||
cans.fillText(str, can.width / 10, can.height / 2);
|
||||
const div = document.createElement('div');
|
||||
div.id = id;
|
||||
div.style.pointerEvents = 'none';
|
||||
div.style.top = '0px';
|
||||
div.style.left = '0px';
|
||||
div.style.position = 'fixed';
|
||||
div.style.zIndex = '10000000';
|
||||
div.style.width = `${document.documentElement.clientWidth}px`;
|
||||
div.style.height = `${document.documentElement.clientHeight}px`;
|
||||
div.style.background = `url(${can.toDataURL('image/png')}) left top repeat`;
|
||||
document.body.appendChild(div);
|
||||
return id;
|
||||
};
|
||||
|
||||
/**
|
||||
* 页面添加水印效果
|
||||
* @method set 设置水印
|
||||
* @method del 删除水印
|
||||
*/
|
||||
const watermark = {
|
||||
// 设置水印
|
||||
set: (str: string) => {
|
||||
let id = setWatermark(str);
|
||||
if (document.getElementById(id) === null) id = setWatermark(str);
|
||||
},
|
||||
// 删除水印
|
||||
del: () => {
|
||||
let id = '1.23452384164.123412416';
|
||||
if (document.getElementById(id) !== null) document.body.removeChild(<HTMLElement>document.getElementById(id));
|
||||
},
|
||||
};
|
||||
|
||||
// 导出方法
|
||||
export default watermark;
|
@ -1,23 +1,21 @@
|
||||
<template>
|
||||
<PageWrapper>
|
||||
<el-row :gutter="10" class="mt-3">
|
||||
<el-col :xs="24" :sm="24" :md="3" :lg="3" :xl="3">
|
||||
<el-card shadow="hover" class="mb-4 border-0 proCard" :style="{ height: docHeight + 'px' }">
|
||||
<div
|
||||
<el-card shadow="never" size="small" class="proCard tabsCard">
|
||||
<el-tabs v-model="activeName" @tab-change="handleClick">
|
||||
<el-tab-pane
|
||||
:name="item.value"
|
||||
v-for="(item, index) in messageTypeList"
|
||||
:key="index"
|
||||
@click="handleClick(item, index)"
|
||||
class="type-item"
|
||||
:class="index == activeIndex ? 'active' : ''"
|
||||
>
|
||||
<template #label>
|
||||
<span class="custom-tabs-label">
|
||||
<el-badge :value="item.number ? item.number : ''" :max="99" class="item">
|
||||
<span class="t1">{{ item.name }}</span>
|
||||
</el-badge>
|
||||
</div>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :xs="24" :sm="24" :md="21" :lg="21" :xl="21">
|
||||
<el-card shadow="hover" class="mb-4 border-0 proCard">
|
||||
</span>
|
||||
</template>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<BasicTable
|
||||
:columns="columns"
|
||||
:request="loadDataTable"
|
||||
@ -39,8 +37,6 @@
|
||||
</template>
|
||||
</BasicTable>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<editDialog
|
||||
v-if="editVisible"
|
||||
:messageId="messageId"
|
||||
@ -64,7 +60,7 @@
|
||||
const editDialog = defineAsyncComponent(() => import('./edit.vue'));
|
||||
const messageId = ref(0);
|
||||
const docHeight = ref(500);
|
||||
const activeIndex = ref(0);
|
||||
const activeName = ref(1);
|
||||
const messageTypeList = ref([
|
||||
{
|
||||
name: '系统通知',
|
||||
@ -118,7 +114,7 @@
|
||||
|
||||
const loadDataTable = async (res: any) => {
|
||||
const result = await getMessageProfile({ ...formParams, ...res });
|
||||
let item = messageTypeList.value.find((item, index) => index == activeIndex.value);
|
||||
let item = messageTypeList.value.find((item, index) => item.value == activeName.value);
|
||||
item.number = result.number;
|
||||
return result;
|
||||
};
|
||||
@ -126,9 +122,9 @@
|
||||
function reloadTable(noRefresh = '') {
|
||||
tableRef.value.reload(noRefresh ? {} : { pageNo: 1 });
|
||||
}
|
||||
const handleClick = (item, index) => {
|
||||
activeIndex.value = index;
|
||||
formParams.type = item.value;
|
||||
const handleClick = (e) => {
|
||||
activeName.value = e
|
||||
formParams.type = activeName.value;
|
||||
reloadTable();
|
||||
};
|
||||
|
||||
@ -166,32 +162,8 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.type-item {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
padding: 0 6px;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
.t1 {
|
||||
width: 100px;
|
||||
display: block;
|
||||
}
|
||||
&.active {
|
||||
background-color: #e8f1ff;
|
||||
border-radius: 3px;
|
||||
.t1 {
|
||||
color: #1677ff;
|
||||
.t2 {
|
||||
background-color: #ff4d4f;
|
||||
color: #ffffff;
|
||||
}
|
||||
}
|
||||
}
|
||||
.el-badge__content.is-fixed {
|
||||
top: 20px;
|
||||
right: calc(-10px + var(--el-badge-size) / 2);
|
||||
}
|
||||
<style lang="scss" scoped>
|
||||
:deep(.proCard.tabsCard .el-card__body) {
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
</style>
|
||||
|
@ -104,7 +104,7 @@
|
||||
size: 10,
|
||||
count: configDataList.value.length,
|
||||
});
|
||||
const fwbHeight = document.body.clientHeight - 370;
|
||||
const fwbHeight = document.body.clientHeight - 360;
|
||||
|
||||
/**
|
||||
* 执行添加
|
||||
|
@ -122,7 +122,7 @@
|
||||
size: 20,
|
||||
count: dictDataList.value.length,
|
||||
});
|
||||
const fwbHeight = document.body.clientHeight - 370;
|
||||
const fwbHeight = document.body.clientHeight - 360;
|
||||
|
||||
/**
|
||||
* 执行添加
|
||||
|
@ -126,7 +126,7 @@
|
||||
});
|
||||
const cacheName = ref('');
|
||||
const cacheKey = ref('');
|
||||
const fwbHeight = document.body.clientHeight - 230;
|
||||
const fwbHeight = document.body.clientHeight - 220;
|
||||
|
||||
/**
|
||||
* 选择缓存名
|
||||
|
@ -73,7 +73,7 @@
|
||||
size: 10,
|
||||
count: onlineTableData.value.length,
|
||||
});
|
||||
const fwbHeight = document.body.clientHeight - 340;
|
||||
const fwbHeight = document.body.clientHeight - 330;
|
||||
|
||||
/**
|
||||
* 加载数据列表
|
||||
|
Loading…
Reference in New Issue
Block a user