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