mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-18 07:16:46 +08:00
公告
This commit is contained in:
@@ -6,20 +6,33 @@
|
||||
<div class="switch">
|
||||
<a-switch v-model:checked="noticeChecked" size="small" /><span
|
||||
style="margin-left: 16px"
|
||||
>开启</span
|
||||
>
|
||||
开启
|
||||
</span>
|
||||
</div>
|
||||
<template v-if="noticeChecked">
|
||||
<p>公告内容</p>
|
||||
<!-- 文本 -->
|
||||
<div
|
||||
v-if="!editOn"
|
||||
style="height: 120px; border: 1px solid rgb(217, 217, 217"
|
||||
>
|
||||
{{ noticeContent }}
|
||||
</div>
|
||||
<a-textarea
|
||||
v-if="editOn"
|
||||
v-model:value="noticeContent"
|
||||
:maxlength="150"
|
||||
placeholder="公告信息最多输入150个字"
|
||||
style="margin-top: -10px; height: 120px"
|
||||
/>
|
||||
<div class="publish">
|
||||
<div class="iconPub"></div>
|
||||
<div class="btnText" @click="pubNotice">发布</div>
|
||||
<!-- 按钮 -->
|
||||
<div v-if="!editOn" class="btn-content">
|
||||
<a-button type="primary" @click="handleEdit">编辑</a-button>
|
||||
</div>
|
||||
<div v-if="editOn" class="btn-content">
|
||||
<a-button class="cancel" @click="handleCancel">取消</a-button>
|
||||
<a-button type="primary" @click="pubNotice" class="sure">发布</a-button>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
@@ -44,6 +57,8 @@ export default {
|
||||
noticeChecked: true,
|
||||
projectInfo: {},
|
||||
noticeContent: "",
|
||||
|
||||
editOn: false,
|
||||
});
|
||||
const getTaskInfo = () => {
|
||||
getTask({ projectId: props.projectId }).then((res) => {
|
||||
@@ -51,6 +66,14 @@ export default {
|
||||
state.projectInfo = res.data.data.projectInfo;
|
||||
});
|
||||
};
|
||||
|
||||
const handleEdit = () => {
|
||||
state.editOn = true;
|
||||
};
|
||||
const handleCancel = () => {
|
||||
state.editOn = false;
|
||||
};
|
||||
|
||||
const pubNotice = () => {
|
||||
if (state.noticeContent == "") {
|
||||
message.destroy();
|
||||
@@ -66,10 +89,15 @@ export default {
|
||||
};
|
||||
publishNotice(obj)
|
||||
.then((res) => {
|
||||
message.destroy();
|
||||
message.success("发布成功", res);
|
||||
state.noticeContent = "";
|
||||
emitter.emit("setNotice", false);
|
||||
// console.log("res");
|
||||
// console.log(res);
|
||||
if (res.data.code === 200) {
|
||||
message.destroy();
|
||||
message.success("发布成功", res);
|
||||
state.noticeContent = res.data.data.notice;
|
||||
handleCancel();
|
||||
emitter.emit("setNotice", false);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
message.destroy();
|
||||
@@ -85,6 +113,8 @@ export default {
|
||||
...toRefs(state),
|
||||
getTaskInfo,
|
||||
pubNotice,
|
||||
handleEdit,
|
||||
handleCancel,
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -141,5 +171,12 @@ export default {
|
||||
margin-left: 5px;
|
||||
}
|
||||
}
|
||||
.btn-content {
|
||||
margin-top: 20px;
|
||||
text-align: right;
|
||||
.cancel {
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user