feat(期刊): 期刊summary功能

dev
zhangjiabao 7 months ago
parent bf8be5bea5
commit bf26a14640

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

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

Loading…
Cancel
Save