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

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; margin-left: 14px;
.el-form-item { .el-form-item {
display: flex; //display: flex;
align-items: center; //align-items: center;
margin-right: 18px;
} }
.el-form-item__label { .el-form-item__label {

View File

@@ -29,15 +29,29 @@
</div> </div>
</template> </template>
</el-popover> </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> </div>
</template> </template>
<script setup> <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 {getToken} from '@/utils/auth'
import {ElMessage} from "element-plus"; import {ElMessage} from "element-plus";
import {useRouter} from "vue-router"; import {useRouter} from "vue-router";
import {defineExpose} from "vue"; // import {defineExpose} from "vue";
const router = useRouter() const router = useRouter()
const pageInfo = reactive({ const pageInfo = reactive({
pageNum: 1, pageNum: 1,
@@ -46,10 +60,18 @@ const pageInfo = reactive({
let send = { let send = {
type: "ping" type: "ping"
} }
const viewForm = ref();
const visible = ref(false);
const showNotify = ref(false); const showNotify = ref(false);
const total = ref(); const total = ref();
const noticeList = ref(); const noticeList = ref();
//查看详情
const handleViewDetails = (noticeId) => {
getNotifyDetail(noticeId).then(res => {
visible.value = true
viewForm.value = res.data
})
}
const initWebSocket = () => { const initWebSocket = () => {
const socket = new WebSocket(import.meta.env.VITE_BASE_WSURL + '/notice-ws/notice') const socket = new WebSocket(import.meta.env.VITE_BASE_WSURL + '/notice-ws/notice')
// 2. ws.send()给服务器发送信息 // 2. ws.send()给服务器发送信息
@@ -105,10 +127,15 @@ const searchNotifyList = () => {
searchNotifyList() searchNotifyList()
//点击名字跳转到详情页 //点击名字跳转到详情页
const handleToNotifyDetail = (notice,index) => { const handleToNotifyDetail = (notice, index) => {
noticeList.value.splice(index,1) noticeList.value.splice(index, 1)
total.value-=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> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.title-block {
text-align: center;
padding-bottom: 30px;
.title {
font-size: 28px;
font-weight: bold;
}
}
ul::-webkit-scrollbar { ul::-webkit-scrollbar {
width: 6px; width: 6px;
} }

View File

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

View File

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