123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>消息列表-消息中心-创业帮</title>
- <meta name="keywords" content="消息列表-消息中心-创业帮">
- <meta name="description" content="消息列表-消息中心-创业帮">
- <meta content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,shrink-to-fit=no,user-scalable=no" name="viewport" viewport="cover">
- <meta name="apple-mobile-web-app-capable" content="yes">
- <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
- <meta content="telephone=no" name="format-detection">
- <meta content="email=no" name="format-detection">
- <meta name="apple-mobile-web-app-title" content="消息列表-消息中心-创业帮">
- <meta http-equiv="Cache-Control" content="no-siteapp">
- <link rel="stylesheet" href="./static/css/main.css">
- </head>
- <body class="back-color pb0 bgcf7f7f7">
- <div id="app" v-cloak>
- <van-nav-bar class="user_rank_explan_title user_title_normal" :title="noticetype" v-if="toptitleisshow" @click-left="goback" left-arrow>
- <template #left> <img src="./static/images/left.png" alt=""></template>
- </van-nav-bar>
- <div class="notice-list">
- <van-pull-refresh v-model="refreshing" @refresh="onRefresh" :class="noticelist.length === 0 ? 'isnodata':''">
- <van-empty class="custom-image" image="./static/images/no-data.png" description="暂无数据" v-if="noticelist.length === 0"> </van-empty>
- <ul class="pt16 pl16 pr16">
- <van-empty class="custom-image" image="./static/images/empty-img.png" description="暂无数据" v-if="isnodata"></van-empty>
- <van-list v-model="loading" :finished="finished" finished-text="没有更多数据了" @load="onLoad" :immediate-check="false">
- <li class="mb20" v-for="item,index in noticelist" :key="item.Id" @click="articledetail(item.Id,item.MsgType,item.Url,index)">
- <div class="tc">
- <div class="notice-time dib"><span class="cfff db">{{item.CreateDate}}</span></div>
- </div>
- <div class="notice-box pt16 ovh">
- <div class="notice-title">
- <div class="dib rel pr6" v-if="item.ReadFlag !== 1">
- <van-badge content=" " dot></van-badge>
- </div><span class="f16 c333">{{item.Title}}</span>
- </div>
- <div class="notice-img pt8" v-if="item.BgPic !== ''"><img class="db" :src="PublicLib.CachePicture({picUrl:item.BgPic,domid:'noticeimg' + index})" :id="'noticeimg' + index" style="width:100%;"></div>
- <div class="notice-info pt8 pb16"><span class="f12 c999">{{item.CreateDate}} {{item.Title}}</span></div>
- <div class="notice-btn van-hairline--top" v-if="item.MsgType !== 2">
- <van-cell title="查看详情" is-link></van-cell>
- </div>
- </div>
- </li>
- </van-list>
- </ul>
- </van-pull-refresh>
- </div>
- </div>
- <script src="./static/js/klm-vv.min.js"></script>
- <script src="./static/js/klm-axios-config.js"></script>
- <script>
- // 通过 CDN 引入时不会自动注册 Lazyload 组件
- // 可以通过下面的方式手动注册
- Vue.use(vant.Lazyload);
-
- // 在 #app 标签下渲染一个按钮组件
- let app = new Vue({
- el: '#app',
- data() {
- return {
- isnodata:false,
- toptitleisshow:false,
- noticetype:'消息',
- noticelist:[],
- //- 滚动加载
- loading: false,
- finished: false,
- //- 刷新
- refreshing: false,
- pageinfo:{
- PageSize:10,
- PageNum:1
- }
- };
- },
- created() {
- this.toptitleisshow = toptitleisshow;
- this.noticetype = PublicLib.getCookieInfo('noticeType');
- this.getnoticelist();
- },
- methods: {
- onLoad() {
- if (this.refreshing) {
- this.noticelist = [];
- this.refreshing = false;
- this.pageinfo.PageNum = 0;
- };
- this.pageinfo.PageNum++;
- this.getnoticelist();
- },
- onRefresh() {
- // 清空列表数据
- this.finished = false;
- // 重新加载数据
- // 将 loading 设置为 true,表示处于加载状态
- this.loading = true;
- this.onLoad();
- },
- async getnoticelist(){
- //- PublicLib.ShowLoading({Message:''});
- let requestUrl = '';
- if(PublicLib.getCookieInfo('noticeType') === '个人消息'){
- requestUrl = '/api/v1/msgpersonal/list?t='+Math.random(6);
- }else{
- requestUrl = '/api/v1/msgplacard/list?t='+Math.random(6);
- };
- const UserId = PublicLib.getCookieInfo('userId');
- const res = await getRequest(requestUrl,JSON.stringify({UserId,...this.pageinfo}));
- if(res.status === 1) {
- PublicLib.HideLoading();
- if(res.data.length < this.pageinfo.PageSize) {
- this.finished = true;
- };
- this.noticelist.push(...res.data);
- //- console.log(res)
- this.loading = false;
- if(this.noticelist.length === 0) {this.isnodata = true}else{this.isnodata = false};
- res.data.forEach(item=>{
- PublicLib.CachePicture({picUrl:item.BgPic});
- });
- }
- },
- goback(){
- PublicLib.GoBack({Level:1});
- },
- articledetail(id,type,url,index){
- if(type === 2){
- this.readflag(id,index);
- }else if(type === 0){
- PublicLib.putCookieInfo('noticeArticleDetail', id);
- PublicLib.Goto({Url:'notice-detail'});
- }else if(type === 1){
- PublicLib.Goto({Url:url});
- };
- },
- //- 标记为已读
- async readflag(Id,index){
- let requestUrl = '';
- if(PublicLib.getCookieInfo('noticeType') === '个人消息'){
- requestUrl = '/api/v1/msgpersonal/read?t='+Math.random(6);
- }else{
- requestUrl = '/api/v1/msgplacard/read?t='+Math.random(6);
- };
- const UserId = PublicLib.getCookieInfo('userId');
- const res = await postRequest(requestUrl,JSON.stringify({UserId,Id}));
- if(res.status === 1) {
- this.noticelist[index].ReadFlag = 1;
- }
- },
- }
- });
- </script>
- </body>
- </html>
|