|
|
import { makeAutoObservable, runInAction } from "mobx";
|
|
|
import * as config from "@/config";
|
|
|
|
|
|
class Notice {
|
|
|
constructor(root) {
|
|
|
makeAutoObservable(this, { rootStore: false });
|
|
|
this.root = root;
|
|
|
}
|
|
|
|
|
|
noticeList = []; //公告列表
|
|
|
noticeUnRead = 0; //未读公告数量
|
|
|
noticeInfo = { CCP_BLID: 0, CCP_BLTitle: "", CCP_BLContent: "", CCP_LastEditTime: "" }; //公告详情
|
|
|
|
|
|
/* 查询公告列表
|
|
|
LMI_SN 登录用户SN,用户sn用来判断是否已读公告
|
|
|
*/
|
|
|
getBulletinList(LMI_SN) {
|
|
|
let url = `/service-Cooperate/Cooperate/GetBulletinList`;
|
|
|
url += `?LMI_SN=${LMI_SN}`;
|
|
|
url+=`&token=${this.root.authStore.login.token}`;
|
|
|
fetch(config.HT_HOST + url)
|
|
|
.then(response => response.json())
|
|
|
.then(json => {
|
|
|
runInAction(() => {
|
|
|
this.noticeList = json.Result;
|
|
|
});
|
|
|
})
|
|
|
.catch(error => {
|
|
|
console.log("fetch data failed", error);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/* 查询反馈表信息
|
|
|
LMI_SN 登录用户sn 用户sn用来设置已读公告,请求过一次详情页表示已读
|
|
|
CCP_BLID 公告sn
|
|
|
*/
|
|
|
getNoticeDetail(LMI_SN, CCP_BLID) {
|
|
|
let url = `/service-Cooperate/Cooperate/GetBulletinDetail`;
|
|
|
url += `?LMI_SN=${LMI_SN}&CCP_BLID=${CCP_BLID}`;
|
|
|
url+=`&token=${this.root.authStore.login.token}`;
|
|
|
fetch(config.HT_HOST + url)
|
|
|
.then(response => response.json())
|
|
|
.then(json => {
|
|
|
console.log(json);
|
|
|
runInAction(() => {
|
|
|
this.noticeInfo = json.Result;
|
|
|
});
|
|
|
})
|
|
|
.catch(error => {
|
|
|
console.log("fetch data failed", error);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
//检查是否有未读公告
|
|
|
getBulletinUnReadCount(LMI_SN) {
|
|
|
let url = `/service-Cooperate/Cooperate/GetBulletinUnReadCount`;
|
|
|
url += `?LMI_SN=${LMI_SN}`;
|
|
|
url+=`&token=${this.root.authStore.login.token}`;
|
|
|
fetch(config.HT_HOST + url)
|
|
|
.then(response => response.json())
|
|
|
.then(json => {
|
|
|
console.log(json);
|
|
|
runInAction(() => {
|
|
|
this.noticeUnRead = json.Result.CCP_BulletinCount;
|
|
|
});
|
|
|
})
|
|
|
.catch(error => {
|
|
|
console.log("fetch data failed", error);
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
export default Notice;
|