77 lines
2.3 KiB
JavaScript
77 lines
2.3 KiB
JavaScript
/**
|
|
* @Author: 嗨噜客(三亚)<fm453>
|
|
* @Date: 2023-07-19 16:03:07
|
|
* @FilePath: apis/ctms/notice.js
|
|
* @Description:
|
|
* @Email: 393213759@qq.com
|
|
* Copyright (c) 2025 by www.hiluker.cn, All Rights Reserved.
|
|
*/
|
|
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"
|
|
});
|
|
}
|
|
})
|
|
}
|
|
} |