feat(期刊): 期刊summary功能

dev
zhangjiabao 11 months ago
parent bf8be5bea5
commit bf26a14640

@ -70,6 +70,9 @@
label-width="100px" label-width="100px"
label-suffix=":" label-suffix=":"
> >
<el-form-item label="文案摘要">
<span>{{ data.summary }}</span>
</el-form-item>
<el-form-item label="期刊文案"> <el-form-item label="期刊文案">
<div v-html="data.content"></div> <div v-html="data.content"></div>
</el-form-item> </el-form-item>

@ -197,6 +197,15 @@
label-position="left" label-position="left"
label-width="100px" label-width="100px"
> >
<el-form-item prop="summary" label="文案摘要">
<el-button
size="mini"
@click="handelSummaryGenerateClick"
icon="el-icon-connection"
>生成摘要</el-button
>
<el-input type="textarea" rows="5" v-model="data.summary"></el-input>
</el-form-item>
<el-form-item prop="volid" label="期刊文案"> <el-form-item prop="volid" label="期刊文案">
<quill-editor <quill-editor
ref="text" ref="text"
@ -349,6 +358,7 @@ export default {
songs: [], songs: [],
size: 0, size: 0,
content: "", content: "",
summary: "",
duration: 0 duration: 0
} }
}, },
@ -687,6 +697,19 @@ export default {
handleMusicModifyDialogBeforeClose(done) { handleMusicModifyDialogBeforeClose(done) {
this.musicModifyDialog.visible = false; this.musicModifyDialog.visible = false;
done(); done();
},
/**
* 生成摘要
*/
handelSummaryGenerateClick() {
// tag<xxxxx>
this.data.summary = this.data.content.replace(/<[^>]*>/g, "");
// html
this.data.summary = new DOMParser().parseFromString(
this.data.summary,
"text/html"
).body.textContent;
this.$message.success("摘要生成成功");
} }
} }
}; };

@ -11,15 +11,24 @@
<span class="card-header-text">{{ <span class="card-header-text">{{
["期刊发布", "期刊编辑"][type] ["期刊发布", "期刊编辑"][type]
}}</span> }}</span>
<div style="float: right; margin-top: -5px;">
<el-button
icon="el-icon-s-fold"
size="small"
@click="handleBackToList"
>返回列表</el-button
>
<el-button <el-button
style="float: right; margin-top: -5px;"
type="primary" type="primary"
icon="el-icon-circle-check" icon="el-icon-circle-check"
size="small" size="small"
@click="save" @click="save"
:loading="saveLoading"
:disabled="saveLoading"
>保存期刊</el-button >保存期刊</el-button
> >
</div> </div>
</div>
<el-result v-if="resultShow" icon="success" title="保存成功"> <el-result v-if="resultShow" icon="success" title="保存成功">
<template slot="extra"> <template slot="extra">
<el-button <el-button
@ -59,6 +68,7 @@ export default {
remoteData: { tags: [], publisher: [] }, remoteData: { tags: [], publisher: [] },
contentShow: false, contentShow: false,
resultShow: false, resultShow: false,
saveLoading: false,
data: { data: {
id: null, id: null,
title: null, title: null,
@ -69,6 +79,7 @@ export default {
songs: [], songs: [],
size: 0, size: 0,
content: "", content: "",
summary: "",
duration: 0 duration: 0
} }
}; };
@ -151,6 +162,7 @@ export default {
songs: [], songs: [],
size: 0, size: 0,
content: "", content: "",
summary: "",
duration: 0 duration: 0
}; };
this.type = 0; this.type = 0;
@ -162,11 +174,13 @@ export default {
* 保存 * 保存
*/ */
save() { save() {
this.saveLoading = true;
this.$refs.modifyDialog.$refs.modifyDialogForm.validate(valid => { this.$refs.modifyDialog.$refs.modifyDialogForm.validate(valid => {
if (valid) { if (valid) {
let orgData = this.$refs.modifyDialog.data; let orgData = this.$refs.modifyDialog.data;
let param = { let param = {
id: orgData["id"], id: orgData["id"],
summary: orgData["summary"],
content: orgData["content"], content: orgData["content"],
image: orgData["image"], image: orgData["image"],
journalNo: orgData["journalNo"], journalNo: orgData["journalNo"],
@ -197,19 +211,21 @@ export default {
image: null, image: null,
songs: [], songs: [],
size: 0, size: 0,
summary: "",
content: "", content: "",
duration: 0 duration: 0
}; };
this.$refs.modifyDialog.selectTag = []; this.$refs.modifyDialog.selectTag = [];
this.saveLoading = false;
this.contentShow = false; this.contentShow = false;
this.resultShow = true; this.resultShow = true;
this.$message.success(res.message); this.$message.success(res.message);
} else { } else {
this.saveLoading = false;
this.$message.error(res.message); this.$message.error(res.message);
} }
}); });
console.log("新增");
return; return;
} }
if (this.type === 1) { if (this.type === 1) {
@ -225,22 +241,24 @@ export default {
songs: [], songs: [],
size: 0, size: 0,
content: "", content: "",
summary: "",
duration: 0 duration: 0
}; };
this.$refs.modifyDialog.selectTag = []; this.$refs.modifyDialog.selectTag = [];
this.saveLoading = false;
this.contentShow = false; this.contentShow = false;
this.resultShow = true; this.resultShow = true;
this.$message.success(res.message); this.$message.success(res.message);
} else { } else {
this.saveLoading = false;
this.$message.error(res.message); this.$message.error(res.message);
} }
}); });
console.log("新增");
return; return;
} }
} else { } else {
this.$message.error("请完善表单相关信息!"); this.$message.error("请完善表单相关信息!");
this.saveLoading = false;
return false; return false;
} }
}); });

Loading…
Cancel
Save