邓洁 : 修改右上角铃铛通知详情弹窗

This commit is contained in:
邓洁
2023-11-11 18:12:40 +08:00
parent 06c5024af0
commit 275622c432
4 changed files with 57 additions and 21 deletions

View File

@@ -86,8 +86,9 @@ html, body, #app, .el-container, .el-aside, .el-main {
margin-left: 14px;
.el-form-item {
display: flex;
align-items: center;
//display: flex;
//align-items: center;
margin-right: 18px;
}
.el-form-item__label {

View File

@@ -29,15 +29,29 @@
</div>
</template>
</el-popover>
<el-dialog width="1200px" title="通知公告详情" v-model="visible" @close="visible=false">
<el-form :model="viewForm" label-width="100px">
<el-row>
<el-col :span="24" class="title-block">
<el-text class="title">{{ viewForm.noticeTitle }}</el-text>
</el-col>
<el-col :span="24">
<el-text v-if="viewForm.contentType == 'text'">{{ viewForm.noticeContent }}</el-text>
<span v-else v-html="viewForm.noticeContent"></span>
</el-col>
</el-row>
</el-form>
</el-dialog>
</div>
</template>
<script setup>
import {getNotifyList,readAllNotify, readSingleNotify} from "@/api/notice/notify";
import {getNotifyList,getNotifyDetail, readAllNotify, readSingleNotify} from "@/api/notice/notify";
import {getToken} from '@/utils/auth'
import {ElMessage} from "element-plus";
import {useRouter} from "vue-router";
import {defineExpose} from "vue";
// import {defineExpose} from "vue";
const router = useRouter()
const pageInfo = reactive({
pageNum: 1,
@@ -46,10 +60,18 @@ const pageInfo = reactive({
let send = {
type: "ping"
}
const viewForm = ref();
const visible = ref(false);
const showNotify = ref(false);
const total = ref();
const noticeList = ref();
//查看详情
const handleViewDetails = (noticeId) => {
getNotifyDetail(noticeId).then(res => {
visible.value = true
viewForm.value = res.data
})
}
const initWebSocket = () => {
const socket = new WebSocket(import.meta.env.VITE_BASE_WSURL + '/notice-ws/notice')
// 2. ws.send()给服务器发送信息
@@ -108,7 +130,12 @@ searchNotifyList()
const handleToNotifyDetail = (notice, index) => {
noticeList.value.splice(index, 1)
total.value -= 1
router.push({path: `/system/notice/inform/index/${notice.noticeId}`})
viewForm.value={
noticeTitle:'',
noticeContent:''
}
// router.push({path: `/system/notice/inform/index/${notice.noticeId}`})
handleViewDetails(notice.noticeId)
}
//单个已读
@@ -167,6 +194,15 @@ const handleNext = () => {
</script>
<style lang="scss" scoped>
.title-block {
text-align: center;
padding-bottom: 30px;
.title {
font-size: 28px;
font-weight: bold;
}
}
ul::-webkit-scrollbar {
width: 6px;
}

View File

@@ -36,6 +36,15 @@ const tagPath = ref()
watch(route, () => {
init()
})
onMounted(() => {
document.addEventListener('click', nullBlockClick)
})
onBeforeUnmount(() => {
document.removeEventListener('click', nullBlockClick)
})
const nullBlockClick = () => {
visible.value = false
}
const init = () => {
tagsViewStore.addVisitedViews(route)
}

View File

@@ -38,7 +38,6 @@
</div>
<paging :current-page="pageInfo.pageNum" :page-size="pageInfo.pageSize" :page-sizes="[10, 20, 30, 40,50]"
:total="total" @changeSize="handleSizeChange" @goPage="handleCurrentChange"/>
<!-- <bell-socket style="display: none" ref="bellSocket"/>-->
<!--详情弹窗-->
<el-dialog v-model="isViewVisited" title="通知公告详情" width="1200px" @close="handleCloseDialog">
<el-form :model="viewForm" label-width="100px">
@@ -71,22 +70,16 @@ const queryParams = reactive({
state: null
})
const router = useRouter()
// const bellSocket = ref()
const loading = ref(true)
const list = ref([])
const total = ref([]);
const isViewVisited = ref(false);
const viewForm = ref();
const notifyId = reactive(router.currentRoute.value.params.queryId)
const pageInfo = reactive({
pageNum: 1,
pageSize: 10
});
onMounted(()=>{
if(notifyId!==undefined){
handleViewDetails(notifyId)
}
})
//重置搜索
const handleReset = () => {
getList()
@@ -118,9 +111,6 @@ const handleViewDetails = (noticeId) => {
}
//关闭详情弹窗
const handleCloseDialog = () => {
if(notifyId!==undefined){
router.push({path:'/system/notice/inform/index'})
}
isViewVisited.value = false
}
//删除单个消息