1.2.3 后台操作按钮调整及其新增开启拼团功能

This commit is contained in:
hupeng
2019-11-19 13:44:19 +08:00
commit 4faa83dc0c
307 changed files with 23684 additions and 0 deletions

View File

@ -0,0 +1,139 @@
<template>
<el-dialog :append-to-body="true" :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog" :title="isAdd ? '新增' : '编辑'" width="900px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
<el-form-item label="标题" >
<el-input v-model="form.title" style="width: 370px;"/>
</el-form-item>
<el-form-item label="作者" >
<el-input v-model="form.author" style="width: 370px;"/>
</el-form-item>
<el-form-item label="封面" >
<pic-upload v-model="form.imageInput" style="width: 370px;"/>
</el-form-item>
<el-form-item label="简介" >
<el-input v-model="form.synopsis" style="width: 370px;" rows="5" type="textarea"/>
</el-form-item>
<el-form-item label="正文" >
<editor v-model="form.content" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="cancel">取消</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</template>
<script>
import { add, edit } from '@/api/yxArticle'
import picUpload from '@/components/pic-upload'
import editor from '../../components/Editor'
import yamedit from '@/components/YamlEdit'
export default {
components: { editor, picUpload, yamedit },
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false,
form: {
id: '',
cid: '',
title: '',
author: '',
imageInput: '',
synopsis: '',
content: '',
shareTitle: '',
shareSynopsis: '',
visit: '',
sort: '',
url: '',
status: '',
addTime: '',
hide: '',
merId: '',
productId: '',
isHot: '',
isBanner: ''
},
rules: {
}
}
},
methods: {
cancel() {
this.resetForm()
},
doSubmit() {
this.loading = true
if (this.isAdd) {
this.doAdd()
} else this.doEdit()
},
doAdd() {
add(this.form).then(res => {
this.resetForm()
this.$notify({
title: '添加成功',
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
doEdit() {
edit(this.form).then(res => {
this.resetForm()
this.$notify({
title: '修改成功',
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
resetForm() {
this.dialog = false
this.$refs['form'].resetFields()
this.form = {
id: '',
cid: '',
title: '',
author: '',
imageInput: '',
synopsis: '',
shareTitle: '',
shareSynopsis: '',
visit: '',
sort: '',
url: '',
status: '',
addTime: '',
hide: '',
adminId: '',
merId: '',
productId: '',
isHot: '',
isBanner: ''
}
}
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,175 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!-- 新增 -->
<div style="display: inline-block;margin: 0px 2px;">
<el-button
v-permission="['ADMIN','YXARTICLE_ALL','YXARTICLE_CREATE']"
class="filter-item"
size="mini"
type="primary"
icon="el-icon-plus"
@click="add">新增</el-button>
</div>
</div>
<!--表单组件-->
<eForm ref="form" :is-add="isAdd"/>
<!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
<el-table-column prop="id" label="ID"/>
<el-table-column prop="title" label="标题"/>
<el-table-column prop="author" label="作者"/>
<el-table-column ref="table" prop="imageInput" label="封面">
<template slot-scope="scope">
<a :href="scope.row.imageInput" style="color: #42b983" target="_blank"><img :src="scope.row.imageInput" alt="点击打开" class="el-avatar"></a>
</template>
</el-table-column>
<el-table-column :show-overflow-tooltip="true" prop="addTime" label="创建日期">
<template slot-scope="scope">
<span>{{ scope.row.addTime }}</span>
</template>
</el-table-column>
<el-table-column v-if="checkPermission(['ADMIN','YXARTICLE_ALL','YXARTICLE_EDIT','YXARTICLE_DELETE'])" label="操作" width="180px" align="center">
<template slot-scope="scope">
<el-button v-permission="['ADMIN','YXARTICLE_ALL','YXARTICLE_EDIT']" size="mini" type="primary" icon="el-icon-edit" @click="edit(scope.row)"/>
<el-popover
v-permission="['ADMIN','YXARTICLE_ALL','YXARTICLE_DELETE']"
:ref="scope.row.id"
placement="top"
width="180">
<p>确定删除本条数据吗</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="$refs[scope.row.id].doClose()">取消</el-button>
<el-button :loading="delLoading" type="primary" size="mini" @click="subDelete(scope.row.id)">确定</el-button>
</div>
<el-button slot="reference" type="danger" icon="el-icon-delete" size="mini"/>
</el-popover>
<el-popover
v-permission="['ADMIN','YXARTICLE_ALL','YXARTICLE_DELETE']"
:ref="'item'+scope.row.id"
placement="top"
width="180">
<p>确定发布本条数据吗</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="$refs['item'+scope.row.id].doClose()">取消</el-button>
<el-button :loading="delLoading" type="primary" size="mini" @click="subPublish(scope.row.id)">确定</el-button>
</div>
<el-button slot="reference" type="primary" size="mini">发布</el-button>
</el-popover>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"/>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/initData'
import { del, publish } from '@/api/yxArticle'
import eForm from './form'
import { formatTime } from '@/utils/index'
export default {
components: { eForm },
mixins: [initData],
data() {
return {
delLoading: false,
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
formatTime,
checkPermission,
beforeInit() {
this.url = 'api/yxArticle'
const sort = 'id,desc'
this.params = { page: this.page, size: this.size, sort: sort }
return true
},
subDelete(id) {
this.delLoading = true
del(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[id].doClose()
console.log(err.response.data.message)
})
},
subPublish(id) {
this.delLoading = true
publish(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '发布成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[id].doClose()
console.log(err.response.data.message)
})
},
add() {
this.isAdd = true
this.$refs.form.dialog = true
},
edit(data) {
this.isAdd = false
const _this = this.$refs.form
_this.form = {
id: data.id,
cid: data.cid,
title: data.title,
author: data.author,
imageInput: data.imageInput,
synopsis: data.synopsis,
content: data.content,
shareTitle: data.shareTitle,
shareSynopsis: data.shareSynopsis,
visit: data.visit,
sort: data.sort,
url: data.url,
status: data.status,
addTime: data.addTime,
hide: data.hide,
adminId: data.adminId,
merId: data.merId,
productId: data.productId,
isHot: data.isHot,
isBanner: data.isBanner
}
_this.dialog = true
}
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,154 @@
<template>
<el-dialog :append-to-body="true" :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog" :title="isAdd ? '新增' : '编辑'" width="500px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
<el-form-item label="字段名称" >
<el-input v-model="form.menuName" style="width: 370px;"/>
</el-form-item>
<el-form-item label="类型(文本框,单选按钮...)" >
<el-input v-model="form.type" style="width: 370px;"/>
</el-form-item>
<el-form-item label="表单类型" >
<el-input v-model="form.inputType" style="width: 370px;"/>
</el-form-item>
<el-form-item label="配置分类id" >
<el-input v-model="form.configTabId" style="width: 370px;"/>
</el-form-item>
<el-form-item label="规则 单选框和多选框" >
<el-input v-model="form.parameter" style="width: 370px;"/>
</el-form-item>
<el-form-item label="上传文件格式1单图2多图3文件" >
<el-input v-model="form.uploadType" style="width: 370px;"/>
</el-form-item>
<el-form-item label="规则" >
<el-input v-model="form.required" style="width: 370px;"/>
</el-form-item>
<el-form-item label="多行文本框的宽度" >
<el-input v-model="form.width" style="width: 370px;"/>
</el-form-item>
<el-form-item label="多行文框的高度" >
<el-input v-model="form.high" style="width: 370px;"/>
</el-form-item>
<el-form-item label="默认值" >
<el-input v-model="form.value" style="width: 370px;"/>
</el-form-item>
<el-form-item label="配置名称" >
<el-input v-model="form.info" style="width: 370px;"/>
</el-form-item>
<el-form-item label="配置简介" >
<el-input v-model="form.desc" style="width: 370px;"/>
</el-form-item>
<el-form-item label="排序" >
<el-input v-model="form.sort" style="width: 370px;"/>
</el-form-item>
<el-form-item label="是否隐藏" >
<el-input v-model="form.status" style="width: 370px;"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="cancel">取消</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</template>
<script>
import { add, edit } from '@/api/yxSystemConfig'
export default {
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false,
form: {
id: '',
menuName: '',
type: '',
inputType: '',
configTabId: '',
parameter: '',
uploadType: '',
required: '',
width: '',
high: '',
value: '',
info: '',
desc: '',
sort: '',
status: ''
},
rules: {
}
}
},
methods: {
cancel() {
this.resetForm()
},
doSubmit() {
this.loading = true
if (this.isAdd) {
this.doAdd()
} else this.doEdit()
},
doAdd() {
add(this.form).then(res => {
this.resetForm()
this.$notify({
title: '添加成功',
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
doEdit() {
edit(this.form).then(res => {
this.resetForm()
this.$notify({
title: '修改成功',
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
resetForm() {
this.dialog = false
this.$refs['form'].resetFields()
this.form = {
id: '',
menuName: '',
type: '',
inputType: '',
configTabId: '',
parameter: '',
uploadType: '',
required: '',
width: '',
high: '',
value: '',
info: '',
desc: '',
sort: '',
status: ''
}
}
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,121 @@
<template>
<div class="app-container">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="150px">
<!--<el-form-item label="公众号名称" >-->
<!--<el-input v-model="form.wechat_name" style="width: 370px;"/>-->
<!--</el-form-item>-->
<!--<el-form-item label="微信号" >-->
<!--<el-input v-model="form.wechat_id" style="width: 370px;"/>-->
<!--</el-form-item>-->
<!--<el-form-item label="公众号原始id" >-->
<!--<el-input v-model="form.wechat_sourceid" style="width: 370px;"/>-->
<!--</el-form-item>-->
<!--<el-form-item label="AppID" >-->
<!--<el-input v-model="form.wechat_appid" style="width: 370px;"/>-->
<!--</el-form-item>-->
<!--<el-form-item label="AppSecret" >-->
<!--<el-input v-model="form.wechat_appsecret" style="width: 370px;"/>-->
<!--</el-form-item>-->
<!--<el-form-item label="微信验证TOKEN" >-->
<!--<el-input v-model="form.wechat_token" style="width: 370px;"/>-->
<!--</el-form-item>-->
<!--<el-form-item label="消息加解密方式" >-->
<!--<el-input v-model="form.wechat_encode" style="width: 370px;"/>-->
<!--</el-form-item>-->
<!--<el-form-item label="EncodingAESKey" >-->
<!--<el-input v-model="form.wechat_encodingaeskey" style="width: 370px;"/>-->
<!--</el-form-item>-->
<el-form-item label="微信分享图片" >
<pic-upload v-model="form.wechat_share_img" style="width: 370px;"/>
</el-form-item>
<el-form-item label="公众号二维码" >
<pic-upload v-model="form.wechat_qrcode" style="width: 370px;"/>
</el-form-item>
<el-form-item label="公众号类型" >
<el-input v-model="form.wechat_type" style="width: 370px;"/>
</el-form-item>
<el-form-item label="微信分享标题" >
<el-input v-model="form.wechat_share_title" style="width: 370px;"/>
</el-form-item>
<el-form-item label="微信分享简介" >
<el-input v-model="form.wechat_share_synopsis" style="width: 370px;" rows="5" type="textarea"/>
</el-form-item>
<el-form-item label="接口地址" >
<el-input v-model="form.api" style="width: 370px;"/>
</el-form-item>
<el-form-item label="公众号logo" >
<pic-upload v-model="form.wechat_avatar" style="width: 370px;"/>
</el-form-item>
<el-form-item label="" >
<el-button :loading="loading" type="primary" @click="doSubmit">提交</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/initData'
import { del, add, get } from '@/api/yxSystemConfig'
import eForm from './form'
import picUpload from '@/components/pic-upload'
import { Message } from 'element-ui'
export default {
components: { eForm, picUpload },
mixins: [initData],
data() {
return {
delLoading: false,
form: {
wechat_name: '',
wechat_id: '',
wechat_sourceid: '',
wechat_appid: '',
wechat_appsecret: '',
wechat_token: '',
wechat_encode: '',
wechat_encodingaeskey: '',
wechat_share_img: '',
wechat_qrcode: '',
wechat_type: '',
wechat_share_title: '',
wechat_share_synopsis: '',
api: '',
wechat_avatar: ''
},
rules: {
}
}
},
created() {
get().then(rese=>{
let newObj = {}
rese.content.map(function (key,value) {
let keyName = key.menuName;
newObj[keyName] = key.value
})
this.form = newObj
})
},
methods: {
checkPermission,
doSubmit() {
add(this.form).then(res => {
Message({message: '设置成功',type: 'success'})
}).catch(err => {
//this.loading = false
console.log(err.response.data.message)
})
},
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,63 @@
<template>
<div class="app-container">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="150px">
<el-form-item label="积分抵用比例" >
<el-input v-model="form.integral_ratio" style="width: 370px;"/>
<p style="color: red">积分抵用比例(1积分抵多少金额)</p>
</el-form-item>
<el-form-item label="" >
<el-button type="primary" @click="doSubmit">提交</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/initData'
import { del, add, get } from '@/api/yxSystemConfig'
import eForm from './form'
import picUpload from '@/components/pic-upload'
import { Message } from 'element-ui'
export default {
components: { eForm, picUpload },
mixins: [initData],
data() {
return {
delLoading: false,
form: {
integral_ratio: ''
},
rules: {
}
}
},
created() {
get().then(rese=>{
let newObj = {}
rese.content.map(function (key,value) {
let keyName = key.menuName;
newObj[keyName] = key.value
})
this.form = newObj
})
},
methods: {
checkPermission,
doSubmit() {
add(this.form).then(res => {
Message({message: '设置成功',type: 'success'})
}).catch(err => {
//this.loading = false
console.log(err.response.data.message)
})
},
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,85 @@
<template>
<div class="app-container">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="150px">
<el-form-item label="分销模式" >
<el-radio v-model="form.store_brokerage_statu" :label="1">指定分销</el-radio>
<el-radio v-model="form.store_brokerage_statu" :label="2">人人分销</el-radio>
</el-form-item>
<el-form-item label="一级返佣比例" >
<el-input v-model="form.store_brokerage_ratio" style="width: 370px;"/>
<p style="color: red">订单交易成功后给上级返佣的比例0 - 100,:5 = 反订单金额的5%</p>
</el-form-item>
<el-form-item label="二级返佣比例" >
<el-input v-model="form.store_brokerage_two" style="width: 370px;"/>
<p style="color: red">订单交易成功后给上级返佣的比例0 - 100,:5 = 反订单金额的5%</p>
</el-form-item>
<el-form-item label="提现最低金额" >
<el-input v-model="form.user_extract_min_price" style="width: 370px;"/>
</el-form-item>
<el-form-item label="H5地址" >
<el-input v-model="form.site_url" style="width: 370px;"/>
</el-form-item>
<el-form-item label="API地址" >
<el-input v-model="form.api_url" style="width: 370px;"/>
</el-form-item>
<el-form-item label="" >
<el-button type="primary" @click="doSubmit">提交</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/initData'
import { del, add, get } from '@/api/yxSystemConfig'
import eForm from './form'
import picUpload from '@/components/pic-upload'
import { Message } from 'element-ui'
export default {
components: { eForm, picUpload },
mixins: [initData],
data() {
return {
delLoading: false,
form: {
store_brokerage_statu: 2,
store_brokerage_ratio: 0,
store_brokerage_two: 0,
user_extract_min_price: 100,
site_url: '',
api_url: ''
},
rules: {
}
}
},
created() {
get().then(rese=>{
let newObj = {}
rese.content.map(function (key,value) {
let keyName = key.menuName;
newObj[keyName] = key.value
})
this.form = newObj
this.form.store_brokerage_statu = parseInt(this.form.store_brokerage_statu)
})
},
methods: {
checkPermission,
doSubmit() {
add(this.form).then(res => {
Message({message: '设置成功',type: 'success'})
}).catch(err => {
//this.loading = false
console.log(err.response.data.message)
})
},
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,94 @@
<template>
<el-dialog :append-to-body="true" :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog" :title="isAdd ? '新增' : '编辑'" width="500px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
<el-form-item label="缓存数据" >
<el-input v-model="form.result" style="width: 370px;"/>
</el-form-item>
<el-form-item label="缓存时间" >
<el-input v-model="form.addTime" style="width: 370px;"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="cancel">取消</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</template>
<script>
import { add, edit } from '@/api/yxCache'
export default {
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false,
form: {
key: '',
result: '',
addTime: ''
},
rules: {
}
}
},
methods: {
cancel() {
this.resetForm()
},
doSubmit() {
this.loading = true
if (this.isAdd) {
this.doAdd()
} else this.doEdit()
},
doAdd() {
add(this.form).then(res => {
this.resetForm()
this.$notify({
title: '添加成功',
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
doEdit() {
edit(this.form).then(res => {
this.resetForm()
this.$notify({
title: '修改成功',
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
resetForm() {
this.dialog = false
this.$refs['form'].resetFields()
this.form = {
key: '',
result: '',
addTime: ''
}
}
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,116 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<!-- 新增 -->
<div style="display: inline-block;margin: 0px 2px;">
<el-button
v-permission="['ADMIN','YXCACHE_ALL','YXCACHE_CREATE']"
class="filter-item"
size="mini"
type="primary"
icon="el-icon-plus"
@click="add">新增</el-button>
</div>
</div>
<!--表单组件-->
<eForm ref="form" :is-add="isAdd"/>
<!--表格渲染-->
<el-table v-loading="loading" :data="data" size="small" style="width: 100%;">
<el-table-column prop="key" label="key"/>
<el-table-column prop="result" label="缓存数据"/>
<el-table-column prop="addTime" label="缓存时间"/>
<el-table-column v-if="checkPermission(['ADMIN','YXCACHE_ALL','YXCACHE_EDIT','YXCACHE_DELETE'])" label="操作" width="150px" align="center">
<template slot-scope="scope">
<el-button v-permission="['ADMIN','YXCACHE_ALL','YXCACHE_EDIT']" size="mini" type="primary" icon="el-icon-edit" @click="edit(scope.row)"/>
<el-popover
v-permission="['ADMIN','YXCACHE_ALL','YXCACHE_DELETE']"
:ref="scope.row.key"
placement="top"
width="180">
<p>确定删除本条数据吗</p>
<div style="text-align: right; margin: 0">
<el-button size="mini" type="text" @click="$refs[scope.row.key].doClose()">取消</el-button>
<el-button :loading="delLoading" type="primary" size="mini" @click="subDelete(scope.row.key)">确定</el-button>
</div>
<el-button slot="reference" type="danger" icon="el-icon-delete" size="mini"/>
</el-popover>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:total="total"
:current-page="page + 1"
style="margin-top: 8px;"
layout="total, prev, pager, next, sizes"
@size-change="sizeChange"
@current-change="pageChange"/>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/initData'
import { del } from '@/api/yxCache'
import eForm from './form'
export default {
components: { eForm },
mixins: [initData],
data() {
return {
delLoading: false,
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
checkPermission,
beforeInit() {
this.url = 'api/yxCache'
const sort = 'key,desc'
this.params = { page: this.page, size: this.size, sort: sort }
return true
},
subDelete(key) {
this.delLoading = true
del(key).then(res => {
this.delLoading = false
this.$refs[key].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[key].doClose()
console.log(err.response.data.message)
})
},
add() {
this.isAdd = true
this.$refs.form.dialog = true
},
edit(data) {
this.isAdd = false
const _this = this.$refs.form
_this.form = {
key: data.key,
result: data.result,
addTime: data.addTime
}
_this.dialog = true
}
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,449 @@
<template>
<div class="app-container">
<div class="wechat-reply-wrapper wechat-menu">
<div class="ibox-content clearfix">
<el-row :gutter="20">
<el-col :span="8">
<div class="view-wrapper col-sm-4">
<div class="mobile-header">公众号</div>
<section class="view-body">
<div class="time-wrapper"><span class="time">9:36</span></div>
</section>
<div class="menu-footer">
<ul class="flex">
<li v-for="(menu, index) in menus" :class="{active:menu === checkedMenu}">
<span @click="activeMenu(menu,index,null)" ><i class="icon-sub"></i>{{ menu.name || '一级菜单' }}</span>
<div class="sub-menu">
<ul>
<li v-for="(child, cindex) in menu.subButtons" :class="{active:child === checkedMenu}">
<span @click="activeMenu(child,cindex,index)">{{ child.name || '二级菜单' }}</span>
</li>
<li v-if="menu.subButtons.length < 5" @click="addChild(menu,index)"><i class="icon-add"></i></li>
</ul>
</div>
</li>
<li v-if="menus.length < 3" @click="addMenu()"><i class="icon-add"></i></li>
</ul>
</div>
</div>
</el-col>
<el-col :span="12">
<div class="control-wrapper menu-control col-sm-8" v-show="checkedMenuId !== null">
<section>
<div class="control-main">
<h3 class="popover-title">菜单名称 <a class="fr" href="javascript:void(0);" @click="delMenu">删除</a></h3>
<p class="tips-txt">已添加子菜单仅可设置菜单名称</p>
<div class="menu-content control-body">
<form action="">
<div class="form-group clearfix">
<label for="" class="el-form-item__label" style="width: 80px;">菜单名称</label>
<div class="col-sm-9 group-item">
<input type="text" placeholder="菜单名称" style="width: 370px;" class="el-input__inner" v-model="checkedMenu.name">
</div>
</div>
<div class="form-group clearfix">
<label class="el-form-item__label" style="width: 80px;" for="">规则状态</label>
<div class="group-item col-sm-9">
<select style="width: 370px;" class="el-input__inner" name="" id="" v-model="checkedMenu.type">
<option value="click">关键字</option>
<option value="view">跳转网页</option>
<option value="miniprogram">小程序</option>
</select>
</div>
</div>
<div class="menu-control-box">
<!-- 关键字 -->
<div class="keywords item" :class="{show:checkedMenu.type=='click'}">
<span class="el-form-item__label">关键字</span>
<input type="text" placeholder="请输入关键字" class="form-control" v-model="checkedMenu.key">
</div>
<!-- 跳转地址 -->
<div class="url item" :class="{show:checkedMenu.type=='view'}">
<span class="el-form-item__label">跳转地址</span>
<input type="text" v-model="checkedMenu.url" placeholder="请输入跳转地址" class="form-control">
<p class="text-left"></p>
</div>
<!-- 小程序 -->
<div class="wrchat-app item" :class="{show:checkedMenu.type=='miniprogram'}">
<div class="list">
<span class="el-form-item__label">appId</span>
<input class="form-control" v-model="checkedMenu.appId" type="text" />
</div>
<div class="list">
<span class="el-form-item__label">备用网页url</span>
<input class="form-control" v-model="checkedMenu.url" type="text" />
</div>
<div class="list">
<span class="el-form-item__label">小程序路径</span>
<input class="form-control" v-model="checkedMenu.pagePath" type="text" />
</div>
</div>
<!-- 多客服 -->
<div class="service item">
<p>回复内容</p>
<textarea cols="60" rows="10"></textarea>
</div>
</div>
</form>
</div>
</div>
</section>
</div>
</el-col>
</el-row>
</div>
<div class="ibox-content submit">
<button class="el-button el-button--primary" @click="submit">保存发布</button>
</div>
</div>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/initData'
import { del, add, get } from '@/api/yxCache'
import eForm from './form'
import { Message } from 'element-ui'
export default {
components: { eForm },
mixins: [initData],
data() {
return {
delLoading: false,
menus: [],
checkedMenu:{
type:'click',
name:''
},
checkedMenuId:null,
parentMenuId:null
}
},
created() {
get().then(res=>{
this.menus = JSON.parse(res.result)
})
},
methods: {
checkPermission,
beforeInit() {
this.url = 'api/yxCache'
const sort = 'key,desc'
this.params = { page: this.page, size: this.size, sort: sort }
return true
},
subDelete(key) {
this.delLoading = true
del(key).then(res => {
this.delLoading = false
this.$refs[key].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[key].doClose()
console.log(err.response.data.message)
})
},
add() {
this.isAdd = true
this.$refs.form.dialog = true
},
edit(data) {
this.isAdd = false
const _this = this.$refs.form
_this.form = {
key: data.key,
result: data.result,
addTime: data.addTime
}
_this.dialog = true
},
defaultMenusData:function(){
return {
type:'click',
name:'',
subButtons:[]
};
},
defaultChildData:function(){
return {
type:'click',
name:''
};
},
addMenu:function(){
if(!this.check()) return false;
var data = this.defaultMenusData(),id = this.menus.length;
this.menus.push(data);
this.checkedMenu = data;
this.checkedMenuId = id;
this.parentMenuId = null;
},
addChild:function(menu,index){
if(!this.check()) return false;
var data = this.defaultChildData(),id = menu.subButtons.length;
menu.subButtons.push(data);
this.checkedMenu = data;
this.checkedMenuId = id;
this.parentMenuId = index;
},
delMenu:function(){
console.log(this.parentMenuId);
this.parentMenuId === null ?
this.menus.splice(this.checkedMenuId,1) : this.menus[this.parentMenuId].subButtons.splice(this.checkedMenuId,1);
this.parentMenuId = null;
this.checkedMenu = {};
this.checkedMenuId = null;
},
activeMenu:function(menu,index,pid){
if(!this.check()) return false;
pid === null ?
(this.checkedMenu = menu) : (this.checkedMenu = this.menus[pid].subButtons[index],this.parentMenuId = pid);
this.checkedMenuId=index
},
check:function(){
if(this.checkedMenuId === null) return true;
if(!this.checkedMenu.name){
//$eb.message('请输入按钮名称!');
this.$message({
message: '请输入按钮名称',
type: 'error',
duration: 1000,
onClose: () => {
//this.init()
}
})
return false;
}
if(this.checkedMenu.type == 'click' && !this.checkedMenu.key){
//$eb.message('请输入关键字!');
this.$message({
message: '请输入关键字',
type: 'error',
duration: 1000,
onClose: () => {
//this.init()
}
})
return false;
}
if(this.checkedMenu.type == 'view' && !this.checkedMenu.url){
this.$message({
message: '请输入跳转地址',
type: 'error',
duration: 1000,
onClose: () => {
//this.init()
}
})
return false;
}
if(this.checkedMenu.type == 'miniprogram'
&& (!this.checkedMenu.appId
|| !this.checkedMenu.pagePath
|| !this.checkedMenu.url)){
//$eb.message('请填写完整小程序配置!');
this.$message({
message: '请填写完整小程序配置',
type: 'error',
duration: 1000,
onClose: () => {
//this.init()
}
})
return false;
}
return true;
},
submit:function(){
// this.$message.error('错了哦,这是一条错误消息')
//return false;
if(!this.check()) return false
//console.log(this.menus.length)
if(!this.menus.length){
this.$message({
message: '请添加菜单',
type: 'error',
duration: 1000,
})
return false;
}
add({buttons:this.menus}).then(function (res) {
console.log(555)
Message({message: '添加成功',type: 'success'})
}).catch(function(err){
//$eb.message('error',err);
//this.$message.error('错了哦,这是一条错误消息');
//Message({message: "2222",type: 'error'})
})
}
}
}
</script>
<style rel="stylesheet/scss" scoped>
body {
font-family: "open sans","Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 13px;
color: #676a6c;
overflow-x: hidden;
}
.form-control, .single-line {
background-color: #FFF;
background-image: none;
border: 1px solid #e5e6e7;
border-radius: 1px;
color: inherit;
display: block;
padding: 6px 12px;
-webkit-transition: border-color .15s ease-in-out 0s,box-shadow .15s ease-in-out 0s;
transition: border-color .15s ease-in-out 0s,box-shadow .15s ease-in-out 0s;
width: 100%;
font-size: 14px;}
.flex{ display: -webkit-box; display: -moz-box; display: -webkit-flex; display: -moz-flex; display: -ms-flexbox; display: flex; }
#app .layout-ceiling-main a{ color:#9ba7b5}
#table-list .mp-search-wrapper{ float: right; margin-left: 12px; }
#table-list .mp-header-wrapper{ overflow: hidden; }
#table-list .mp-header-wrapper h1{ padding-left:15px; float: left; font-size: 18px; line-height: 24px; padding-bottom: 20px; font-weight: 400; color: #464c5b; }
.mp-form{ padding: 20px 20px 20px 0; }
.mp-form .ivu-tree li{ margin: 0; }
.mp-form .ivu-color-picker .ivu-select-dropdown{ left: -38px !important; }
.mp-form .mp-upload{ display: inline-block; }
.mp-form .demo-upload-list{ display: inline-block; width: 60px; height: 60px; text-align: center; line-height: 60px; border: 1px solid transparent; border-radius: 4px; overflow: hidden; background: #fff; position: relative; box-shadow: 0 1px 1px rgba(0,0,0,.2); margin-right: 4px; }
.mp-form .demo-upload-list img{ width: 100%; height: 100%; }
.mp-form .demo-upload-list-cover{ display: none; position: absolute; top: 0; bottom: 0; left: 0; right: 0; background: rgba(0,0,0,.6); }
.mp-form .demo-upload-list:hover .demo-upload-list-cover{ display: block; }
.mp-form .demo-upload-list-cover i{ color: #fff; font-size: 20px; cursor: pointer; margin: 0 2px; }
[v-cloak]{ display: none}
.mp-form .mp-upload-btn{ width:58px; height:58px; line-height:58px; }
.mp-form .add-submit-item .ivu-btn{ position: fixed; left: 0; bottom: 0; border-radius: 0; }
.vertical-center-modal .ivu-modal{ top: 0; }
.vertical-center-modal .ivu-modal-header{ z-index: 9; position: relative; }
.vertical-center-modal .ivu-modal-close{ z-index: 10; }
.wechat-reply-wrapper .fl{ float: left; }
.wechat-reply-wrapper .fr{ float: right; }
.wechat-reply-wrapper .clearfix:after{ content:"."; display:block; height:0; visibility:hidden; clear:both; }
.wechat-reply-wrapper .ibox-title{ padding:15px; font-size: 16px; border-bottom: 1px solid #e7eaec; }
.wechat-reply-wrapper .ibox-title p{ border-left: 2px solid #2494f2; text-indent: 8px; }
.wechat-reply-wrapper .ibox-content{ padding: 15px; }
.wechat-reply-wrapper .ibox-content .view-wrapper{ position: relative; width: 317px; background-image:url(../../../assets/wechat/mobile_head.png); background-repeat: no-repeat; background-position: left top; background-color: #f5f5f5; }
.wechat-reply-wrapper .ibox-content .view-wrapper .mobile-header{ position: relative; left: 0; top: 36px; width: 100%; text-align: center; color: #fff; font-size: 16px; }
.wechat-reply-wrapper .ibox-content .view-wrapper .view-body{ margin-top: 65px; background-color: #f5f5f5; height: 500px; }
.wechat-reply-wrapper .view-wrapper .view-body .time-wrapper{ margin-bottom: 10px; text-align: center; }
.wechat-reply-wrapper .view-wrapper .view-body .time-wrapper .time{ display: inline-block; color: #f5f5f5; display: inline-block; color: #f5f5f5; background: rgba(0,0,0,.3); padding: 3px 8px; border-radius: 3px; font-size: 12px; }
.wechat-reply-wrapper .view-wrapper .view-body .view-item{ display: none; }
.wechat-reply-wrapper .view-wrapper .view-body .view-item.show{ display: none; }
.wechat-reply-wrapper .view-wrapper .view-body .view-item .avatar{ width: 40px; height: 40px; }
.wechat-reply-wrapper .view-wrapper .view-body .view-item .avatar img{ max-width: 100%; height: auto; }
.wechat-reply-wrapper .view-wrapper .view-body .view-item .box-content{ position: relative; max-width: 60%; min-height: 40px; margin-left: 15px; padding: 10px; border: 1px solid #ccc; word-break: break-all; word-wrap: break-word; line-height: 1.5; border-radius: 5px; }
.wechat-reply-wrapper .view-wrapper .view-body .view-item .box-content .picbox{ max-width: 100%; }
.wechat-reply-wrapper .view-wrapper .view-body .view-item .box-content:before{ content: ''; position: absolute; left: -13px; top: 11px; display: block; width: 0; height: 0; border-left: 8px solid transparent; border-right: 8px solid transparent; border-top: 10px solid #ccc; -webkit-transform: rotate(90deg); transform: rotate(90deg); }
.wechat-reply-wrapper .view-wrapper .view-body .view-item .box-content:after{ content: ''; content: ''; position: absolute; left: -12px; top: 11px; display: block; width: 0; height: 0; border-left: 8px solid transparent; border-right: 8px solid transparent; border-top: 10px solid #f5f5f5; -webkit-transform: rotate(90deg); transform: rotate(90deg); }
.wechat-reply-wrapper .submit{text-align: center;}
/* 图文 */
.view-wrapper .view-body .view-item.news-box{ width: 100%; background-color: #fff; border-radius: 5px; }
.view-wrapper .view-body .view-item .vn-content{ padding:0;}
.view-wrapper .view-body .view-item .vn-content .vn-title{ line-height: 1.5; font-size: 16px; }
.view-wrapper .view-body .view-item .vn-content .vn-time{ padding: 5px 0; font-size: 12px; color: #999; }
.view-wrapper .view-body .view-item .vn-content .vn-picture{ width: 100%; height: 150px; background-size: cover; background-position: center center; border-radius: 5px 5px 0 0;}
.view-wrapper .view-body .view-item .vn-content .vn-picture-info{ line-height: 22px; color: #7b7b7b; padding: 0; display: block; overflow: hidden; word-break: break-all; text-overflow: ellipsis; font-size: 12px; white-space: nowrap; }
.view-wrapper .view-body .view-item .vn-more{ display: block; padding: 10px 0 0; border-top: 1px solid #dddddd; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.view-wrapper .view-body .view-item .vn-content .con-item-box{ position: relative; }
.view-wrapper .view-body .view-item .vn-content .con-item-box .first-title{ width: 100%; height: 44px; line-height: 44px; font-size: 14px; position: absolute; left: 0; bottom: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; /*background: rgba(0,0,0,.8);*/ color: #fff; text-indent: 1em; }
.view-wrapper .view-body .view-item .vn-content .con-item-list{ margin-top: 10px; margin:6px 10px 0 10px; border-top: 1px solid #FBFBFB; }
.view-wrapper .view-body .view-item .vn-content .con-item-list .list-tit-info{ width: 70%; line-height: 1.5; word-wrap:break-word; }
.view-wrapper .view-body .view-item .vn-content .con-item-list .list-pic{ width: 20%; min-height: 50px; background-size: cover; background-position: center center; }
/* 音乐 */
.view-wrapper .view-body .view-item.music-box .box-content{ position: relative; width: 100%; background: #080; color: #fff; border-color: #080; }
.view-wrapper .view-body .view-item.music-box .box-content p{ width: 75%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.view-wrapper .view-body .view-item.music-box .box-content .music-icon{ position: absolute; right: 11px; top: 50%; width: 30px; height: 30px; background: #0a0; text-align: center; line-height: 30px; margin-top: -15px; font-size: 16px; }
.view-wrapper .view-body .view-item.music-box .box-content:after{ display: none; }
.view-wrapper .view-body .view-item.music-box .box-content:before{ border-top: 10px solid #080; }
/* 视频 */
.view-wrapper .view-body .view-item.video-box{ width: 100%; background-color: #fff; border: 1px solid #ccc; border-radius: 5px; }
.view-wrapper .view-body .view-item.video-box .vn-title{ overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
/* 右侧控制器 */
.wechat-reply-wrapper .ibox-content .control-wrapper{ position: relative; width: 535px; height: 565px; padding: 0; margin-left: 20px; border: 1px solid #e2e2e2; }
.wechat-reply-wrapper .ibox-content .control-wrapper .control-title{ position: absolute; left: 71px; top: -12px; width: auto; padding: 0 10px; font-size: 20px; background-color: #fff; }
.wechat-reply-wrapper .ibox-content .control-wrapper .control-body{ margin-top: 40px; padding: 0 10px; }
.wechat-reply-wrapper .ibox-content .control-wrapper .control-body .form-group label{ font-weight: normal; }
.wechat-reply-wrapper .ibox-content .control-wrapper .control-body .form-group .tips:after{ content: '*'; color: red; position: absolute; margin-left: 4px; font-weight: bold; line-height: 1.8em; }
.wechat-reply-wrapper .ibox-content .control-wrapper .control-body .form-group .group-item{ position: relative; }
.wechat-reply-wrapper .ibox-content .control-wrapper .control-body .form-group .group-item .file-btn{ position: absolute; right: 15px; top: 0; display: block; width: 66px; border-radius: 6px; cursor: pointer; padding: .5rem; background-color: #18a689; color: #fff; text-align: center; height: 100%; line-height: 23px; }
.wechat-reply-wrapper .ibox-content .control-wrapper .control-body .form-group .group-item textarea{ resize: none; width: 100%; height: 100px; padding: 10px; }
.wechat-reply-wrapper .ibox-content .control-wrapper .control-body .tips-info{ padding-left: 100px; font-size: 12px; color: #737373; }
.wechat-reply-wrapper .ibox-content .control-wrapper .control-body .control-main .control-item{ display: none; }
.wechat-reply-wrapper .ibox-content .control-wrapper .control-body .control-main .control-item.show{ display: block; }
/* 微信菜单定制 */
.wechat-menu{ position: relative; }
.wechat-menu ul{ padding: 0; }
.wechat-menu .menu-footer{ position: absolute; left:0; bottom: -10px; width: 100%; padding-left: 43px; background: url("../../../assets/wechat/mobile_foot.png") no-repeat 0px 20px; border-top: 1px solid #e7e7eb; }
.wechat-menu .menu-footer span{display: block;}
.wechat-menu .menu-footer .icon-add{ background: url(../../../assets/wechat/index.png) 0 0 no-repeat; width: 14px; height: 14px; vertical-align: middle; display: inline-block; margin-top: -2px; border-bottom: none!important; }
.wechat-menu .menu-footer li{ position: relative; -webkit-flex: 1; -moz-flex:1; -ms-flex: 1; flex: 1; height: 50px; line-height: 50px; text-align: center; cursor: pointer; list-style: none; border: 1px solid transparent; border-right: 1px solid #e7e7eb; }
.wechat-menu .menu-footer .icon-sub{ background: url(../../../assets/wechat/index.png) 0 -48px no-repeat; width: 7px; height: 7px; vertical-align: middle; display: inline-block; margin-right: 2px; margin-top: -2px; }
.wechat-menu .menu-footer .sub-menu{ position: absolute; border-radius: 3px; border: 1px solid #d0d0d0; display: block; bottom: 60px; width: 100%; background-color: #fafafa; }
.wechat-menu .menu-footer .sub-menu:after{ content: ''; position: absolute; width: 10px; height: 10px; background: #fafafa;-webkit-transform: rotate(45deg); -moz-transform: rotate(45deg); -ms-transform: rotate(45deg); transform: rotate(45deg); bottom: -5px; border-bottom: 1px solid #d0d0d0; border-right: 1px solid #d0d0d0; left: 50%; margin-left: -5px; }
.wechat-menu .menu-footer .sub-menu li{border-right: 0; border-bottom: 1px solid #d0d0d0;}
.wechat-menu .menu-footer .sub-menu li:last-child{border-bottom: 0;}
.wechat-menu .menu-footer .active{border:1px solid #44b549;}
.wechat-menu .menu-footer .sub-menu li.active{border:1px solid #44b549 !important;}
/* 右侧 */
.wechat-menu .menu-control .popover-title{ padding: 8px 14px; margin: 0; font-size: 14px; background-color: #f7f7f7; border-bottom: 1px solid #ebebeb; border-radius: 5px 5px 0 0; font-weight: 400; }
.wechat-menu .menu-control .popover-title a{ color: #06C; font-size: 12px; }
.wechat-menu .menu-control .tips-txt{line-height: 40px; padding: 0 20px;}
.wechat-reply-wrapper .ibox-content .control-wrapper .control-body.menu-content{ padding: 0 20px; margin-top: 0; }
.wechat-reply-wrapper .ibox-content .control-wrapper .control-body.menu-content .radio{ display: inline-block !important; width: 45%; }
.wechat-reply-wrapper .ibox-content .control-wrapper .control-body.menu-content .menu-control-box {padding: 0 20px;}
.wechat-reply-wrapper .ibox-content .control-wrapper .control-body.menu-content .menu-control-box .radio{ display: block!important; width: 100%; }
.menu-control-box .item{ display: none; }
.menu-control-box .show{ display: block; }
</style>

View File

@ -0,0 +1,112 @@
<template>
<el-dialog :append-to-body="true" :close-on-click-modal="false" :before-close="cancel" :visible.sync="dialog" :title="isAdd ? '新增' : '编辑'" width="500px">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
<el-form-item label="关键字" prop="key">
<el-input v-model="form.key" style="width: 370px;"/>
</el-form-item>
<el-form-item label="回复类型" >
<el-input v-model="form.type" style="width: 370px;"/>
</el-form-item>
<el-form-item label="回复数据" >
<el-input v-model="form.data" style="width: 370px;"/>
</el-form-item>
<el-form-item label="0=不可用 1 =可用" >
<el-input v-model="form.status" style="width: 370px;"/>
</el-form-item>
<el-form-item label="是否隐藏" >
<el-input v-model="form.hide" style="width: 370px;"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="cancel">取消</el-button>
<el-button :loading="loading" type="primary" @click="doSubmit">确认</el-button>
</div>
</el-dialog>
</template>
<script>
import { add, edit } from '@/api/yxWechatReply'
export default {
props: {
isAdd: {
type: Boolean,
required: true
}
},
data() {
return {
loading: false, dialog: false,
form: {
id: '',
key: '',
type: '',
data: '',
status: '',
hide: ''
},
rules: {
key: [
{ required: true, message: 'please enter', trigger: 'blur' }
],
}
}
},
methods: {
cancel() {
this.resetForm()
},
doSubmit() {
this.loading = true
if (this.isAdd) {
this.doAdd()
} else this.doEdit()
},
doAdd() {
add(this.form).then(res => {
this.resetForm()
this.$notify({
title: '添加成功',
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
doEdit() {
edit(this.form).then(res => {
this.resetForm()
this.$notify({
title: '修改成功',
type: 'success',
duration: 2500
})
this.loading = false
this.$parent.init()
}).catch(err => {
this.loading = false
console.log(err.response.data.message)
})
},
resetForm() {
this.dialog = false
this.$refs['form'].resetFields()
this.form = {
id: '',
key: '',
type: '',
data: '',
status: '',
hide: ''
}
}
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,425 @@
<template>
<div class="app-container">
<div class="wechat-reply-wrapper">
<div class="ibox-title"><p>{{msg}}</p></div>
<div class="ibox-content clearfix">
<el-row :gutter="20">
<el-col :span="8">
<div class="view-wrapper col-sm-4">
<div class="mobile-header">公众号</div>
<section class="view-body" style="overflow:scroll;">
<div class="time-wrapper"><span class="time">9:36</span></div>
<div class="view-item text-box clearfix" :class="{show:type=='text'}">
<div class="avatar fl"><img src="../../../assets/wechat/head.gif" /></div>
<div class="box-content fl">
{{dataGroup.text.content}}
</div>
</div>
<div class="view-item news-box" :class="{show:type=='news'}" v-if="dataGroup.news.length >0">
<div class="vn-content" v-if="dataGroup.news.length ==1">
<div class="vn-title">{{dataGroup.news[0].title}}</div>
<div class="vn-time">{{dataGroup.news[0].date}}</div>
<div class="vn-picture" :style="{backgroundImage: 'url('+dataGroup.news[0].image+')'}"></div>
<div class="vn-picture-info">{{dataGroup.news[0].description}}</div>
<div class="vn-more">
<a :href="dataGroup.news[0].url">阅读原文</a>
</div>
</div>
<div class="vn-content" v-else>
<div class="con-item-box">
<div class="vn-picture" :style="{backgroundImage: 'url('+dataGroup.news[0].image+')'}"></div>
<div class="first-title">{{dataGroup.news[0].title}}</div>
</div>
<div class="con-item-list clearfix" v-for="(newinfos,index) in dataGroup.news" v-if="index>0">
<div class="list-tit-info fl">{{newinfos.title}}</div>
<div class="list-pic fr" :style="{backgroundImage: 'url('+newinfos.image+')'}"></div>
</div>
</div>
</div>
<div class="view-item text-box clearfix" :class="{show:type=='image'}">
<div class="avatar fl"><img src="../../../assets/wechat/head.gif" /></div>
<div class="box-content fl">
<img class="picbox" :src="dataGroup.image.src" alt="" />
</div>
</div>
</section>
</div>
</el-col>
<el-col :span="12">
<div class="control-wrapper col-sm-8">
<section>
<form action="" method="post" enctype="multipart/form-data">
<div class="control-title">{{msg}}</div>
<div class="control-body">
<div class="form-group clearfix">
<el-row :gutter="20">
<el-col :span="4">
<label class="col-sm-2 control-label tips" for="">规则状态</label>
</el-col>
<el-col :span="16">
<div class="group-item">
<div class="radio i-checks" style="display:inline;margin-left: 5px;">
<label class="" style="padding-left: 0;">
<input style="position: relative;top: 1px;left: 3px;" checked="checked" v-model="status" type="radio" value="1" name="status">
启用</label>
</div>
<div class="radio i-checks" style="display:inline;margin-left: 10px;">
<label class="" style="padding-left: 0;">
<input style="position: relative;top: 1px;left: 3px;" type="radio" value="0" v-model="status" name="status">
禁用
</label>
</div>
</div>
</el-col>
</el-row>
</div>
<div class="form-group clearfix">
<el-row :gutter="20">
<el-col :span="4">
<label class="col-sm-2 tips" for="">消息类型</label>
</el-col>
<el-col :span="16">
<div class="col-sm-10 group-item">
<select class="form-control m-b" v-model="type" name="account">
<option value="text">文字消息</option>
<option value="image">图片消息</option>
</select>
</div>
</el-col>
</el-row>
</div>
<div class="control-main">
<!-- 文字 -->
<div class="control-item control-main-txt" :class="{show:type=='text'}">
<div class="form-group clearfix">
<label class="col-sm-2 tips" for="">规则内容</label>
<div class="col-sm-10 group-item">
<textarea v-model="dataGroup.text.content" name="" id="" cols="30" rows="10" placeholder="请输入内容"></textarea>
</div>
</div>
</div>
<!-- 图片 -->
<div class="control-item control-main-picture" :class="{show:type=='image'}">
<div class="form-group clearfix">
<pic-upload v-model="dataGroup.image.src" style="width: 500px;"/>
</div>
</div>
</div>
</div>
<div style="text-align: center;"><button type="button" class="el-button el-button--primary" @click="submit">提交</button></div>
</form>
</section>
</div>
</el-col>
</el-row>
</div>
</div>
</div>
</template>
<script>
import checkPermission from '@/utils/permission'
import initData from '@/mixins/initData'
import { del, add, get } from '@/api/yxWechatReply'
import eForm from './form'
import picUpload from '@/components/pic-upload'
import { Message } from 'element-ui'
export default {
components: { eForm, picUpload },
mixins: [initData],
data() {
return {
delLoading: false,
status: 1,
msg: '',
type: 'text',
textBox: '',
pic: '',
key:'',
dataGroup:{
text:{
content:''
},
image:{
src:''
},
voice:{
src:''
},
news:[]
},
uploadColl: function () {
},
uploadLink: '',
result: null
}
},
created() {
this.$nextTick(() => {
this.init()
})
},
methods: {
checkPermission,
beforeInit() {
this.url = 'api/yxWechatReply'
const sort = 'id,desc'
this.params = { page: this.page, size: this.size, sort: sort }
return true
},
subDelete(id) {
this.delLoading = true
del(id).then(res => {
this.delLoading = false
this.$refs[id].doClose()
this.dleChangePage()
this.init()
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
}).catch(err => {
this.delLoading = false
this.$refs[id].doClose()
console.log(err.response.data.message)
})
},
add() {
this.isAdd = true
this.$refs.form.dialog = true
},
edit(data) {
this.isAdd = false
const _this = this.$refs.form
_this.form = {
id: data.id,
key: data.key,
type: data.type,
data: data.data,
status: data.status,
hide: data.hide
}
_this.dialog = true
},
submit: function(){
if(!this.check()) return false;
add({key:this.key,status:this.status,data:this.dataGroup[this.type],type:this.type}).then(function (res) {
Message({message: '设置成功',type: 'success'})
}).catch(function(err){
Message({message: err,type: 'error'})
})
},
check: function(){
var dataGroup = this.dataGroup;
switch (this.type){
case 'text':
if(dataGroup.text.content == '')
return this.returnError('请输入文字消息内容');
break;
case 'image':
if(dataGroup.image.src == '')
return this.returnError('请上传图片');
break;
case 'news':
if(dataGroup.news.length < 1)
return this.returnError('请选择图文消息');
break;
case 'voice':
if(dataGroup.voice.src == '')
return this.returnError('请上传声音');
break;
}
return true;
},
returnError:function(err){
$eb.message('error',err);
return false;
}
},
mounted: function () {
this.key = "subscribe"
this.msg = "编辑关注回复";
get().then(rese=>{
this.result = rese
this.type = rese.type;
this.status = rese.status;
let newData = JSON.parse(rese.data)
if(rese.type == 'image') {
this.dataGroup.image.src = newDatasrc;
}else if(rese.type == 'text'){
this.dataGroup.text.content = newData.content;
}
if(this.used_key){
this.keyword = this.result.key;
}
})
}
}
</script>
<style scoped>
body {
font-family: "open sans","Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 13px;
color: #676a6c;
overflow-x: hidden;
}
.form-control, .single-line {
background-color: #FFF;
background-image: none;
border: 1px solid #e5e6e7;
border-radius: 1px;
color: inherit;
display: block;
padding: 6px 12px;
-webkit-transition: border-color .15s ease-in-out 0s,box-shadow .15s ease-in-out 0s;
transition: border-color .15s ease-in-out 0s,box-shadow .15s ease-in-out 0s;
width: 100%;
font-size: 14px;}
.flex{ display: -webkit-box; display: -moz-box; display: -webkit-flex; display: -moz-flex; display: -ms-flexbox; display: flex; }
#app .layout-ceiling-main a{ color:#9ba7b5}
#table-list .mp-search-wrapper{ float: right; margin-left: 12px; }
#table-list .mp-header-wrapper{ overflow: hidden; }
#table-list .mp-header-wrapper h1{ padding-left:15px; float: left; font-size: 18px; line-height: 24px; padding-bottom: 20px; font-weight: 400; color: #464c5b; }
.mp-form{ padding: 20px 20px 20px 0; }
.mp-form .ivu-tree li{ margin: 0; }
.mp-form .ivu-color-picker .ivu-select-dropdown{ left: -38px !important; }
.mp-form .mp-upload{ display: inline-block; }
.mp-form .demo-upload-list{ display: inline-block; width: 60px; height: 60px; text-align: center; line-height: 60px; border: 1px solid transparent; border-radius: 4px; overflow: hidden; background: #fff; position: relative; box-shadow: 0 1px 1px rgba(0,0,0,.2); margin-right: 4px; }
.mp-form .demo-upload-list img{ width: 100%; height: 100%; }
.mp-form .demo-upload-list-cover{ display: none; position: absolute; top: 0; bottom: 0; left: 0; right: 0; background: rgba(0,0,0,.6); }
.mp-form .demo-upload-list:hover .demo-upload-list-cover{ display: block; }
.mp-form .demo-upload-list-cover i{ color: #fff; font-size: 20px; cursor: pointer; margin: 0 2px; }
[v-cloak]{ display: none}
.mp-form .mp-upload-btn{ width:58px; height:58px; line-height:58px; }
.mp-form .add-submit-item .ivu-btn{ position: fixed; left: 0; bottom: 0; border-radius: 0; }
.vertical-center-modal .ivu-modal{ top: 0; }
.vertical-center-modal .ivu-modal-header{ z-index: 9; position: relative; }
.vertical-center-modal .ivu-modal-close{ z-index: 10; }
.wechat-reply-wrapper .fl{ float: left;margin-left: 10px; }
.wechat-reply-wrapper .fr{ float: right; }
.wechat-reply-wrapper .clearfix:after{ content:"."; display:block; height:10px; visibility:hidden; clear:both; }
.wechat-reply-wrapper .ibox-title{ padding:0px; font-size: 16px; border-bottom: 1px solid #e7eaec; }
.wechat-reply-wrapper .ibox-title p{ border-left: 2px solid #2494f2; text-indent: 8px; }
.wechat-reply-wrapper .ibox-content{ padding: 15px; }
.wechat-reply-wrapper .ibox-content .view-wrapper{ position: relative; width: 317px; background-image:url(../../../assets/wechat/mobile_head.png); background-repeat: no-repeat; background-position: left top; background-color: #f5f5f5; }
.wechat-reply-wrapper .ibox-content .view-wrapper .mobile-header{ position: relative; left: 0; top: 36px; width: 100%; text-align: center; color: #fff; font-size: 16px; }
.wechat-reply-wrapper .ibox-content .view-wrapper .view-body{ margin-top: 65px; background-color: #f5f5f5; height: 500px; }
.wechat-reply-wrapper .view-wrapper .view-body .time-wrapper{ margin-bottom: 10px; text-align: center; }
.wechat-reply-wrapper .view-wrapper .view-body .time-wrapper .time{ display: inline-block; color: #f5f5f5; display: inline-block; color: #f5f5f5; background: rgba(0,0,0,.3); padding: 3px 8px; border-radius: 3px; font-size: 12px; }
.wechat-reply-wrapper .view-wrapper .view-body .view-item{ display: none; }
.wechat-reply-wrapper .view-wrapper .view-body .view-item.show{ display: block; }
.wechat-reply-wrapper .view-wrapper .view-body .view-item .avatar{ width: 40px; height: 40px; }
.wechat-reply-wrapper .view-wrapper .view-body .view-item .avatar img{ max-width: 100%; height: auto; }
.wechat-reply-wrapper .view-wrapper .view-body .view-item .box-content{ position: relative; max-width: 60%; min-height: 40px; margin-left: 15px; padding: 10px; border: 1px solid #ccc; word-break: break-all; word-wrap: break-word; line-height: 1.5; border-radius: 5px; }
.wechat-reply-wrapper .view-wrapper .view-body .view-item .box-content .picbox{ max-width: 100%; }
.wechat-reply-wrapper .view-wrapper .view-body .view-item .box-content:before{ content: ''; position: absolute; left: -13px; top: 11px; display: block; width: 0; height: 0; border-left: 8px solid transparent; border-right: 8px solid transparent; border-top: 10px solid #ccc; -webkit-transform: rotate(90deg); transform: rotate(90deg); }
.wechat-reply-wrapper .view-wrapper .view-body .view-item .box-content:after{ content: ''; content: ''; position: absolute; left: -12px; top: 11px; display: block; width: 0; height: 0; border-left: 8px solid transparent; border-right: 8px solid transparent; border-top: 10px solid #f5f5f5; -webkit-transform: rotate(90deg); transform: rotate(90deg); }
.wechat-reply-wrapper .submit{text-align: center;}
/* 图文 */
.view-wrapper .view-body .view-item.news-box{ width: 100%; background-color: #fff; border-radius: 5px; }
.view-wrapper .view-body .view-item .vn-content{ padding:0;}
.view-wrapper .view-body .view-item .vn-content .vn-title{ line-height: 1.5; font-size: 16px; }
.view-wrapper .view-body .view-item .vn-content .vn-time{ padding: 5px 0; font-size: 12px; color: #999; }
.view-wrapper .view-body .view-item .vn-content .vn-picture{ width: 100%; height: 150px; background-size: cover; background-position: center center; border-radius: 5px 5px 0 0;}
.view-wrapper .view-body .view-item .vn-content .vn-picture-info{ line-height: 22px; color: #7b7b7b; padding: 0; display: block; overflow: hidden; word-break: break-all; text-overflow: ellipsis; font-size: 12px; white-space: nowrap; }
.view-wrapper .view-body .view-item .vn-more{ display: block; padding: 10px 0 0; border-top: 1px solid #dddddd; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.view-wrapper .view-body .view-item .vn-content .con-item-box{ position: relative; }
.view-wrapper .view-body .view-item .vn-content .con-item-box .first-title{ width: 100%; height: 44px; line-height: 44px; font-size: 14px; position: absolute; left: 0; bottom: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; /*background: rgba(0,0,0,.8);*/ color: #fff; text-indent: 1em; }
.view-wrapper .view-body .view-item .vn-content .con-item-list{ margin-top: 10px; margin:6px 10px 0 10px; border-top: 1px solid #FBFBFB; }
.view-wrapper .view-body .view-item .vn-content .con-item-list .list-tit-info{ width: 70%; line-height: 1.5; word-wrap:break-word; }
.view-wrapper .view-body .view-item .vn-content .con-item-list .list-pic{ width: 20%; min-height: 50px; background-size: cover; background-position: center center; }
/* 音乐 */
.view-wrapper .view-body .view-item.music-box .box-content{ position: relative; width: 100%; background: #080; color: #fff; border-color: #080; }
.view-wrapper .view-body .view-item.music-box .box-content p{ width: 75%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.view-wrapper .view-body .view-item.music-box .box-content .music-icon{ position: absolute; right: 11px; top: 50%; width: 30px; height: 30px; background: #0a0; text-align: center; line-height: 30px; margin-top: -15px; font-size: 16px; }
.view-wrapper .view-body .view-item.music-box .box-content:after{ display: none; }
.view-wrapper .view-body .view-item.music-box .box-content:before{ border-top: 10px solid #080; }
/* 视频 */
.view-wrapper .view-body .view-item.video-box{ width: 100%; background-color: #fff; border: 1px solid #ccc; border-radius: 5px; }
.view-wrapper .view-body .view-item.video-box .vn-title{ overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
/* 右侧控制器 */
.wechat-reply-wrapper .ibox-content .control-wrapper{ position: relative; width: 535px; height: 565px; padding: 0; margin-left: 20px; border: 1px solid #e2e2e2; }
.wechat-reply-wrapper .ibox-content .control-wrapper .control-title{ position: absolute; left: 71px; top: -12px; width: auto; padding: 0 10px; font-size: 20px; background-color: #fff; }
.wechat-reply-wrapper .ibox-content .control-wrapper .control-body{ margin-top: 40px; padding: 0 10px; }
.wechat-reply-wrapper .ibox-content .control-wrapper .control-body .form-group label{ font-weight: normal; }
.wechat-reply-wrapper .ibox-content .control-wrapper .control-body .form-group .tips:after{ content: '*'; color: red; position: absolute; margin-left: 4px; font-weight: bold; line-height: 1.8em; }
.wechat-reply-wrapper .ibox-content .control-wrapper .control-body .form-group .group-item{ position: relative; }
.wechat-reply-wrapper .ibox-content .control-wrapper .control-body .form-group .group-item .file-btn{ position: absolute; right: 15px; top: 0; display: block; width: 66px; border-radius: 6px; cursor: pointer; padding: .5rem; background-color: #18a689; color: #fff; text-align: center; height: 100%; line-height: 23px; }
.wechat-reply-wrapper .ibox-content .control-wrapper .control-body .form-group .group-item textarea{ resize: none; width: 100%; height: 100px; padding: 10px; }
.wechat-reply-wrapper .ibox-content .control-wrapper .control-body .tips-info{ padding-left: 100px; font-size: 12px; color: #737373; }
.wechat-reply-wrapper .ibox-content .control-wrapper .control-body .control-main .control-item{ display: none; }
.wechat-reply-wrapper .ibox-content .control-wrapper .control-body .control-main .control-item.show{ display: block; }
/* 微信菜单定制 */
.wechat-menu{ position: relative; }
.wechat-menu ul{ padding: 0; }
.wechat-menu .menu-footer{ position: absolute; left:0; bottom: -10px; width: 100%; padding-left: 43px; background: url("../../../assets/wechat/mobile_foot.png") no-repeat 0px 20px; border-top: 1px solid #e7e7eb; }
.wechat-menu .menu-footer span{display: block;}
.wechat-menu .menu-footer .icon-add{ background: url(../../../assets/wechat/index.png) 0 0 no-repeat; width: 14px; height: 14px; vertical-align: middle; display: inline-block; margin-top: -2px; border-bottom: none!important; }
.wechat-menu .menu-footer li{ position: relative; -webkit-flex: 1; -moz-flex:1; -ms-flex: 1; flex: 1; height: 50px; line-height: 50px; text-align: center; cursor: pointer; list-style: none; border: 1px solid transparent; border-right: 1px solid #e7e7eb; }
.wechat-menu .menu-footer .icon-sub{ background: url(../../../assets/wechat/index.png) 0 -48px no-repeat; width: 7px; height: 7px; vertical-align: middle; display: inline-block; margin-right: 2px; margin-top: -2px; }
.wechat-menu .menu-footer .sub-menu{ position: absolute; border-radius: 3px; border: 1px solid #d0d0d0; display: block; bottom: 60px; width: 100%; background-color: #fafafa; }
.wechat-menu .menu-footer .sub-menu:after{ content: ''; position: absolute; width: 10px; height: 10px; background: #fafafa;-webkit-transform: rotate(45deg); -moz-transform: rotate(45deg); -ms-transform: rotate(45deg); transform: rotate(45deg); bottom: -5px; border-bottom: 1px solid #d0d0d0; border-right: 1px solid #d0d0d0; left: 50%; margin-left: -5px; }
.wechat-menu .menu-footer .sub-menu li{border-right: 0; border-bottom: 1px solid #d0d0d0;}
.wechat-menu .menu-footer .sub-menu li:last-child{border-bottom: 0;}
.wechat-menu .menu-footer .active{border:1px solid #44b549;}
.wechat-menu .menu-footer .sub-menu li.active{border:1px solid #44b549 !important;}
/* 右侧 */
.wechat-menu .menu-control .popover-title{ padding: 8px 14px; margin: 0; font-size: 14px; background-color: #f7f7f7; border-bottom: 1px solid #ebebeb; border-radius: 5px 5px 0 0; font-weight: 400; }
.wechat-menu .menu-control .popover-title a{ color: #06C; font-size: 12px; }
.wechat-menu .menu-control .tips-txt{line-height: 40px; padding: 0 20px;}
.wechat-reply-wrapper .ibox-content .control-wrapper .control-body.menu-content{ padding: 0 20px; margin-top: 0; }
.wechat-reply-wrapper .ibox-content .control-wrapper .control-body.menu-content .radio{ display: inline-block !important; width: 45%; }
.wechat-reply-wrapper .ibox-content .control-wrapper .control-body.menu-content .menu-control-box {padding: 0 20px;}
.wechat-reply-wrapper .ibox-content .control-wrapper .control-body.menu-content .menu-control-box .radio{ display: block!important; width: 100%; }
.menu-control-box .item{ display: none; }
.menu-control-box .show{ display: block; }
</style>