|
|
|
@ -1,20 +1,23 @@ |
|
|
|
|
<template> |
|
|
|
|
<div class="page" v-show="loaded"> |
|
|
|
|
<div class="page" |
|
|
|
|
v-show="loaded"> |
|
|
|
|
<p class="page-name mb">栏目</p> |
|
|
|
|
<el-form :model="form" :rules="rules" class="input-form model" label-width="120px"> |
|
|
|
|
<el-form :model="form" |
|
|
|
|
:rules="rules" |
|
|
|
|
class="input-form model" |
|
|
|
|
label-width="120px"> |
|
|
|
|
<div class="item-line"> |
|
|
|
|
<el-form-item prop="columnName" label="栏目名称"> |
|
|
|
|
<el-input |
|
|
|
|
placeholder="请输入栏目名称" |
|
|
|
|
<el-form-item prop="columnName" |
|
|
|
|
label="栏目名称"> |
|
|
|
|
<el-input placeholder="请输入栏目名称" |
|
|
|
|
v-model="form.columnName" |
|
|
|
|
clearable |
|
|
|
|
maxlength="40" |
|
|
|
|
@input="nameChange" |
|
|
|
|
></el-input> |
|
|
|
|
@input="nameChange"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="fatherId" label="设置上级"> |
|
|
|
|
<el-cascader |
|
|
|
|
ref="fatherId" |
|
|
|
|
<el-form-item prop="fatherId" |
|
|
|
|
label="设置上级"> |
|
|
|
|
<el-cascader ref="fatherId" |
|
|
|
|
v-model="form.fatherId" |
|
|
|
|
:options="columns" |
|
|
|
|
:props="columnProps" |
|
|
|
@ -23,22 +26,26 @@ |
|
|
|
|
</el-form-item> |
|
|
|
|
</div> |
|
|
|
|
<div class="item-line"> |
|
|
|
|
<el-form-item prop="typeId" label="栏目类型"> |
|
|
|
|
<el-select v-model="form.typeId" @change="typeChange"> |
|
|
|
|
<el-option |
|
|
|
|
v-for="item in types" |
|
|
|
|
<el-form-item prop="typeId" |
|
|
|
|
label="栏目类型"> |
|
|
|
|
<el-select v-model="form.typeId" |
|
|
|
|
@change="typeChange"> |
|
|
|
|
<el-option v-for="item in types" |
|
|
|
|
:key="item.id" |
|
|
|
|
:label="item.name" |
|
|
|
|
:value="item.id"> |
|
|
|
|
</el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="pageSize" label="分页条数"> |
|
|
|
|
<el-input-number v-model="form.pageSize" :min="0" class="auto"></el-input-number> |
|
|
|
|
<el-form-item prop="pageSize" |
|
|
|
|
label="分页条数"> |
|
|
|
|
<el-input-number v-model="form.pageSize" |
|
|
|
|
:min="0" |
|
|
|
|
class="auto"></el-input-number> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="menuVisible" label="导航菜单可见"> |
|
|
|
|
<el-switch |
|
|
|
|
v-model="form.menuVisible" |
|
|
|
|
<el-form-item prop="menuVisible" |
|
|
|
|
label="导航菜单可见"> |
|
|
|
|
<el-switch v-model="form.menuVisible" |
|
|
|
|
:active-value="0" |
|
|
|
|
:inactive-value="1"> |
|
|
|
|
</el-switch> |
|
|
|
@ -46,65 +53,83 @@ |
|
|
|
|
</div> |
|
|
|
|
<div class="line"></div> |
|
|
|
|
<template v-if="form.typeId === 1 || form.typeId === 4"> |
|
|
|
|
<el-form-item prop="columnBanner" label="栏目Banner"> |
|
|
|
|
<el-upload |
|
|
|
|
class="avatar-uploader avatar-uploader-lg" |
|
|
|
|
<el-form-item prop="columnBanner" |
|
|
|
|
label="栏目Banner"> |
|
|
|
|
<el-upload class="avatar-uploader avatar-uploader-lg" |
|
|
|
|
accept=".jpg,.png,.jpeg,.gif" |
|
|
|
|
:on-change="changeFile" |
|
|
|
|
:show-file-list="false" |
|
|
|
|
:action="this.api.upload" |
|
|
|
|
:auto-upload="false" |
|
|
|
|
> |
|
|
|
|
<img v-if="form.columnBanner" :src="form.columnBanner" class="avatar-lg"> |
|
|
|
|
<div class="uploader-default" v-else> |
|
|
|
|
<img class="plus" src="@/assets/images/plus.png" alt=""> |
|
|
|
|
:auto-upload="false"> |
|
|
|
|
<img v-if="form.columnBanner" |
|
|
|
|
:src="form.columnBanner" |
|
|
|
|
class="avatar-lg"> |
|
|
|
|
<div class="uploader-default" |
|
|
|
|
v-else> |
|
|
|
|
<img class="plus" |
|
|
|
|
src="@/assets/images/plus.png" |
|
|
|
|
alt=""> |
|
|
|
|
<p>点击上传</p> |
|
|
|
|
</div> |
|
|
|
|
<div slot="tip" class="el-upload__tip"> |
|
|
|
|
<div slot="tip" |
|
|
|
|
class="el-upload__tip"> |
|
|
|
|
<p>请上传1920x500PX,5M以内的jpg,bmp,png格式</p> |
|
|
|
|
</div> |
|
|
|
|
</el-upload> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="subtitle" label="栏目副标题"> |
|
|
|
|
<el-input |
|
|
|
|
type="textarea" |
|
|
|
|
<el-form-item prop="subtitle" |
|
|
|
|
label="栏目副标题"> |
|
|
|
|
<el-input type="textarea" |
|
|
|
|
placeholder="请输入栏目副标题" |
|
|
|
|
v-model="form.subtitle" |
|
|
|
|
></el-input> |
|
|
|
|
v-model="form.subtitle"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="templateId" label="栏目模板"> |
|
|
|
|
<el-select v-model="form.templateId" @change="getStyle"> |
|
|
|
|
<el-option |
|
|
|
|
v-for="item in templates" |
|
|
|
|
<el-form-item prop="templateId" |
|
|
|
|
label="栏目模板"> |
|
|
|
|
<el-select v-model="form.templateId" |
|
|
|
|
@change="getStyle"> |
|
|
|
|
<el-option v-for="item in templates" |
|
|
|
|
:key="item.id" |
|
|
|
|
:label="item.templateType" |
|
|
|
|
:value="item.id"> |
|
|
|
|
</el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="listStyleId" label="列表样式"> |
|
|
|
|
<el-form-item prop="listStyleId" |
|
|
|
|
label="列表样式"> |
|
|
|
|
<ul class="styles"> |
|
|
|
|
<li v-for="(item, i) in listStyle" :key="i" @click="form.listStyleId = item.id"> |
|
|
|
|
<li v-for="(item, i) in listStyle" |
|
|
|
|
:key="i" |
|
|
|
|
@click="form.listStyleId = item.id"> |
|
|
|
|
<div class="review"> |
|
|
|
|
<img style="width: 90px;max-height: 110px;" :src="require('@/assets/images/style/' + item.id + '.png')" alt=""> |
|
|
|
|
<img style="width: 90px;max-height: 110px;" |
|
|
|
|
:src="require('@/assets/images/style/' + item.id + '.png')" |
|
|
|
|
alt=""> |
|
|
|
|
</div> |
|
|
|
|
<el-radio v-model="form.listStyleId" :label="item.id">{{ item.style }}</el-radio> |
|
|
|
|
<el-radio v-model="form.listStyleId" |
|
|
|
|
:label="item.id">{{ item.style }}</el-radio> |
|
|
|
|
</li> |
|
|
|
|
</ul> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="detailStyleId" label="详情样式"> |
|
|
|
|
<el-form-item prop="detailStyleId" |
|
|
|
|
label="详情样式"> |
|
|
|
|
<ul class="styles"> |
|
|
|
|
<li v-for="(item, i) in detailStyleId" :key="i" @click="form.detailStyleId = item.id"> |
|
|
|
|
<li v-for="(item, i) in detailStyleId" |
|
|
|
|
:key="i" |
|
|
|
|
@click="form.detailStyleId = item.id"> |
|
|
|
|
<div class="review"> |
|
|
|
|
<img :style="{width: item.id == 24 ? '50px' : '90px', 'max-height': '110px'}" :src="require('@/assets/images/style/' + item.id + '.png')" alt=""> |
|
|
|
|
<img :style="{width: item.id == 24 ? '50px' : '90px', 'max-height': '110px'}" |
|
|
|
|
:src="require('@/assets/images/style/' + item.id + '.png')" |
|
|
|
|
alt=""> |
|
|
|
|
</div> |
|
|
|
|
<el-radio v-model="form.detailStyleId" :label="item.id">{{ item.style }}</el-radio> |
|
|
|
|
<el-radio v-model="form.detailStyleId" |
|
|
|
|
:label="item.id">{{ item.style }}</el-radio> |
|
|
|
|
</li> |
|
|
|
|
</ul> |
|
|
|
|
</el-form-item> |
|
|
|
|
</template> |
|
|
|
|
<template v-if="form.typeId === 2"> |
|
|
|
|
<el-form-item prop="connectionType" label="连接类型"> |
|
|
|
|
<el-form-item prop="connectionType" |
|
|
|
|
label="连接类型"> |
|
|
|
|
<el-radio-group v-model="form.connectionType"> |
|
|
|
|
<el-radio :label="1">站内链接</el-radio> |
|
|
|
|
<el-radio :label="2">站外链接</el-radio> |
|
|
|
@ -113,17 +138,16 @@ |
|
|
|
|
</el-form-item> |
|
|
|
|
<template v-if="form.connectionType === 1"> |
|
|
|
|
<el-form-item label="站内链接"> |
|
|
|
|
<el-cascader |
|
|
|
|
v-model="links" |
|
|
|
|
<el-cascader v-model="links" |
|
|
|
|
:options="columns" |
|
|
|
|
:props="columnProps" |
|
|
|
|
clearable |
|
|
|
|
@change="getArticle"></el-cascader> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="文章"> |
|
|
|
|
<el-select v-model="article" clearable> |
|
|
|
|
<el-option |
|
|
|
|
v-for="item in articles" |
|
|
|
|
<el-select v-model="article" |
|
|
|
|
clearable> |
|
|
|
|
<el-option v-for="item in articles" |
|
|
|
|
:key="item.id" |
|
|
|
|
:label="item.title" |
|
|
|
|
:value="item.id"> |
|
|
|
@ -131,18 +155,19 @@ |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
</template> |
|
|
|
|
<el-form-item v-show="form.connectionType === 2" prop="linkAddress" label="站外链接"> |
|
|
|
|
<el-input |
|
|
|
|
placeholder="请输入站外链接" |
|
|
|
|
<el-form-item v-show="form.connectionType === 2" |
|
|
|
|
prop="linkAddress" |
|
|
|
|
label="站外链接"> |
|
|
|
|
<el-input placeholder="请输入站外链接" |
|
|
|
|
v-model.trim="form.linkAddress" |
|
|
|
|
clearable |
|
|
|
|
></el-input> |
|
|
|
|
clearable></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<template v-if="form.connectionType === 3"> |
|
|
|
|
<el-form-item prop="siteSelection" label="站点选择"> |
|
|
|
|
<el-select v-model="form.siteSelection" @change="getOtherColumn"> |
|
|
|
|
<el-option |
|
|
|
|
v-for="item in sites" |
|
|
|
|
<el-form-item prop="siteSelection" |
|
|
|
|
label="站点选择"> |
|
|
|
|
<el-select v-model="form.siteSelection" |
|
|
|
|
@change="getOtherColumn"> |
|
|
|
|
<el-option v-for="item in sites" |
|
|
|
|
:key="item.id" |
|
|
|
|
:label="item.siteName" |
|
|
|
|
:value="item.id"> |
|
|
|
@ -150,17 +175,16 @@ |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="栏目"> |
|
|
|
|
<el-cascader |
|
|
|
|
v-model="otherLink" |
|
|
|
|
<el-cascader v-model="otherLink" |
|
|
|
|
:options="otherColumns" |
|
|
|
|
:props="columnProps" |
|
|
|
|
clearable |
|
|
|
|
@change="getArticle"></el-cascader> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item label="文章"> |
|
|
|
|
<el-select v-model="otherArticle" clearable> |
|
|
|
|
<el-option |
|
|
|
|
v-for="item in otherArticles" |
|
|
|
|
<el-select v-model="otherArticle" |
|
|
|
|
clearable> |
|
|
|
|
<el-option v-for="item in otherArticles" |
|
|
|
|
:key="item.id" |
|
|
|
|
:label="item.title" |
|
|
|
|
:value="item.id"> |
|
|
|
@ -168,30 +192,35 @@ |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
</template> |
|
|
|
|
<el-form-item prop="isOpen" label="新窗口打开"> |
|
|
|
|
<el-switch |
|
|
|
|
v-model="form.isOpen" |
|
|
|
|
<el-form-item prop="isOpen" |
|
|
|
|
label="新窗口打开"> |
|
|
|
|
<el-switch v-model="form.isOpen" |
|
|
|
|
:active-value="1" |
|
|
|
|
:inactive-value="0"> |
|
|
|
|
</el-switch> |
|
|
|
|
</el-form-item> |
|
|
|
|
</template> |
|
|
|
|
<template v-if="form.typeId === 3"> |
|
|
|
|
<el-form-item prop="templateId" label="栏目模板"> |
|
|
|
|
<el-form-item prop="templateId" |
|
|
|
|
label="栏目模板"> |
|
|
|
|
<el-select v-model="form.templateId"> |
|
|
|
|
<el-option |
|
|
|
|
label="长页模板" |
|
|
|
|
<el-option label="长页模板" |
|
|
|
|
:value="9"> |
|
|
|
|
</el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-form-item prop="listStyleId" label="列表样式"> |
|
|
|
|
<el-form-item prop="listStyleId" |
|
|
|
|
label="列表样式"> |
|
|
|
|
<ul class="styles"> |
|
|
|
|
<li v-for="(item, i) in pageStyle" :key="i" @click="form.listStyleId = item.id"> |
|
|
|
|
<li v-for="(item, i) in pageStyle" |
|
|
|
|
:key="i" |
|
|
|
|
@click="form.listStyleId = item.id"> |
|
|
|
|
<div class="review"> |
|
|
|
|
<img :src="require('@/assets/images/page/' + item.pic + '.png')" alt=""> |
|
|
|
|
<img :src="require('@/assets/images/page/' + item.pic + '.png')" |
|
|
|
|
alt=""> |
|
|
|
|
</div> |
|
|
|
|
<el-radio v-model="form.listStyleId" :label="item.id">{{ item.style }}</el-radio> |
|
|
|
|
<el-radio v-model="form.listStyleId" |
|
|
|
|
:label="item.id">{{ item.style }}</el-radio> |
|
|
|
|
</li> |
|
|
|
|
</ul> |
|
|
|
|
</el-form-item> |
|
|
|
@ -205,13 +234,17 @@ |
|
|
|
|
</el-form-item> --> |
|
|
|
|
</el-form> |
|
|
|
|
<div class="btns"> |
|
|
|
|
<el-button type="primary" @click="submit(0)">确定</el-button> |
|
|
|
|
<el-button type="primary" |
|
|
|
|
@click="submit(0)">确定</el-button> |
|
|
|
|
<el-button @click="$router.push('/column')">取消</el-button> |
|
|
|
|
</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" |
|
|
|
@ -228,7 +261,7 @@ import Cropper from '@/components/img-upload/Cropper' |
|
|
|
|
import Axios from 'axios' |
|
|
|
|
import Modules from '@/const/modules' |
|
|
|
|
export default { |
|
|
|
|
data() { |
|
|
|
|
data () { |
|
|
|
|
return { |
|
|
|
|
loaded: false, |
|
|
|
|
userId: +this.$store.state.user.userId, |
|
|
|
@ -271,7 +304,7 @@ export default { |
|
|
|
|
listStyleId: 1, |
|
|
|
|
detailStyleId: 1, |
|
|
|
|
connectionType: 1, |
|
|
|
|
linkAddress : '', |
|
|
|
|
linkAddress: '', |
|
|
|
|
showWithDetails: 0, |
|
|
|
|
siteSelection: '', |
|
|
|
|
status: 1, |
|
|
|
@ -320,7 +353,7 @@ export default { |
|
|
|
|
'userName' |
|
|
|
|
]) |
|
|
|
|
}, |
|
|
|
|
mounted() { |
|
|
|
|
mounted () { |
|
|
|
|
this.$store.commit('user/setCrumbs', [ |
|
|
|
|
{ |
|
|
|
|
name: '站点管理', |
|
|
|
@ -345,14 +378,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 { |
|
|
|
@ -374,12 +407,12 @@ export default { |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
// 获取当前站点的栏目列表 |
|
|
|
|
getList() { |
|
|
|
|
getList () { |
|
|
|
|
this.$post(this.api.listWithTree, { |
|
|
|
|
siteId: this.site.id, |
|
|
|
|
columnName: '', |
|
|
|
|
templateId: '', |
|
|
|
|
typeId : '', |
|
|
|
|
typeId: '', |
|
|
|
|
isSort: 1 |
|
|
|
|
}).then(({ data }) => { |
|
|
|
|
this.columns = data |
|
|
|
@ -390,17 +423,17 @@ export default { |
|
|
|
|
this.getOtherColumn() |
|
|
|
|
this.loaded = true |
|
|
|
|
} |
|
|
|
|
}).catch(err => {}) |
|
|
|
|
}).catch(err => { }) |
|
|
|
|
}, |
|
|
|
|
// 给当前栏目加上disabled禁止选中 |
|
|
|
|
handleId(list) { |
|
|
|
|
handleId (list) { |
|
|
|
|
list.forEach(e => { |
|
|
|
|
if (this.isEdit && e.id == this.form.id) e.disabled = true |
|
|
|
|
e.children.length ? this.handleId(e.children) : delete e.children |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 文章列表 |
|
|
|
|
getArticle() { |
|
|
|
|
getArticle () { |
|
|
|
|
// 站内链接/其他站点链接 |
|
|
|
|
const inner = this.form.connectionType === 1 |
|
|
|
|
const id = inner ? this.links[this.links.length - 1] : this.otherLink[this.otherLink.length - 1] |
|
|
|
@ -414,10 +447,10 @@ export default { |
|
|
|
|
isDisable: 0 |
|
|
|
|
}).then(({ data }) => { |
|
|
|
|
this[inner ? 'articles' : 'otherArticles'] = data.records.filter(e => e.isRelease) // 只显示已发布的文章 |
|
|
|
|
}).catch(err => {}) |
|
|
|
|
}).catch(err => { }) |
|
|
|
|
}, |
|
|
|
|
// 获取详情 |
|
|
|
|
getData() { |
|
|
|
|
getData () { |
|
|
|
|
this.$post(`${this.api.findColumn}?id=${this.form.id}`).then(({ data }) => { |
|
|
|
|
this.form = data |
|
|
|
|
if (data.typeId === 1 || data.typeId === 4) this.getStyle(0) |
|
|
|
@ -452,16 +485,16 @@ export default { |
|
|
|
|
this.updateTime = 1 |
|
|
|
|
}) |
|
|
|
|
this.loaded = true |
|
|
|
|
}).catch(err => {}) |
|
|
|
|
}).catch(err => { }) |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
this.loaded = true |
|
|
|
|
} |
|
|
|
|
this.getOtherColumn() |
|
|
|
|
}).catch(err => {}) |
|
|
|
|
}).catch(err => { }) |
|
|
|
|
}, |
|
|
|
|
// 栏目类型切换回调 |
|
|
|
|
typeChange(val) { |
|
|
|
|
typeChange (val) { |
|
|
|
|
if (val === 1 || val === 4) { |
|
|
|
|
this.form.templateId = 1 |
|
|
|
|
this.getStyle() |
|
|
|
@ -471,11 +504,11 @@ export default { |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 获取栏目模板 |
|
|
|
|
getTemplate() { |
|
|
|
|
getTemplate () { |
|
|
|
|
this.$post(this.api.listOfColumnTemplates).then(({ data }) => { |
|
|
|
|
this.templates = data |
|
|
|
|
this.isEdit || this.getStyle() |
|
|
|
|
}).catch(err => {}) |
|
|
|
|
}).catch(err => { }) |
|
|
|
|
|
|
|
|
|
this.$post(this.api.longPageListStyle).then(({ data }) => { |
|
|
|
|
// 产业光源五个页面的path有斜杠,图片名没法用斜杠,所以改成驼峰 |
|
|
|
@ -490,22 +523,24 @@ export default { |
|
|
|
|
e.pic = pic |
|
|
|
|
}) |
|
|
|
|
this.pageStyle = data |
|
|
|
|
}).catch(err => {}) |
|
|
|
|
}).catch(err => { }) |
|
|
|
|
}, |
|
|
|
|
// 根据模板id获取样式 |
|
|
|
|
getStyle(set = 1) { |
|
|
|
|
getStyle (set = 1) { |
|
|
|
|
const { templateId } = this.form |
|
|
|
|
this.$post(`${this.api.theTemplateIdGetsTheStyle}?templateId=${templateId}`).then(({ data }) => { |
|
|
|
|
this.listStyle = data.listingTemplateTypes |
|
|
|
|
this.detailStyleId = data.detailsTypeOfTheTemplate |
|
|
|
|
const detailList = data.detailsTypeOfTheTemplate |
|
|
|
|
if (templateId == 11) detailList.shift() // 出版物不用显示文章 |
|
|
|
|
this.detailStyleId = detailList |
|
|
|
|
if (set) { |
|
|
|
|
this.form.listStyleId = this.listStyle[templateId === 1 ? 1 : 0].id |
|
|
|
|
this.form.detailStyleId = this.detailStyleId[0].id |
|
|
|
|
this.form.detailStyleId = this.detailStyleId[templateId === 7 ? 1 : 0].id |
|
|
|
|
} |
|
|
|
|
}).catch(err => {}) |
|
|
|
|
}).catch(err => { }) |
|
|
|
|
}, |
|
|
|
|
// 获取站点列表 |
|
|
|
|
getSite() { |
|
|
|
|
getSite () { |
|
|
|
|
this.$post(this.api.site, { |
|
|
|
|
page: 1, |
|
|
|
|
limit: 1000, |
|
|
|
@ -513,15 +548,15 @@ export default { |
|
|
|
|
}).then(({ data }) => { |
|
|
|
|
data.records.splice(data.records.findIndex(e => e.id == this.site.id), 1) // 不显示当前站点 |
|
|
|
|
this.sites = data.records |
|
|
|
|
}).catch(e => {}) |
|
|
|
|
}).catch(e => { }) |
|
|
|
|
}, |
|
|
|
|
// 获取指定站点的栏目列表 |
|
|
|
|
getOtherColumn(val) { |
|
|
|
|
getOtherColumn (val) { |
|
|
|
|
this.form.siteSelection && this.$post(this.api.listWithTree, { |
|
|
|
|
siteId: this.form.siteSelection, |
|
|
|
|
columnName: '', |
|
|
|
|
templateId: '', |
|
|
|
|
typeId : '', |
|
|
|
|
typeId: '', |
|
|
|
|
isSort: 1 |
|
|
|
|
}).then(({ data }) => { |
|
|
|
|
if (val) { |
|
|
|
@ -530,10 +565,10 @@ export default { |
|
|
|
|
this.otherLink = '' |
|
|
|
|
} |
|
|
|
|
this.otherColumns = data |
|
|
|
|
}).catch(err => {}) |
|
|
|
|
}).catch(err => { }) |
|
|
|
|
}, |
|
|
|
|
// 栏目名称判重 |
|
|
|
|
nameChange(){ |
|
|
|
|
nameChange () { |
|
|
|
|
clearTimeout(this.nameTimer) |
|
|
|
|
this.nameTimer = setTimeout(() => { |
|
|
|
|
const { columnName, fatherId, id } = this.form |
|
|
|
@ -549,19 +584,19 @@ export default { |
|
|
|
|
}).catch(res => { |
|
|
|
|
this.nameRepeat = true |
|
|
|
|
}) |
|
|
|
|
}else{ |
|
|
|
|
} else { |
|
|
|
|
this.nameRepeat = false |
|
|
|
|
} |
|
|
|
|
}, 500) |
|
|
|
|
}, |
|
|
|
|
// 上级选择回调 |
|
|
|
|
fatherIdChange(val) { |
|
|
|
|
fatherIdChange (val) { |
|
|
|
|
const check = this.$refs.fatherId.getCheckedNodes() |
|
|
|
|
this.form.level = check.length ? check[0].level + 1 : 1 // 更改了父级后要重新获取当前栏目level |
|
|
|
|
this.nameChange() |
|
|
|
|
}, |
|
|
|
|
// 图片裁剪上传事件 |
|
|
|
|
customUpload(data) { |
|
|
|
|
customUpload (data) { |
|
|
|
|
const formData = new FormData() |
|
|
|
|
formData.append('file', data, this.file.name) |
|
|
|
|
formData.append('quote', this.form.columnName) |
|
|
|
@ -571,10 +606,10 @@ export default { |
|
|
|
|
this.imgUpload(formData) |
|
|
|
|
}, |
|
|
|
|
// 压缩图片 |
|
|
|
|
compress(img) { |
|
|
|
|
compress (img) { |
|
|
|
|
const canvas = document.createElement('canvas') |
|
|
|
|
const ctx = canvas.getContext('2d') |
|
|
|
|
console.log("🚀 ~ file: index.vue:540 ~ compress ~ ctx", ctx,img.width) |
|
|
|
|
console.log("🚀 ~ file: index.vue:540 ~ compress ~ ctx", ctx, img.width) |
|
|
|
|
// let initSize = img.src.length; |
|
|
|
|
const width = img.width |
|
|
|
|
const height = img.height |
|
|
|
@ -589,7 +624,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]) |
|
|
|
@ -609,7 +644,7 @@ export default { |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 图片上传到服务器 |
|
|
|
|
imgUpload(formData) { |
|
|
|
|
imgUpload (formData) { |
|
|
|
|
this.isUpload = true |
|
|
|
|
Axios({ |
|
|
|
|
method: 'post', |
|
|
|
@ -621,16 +656,16 @@ export default { |
|
|
|
|
}, |
|
|
|
|
}).then(({ data }) => { |
|
|
|
|
let url = this.form.columnBanner |
|
|
|
|
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.columnBanner = data.url |
|
|
|
|
this.fileId = data.id |
|
|
|
|
}).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)) { |
|
|
|
@ -651,7 +686,7 @@ export default { |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// 更新附件的状态为发布 |
|
|
|
|
updateFile(form, quoteId) { |
|
|
|
|
updateFile (form, quoteId) { |
|
|
|
|
this.fileId && this.$post(this.api.updateFile, { |
|
|
|
|
id: this.fileId, |
|
|
|
|
isRelease: 1, |
|
|
|
@ -659,10 +694,10 @@ export default { |
|
|
|
|
quoteId |
|
|
|
|
}).then(res => { |
|
|
|
|
this.fileId = '' |
|
|
|
|
}).catch(err => {}) |
|
|
|
|
}).catch(err => { }) |
|
|
|
|
}, |
|
|
|
|
// 提交 |
|
|
|
|
submit(next) { |
|
|
|
|
submit (next) { |
|
|
|
|
if (this.submiting) return false |
|
|
|
|
const { form } = this |
|
|
|
|
if (!form.columnName) return Util.errorMsg('请填写栏目名称') |
|
|
|
@ -710,7 +745,7 @@ export default { |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
// 保存长页模板 |
|
|
|
|
savePage(columnId) { |
|
|
|
|
savePage (columnId) { |
|
|
|
|
const { listStyleId } = this.form |
|
|
|
|
const module = Modules[this.pageStyle.find(e => e.id == listStyleId).path] // 获取module.js里存的初始长页数据 |
|
|
|
|
if (module) { |
|
|
|
@ -722,7 +757,7 @@ export default { |
|
|
|
|
editorId: this.userId, |
|
|
|
|
jsonBeforeEditing: module, |
|
|
|
|
theEditedJson: module, |
|
|
|
|
}).then(res => {}).catch(err => {}) |
|
|
|
|
}).then(res => { }).catch(err => { }) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -738,7 +773,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; |
|
|
|
@ -749,7 +784,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; |
|
|
|
@ -803,7 +838,7 @@ $upload-lg-height: 102px; |
|
|
|
|
text-align: center; |
|
|
|
|
cursor: pointer; |
|
|
|
|
&:hover .review { |
|
|
|
|
border-color: #2962FF; |
|
|
|
|
border-color: #2962ff; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.review { |
|
|
|
@ -813,7 +848,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: 50px; |
|
|
|
|