mutations.js
1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import * as Types from './types';
export default {
[Types.FETCH_NOTICE_LIST_REQUEST](state, { page }) {
console.log("page:"+page+"==="+state.fetchNoticeList)
state.fetchNoticeList = false;
if (page === 1) {
state.fetchNoticeLastedTime = 0;
state.fetchNoticePage = 1;
// state.noticeList.length = 0;
}
},
[Types.FETCH_NOTICE_LIST_SUCCESS](state, { data }) {
state.fetchNoticeList = false;
state.fetchNoticePage += 1;
state.fetchNoticeLastedTime = data.lastedTime;
const noticeList = data.noticeList || [];
if (noticeList.length) {
noticeList.forEach(val => {
// if (/imageView/.test(val.topicImageUrl) && !/format/.test(val.topicImageUrl)) {
// val.topicImageUrl += '/format/jpg';
// }
state.noticeList.push(val);
if (!state.noticeInfo[val.id]) {
state.noticeInfo[val.id] = {
//根据接口key 修改
topicId: val.id,
topicName: val.topicName,
topicImageUrl: val.topicImageUrl,
topicDesc: val.topicDesc
};
}
});
}
},
[Types.FETCH_NOTICE_LIST_FAILD](state) {
state.fetchNoticeList = false;
},
}