首次完整推送,
V:1.20240808.006
This commit is contained in:
69
apis/ctms/notice.js
Normal file
69
apis/ctms/notice.js
Normal file
@ -0,0 +1,69 @@
|
||||
import request from './_utils/request.js'
|
||||
import apis from './apis.json'
|
||||
import constant from './_utils/constant.js'
|
||||
import storage from './_utils/storage.js'
|
||||
export default {
|
||||
//列表
|
||||
list: function(page = 0, psize = 10) {
|
||||
var data = {
|
||||
page: page,
|
||||
psize: psize, //分页数据大小
|
||||
};
|
||||
var url = apis.NoticeList;
|
||||
var header = {
|
||||
'content-type': 'application/x-www-form-urlencoded'
|
||||
};
|
||||
return request({
|
||||
'url': url,
|
||||
'method': 'POST',
|
||||
'data': data,
|
||||
"headers": header,
|
||||
'params': {}
|
||||
}).then((res) => {
|
||||
switch (res.code) {
|
||||
default:
|
||||
break;
|
||||
case 0:
|
||||
var notices = {};
|
||||
var totalCount = 0;
|
||||
storage.set(constant.noitceList, notices, 'page-' + page);
|
||||
break;
|
||||
case 200:
|
||||
var notices = res.data.notices;
|
||||
var totalCount = res.data.total;
|
||||
storage.set(constant.noticeList, totalCount, 'total');
|
||||
storage.set(constant.noitceList, notices, 'page-' + page);
|
||||
for (var x in notices) {
|
||||
storage.set(constant.noticeDetail, notices[x], notices[x].id);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return res.data;
|
||||
})
|
||||
},
|
||||
|
||||
//详情
|
||||
detail: function(id) {
|
||||
var data = {
|
||||
id: id
|
||||
};
|
||||
var url = apis.NoticeDetail;
|
||||
return request({
|
||||
'url': url,
|
||||
'method': 'POST',
|
||||
'data': data,
|
||||
'params': {}
|
||||
}).then((res) => {
|
||||
if (res.code == 200) {
|
||||
var notice = res.data;
|
||||
storage.set(constant.noticeDetail, notice, id);
|
||||
return res;
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: "信息获取失败!",
|
||||
icon: "fail"
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user