|
|
|
@ -1,31 +1,37 @@ |
|
|
|
|
<template> |
|
|
|
|
<div> |
|
|
|
|
<el-card shadow="hover" class="mgb20"> |
|
|
|
|
<el-card shadow="hover" |
|
|
|
|
class="mgb20"> |
|
|
|
|
<div class="flex-between"> |
|
|
|
|
<div class="per_title" v-preventReClick @click="back"> |
|
|
|
|
<div class="per_title" |
|
|
|
|
v-preventReClick |
|
|
|
|
@click="back"> |
|
|
|
|
<i class="el-icon-arrow-left"></i> |
|
|
|
|
<span class="per_back">返回</span> |
|
|
|
|
<span class="per_school" v-text="form.id ? '编辑文章' : '新建文章'"></span> |
|
|
|
|
<span class="per_school" |
|
|
|
|
v-text="form.id ? '编辑文章' : '新建文章'"></span> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</el-card> |
|
|
|
|
<div class="page"> |
|
|
|
|
<el-form :model="form" :rules="rules" class="input-form model" label-width="140px"> |
|
|
|
|
<el-form-item prop="title" label="标题"> |
|
|
|
|
<el-input |
|
|
|
|
id="articleTitle" |
|
|
|
|
<el-form :model="form" |
|
|
|
|
:rules="rules" |
|
|
|
|
class="input-form model" |
|
|
|
|
label-width="140px"> |
|
|
|
|
<el-form-item prop="title" |
|
|
|
|
label="标题"> |
|
|
|
|
<el-input id="focus-el" |
|
|
|
|
style="width: 940px" |
|
|
|
|
placeholder="请输入标题" |
|
|
|
|
v-model="form.title" |
|
|
|
|
clearable |
|
|
|
|
maxlength="100" |
|
|
|
|
@change="nameChange" |
|
|
|
|
></el-input> |
|
|
|
|
@change="nameChange"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<div class="item-line"> |
|
|
|
|
<el-form-item prop="releaseTime" label="发布日期"> |
|
|
|
|
<el-date-picker |
|
|
|
|
v-model="form.releaseTime" |
|
|
|
|
<el-form-item prop="releaseTime" |
|
|
|
|
label="发布日期"> |
|
|
|
|
<el-date-picker v-model="form.releaseTime" |
|
|
|
|
type="date" |
|
|
|
|
placeholder="选择日期" |
|
|
|
|
format="yyyy-MM-dd" |
|
|
|
@ -35,124 +41,136 @@ |
|
|
|
|
</el-form-item> |
|
|
|
|
</div> |
|
|
|
|
<div class="item-line"> |
|
|
|
|
<el-form-item prop="source" label="来源"> |
|
|
|
|
<el-input |
|
|
|
|
placeholder="请输入来源" |
|
|
|
|
<el-form-item prop="source" |
|
|
|
|
label="来源"> |
|
|
|
|
<el-input placeholder="请输入来源" |
|
|
|
|
v-model.trim="form.source" |
|
|
|
|
clearable |
|
|
|
|
maxlength="50" |
|
|
|
|
class="inline-input" |
|
|
|
|
></el-input> |
|
|
|
|
class="inline-input"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="author" label="作者"> |
|
|
|
|
<el-input |
|
|
|
|
v-model="form.author" |
|
|
|
|
<el-form-item prop="author" |
|
|
|
|
label="作者"> |
|
|
|
|
<el-input v-model="form.author" |
|
|
|
|
clearable |
|
|
|
|
maxlength="50" |
|
|
|
|
class="inline-input" |
|
|
|
|
></el-input> |
|
|
|
|
class="inline-input"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
</div> |
|
|
|
|
<div class="item-line"> |
|
|
|
|
<el-form-item prop="edit" label="编辑"> |
|
|
|
|
<el-input |
|
|
|
|
placeholder="请输入编辑" |
|
|
|
|
<el-form-item prop="edit" |
|
|
|
|
label="编辑"> |
|
|
|
|
<el-input placeholder="请输入编辑" |
|
|
|
|
v-model.trim="form.edit" |
|
|
|
|
clearable |
|
|
|
|
maxlength="50" |
|
|
|
|
class="inline-input" |
|
|
|
|
></el-input> |
|
|
|
|
class="inline-input"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="audit" label="审核"> |
|
|
|
|
<el-input |
|
|
|
|
placeholder="请输入审核" |
|
|
|
|
<el-form-item prop="audit" |
|
|
|
|
label="审核"> |
|
|
|
|
<el-input placeholder="请输入审核" |
|
|
|
|
v-model.trim="form.audit" |
|
|
|
|
clearable |
|
|
|
|
maxlength="50" |
|
|
|
|
class="inline-input" |
|
|
|
|
></el-input> |
|
|
|
|
class="inline-input"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
<div class="item-line"> |
|
|
|
|
<el-form-item prop="classificationId" label="所属分类"> |
|
|
|
|
<el-select style="width: 234px;" v-model="form.classificationId"> |
|
|
|
|
<el-form-item prop="classificationId" |
|
|
|
|
label="所属分类"> |
|
|
|
|
<el-select style="width: 234px;" |
|
|
|
|
v-model="form.classificationId"> |
|
|
|
|
<template v-for="item in classifications"> |
|
|
|
|
<el-option |
|
|
|
|
v-if="item.id" |
|
|
|
|
<el-option v-if="item.id" |
|
|
|
|
:key="item.id" |
|
|
|
|
:label="item.classificationName" |
|
|
|
|
:value="item.id"> |
|
|
|
|
</el-option> |
|
|
|
|
</template> |
|
|
|
|
</el-select> |
|
|
|
|
<el-button class="set-btn" type="primary" @click="setClass">设置</el-button> |
|
|
|
|
<el-button class="set-btn" |
|
|
|
|
type="primary" |
|
|
|
|
@click="setClass">设置</el-button> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="author" label="主题标签"> |
|
|
|
|
<el-select style="width: 234px;" v-model="form.lableId" multiple> |
|
|
|
|
<el-form-item prop="author" |
|
|
|
|
label="主题标签"> |
|
|
|
|
<el-select style="width: 234px;" |
|
|
|
|
v-model="form.lableId" |
|
|
|
|
multiple> |
|
|
|
|
<template v-for="item in labels"> |
|
|
|
|
<el-option |
|
|
|
|
v-if="item.id" |
|
|
|
|
<el-option v-if="item.id" |
|
|
|
|
:key="item.id" |
|
|
|
|
:label="item.labelName" |
|
|
|
|
:value="item.id"> |
|
|
|
|
</el-option> |
|
|
|
|
</template> |
|
|
|
|
</el-select> |
|
|
|
|
<el-button class="set-btn" type="primary" @click="setLabel">设置</el-button> |
|
|
|
|
<el-button class="set-btn" |
|
|
|
|
type="primary" |
|
|
|
|
@click="setLabel">设置</el-button> |
|
|
|
|
</el-form-item> |
|
|
|
|
</div> |
|
|
|
|
<el-form-item prop="summary" label="摘要"> |
|
|
|
|
<el-input |
|
|
|
|
style="width: 940px" |
|
|
|
|
<el-form-item prop="summary" |
|
|
|
|
label="摘要"> |
|
|
|
|
<el-input style="width: 940px" |
|
|
|
|
type="textarea" |
|
|
|
|
v-model.trim="form.summary" |
|
|
|
|
:rows="3" |
|
|
|
|
clearable |
|
|
|
|
></el-input> |
|
|
|
|
clearable></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="bannerImg" label="封面图"> |
|
|
|
|
<el-upload |
|
|
|
|
class="avatar-uploader" |
|
|
|
|
<el-form-item prop="bannerImg" |
|
|
|
|
label="封面图"> |
|
|
|
|
<el-upload class="avatar-uploader" |
|
|
|
|
accept=".jpg,.png,.jpeg,.gif" |
|
|
|
|
:on-change="changeFile" |
|
|
|
|
:show-file-list="false" |
|
|
|
|
:action="this.api.fileupload" |
|
|
|
|
:auto-upload="false" |
|
|
|
|
> |
|
|
|
|
<img v-if="form.bannerImg" :src="form.bannerImg" class="avatar"> |
|
|
|
|
<div class="uploader-default" v-else> |
|
|
|
|
<img class="plus" src="@/assets/img/plus.png" alt=""> |
|
|
|
|
:auto-upload="false"> |
|
|
|
|
<img v-if="form.bannerImg" |
|
|
|
|
:src="form.bannerImg" |
|
|
|
|
class="avatar"> |
|
|
|
|
<div class="uploader-default" |
|
|
|
|
v-else> |
|
|
|
|
<img class="plus" |
|
|
|
|
src="@/assets/img/plus.png" |
|
|
|
|
alt=""> |
|
|
|
|
<p>点击上传</p> |
|
|
|
|
</div> |
|
|
|
|
</el-upload> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="mainBody" label="正文" > |
|
|
|
|
<Editor api-key='rnk6zw9v267xqz7pf98twt1vmrvltmd436je7a642pckltda' v-model="form.mainBody" :init="editorConfig" /> |
|
|
|
|
<el-form-item prop="mainBody" |
|
|
|
|
label="正文"> |
|
|
|
|
<Editor api-key='rnk6zw9v267xqz7pf98twt1vmrvltmd436je7a642pckltda' |
|
|
|
|
v-model="form.mainBody" |
|
|
|
|
:init="editorConfig" /> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="file" label="文件上传"> |
|
|
|
|
<el-upload |
|
|
|
|
:before-upload="fileBeforeUpload" |
|
|
|
|
<el-form-item prop="file" |
|
|
|
|
label="文件上传"> |
|
|
|
|
<el-upload :before-upload="fileBeforeUpload" |
|
|
|
|
:on-remove="handleRemove" |
|
|
|
|
:on-success="uploadSuccessFile" |
|
|
|
|
:action="this.api.fileUploadNakadai" |
|
|
|
|
:file-list="form.fileList" |
|
|
|
|
:headers="headers" |
|
|
|
|
> |
|
|
|
|
:headers="headers"> |
|
|
|
|
<el-button>上传</el-button> |
|
|
|
|
</el-upload> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-form> |
|
|
|
|
<div class="btns"> |
|
|
|
|
<el-button type="primary" @click="submit(1)">发布</el-button> |
|
|
|
|
<el-button type="primary" |
|
|
|
|
@click="submit(1)">发布</el-button> |
|
|
|
|
<el-button @click="submit(0)">保存草稿</el-button> |
|
|
|
|
<el-button @click="back">取消</el-button> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<!-- 剪裁组件弹窗 --> |
|
|
|
|
<el-dialog title="图片裁剪" append-to-body :visible.sync="cropperModel" width="1100px" :close-on-click-modal="false"> |
|
|
|
|
<Cropper |
|
|
|
|
ref="cropper" |
|
|
|
|
<el-dialog title="图片裁剪" |
|
|
|
|
append-to-body |
|
|
|
|
:visible.sync="cropperModel" |
|
|
|
|
width="1100px" |
|
|
|
|
:close-on-click-modal="false"> |
|
|
|
|
<Cropper ref="cropper" |
|
|
|
|
:img-file.sync="file" |
|
|
|
|
:is-upload="isUpload" |
|
|
|
|
:fixed="true" |
|
|
|
@ -160,30 +178,53 @@ |
|
|
|
|
@upload="customUpload" /> |
|
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
|
<el-dialog title="所属分类设置" :visible.sync="classVisible" width="500px" :close-on-click-modal="false" class="manage-dia" :before-close="closeClass"> |
|
|
|
|
<el-dialog title="所属分类设置" |
|
|
|
|
:visible.sync="classVisible" |
|
|
|
|
width="500px" |
|
|
|
|
:close-on-click-modal="false" |
|
|
|
|
class="manage-dia" |
|
|
|
|
:before-close="closeClass"> |
|
|
|
|
<div class="plus"> |
|
|
|
|
<i class="el-icon-circle-plus-outline" @click="addClass"></i> |
|
|
|
|
<i class="el-icon-circle-plus-outline" |
|
|
|
|
@click="addClass"></i> |
|
|
|
|
</div> |
|
|
|
|
<el-table :data="classifications" ref="table" header-align="center" row-key="id"> |
|
|
|
|
<el-table-column type="index" width="60" label="序号" align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="classificationName" label="分类名称" align="center" min-width="130"> |
|
|
|
|
<el-table :data="classifications" |
|
|
|
|
ref="table" |
|
|
|
|
header-align="center" |
|
|
|
|
row-key="id"> |
|
|
|
|
<el-table-column type="index" |
|
|
|
|
width="60" |
|
|
|
|
label="序号" |
|
|
|
|
align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="classificationName" |
|
|
|
|
label="分类名称" |
|
|
|
|
align="center" |
|
|
|
|
min-width="130"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-input |
|
|
|
|
v-if="scope.row.edit" |
|
|
|
|
<el-input v-if="scope.row.edit" |
|
|
|
|
placeholder="请输入分类名称" |
|
|
|
|
v-model="scope.row.classificationName" |
|
|
|
|
clearable |
|
|
|
|
maxlength="30" |
|
|
|
|
></el-input> |
|
|
|
|
maxlength="30"></el-input> |
|
|
|
|
<span v-else>{{ scope.row.classificationName }}</span> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="updateTime1" label="是否引用" align="center" min-width="60">否</el-table-column> |
|
|
|
|
<el-table-column label="操作" align="center" min-width="60"> |
|
|
|
|
<el-table-column prop="updateTime1" |
|
|
|
|
label="是否引用" |
|
|
|
|
align="center" |
|
|
|
|
min-width="60">否</el-table-column> |
|
|
|
|
<el-table-column label="操作" |
|
|
|
|
align="center" |
|
|
|
|
min-width="60"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<i v-if="scope.row.edit" class="el-icon-check edit" @click="submitClass(scope.row)"></i> |
|
|
|
|
<i v-else class="el-icon-edit edit" @click="editClass(scope.row)"></i> |
|
|
|
|
<i class="el-icon-delete del" @click="delClass(scope.row, scope.$index)"></i> |
|
|
|
|
<i v-if="scope.row.edit" |
|
|
|
|
class="el-icon-check edit" |
|
|
|
|
@click="submitClass(scope.row)"></i> |
|
|
|
|
<i v-else |
|
|
|
|
class="el-icon-edit edit" |
|
|
|
|
@click="editClass(scope.row)"></i> |
|
|
|
|
<i class="el-icon-delete del" |
|
|
|
|
@click="delClass(scope.row, scope.$index)"></i> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
</el-table> |
|
|
|
@ -192,30 +233,53 @@ |
|
|
|
|
</span> |
|
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
|
<el-dialog title="主题标签设置" :visible.sync="labelVisible" width="500px" :close-on-click-modal="false" class="manage-dia" :before-close="closeLabel"> |
|
|
|
|
<el-dialog title="主题标签设置" |
|
|
|
|
:visible.sync="labelVisible" |
|
|
|
|
width="500px" |
|
|
|
|
:close-on-click-modal="false" |
|
|
|
|
class="manage-dia" |
|
|
|
|
:before-close="closeLabel"> |
|
|
|
|
<div class="plus"> |
|
|
|
|
<i class="el-icon-circle-plus-outline" @click="addLabel"></i> |
|
|
|
|
<i class="el-icon-circle-plus-outline" |
|
|
|
|
@click="addLabel"></i> |
|
|
|
|
</div> |
|
|
|
|
<el-table :data="labels" ref="table" header-align="center" row-key="id"> |
|
|
|
|
<el-table-column type="index" width="60" label="序号" align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="labelName" label="主题名称" align="center" min-width="130"> |
|
|
|
|
<el-table :data="labels" |
|
|
|
|
ref="table" |
|
|
|
|
header-align="center" |
|
|
|
|
row-key="id"> |
|
|
|
|
<el-table-column type="index" |
|
|
|
|
width="60" |
|
|
|
|
label="序号" |
|
|
|
|
align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="labelName" |
|
|
|
|
label="主题名称" |
|
|
|
|
align="center" |
|
|
|
|
min-width="130"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<el-input |
|
|
|
|
v-if="scope.row.edit" |
|
|
|
|
<el-input v-if="scope.row.edit" |
|
|
|
|
placeholder="请输入主题名称" |
|
|
|
|
v-model="scope.row.labelName" |
|
|
|
|
clearable |
|
|
|
|
maxlength="30" |
|
|
|
|
></el-input> |
|
|
|
|
maxlength="30"></el-input> |
|
|
|
|
<span v-else>{{ scope.row.labelName }}</span> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
<el-table-column prop="updateTime1" label="是否引用" align="center" min-width="60">否</el-table-column> |
|
|
|
|
<el-table-column label="操作" align="center" min-width="60"> |
|
|
|
|
<el-table-column prop="updateTime1" |
|
|
|
|
label="是否引用" |
|
|
|
|
align="center" |
|
|
|
|
min-width="60">否</el-table-column> |
|
|
|
|
<el-table-column label="操作" |
|
|
|
|
align="center" |
|
|
|
|
min-width="60"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
<i v-if="scope.row.edit" class="el-icon-check edit" @click="submitLabel(scope.row)"></i> |
|
|
|
|
<i v-else class="el-icon-edit edit" @click="editLabel(scope.row)"></i> |
|
|
|
|
<i class="el-icon-delete del" @click="delLabel(scope.row, scope.$index)"></i> |
|
|
|
|
<i v-if="scope.row.edit" |
|
|
|
|
class="el-icon-check edit" |
|
|
|
|
@click="submitLabel(scope.row)"></i> |
|
|
|
|
<i v-else |
|
|
|
|
class="el-icon-edit edit" |
|
|
|
|
@click="editLabel(scope.row)"></i> |
|
|
|
|
<i class="el-icon-delete del" |
|
|
|
|
@click="delLabel(scope.row, scope.$index)"></i> |
|
|
|
|
</template> |
|
|
|
|
</el-table-column> |
|
|
|
|
</el-table> |
|
|
|
@ -234,7 +298,7 @@ import editorConfig from '@/utils/editor' |
|
|
|
|
import Cropper from '@/components/img-upload/Cropper' |
|
|
|
|
import Axios from 'axios' |
|
|
|
|
export default { |
|
|
|
|
data() { |
|
|
|
|
data () { |
|
|
|
|
return { |
|
|
|
|
typeId: +this.$route.query.type, |
|
|
|
|
headers: { |
|
|
|
@ -253,7 +317,7 @@ export default { |
|
|
|
|
isRelease: 0, |
|
|
|
|
mainBody: '', |
|
|
|
|
releaseTime: new Date(), |
|
|
|
|
summary : '', |
|
|
|
|
summary: '', |
|
|
|
|
title: '', |
|
|
|
|
fileList: [], |
|
|
|
|
typeId: +this.$route.query.type |
|
|
|
@ -297,14 +361,14 @@ export default { |
|
|
|
|
watch: { |
|
|
|
|
// 监听信息是否有更改,有的话页面离开的时候要询问是否要保存 |
|
|
|
|
form: { |
|
|
|
|
handler(val){ |
|
|
|
|
handler (val) { |
|
|
|
|
this.updateTime++ |
|
|
|
|
}, |
|
|
|
|
deep:true |
|
|
|
|
deep: true |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 页面离开的时候如果没有保存则提示 |
|
|
|
|
beforeRouteLeave(to, from, next) { |
|
|
|
|
beforeRouteLeave (to, from, next) { |
|
|
|
|
if (this.submiting) { |
|
|
|
|
next() |
|
|
|
|
} else if (!this.pass) { |
|
|
|
@ -325,23 +389,23 @@ export default { |
|
|
|
|
next() |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
mounted() { |
|
|
|
|
mounted () { |
|
|
|
|
this.getArticle() |
|
|
|
|
this.getLabel() |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
// 文章详情 |
|
|
|
|
getArticle() { |
|
|
|
|
getArticle () { |
|
|
|
|
const { id } = this.form |
|
|
|
|
id ? this.$post(`${this.api.findByIdParnerArticle}?id=${id}`).then(({ data }) => { |
|
|
|
|
data.lableId = data.lableId ? data.lableId.split(',').map(e => +e) : [] |
|
|
|
|
data.fileList.forEach(e => e.name = e.fileName) |
|
|
|
|
this.form = data |
|
|
|
|
this.getClassification(1) |
|
|
|
|
}).catch(err => {}) : this.getClassification(1) |
|
|
|
|
}).catch(err => { }) : this.getClassification(1) |
|
|
|
|
}, |
|
|
|
|
// 获取所属分类 |
|
|
|
|
getClassification(detail) { |
|
|
|
|
getClassification (detail) { |
|
|
|
|
this.$post(`${this.api.queryClassificationByType}?typeId=${this.typeId}`).then(({ data }) => { |
|
|
|
|
this.classifications = data |
|
|
|
|
// 如果所选分类被删除,则清空分类id |
|
|
|
@ -352,14 +416,14 @@ export default { |
|
|
|
|
this.updateTime = 0 |
|
|
|
|
}, 500) |
|
|
|
|
} |
|
|
|
|
}).catch(err => {}) |
|
|
|
|
}).catch(err => { }) |
|
|
|
|
}, |
|
|
|
|
// 显示所属分类弹框 |
|
|
|
|
setClass() { |
|
|
|
|
setClass () { |
|
|
|
|
this.classVisible = true |
|
|
|
|
}, |
|
|
|
|
// 新增所属分类 |
|
|
|
|
addClass() { |
|
|
|
|
addClass () { |
|
|
|
|
this.classifications.push({ |
|
|
|
|
edit: true, |
|
|
|
|
id: '', |
|
|
|
@ -367,11 +431,11 @@ export default { |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 编辑所属分类 |
|
|
|
|
editClass(row) { |
|
|
|
|
editClass (row) { |
|
|
|
|
this.$set(row, 'edit', 1) |
|
|
|
|
}, |
|
|
|
|
// 删除所属分类 |
|
|
|
|
delClass(row, i) { |
|
|
|
|
delClass (row, i) { |
|
|
|
|
if (row.id) { |
|
|
|
|
this.$confirm('确定要删除吗?', '提示', { |
|
|
|
|
type: 'warning' |
|
|
|
@ -379,14 +443,14 @@ export default { |
|
|
|
|
this.$post(`${this.api.batchDeletionParnerClass}?ids=${row.id}`).then(res => { |
|
|
|
|
Util.successMsg('删除成功') |
|
|
|
|
this.getClassification() |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(() => {}) |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}).catch(() => { }) |
|
|
|
|
} else { |
|
|
|
|
this.classifications.splice(i, 1) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 提交所属分类 |
|
|
|
|
submitClass(row, showMsg = 1) { |
|
|
|
|
submitClass (row, showMsg = 1) { |
|
|
|
|
if (!row.classificationName) return Util.errorMsg('请输入分类名称') |
|
|
|
|
this.$post(`${this.api.checkForHeavyParnerClass}?classificationName=${row.classificationName}&typeId=${this.typeId}&classificationId=${row.id}`).then(res => { |
|
|
|
|
this.$post(this.api[row.id ? 'updateParnerClass' : 'saveParnerClass'], { |
|
|
|
@ -396,11 +460,11 @@ export default { |
|
|
|
|
}).then(res => { |
|
|
|
|
showMsg && Util.successMsg((row.id ? '修改' : '新增') + '成功') |
|
|
|
|
this.getClassification() |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}, |
|
|
|
|
// 关闭所属分类 |
|
|
|
|
closeClass() { |
|
|
|
|
closeClass () { |
|
|
|
|
const list = this.classifications |
|
|
|
|
if (list.find(e => e.edit && e.classificationName)) { |
|
|
|
|
this.$confirm('所填写内容暂未保存,是否保存?', '提示', { |
|
|
|
@ -421,17 +485,17 @@ export default { |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 获取标签 |
|
|
|
|
getLabel() { |
|
|
|
|
getLabel () { |
|
|
|
|
this.$post(this.api.queryAllArticleSubjectTags).then(({ data }) => { |
|
|
|
|
this.labels = data |
|
|
|
|
}).catch(err => {}) |
|
|
|
|
}).catch(err => { }) |
|
|
|
|
}, |
|
|
|
|
// 显示标签弹框 |
|
|
|
|
setLabel() { |
|
|
|
|
setLabel () { |
|
|
|
|
this.labelVisible = true |
|
|
|
|
}, |
|
|
|
|
// 新增标签 |
|
|
|
|
addLabel() { |
|
|
|
|
addLabel () { |
|
|
|
|
this.labels.push({ |
|
|
|
|
edit: true, |
|
|
|
|
id: '', |
|
|
|
@ -439,11 +503,11 @@ export default { |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 编辑标签 |
|
|
|
|
editLabel(row) { |
|
|
|
|
editLabel (row) { |
|
|
|
|
this.$set(row, 'edit', 1) |
|
|
|
|
}, |
|
|
|
|
// 删除标签 |
|
|
|
|
delLabel(row, i) { |
|
|
|
|
delLabel (row, i) { |
|
|
|
|
if (row.id) { |
|
|
|
|
this.$confirm('确定要删除吗?', '提示', { |
|
|
|
|
type: 'warning' |
|
|
|
@ -451,14 +515,14 @@ export default { |
|
|
|
|
this.$post(`${this.api.batchDeletionParnerLabel}?ids=${row.id}`).then(res => { |
|
|
|
|
Util.successMsg('删除成功') |
|
|
|
|
this.getLabel() |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(() => {}) |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}).catch(() => { }) |
|
|
|
|
} else { |
|
|
|
|
this.labels.splice(i, 1) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 提交标签 |
|
|
|
|
submitLabel(row, showMsg = 1) { |
|
|
|
|
submitLabel (row, showMsg = 1) { |
|
|
|
|
if (!row.labelName) return Util.errorMsg('请输入主题名称') |
|
|
|
|
this.$post(`${this.api.checkForHeavyParnerLabel}?labelName=${row.labelName}&labelId=${row.id}`).then(res => { |
|
|
|
|
this.$post(this.api[row.id ? 'updateParnerLabel' : 'saveParnerLabel'], { |
|
|
|
@ -467,11 +531,11 @@ export default { |
|
|
|
|
}).then(res => { |
|
|
|
|
showMsg && Util.successMsg((row.id ? '修改' : '新增') + '成功') |
|
|
|
|
this.getLabel() |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
}, |
|
|
|
|
// 关闭标签 |
|
|
|
|
closeLabel() { |
|
|
|
|
closeLabel () { |
|
|
|
|
const list = this.labels |
|
|
|
|
if (list.find(e => e.edit && e.labelName)) { |
|
|
|
|
this.$confirm('所填写内容暂未保存,是否保存?', '提示', { |
|
|
|
@ -490,9 +554,9 @@ export default { |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 文章名称判重 |
|
|
|
|
nameChange(){ |
|
|
|
|
nameChange () { |
|
|
|
|
const { title, id } = this.form |
|
|
|
|
if(title && title !== this.originalName){ |
|
|
|
|
if (title && title !== this.originalName) { |
|
|
|
|
this.$post(this.api.checkIfTheTitleIsRepeat, { |
|
|
|
|
typeId: this.typeId, |
|
|
|
|
title, |
|
|
|
@ -502,18 +566,18 @@ export default { |
|
|
|
|
}).catch(res => { |
|
|
|
|
this.nameRepeat = true |
|
|
|
|
}) |
|
|
|
|
}else{ |
|
|
|
|
} else { |
|
|
|
|
this.nameRepeat = false |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 图片裁剪上传事件 |
|
|
|
|
customUpload(data) { |
|
|
|
|
customUpload (data) { |
|
|
|
|
const formData = new FormData() |
|
|
|
|
formData.append('file', data, this.file.name) |
|
|
|
|
this.imgUpload(formData) |
|
|
|
|
}, |
|
|
|
|
// 压缩图片 |
|
|
|
|
compress(img) { |
|
|
|
|
compress (img) { |
|
|
|
|
const canvas = document.createElement('canvas') |
|
|
|
|
const ctx = canvas.getContext('2d') |
|
|
|
|
// let initSize = img.src.length; |
|
|
|
@ -530,7 +594,7 @@ export default { |
|
|
|
|
return ndata |
|
|
|
|
}, |
|
|
|
|
// base64转成bolb对象 |
|
|
|
|
dataURItoBlob(base64Data) { |
|
|
|
|
dataURItoBlob (base64Data) { |
|
|
|
|
let byteString |
|
|
|
|
if (base64Data.split(',')[0].indexOf('base64') >= 0) { |
|
|
|
|
byteString = atob(base64Data.split(',')[1]) |
|
|
|
@ -550,7 +614,7 @@ export default { |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 图片上传到服务器 |
|
|
|
|
imgUpload(formData) { |
|
|
|
|
imgUpload (formData) { |
|
|
|
|
this.isUpload = true |
|
|
|
|
Axios({ |
|
|
|
|
method: 'post', |
|
|
|
@ -562,13 +626,13 @@ export default { |
|
|
|
|
}, |
|
|
|
|
}).then(({ data }) => { |
|
|
|
|
this.form.bannerImg = data.filesResult.fileUrl |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(res => { }) |
|
|
|
|
this.$refs.cropper.isDisabled = false |
|
|
|
|
this.isUpload = false |
|
|
|
|
this.cropperModel = false |
|
|
|
|
}, |
|
|
|
|
// 图片改变钩子 |
|
|
|
|
changeFile(file) { |
|
|
|
|
changeFile (file) { |
|
|
|
|
const { size, name } = file |
|
|
|
|
const ext = name.substring(name.lastIndexOf('.') + 1) |
|
|
|
|
if (!Util.isImg(ext)) { |
|
|
|
@ -589,23 +653,23 @@ export default { |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 附件删除 |
|
|
|
|
handleRemove(e, fileList) { |
|
|
|
|
handleRemove (e, fileList) { |
|
|
|
|
e.id ? this.$post(`${this.api.batchDeletionParnerFile}?ids=${e.id}`).then(res => { |
|
|
|
|
this.form.fileList = fileList |
|
|
|
|
}).catch(res => {}) : (this.form.fileList = fileList) |
|
|
|
|
}).catch(res => { }) : (this.form.fileList = fileList) |
|
|
|
|
}, |
|
|
|
|
// banner上传成功 |
|
|
|
|
uploadSuccessBanner(res) { |
|
|
|
|
uploadSuccessBanner (res) { |
|
|
|
|
let url = this.form.bannerImg |
|
|
|
|
url && this.$del(this.api.delFile, [url.split('/').pop()]).then(res => {}).catch(e => {}) |
|
|
|
|
url && this.$del(this.api.delFile, [url.split('/').pop()]).then(res => { }).catch(e => { }) |
|
|
|
|
this.form.bannerImg = res.url |
|
|
|
|
}, |
|
|
|
|
// 附件上传之前的钩子 |
|
|
|
|
fileBeforeUpload(file) { |
|
|
|
|
fileBeforeUpload (file) { |
|
|
|
|
this.uploading++ |
|
|
|
|
}, |
|
|
|
|
// 附件上传成功 |
|
|
|
|
uploadSuccessFile(res) { |
|
|
|
|
uploadSuccessFile (res) { |
|
|
|
|
const { originalFileName, fileUrl } = res.filesResult |
|
|
|
|
this.uploading-- |
|
|
|
|
this.form.id ? |
|
|
|
@ -622,7 +686,7 @@ export default { |
|
|
|
|
url: fileUrl, |
|
|
|
|
id: data |
|
|
|
|
}) |
|
|
|
|
}).catch(res => {}) : |
|
|
|
|
}).catch(res => { }) : |
|
|
|
|
this.form.fileList.push({ |
|
|
|
|
fileName: originalFileName, |
|
|
|
|
filePath: fileUrl, |
|
|
|
@ -631,11 +695,11 @@ export default { |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 预览 |
|
|
|
|
preview() { |
|
|
|
|
preview () { |
|
|
|
|
window.open((Setting.isDev ? `http://${location.hostname}:8095` : this.$store.state.content.site.domainName) + `#/article?articleId=${this.form.id}&siteId=${this.form.siteId}&id=${this.form.columnId}`) |
|
|
|
|
}, |
|
|
|
|
// 返回 |
|
|
|
|
back() { |
|
|
|
|
back () { |
|
|
|
|
this.pass = true |
|
|
|
|
// 更改了信息才需要提示 |
|
|
|
|
if (this.updateTime) { |
|
|
|
@ -651,17 +715,17 @@ export default { |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 提交 |
|
|
|
|
submit(isRelease, next) { |
|
|
|
|
submit (isRelease, next) { |
|
|
|
|
if (this.submiting) return false |
|
|
|
|
const form = JSON.parse(JSON.stringify(this.form)) |
|
|
|
|
console.log('form=>',form) |
|
|
|
|
console.log('form=>', form) |
|
|
|
|
if (!form.title) return Util.errorMsg('请填写标题') |
|
|
|
|
if (this.nameRepeat) return Util.errorMsg('该标题已重复!') |
|
|
|
|
// 如果是发布 |
|
|
|
|
if (isRelease) { |
|
|
|
|
if (!form.releaseTime) return Util.errorMsg('请选择发布日期') |
|
|
|
|
if (!form.classificationId) return Util.errorMsg('请选择所属分类') |
|
|
|
|
if (!form.bannerImg ) return Util.errorMsg('请上传封面') |
|
|
|
|
if (!form.bannerImg) return Util.errorMsg('请上传封面') |
|
|
|
|
if (!form.mainBody) return Util.errorMsg('请输入正文') |
|
|
|
|
} |
|
|
|
|
// if (this.uploading) return Util.errorMsg('文件正在上传,请上传完成后再发布') |
|
|
|
@ -701,7 +765,7 @@ $upload-lg-height: 102px; |
|
|
|
|
position: relative; |
|
|
|
|
width: $upload-width; |
|
|
|
|
height: $upload-height; |
|
|
|
|
border: 1px solid #DCDEE0; |
|
|
|
|
border: 1px solid #dcdee0; |
|
|
|
|
border-radius: 2px; |
|
|
|
|
cursor: pointer; |
|
|
|
|
overflow: hidden; |
|
|
|
@ -712,7 +776,7 @@ $upload-lg-height: 102px; |
|
|
|
|
justify-content: center; |
|
|
|
|
align-items: center; |
|
|
|
|
text-align: center; |
|
|
|
|
background: #FAFAFA; |
|
|
|
|
background: #fafafa; |
|
|
|
|
p { |
|
|
|
|
margin-top: 10px; |
|
|
|
|
font-size: 14px; |
|
|
|
@ -769,7 +833,7 @@ $upload-lg-height: 102px; |
|
|
|
|
text-align: center; |
|
|
|
|
cursor: pointer; |
|
|
|
|
&:hover .review { |
|
|
|
|
border-color: #9278FF; |
|
|
|
|
border-color: #9278ff; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.review { |
|
|
|
@ -779,7 +843,7 @@ $upload-lg-height: 102px; |
|
|
|
|
width: 170px; |
|
|
|
|
height: 112px; |
|
|
|
|
margin-bottom: 10px; |
|
|
|
|
border: 1px solid #DCDEE0; |
|
|
|
|
border: 1px solid #dcdee0; |
|
|
|
|
border-radius: 2px; |
|
|
|
|
img { |
|
|
|
|
width: 80px; |
|
|
|
@ -798,7 +862,7 @@ $upload-lg-height: 102px; |
|
|
|
|
.plus { |
|
|
|
|
margin-bottom: 10px; |
|
|
|
|
font-size: 18px; |
|
|
|
|
color: #9278FF; |
|
|
|
|
color: #9278ff; |
|
|
|
|
text-align: right; |
|
|
|
|
cursor: pointer; |
|
|
|
|
} |
|
|
|
@ -806,7 +870,8 @@ $upload-lg-height: 102px; |
|
|
|
|
margin-left: 10px !important; |
|
|
|
|
} |
|
|
|
|
.manage-dia { |
|
|
|
|
.edit, .del { |
|
|
|
|
.edit, |
|
|
|
|
.del { |
|
|
|
|
font-size: 14px; |
|
|
|
|
cursor: pointer; |
|
|
|
|
} |
|
|
|
@ -834,12 +899,13 @@ $upload-lg-height: 102px; |
|
|
|
|
} |
|
|
|
|
.line { |
|
|
|
|
margin-bottom: 24px; |
|
|
|
|
border-bottom: 1px dashed #C2C2C2; |
|
|
|
|
border-bottom: 1px dashed #c2c2c2; |
|
|
|
|
} |
|
|
|
|
.el-form-item--small.el-form-item { |
|
|
|
|
margin-bottom: 24px; |
|
|
|
|
} |
|
|
|
|
.el-input, .el-select { |
|
|
|
|
.el-input, |
|
|
|
|
.el-select { |
|
|
|
|
width: 300px; |
|
|
|
|
} |
|
|
|
|
.el-select .el-input { |
|
|
|
@ -848,13 +914,14 @@ $upload-lg-height: 102px; |
|
|
|
|
.el-textarea { |
|
|
|
|
width: 550px; |
|
|
|
|
} |
|
|
|
|
.auto, .auto .el-input { |
|
|
|
|
.auto, |
|
|
|
|
.auto .el-input { |
|
|
|
|
width: auto; |
|
|
|
|
} |
|
|
|
|
.el-form-item.is-required:not(.is-no-asterisk) > .el-form-item__label:before { |
|
|
|
|
font-size: 18px; |
|
|
|
|
vertical-align: -4px; |
|
|
|
|
color: #F5222D; |
|
|
|
|
color: #f5222d; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.btns { |
|
|
|
|