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

@@ -12,9 +12,9 @@
<div class="itemtime">{{ item.pubtime }}</div>
</div>
</div>
</template>s
</template>
<script>
import { reactive, toRefs, onMounted } from "vue";
import { reactive, toRefs, onMounted, watch } from "vue";
import { getTask } from "../../api/indexTaskadd";
import { noticeList } from "../../api/indexNotice";
import emitter from "../../utils/bus";
@@ -26,6 +26,10 @@ export default {
type: Number,
default: null,
},
show: {
type: String,
default: null,
},
},
setup(props) {
@@ -89,6 +93,19 @@ export default {
getTaskInfo();
getNotice();
});
watch(
() => props.show,
() => {
console.log("props.show", props.show);
if (props.show == 12) {
getTaskInfo();
getNotice();
}
},
{
deep: true,
}
);
return {
...toRefs(state),
getTaskInfo,

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>
<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("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);
}
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(() => {

View File

@@ -203,6 +203,7 @@ function changePagination(page) {
function getStuList() {
tableData.value.loading = true;
getStuPage(tableParam.value).then((res) => {
console.log("学员管理-获取学员", res.data);
tableData.value.total = res.data.data.total;
tableData.value.list = res.data.data.records;
tableData.value.loading = false;

View File

@@ -708,7 +708,10 @@
<NoticePub v-model:projectId="projectId"></NoticePub>
</a-tab-pane>
<a-tab-pane key="12" tab="历史公告" force-render>
<NoticeHis v-model:projectId="projectId"></NoticeHis>
<NoticeHis
v-model:projectId="projectId"
:show="activeKeyNotice"
></NoticeHis>
</a-tab-pane>
</a-tabs>
</a-tab-pane>