1.优化2.0消息中心列表

yj-dev
杨杰 2 years ago
parent 416f0a02c2
commit 127cd4a533
  1. 4
      Utils/Api.js
  2. 50
      pages/user/news/news.vue

@ -171,8 +171,8 @@ export const getDiscountByCode = params => {
//站内信列表 //站内信列表
export const queryMsgByList = params => { export const getMsgByList = params => {
return POST('GET', `${base}/bsMsg/queryMsgByList`, params).then(res => res.data); return POST('GET', `${base}//bsMsg/getMsgByList`, params).then(res => res.data);
} }
// 根据优惠券查卡券 // 根据优惠券查卡券
export const getCouponByDiscount = params => { export const getCouponByDiscount = params => {

@ -3,14 +3,14 @@
<!-- 顶部类型 --> <!-- 顶部类型 -->
<scroll-view scroll-x='true' class="srollview width100" :style="{top:headerTop}" scroll-with-animation> <scroll-view scroll-x='true' class="srollview width100" :style="{top:headerTop}" scroll-with-animation>
<view class="conent" :class="[newstypeid == item.codeValue ? 'activeconent' : 'frontconent']" <view class="conent" :class="[newstypeid == item.codeValue ? 'activeconent' : 'frontconent']"
v-for="(item,index) in newsTyplist" :key="index" @click="queryMsgByList(item.codeValue)"> v-for="(item,index) in newsTyplist" :key="index" @click="changeValue(item.codeValue)">
{{item.codeName}}</view> {{item.codeName}}
</view>
</scroll-view> </scroll-view>
<view class="mart10 height70"></view> <view class="mart10 height70"></view>
<!-- 内容 --> <!-- 内容 -->
<view v-if="newsList == ''" <view v-if="newsList == ''" class="mart60 fotct font14 fcor666">
class="mart60 fotct font14 fcor666">
<image mode="widthFix" style="width: 70vw;" :src="imagewxUrl+imgadres"></image> <image mode="widthFix" style="width: 70vw;" :src="imagewxUrl+imgadres"></image>
</view> </view>
<view class="newscont width90 border-8r backcorfff mart20" v-for="(item,index) in newsList" :key="index"> <view class="newscont width90 border-8r backcorfff mart20" v-for="(item,index) in newsList" :key="index">
@ -73,7 +73,7 @@
<script> <script>
import { import {
queryMsgByList, getMsgByList,
getDictionaryByCodeType getDictionaryByCodeType
} from '../../../Utils/Api.js'; } from '../../../Utils/Api.js';
let app = getApp(); let app = getApp();
@ -86,7 +86,10 @@
newsTyplist: [], // newsTyplist: [], //
newsList: [], // newsList: [], //
newstypeid: 1, //id newstypeid: 1, //id
headerTop: '0px' headerTop: '0px',
pageNum: 1,
pageSize: 10,
isNoMoreData: false,
} }
}, },
filters: { filters: {
@ -104,6 +107,9 @@
onShow() { onShow() {
this.getDictionaryByCodeType(); this.getDictionaryByCodeType();
}, },
onReachBottom() {
this.getMsgByList();
},
methods: { methods: {
// //
getDictionaryByCodeType() { getDictionaryByCodeType() {
@ -114,20 +120,40 @@
if (res.return_code == '000000') { if (res.return_code == '000000') {
this.newsTyplist = res.return_data; this.newsTyplist = res.return_data;
this.newstypeid = res.return_data[0].codeValue; this.newstypeid = res.return_data[0].codeValue;
this.queryMsgByList(res.return_data[0].codeValue); this.getMsgByList(res.return_data[0].codeValue);
} }
}) })
}, },
//
changeValue(item) {
this.pageNum = 1;
this.newsList = [];
this.isNoMoreData = false;
this.getMsgByList(item);
},
// //
queryMsgByList(item) { getMsgByList(item) {
this.newstypeid = item; this.newstypeid = item;
if (this.isNoMoreData) {
uni.hideLoading()
return false;
}
let pagenum = this.pageNum;
let datas = { let datas = {
companyId: app.globalData.companyId, companyId: app.globalData.companyId,
type: item type: item,
pageNum: this.pageNum,
pageSize: this.pageSize
}
getMsgByList(datas).then(res => {
if (res.return_code == '000000' && res.return_data.list != '') {
this.newsList = res.return_data.list;
this.isNoMoreData = res.return_data.list.length == this.pageSize ? false : true;
if (res.return_data.total == (this.pageNum * this.pageSize)) {
this.isNoMoreData = true;
} }
queryMsgByList(datas).then(res => { this.newsList = this.newsList.concat(res.return_data.list);
if (res.return_code == '000000' && res.return_data) { this.pageNum = res.return_data.list.length == this.pageSize ? ++pagenum : pagenum;
this.newsList = res.return_data;
} else { } else {
this.newsList = []; this.newsList = [];
} }

Loading…
Cancel
Save