fix:修改公告内容

This commit is contained in:
lixg
2022-12-19 21:44:20 +08:00
parent 23f3d134c5
commit 360b068a1b
4 changed files with 57 additions and 32 deletions

View File

@@ -4,11 +4,11 @@
<div class="noticeTitle">
<!-- <div class="notitle"><span class="titlespan">公告</span></div> -->
<div class="switch">
<a-switch v-model:checked="noticeChecked" @click="noticeFlag" size="small" /><span
style="margin-left: 16px"
>
开启
</span>
<a-switch
v-model:checked="noticeChecked"
@click="noticeFlag"
size="small"
/><span style="margin-left: 16px"> 开启 </span>
</div>
<template v-if="noticeChecked">
<p>当前公告内容</p>
@@ -23,10 +23,8 @@
</template>
<!-- 编辑 -->
<template v-if="editOn">
<div class="txt-content">
{{ noticeContent1 ? noticeContent1 : "暂无公告" }}
<div class="txt-content">
{{ noticeContent1 ? noticeContent1 : "暂无公告" }}
</div>
<p>编辑新公告</p>
<a-textarea
@@ -74,29 +72,30 @@ export default {
state.projectInfo = res.data.data.projectInfo;
state.noticeContent1 = state.projectInfo.notice;
state.noticeContent = state.projectInfo.notice;
state.noticeChecked = state.projectInfo.noticeFlag==0?false:true;
state.noticeChecked = state.projectInfo.noticeFlag == 0 ? false : true;
});
console.log("state.noticeChecked",state.noticeChecked);
console.log("state.noticeChecked", state.noticeChecked);
};
const handleEdit = () => {
state.editOn = true;
};
const handleCancel = () => {
state.editOn = false;
};
const noticeFlag =()=>{
const noticeFlag = () => {
//state.noticeChecked = !state.noticeChecked;
console.log("111",state.projectInfo);
state.projectInfo.noticeFlag = state.noticeChecked?1:0;
editProj(state.projectInfo).then((res)=>{
console.log("res",res.data.data.projectInfo);
}).catch((error)=>{
console.log(error);
});
console.log("222",state.projectInfo);
}
console.log("111", state.projectInfo);
state.projectInfo.noticeFlag = state.noticeChecked ? 1 : 0;
editProj(state.projectInfo)
.then((res) => {
console.log("res5555555555", res);
})
.catch((error) => {
console.log(error);
});
console.log("222", state.projectInfo);
};
const pubNotice = () => {
if (state.noticeContent == "") {
message.destroy();
@@ -107,15 +106,22 @@ export default {
projectId: props.projectId,
title: "",
};
publishNotice(obj);//加入历史
state.projectInfo.notice =state.noticeContent;
editProj(state.projectInfo).then((res) => {
publishNotice(obj); //加入历史
state.projectInfo.notice = state.noticeContent;
console.log("222444444", state.projectInfo);
state.noticeContent1 =
state.noticeContent == "" ? "暂无公告" : state.noticeContent;
message.success("发布成功");
handleCancel();
editProj(state.projectInfo)
.then((res) => {
// console.log("res");
// console.log(res);
if (res.data.code === 200) {
message.destroy();
message.success("发布成功", res);
state.noticeContent1 = res.data.data.notice==""?"暂无公告":res.data.data.notice;
message.success("发布成功");
state.noticeContent1 =
res.data.data.notice == "" ? "暂无公告" : res.data.data.notice;
handleCancel();
emitter.emit("setNotice", false);
}
@@ -125,8 +131,6 @@ export default {
message.warning("发布失败");
console.log(err);
});
}
};
onMounted(() => {