| | |
| | | </el-dropdown> |
| | | </div> |
| | | <div class="notice-content" v-loading="loading"> |
| | | <scroll-pagination @load="refresh" :finishLoding="finishLoding"> |
| | | <scroll-pagination @load="refresh" :finishLoding="finishLoding" :list="list"> |
| | | <div class="notice-content-item" v-for="(m,i) in list" :key="i"> |
| | | <div class="btns" v-if="m"> |
| | | <el-dropdown style="margin-right: 20px;" trigger="click" @command="e=>handleDropdown(e,m)" v-if="m.messageType==2||m.messageType==3"> |
| | | <!-- v-if="m.messageType==2||m.messageType==3" --> |
| | | <el-dropdown style="margin-right: 20px;" trigger="click" @command="e=>handleDropdown(e,m)" v-if="false"> |
| | | <span class="el-dropdown-link"> |
| | | <span class="more" style="line-height: 26px;display: inline-block;">···</span> |
| | | </span> |
| | |
| | | </el-dropdown> |
| | | <i class="el-icon-close" style="cursor: pointer;" @click="handleDel(m)"></i> |
| | | </div> |
| | | <div class="content"> |
| | | <div class="content" @click="goNoticeDetail(m)" style="cursor: pointer;"> |
| | | <img :src="`../../static/img/notice-${m.messageType}.svg`" alt="" style="width: 50px;margin-right: 18px;"> |
| | | <div class="content-info"> |
| | | <h4 style="font-weight: normal;margin-bottom: 4px;display: flex;align-items: center;justify-content: space-between;"> |
| | | <span>{{ m.theme }}<el-tag :type="!m.messageStatus?'danger':'success'" size="small" v-if="m.messageType==1||m.messageType==2||m.messageType==3" style="margin-left: 8px;">{{ !m.messageStatus?'未处理':'已处理' }}</el-tag></span> |
| | | <span>{{ m.theme }}<el-tag :type="!m.viewStatus?'danger':'success'" size="small" v-if="m.messageType==1||m.messageType==2||m.messageType==3" style="margin-left: 8px;">{{ !m.viewStatus?'未处理':'已处理' }}</el-tag></span> |
| | | <span class="time" style="color: #999999;font-size: 12px;">{{ m.createTime }}</span> |
| | | </h4> |
| | | <p style="color: #999999;font-size: 14px;margin-bottom: 6px;cursor: pointer;" class="ellipsis-multiline" @click="goNoticeDetail(m)">{{ m.content }}</p> |
| | | <p style="color: #999999;font-size: 14px;margin-bottom: 6px;" class="ellipsis-multiline">{{ m.content }}</p> |
| | | <p style="font-size: 12px;color: #999999;display: flex;align-items: center;justify-content: space-between;"> |
| | | <span>发送人:{{m.createUser}}</span> |
| | | <span>收件人:{{ m.consigneeUser }}</span> |
| | |
| | | pageSize: 8, // 一页7条 |
| | | total: null, |
| | | loading: true, // 组件loading的展示,默认为true |
| | | finishLoding: false // 加载完成,显示已经没有更多了 |
| | | finishLoding: false, // 加载完成,显示已经没有更多了 |
| | | keyMap:{} |
| | | } |
| | | }, |
| | | mounted(){ |
| | | this.getTypeDicts(); |
| | | this.currentPage = 1; |
| | | this.keyMap = {}; |
| | | this.list = []; |
| | | this.refresh(); |
| | | }, |
| | | methods:{ |
| | | refresh(){ |
| | | const key = `_${this.currentPage}` |
| | | const value = this.keyMap[key] |
| | | // 如果value存在,表示缓存有值,那么阻止请求 |
| | | if(value) { |
| | | return |
| | | } |
| | | // value不存在,表示第一次请求,设置占位 |
| | | this.keyMap[key] = 'temp' |
| | | if(this.currentPage==1){ |
| | | this.loading = true |
| | | } |
| | |
| | | p: "abcd" |
| | | },29); |
| | | this.list = []; |
| | | this.keyMap = {}; |
| | | this.currentPage = 1; |
| | | this.refresh(); |
| | | this.$emit('goNoticeDetail') |
| | | }) |
| | | }, |
| | | handleDropdown(e,row){ |
| | |
| | | } |
| | | this.$message.success('删除成功') |
| | | this.list = []; |
| | | this.keyMap = {}; |
| | | this.currentPage = 1; |
| | | this.refresh() |
| | | }).catch(e => { |
| | |
| | | }) |
| | | }).catch(() => {}) |
| | | }, |
| | | // 滚动触底加载 |
| | | scrollFn() { |
| | | let clientHeight = document.documentElement.clientHeight - 18; //可视区域 |
| | | let scrollHeight = document.body.scrollHeight; // 滚动文档高度 |
| | | let scrollTop = parseInt(document.documentElement.scrollTop); // 已滚动的高度 |
| | | let height = 300; |
| | | if ( |
| | | scrollTop + clientHeight >= scrollHeight - height && |
| | | scrollHeight != 0 |
| | | ) { |
| | | if (!this.finishLoding&&this.currentPage*this.pageSize<this.total) { |
| | | this.currentPage = this.currentPage + 1; |
| | | this.refresh(); |
| | | } |
| | | } else { |
| | | return false; |
| | | } |
| | | }, |
| | | throttle(fn, wait) { |
| | | // 封装函数进行节流 |
| | | var timer = null; |
| | | return function () { |
| | | var context = this; |
| | | var args = arguments; |
| | | if (!timer) { |
| | | timer = setTimeout(function () { |
| | | fn.apply(context, args); |
| | | timer = null; |
| | | }, wait); |
| | | } |
| | | }; |
| | | }, |
| | | handleType(){ |
| | | this.list = []; |
| | | this.keyMap = {}; |
| | | this.currentPage = 1; |
| | | this.refresh(); |
| | | }, |
| | |
| | | } |
| | | this.$message.success('操作成功') |
| | | this.list = []; |
| | | this.keyMap = {}; |
| | | this.currentPage = 1; |
| | | this.refresh(); |
| | | }) |
| | | } |
| | | }, |
| | | destroyed() { |
| | | window.removeEventListener("scroll", this.throttle(), false); |
| | | }, |
| | | } |
| | | </script> |