Commit 0b6976ca authored by wangwei's avatar wangwei

Merge remote-tracking branch 'origin/development' into development

parents 3f013f7e 75175df2
<template>
<div>
<el-row type="flex" class="add-btn" justify="end">
<el-col :span="6">
<el-button type="success" plain @click="add">添加配置</el-button>
</el-col>
</el-row>
<el-table
:data="list"
style="width: 100%">
<el-table-column type="expand">
<template slot-scope="props">
<el-form label-position="left" class="demo-table-expand">
<el-form-item label="Key">
<span>{{ props.row.key }}</span>
</el-form-item>
<el-form-item label="关键词">
<span>{{ props.row.value }}</span>
</el-form-item>
<el-form-item label="描述">
<span>{{ props.row.desc }}</span>
</el-form-item>
</el-form>
</template>
</el-table-column>
<el-table-column
label="ID"
prop="id">
</el-table-column>
<el-table-column
label="Key"
prop="key">
</el-table-column>
<el-table-column
label="关键词"
prop="value">
</el-table-column>
<el-table-column
prop="created_at"
label="创建时间">
</el-table-column>
<el-table-column
width="250"
label="操作">
<template slot-scope="scope">
<el-button size="mini" plain type="warning" @click="edit(scope.row)">
编辑
</el-button>
<el-button size="mini" plain type="danger" @click="del(scope.row)">
删除
</el-button>
</template>
</el-table-column>
</el-table>
<dialog-com :dialogObj="dialogObj" @changeShow="changeShow" @reflash="getList"/>
</div>
</template>
<script>
export default {
name: "sysConfig"
import dialogCom from './sysConfigDialog'
import {getConfigListApi,deleteConfigApi,getConfigDetailApi} from "../../service/api";
export default {
name: "sysConfig",
data() {
return {
dialogObj:{
value:'',
desc:'',
show:false,
id:''
},
list: []
}
},
components:{
dialogCom
},
mounted(){
this.getList()
},
methods: {
changeShow(data){
this.dialogObj.show=data
},
getList(){
getConfigListApi().then(res => {
this.list = res.list
})
},
add(){
this.dialogObj.id = '';
this.dialogObj.key= '';
this.dialogObj.value = '';
this.dialogObj.desc = '';
this.dialogObj.show = true
},
edit(data){
getConfigDetailApi(data.id).then((res) => {
this.dialogObj.id = res.id;
this.dialogObj.key= res.key;
this.dialogObj.value = res.value;
this.dialogObj.desc = res.desc;
this.dialogObj.show = true
});
},
del(data){
this.$confirm('此操作将删除该记录?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteConfigApi(data.id).then(res=>{
this.getList()
this.$message({
type: 'success',
message: '删除成功!'
});
});
});
}
}
}
</script>
<style scoped>
<style scoped lang="less">
@import "../../util/public";
.add-btn {
margin: 10px 0;
}
</style>
<template>
<el-dialog
title="自动回复"
center
append-to-body
:visible.sync="show"
width="800px">
<div v-loading="loading">
<el-form ref="form" :model="form" :rules="rules" >
<el-row>
<el-col :span="4"><label>Key</label></el-col>
<el-col :span="8">
<el-form-item prop="key">
<el-input v-model="form.key"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="4"><label>关键词</label></el-col>
<el-col :span="8">
<el-form-item prop="value">
<el-input v-model="form.value"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="4"><label>描述</label></el-col>
<el-col :span="8">
<el-form-item>
<el-input v-model="form.desc" type="textarea"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="show = false">取 消</el-button>
<el-button type="primary" @click="save">确 定</el-button>
</span>
</div>
</el-dialog>
</template>
<script>
import {updateConfigApi,saveConfigApi} from "../../service/api";
import {TEACHERTYPE} from "../../util/wordbook";
import page from '../framework/page'
export default {
name: "dialogObj",
props:[
'dialogObj'
],
data(){
return{
show:false,
id: '',
loading:true,
form:{
key:'',
value:'',
desc:''
},
mediaList: [],
rules:{
value:[
{ required: true, message: '请输入关键词', trigger: 'change' }
],
desc:[
{ required: true, message: '请输入描述', trigger: 'change' }
],
key:[
{ required: true, message: '请输入Key', trigger: 'change' }
]
}
}
},
components:{
page
},
methods:{
save(){
if(this.dialogObj.id){
this.$refs['form'].validate((valid) => {
if(valid){
updateConfigApi(this.id,this.form).then(res=>{
this.$message({
type: 'success',
message: '修改成功!'
});
this.$emit("reflash");
this.show = false;
})
}
});
}else{
this.$refs['form'].validate((valid) => {
if(valid){
saveConfigApi(this.form).then(res=>{
this.$message({
type: 'success',
message: '新增成功!'
});
this.$emit("reflash");
this.show = false;
})
}
});
}
},
initDialog(){
this.show = this.dialogObj.show;
if (this.dialogObj.id) {
this.id = this.dialogObj.id;
}
this.form.key = this.dialogObj.key;
this.form.value = this.dialogObj.value;
this.form.desc = this.dialogObj.desc;
this.loading = false
}
},
watch:{
dialogObj:{
handler: function () {
this.loading = true;
this.initDialog()
},
deep: true
},
show(value){
this.$emit("changeShow",value);
}
}
}
</script>
<style scoped lang="less">
@import "../../util/public";
/*.el-col {*/
/*height: 50px;*/
/*text-align: center;*/
/*margin-bottom: 20px;*/
/*line-height: 40px;*/
/*.el-select{*/
/*width: 100%;*/
/*}*/
/*img{*/
/*width: 50px;*/
/*border-radius: 100px;*/
/*}*/
/*label{*/
/*color: #5982e6;*/
/*}*/
/*}*/
.dialog-footer{
display: block;
text-align: center;
margin-top: 30px;
}
.msg_sender_wrp {
display: flex;
flex-flow: row wrap;
justify-content: flex-start;
align-items: center;
/*position: absolute;*/
/*left: 100%;*/
/*top: 50%;*/
width: 500px;
/*z-index: 500;*/
/*-ms-transform: translateY(-50%);*/
/*transform: translateY(-50%);*/
/*background: #FFFFFF;*/
/*box-shadow: 0 1px 20px 0 #E4E8EB;*/
/*border-radius: 2px;*/
}
.el-icon-circle-plus-outline {
font-size: 28px;
}
.weui-desktop-msg-sender__tabs {
line-height: 38px;
background-color: #FFFFFF;
}
ul, ol {
padding-left: 0;
list-style-type: none;
}
.weui-desktop-msg-sender__tab {
padding: 0 15px;
float: left;
cursor: pointer;
}
.weui-desktop-msg-sender__tab_appmsg:before {
background: transparent url(https://mp.weixin.qq.com/mpres/en_US/htmledition/pages/modules/msg_sender/svg/default/sender_appmsg3f92fe.svg) no-repeat 0 0;
}
.weui-desktop-msg-sender__tab:before {
content: " ";
display: inline-block;
width: 22px;
height: 20px;
vertical-align: middle;
margin: -0.2em 5px 0 0;
}
.weui-desktop-msg-sender__tab_text:before {
background: transparent url(https://mp.weixin.qq.com/mpres/en_US/htmledition/pages/modules/msg_sender/svg/default/sender_text3f92fe.svg) no-repeat 0 0;
}
.weui-desktop-msg-sender__tab_img:before {
background: transparent url(https://mp.weixin.qq.com/mpres/en_US/htmledition/pages/modules/msg_sender/svg/default/sender_img3f92fe.svg) no-repeat 0 0;
}
.weui-desktop-msg-sender__tab_audio:before {
background: transparent url(https://mp.weixin.qq.com/mpres/en_US/htmledition/pages/modules/msg_sender/svg/default/sender_audio3f92fe.svg) no-repeat 0 0;
}
.weui-desktop-msg-sender__tab_video:before {
background: transparent url(https://mp.weixin.qq.com/mpres/en_US/htmledition/pages/modules/msg_sender/svg/default/sender_video3f92fe.svg) no-repeat 0 0;
}
</style>
<template>
<div>
<el-row type="flex" class="add-btn" justify="end">
<el-col :span="6">
<el-button type="success" plain @click="add">添加回复</el-button>
</el-col>
</el-row>
<el-table
:data="list"
style="width: 100%">
<el-table-column type="expand">
<template slot-scope="props">
<el-form label-position="left" class="demo-table-expand">
<el-form-item label="关键词">
<span>{{ props.row.value }}</span>
</el-form-item>
<el-form-item label="回复内容">
<div v-for="(item, index) in JSON.parse(props.row.desc)">{{ item.content }}</div>
</el-form-item>
</el-form>
</template>
</el-table-column>
<el-table-column
label="ID"
prop="id">
</el-table-column>
<el-table-column
label="关键词"
prop="value">
</el-table-column>
<el-table-column
label="回复内容">
<template slot-scope="scope">
{{ JSON.parse(scope.row.desc).length }} 条回复
</template>
</el-table-column>
<el-table-column
prop="created_at"
label="创建时间">
</el-table-column>
<el-table-column
width="250"
label="操作">
<template slot-scope="scope">
<el-button size="mini" plain type="warning" @click="edit(scope.row)">
编辑
</el-button>
<el-button size="mini" plain type="danger" @click="del(scope.row)">
删除
</el-button>
</template>
</el-table-column>
</el-table>
<dialog-com :dialogObj="dialogObj" @changeShow="changeShow" @reflash="getList"/>
</div>
</template>
<script>
import dialogCom from './autoReplyDialog'
import {getConfigListApi,deleteConfigApi,getConfigDetailApi} from "../../service/api";
export default {
name: "autoReply"
name: "autoReply",
data() {
return {
dialogObj:{
value:'',
desc:'',
show:false,
id:''
},
list: []
}
},
components:{
dialogCom
},
mounted(){
this.getList()
},
methods: {
changeShow(data){
this.dialogObj.show=data
},
getList(){
getConfigListApi({key: 'keywords_reply'}).then(res => {
this.list = res.list
})
},
add(){
this.dialogObj.id = '';
this.dialogObj.value = '';
this.dialogObj.desc = '';
this.dialogObj.show = true
},
edit(data){
getConfigDetailApi(data.id).then((res) => {
this.dialogObj.id = res.id;
this.dialogObj.value = res.value;
this.dialogObj.desc = res.desc;
this.dialogObj.show = true;
});
console.log('edit data', data);
console.log('edit this.dialogObj', this.dialogObj);
},
del(data){
this.$confirm('此操作将删除该记录?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteConfigApi(data.id).then(res=>{
this.getList()
this.$message({
type: 'success',
message: '删除成功!'
});
});
});
}
}
}
</script>
<style scoped>
<style scoped lang="less">
@import "../../util/public";
.add-btn {
margin: 10px 0;
}
</style>
<template>
<div v-if="show">
<el-dialog
title="自动回复"
center
append-to-body
:visible.sync="show"
width="800px">
<div v-loading="loading">
<el-form ref="form" :model="form" :rules="rules" >
<el-row>
<el-col :span="4"><label>关键词</label></el-col>
<el-col :span="8">
<el-form-item prop="value">
<el-input v-model="form.value"></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="4"><label>回复内容</label></el-col>
<el-col :span="8">
<template v-if="form.desc">
<div v-for="(item, index) in JSON.parse(form.desc)" class="msg-item">
<span class="msg-text" v-if="item.type==='text'">{{item.content}}</span>
<img v-else-if="item.type==='image'" :src="item.content"/>
<i v-if="item.type === 'text'" class="el-icon-edit" @click="onEditText(item, index)"></i>
<i class="el-icon-delete" @click="onDelText(item, index)"></i>
</div>
</template>
<div class="msg_sender_wrp">
<i class="el-icon-circle-plus-outline" @click="showType = true"></i>
<ul class="weui-desktop-msg-sender__tabs" v-if="showType">
<!--<li class="weui-desktop-msg-sender__tab weui-desktop-msg-sender__tab_appmsg" @click="getMediaList('news')">图文消息</li>-->
<li class="weui-desktop-msg-sender__tab weui-desktop-msg-sender__tab_text" @click="editContent()">文字</li>
<li class="weui-desktop-msg-sender__tab weui-desktop-msg-sender__tab_img" @click="getMediaList('image')">图片</li>
<!--<li class="weui-desktop-msg-sender__tab weui-desktop-msg-sender__tab_audio" @click="getMediaList('voice')">语音</li>-->
<!--<li class="weui-desktop-msg-sender__tab weui-desktop-msg-sender__tab_video" @click="getMediaList('video')">视频</li>-->
</ul>
</div>
</el-col>
</el-row>
</el-form>
<div v-if="showMedia && mediaList.length > 0">
<el-table
:data="mediaList"
@row-click="onChooseMedia"
style="width: 100%">
<el-table-column
prop="name"
label="名称">
</el-table-column>
<el-table-column
prop="media_id"
label="mediaId">
</el-table-column>
<el-table-column
label="URL">
<template slot-scope="scope">
<a :href="scope.row.url">
<img style="width: 60px;" :src="scope.row.url"/>
</a>
</template>
</el-table-column>
</el-table>
<page :total="total" v-model="nowPage"/>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="show = false">取 消</el-button>
<el-button type="primary" @click="save">确 定</el-button>
</span>
</div>
</el-dialog>
</div>
</template>
<script>
import {updateConfigApi,saveConfigApi,getMediaListApi} from "../../service/api";
import page from '../framework/page'
export default {
name: "dialogObj",
props:[
'dialogObj'
],
data(){
return{
show:false,
id: '',
loading:true,
showType: false,
showTextContent: false,
total:0,
nowPage:0,
type:'text',
form:{
key:'keywords_reply',
value:'',
desc:''
},
textContent: '',
mediaList: [
// {
// "media_id": "hQb3Pbdb4E5Ivxi2sagL5sTdtW5W9pKJNA6Z8nBo6Ao",
// "name": "xx.jpg",
// "update_time": 1535351431,
// "url": "http://mmbiz.qpic.cn/mmbiz_jpg/qNgYSw5sicibUGtiaRYRY9QEZUoqgGdvkTE5Zvg58tUciaAXFslmwuiadgU6turtsF7mXFeicKa9RQTTG1gKSLqPiabpA/0?wx_fmt=jpeg"
// },
// {
// "media_id": "hQb3Pbdb4E5Ivxi2sagL5p2poL7GllXYm4SETNmf210",
// "name": "z.jpg",
// "update_time": 1535351316,
// "url": "http://mmbiz.qpic.cn/mmbiz_jpg/qNgYSw5sicibUGtiaRYRY9QEZUoqgGdvkTE5mTOB0jnmfdH30s54N5FIr2Tsbd9QcBFDiapicYWJ6sCZRMGTIlj179g/0?wx_fmt=jpeg"
// }
],
showMedia: false,
rules:{
value:[
{ required: true, message: '请输入规则名称', trigger: 'change' }
],
desc:[
{ required: true, message: '请输入回复内容', trigger: 'change' }
],
qr:[
{ required: true, message: '请输入二维码', trigger: 'change' }
]
}
}
},
components:{
page
},
methods:{
save(){
let json = {}
console.log('this.form', this.form)
if(this.dialogObj.id){
this.$refs['form'].validate((valid) => {
if(valid){
json = this.form
updateConfigApi(this.id,this.form).then(res=>{
this.$message({
type: 'success',
message: '修改成功!'
});
this.$emit("reflash");
this.show = false;
})
}
});
}else{
this.$refs['form'].validate((valid) => {
if(valid){
saveConfigApi(this.form).then(res=>{
this.$message({
type: 'success',
message: '新增成功!'
});
this.$emit("reflash");
this.show = false;
})
}
});
}
},
addContent(type, content, mediaId) {
let _form = this.form;
let _desc = JSON.parse(_form.desc);
let obj = {};
if (content) {
obj = {
type: type,
content: content
};
}
if (mediaId) {
obj.media_id = mediaId;
}
_desc.push(obj);
_form.desc = JSON.stringify(_desc);
this.form = _form;
},
initDialog(){
this.show = this.dialogObj.show;
if (this.dialogObj.id) {
this.id = this.dialogObj.id;
}
this.form.value = this.dialogObj.value;
this.form.desc = this.dialogObj.desc;
this.loading = false;
this.showType = false;
},
getMediaList(type){
let json = {
type: type,
page: this.nowPage
};
this.showType = false;
this.loading = true;
this.showMedia = true;
getMediaListApi(json).then(res=>{
this.loading = false;
this.type = type;
this.mediaList = res.item;
this.total = res.total_count;
if (this.total === 0 ) {
this.$message({
showClose: true,
message: '暂无数据'
});
}
}).catch(() => {
this.loading = false;
})
},
editContent() {
this.$prompt('请输入文本', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消'
}).then(({value}) => {
this.addContent('text', value, '');
})
},
onEditText(item, index) {
let _form = this.form;
this.$prompt('编辑文本', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputValue: item.content
}).then(({value}) => {
let newDesc = JSON.parse(_form.desc);
let _desc = {
type: 'text',
content: value
};
newDesc.splice(index,1,_desc);
_form.desc = JSON.stringify(newDesc);
})
this.form = _form;
},
onDelText(item, index) {
let _form = this.form;
this.$confirm('此操作将删除该文件, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let _desc = JSON.parse(_form.desc);
_desc.splice(index,1);
_form.desc = JSON.stringify(_desc);
this.$message({
type: 'success',
message: '删除成功!'
});
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
this.form = _form;
},
onChooseMedia(val){
this.addContent(this.type, val.url, val.media_id);
this.showMedia = false;
}
},
watch:{
dialogObj:{
handler: function () {
this.loading = true;
this.initDialog()
},
deep: true
},
show(value){
this.$emit("changeShow",value);
}
}
}
</script>
<style scoped lang="less">
@import "../../util/public";
.msg-item {
margin-bottom: 10px;
}
.msg-text {
margin-right: 20px;
}
.dialog-footer{
display: block;
text-align: center;
margin-top: 30px;
}
.msg_sender_wrp {
display: flex;
flex-flow: row wrap;
justify-content: flex-start;
align-items: center;
height: 48px;
/*position: absolute;*/
/*left: 100%;*/
/*top: 50%;*/
width: 500px;
/*z-index: 500;*/
/*-ms-transform: translateY(-50%);*/
/*transform: translateY(-50%);*/
/*background: #FFFFFF;*/
/*box-shadow: 0 1px 20px 0 #E4E8EB;*/
/*border-radius: 2px;*/
}
.el-icon-circle-plus-outline {
font-size: 28px;
}
.weui-desktop-msg-sender__tabs {
line-height: 38px;
background-color: #FFFFFF;
}
ul, ol {
padding-left: 0;
list-style-type: none;
}
.weui-desktop-msg-sender__tab {
padding: 0 15px;
float: left;
cursor: pointer;
}
.weui-desktop-msg-sender__tab_appmsg:before {
background: transparent url(https://mp.weixin.qq.com/mpres/en_US/htmledition/pages/modules/msg_sender/svg/default/sender_appmsg3f92fe.svg) no-repeat 0 0;
}
.weui-desktop-msg-sender__tab:before {
content: " ";
display: inline-block;
width: 22px;
height: 20px;
vertical-align: middle;
margin: -0.2em 5px 0 0;
}
.weui-desktop-msg-sender__tab_text:before {
background: transparent url(https://mp.weixin.qq.com/mpres/en_US/htmledition/pages/modules/msg_sender/svg/default/sender_text3f92fe.svg) no-repeat 0 0;
}
.weui-desktop-msg-sender__tab_img:before {
background: transparent url(https://mp.weixin.qq.com/mpres/en_US/htmledition/pages/modules/msg_sender/svg/default/sender_img3f92fe.svg) no-repeat 0 0;
}
.weui-desktop-msg-sender__tab_audio:before {
background: transparent url(https://mp.weixin.qq.com/mpres/en_US/htmledition/pages/modules/msg_sender/svg/default/sender_audio3f92fe.svg) no-repeat 0 0;
}
.weui-desktop-msg-sender__tab_video:before {
background: transparent url(https://mp.weixin.qq.com/mpres/en_US/htmledition/pages/modules/msg_sender/svg/default/sender_video3f92fe.svg) no-repeat 0 0;
}
</style>
<template>
<div class="focus-reply">
<div class="title">自动回复</div>
<div class="content">
<div class="inner" v-loading="loading">
<ul class="weui-desktop-msg-sender__tabs">
<li class="weui-desktop-msg-sender__tab weui-desktop-msg-sender__tab_text" :class="type === 'text' ? 'weui-desktop-msg-sender__tab_selected' : ''" @click="type = 'text'">文字</li>
<li class="weui-desktop-msg-sender__tab weui-desktop-msg-sender__tab_img" :class="type === 'image' ? 'weui-desktop-msg-sender__tab_selected' : ''" @click="type = 'image'">图片</li>
</ul>
<div class="inner-bottom">
<div class="img-action" v-if="type === 'image'">
<img v-if="imageContent" :src="imageContent.content"/>
<div class="img-create-access" v-if="!showMedia">
<a href="javascript:;" class="img-create-access__link" @click="getMediaList('image')">从素材库中选择</a>
</div>
<div v-if="showMedia && mediaList.length > 0">
<el-table
:data="mediaList"
@row-click="onChooseMedia"
style="width: 100%">
<el-table-column
prop="name"
label="名称">
</el-table-column>
<el-table-column
prop="media_id"
label="mediaId">
</el-table-column>
<el-table-column
label="URL">
<template slot-scope="scope">
<a :href="scope.row.url">
<img style="width: 60px;" :src="scope.row.url"/>
</a>
</template>
</el-table-column>
</el-table>
<page :total="total" v-model="nowPage"/>
</div>
</div>
<div class="inner-emotion_editor" v-else-if="type === 'text'">
<div class="inner-edit_area">
<el-input
type="textarea"
:autosize="{ minRows: 4, maxRows: 8}"
placeholder="请输入内容"
v-model="content">
</el-input>
</div>
</div>
</div>
<div class="tool_bar">
<button class="weui-desktop-btn weui-desktop-btn_primary" @click="save">保存</button>
<!--<div class="weui-desktop-popover__wrp">-->
<!--<span class="weui-desktop-popover__target"><button class="weui-desktop-btn weui-desktop-btn_default">删除回复</button></span>-->
<!--</div>-->
</div>
</div>
</div>
</div>
</template>
<script>
import {updateConfigApi,saveConfigApi,getMediaListApi,getConfigListApi} from "../../service/api";
import page from '../framework/page'
export default {
name: "focusReply"
name: "focusReply",
data(){
return{
loading:false,
total:0,
nowPage:0,
id: null,
form:{
key:'focus_reply',
value:'focus_reply',
desc:''
},
content: '',
imageContent: '',
type: 'text',
mediaList: [],
mediaListMock: [
{
"media_id": "hQb3Pbdb4E5Ivxi2sagL5sTdtW5W9pKJNA6Z8nBo6Ao",
"name": "xx.jpg",
"update_time": 1535351431,
"url": "http://mmbiz.qpic.cn/mmbiz_jpg/qNgYSw5sicibUGtiaRYRY9QEZUoqgGdvkTE5Zvg58tUciaAXFslmwuiadgU6turtsF7mXFeicKa9RQTTG1gKSLqPiabpA/0?wx_fmt=jpeg"
},
{
"media_id": "hQb3Pbdb4E5Ivxi2sagL5p2poL7GllXYm4SETNmf210",
"name": "z.jpg",
"update_time": 1535351316,
"url": "http://mmbiz.qpic.cn/mmbiz_jpg/qNgYSw5sicibUGtiaRYRY9QEZUoqgGdvkTE5mTOB0jnmfdH30s54N5FIr2Tsbd9QcBFDiapicYWJ6sCZRMGTIlj179g/0?wx_fmt=jpeg"
}
],
showMedia: false,
rules:{
value:[
{ required: true, message: '请输入规则名称', trigger: 'change' }
],
desc:[
{ required: true, message: '请输入回复内容', trigger: 'change' }
],
qr:[
{ required: true, message: '请输入二维码', trigger: 'change' }
]
}
}
},
components:{
page
},
mounted(){
this.getList()
},
methods:{
save(){
let json = this.form
let _desc = [];
if (this.type === 'text') {
if (!this.content) {
this.$message({
showClose: true,
message: '请输入文本内容'
});
return;
}
_desc[0] = {
type : this.type,
content: this.content
}
} else if (this.type === 'image') {
if (!this.imageContent) {
this.$message({
showClose: true,
message: '请选择图片'
});
return
}
_desc[0] = this.imageContent
}
json.desc = JSON.stringify(_desc)
if (this.id) {
updateConfigApi(this.id,json).then(res=>{
this.$message({
type: 'success',
message: '修改成功!'
});
this.$emit("reflash");
this.show = false;
})
} else {
saveConfigApi(json).then(res=>{
this.$message({
type: 'success',
message: '保存成功!'
});
})
}
},
getMediaList(type){
let json = {
type: type,
page: this.nowPage
};
this.loading = true;
getMediaListApi(json).then(res=>{
this.loading = false;
this.type = type;
this.total = res.total_count;
if (res.item.length === 0 ) {
this.$message({
showClose: true,
message: '暂无数据'
});
this.showMedia = false;
} else {
this.showMedia = true;
this.mediaList = res.item;
}
}).catch(() => {
this.loading = false;
this.showMedia = false;
})
},
onChooseMedia(val){
this.addContent(this.type, val.url, val.media_id);
this.showMedia = false;
},
addContent(type, content, mediaId) {
let obj = {};
if (content) {
obj = {
type: type,
content: content
};
}
if (mediaId) {
obj.media_id = mediaId;
}
this.imageContent = obj
},
getList(){
getConfigListApi({key: 'focus_reply'}).then(res => {
if (res.total > 0) {
this.id = res.list[0].id;
let _desc = JSON.parse(res.list[0].desc);
this.type = _desc[0].type;
if (this.type === 'text') {
this.content = _desc[0].content
} else if (this.type === 'image') {
this.imageContent = {
type: 'image',
content: _desc[0].content,
media_id: _desc[0].media_id
}
}
console.log('this.type', _desc)
}
})
},
}
}
</script>
<style scoped>
.focus-reply {
padding: 30px;
}
ul, ol {
padding-left: 0;
list-style-type: none;
}
.title {
color: #353535;
font-size: 20px;
font-weight: 400;
line-height: 1;
}
.content {
padding-top: 40px;
margin-top: 24px;
border-top: 1px solid #E4E8EB;
}
.inner {
border: 1px solid #E4E8EB;
background-color: #FFFFFF;
}
.inner-bottom {
border-top: 1px solid #E4E8EB;
}
.img-action {
padding: 17px 20px;
min-height: 215px;
}
.img-create-access {
position: relative;
border: 2px dotted #E4E8EB;
width: 48.6%;
height: 211px;
text-align: center;
}
.img-create-access:first-child {
float: left;
}
.img-create-access__link {
display: inline-block;
vertical-align: middle;
color: #9A9A9A;
margin: 0 10px;
margin-top: 68px;
text-decoration: none;
}
.img-create-access__link:before {
content: " ";
display: block;
width: 36px;
height: 36px;
margin: 0 auto 5px;
background: transparent url(https://res.wx.qq.com/mpres/en_US/htmledition/pages/modules/msg_sender/images/icon36_add_gray.png) no-repeat 0 0;
}
.weui-desktop-msg-sender__tabs {
line-height: 38px;
background-color: #FFFFFF;
}
.sender__tab_selected {
color: #44B549;
}
.weui-desktop-msg-sender__tab:hover, .weui-desktop-msg-sender__tab_selected {
color: #44B549;
}
.weui-desktop-msg-sender__tab {
display: inline-block;
padding: 0 20px;
cursor: pointer;
}
.weui-desktop-msg-sender__tab:hover.weui-desktop-msg-sender__tab_text:before, .weui-desktop-msg-sender__tab_selected.weui-desktop-msg-sender__tab_text:before {
background-image: url(https://res.wx.qq.com/mpres/en_US/htmledition/pages/modules/msg_sender/svg/default/sender_text_current.svg);
}
.weui-desktop-msg-sender__tab_img:before {
background: transparent url(https://res.wx.qq.com/mpres/en_US/htmledition/pages/modules/msg_sender/svg/default/sender_img.svg) no-repeat 0 0;
}
.weui-desktop-msg-sender__tab:hover.weui-desktop-msg-sender__tab_img:before, .weui-desktop-msg-sender__tab_selected.weui-desktop-msg-sender__tab_img:before {
background-image: url(https://res.wx.qq.com/mpres/en_US/htmledition/pages/modules/msg_sender/svg/default/sender_img_current.svg);
}
.weui-desktop-msg-sender__tab:before {
content: " ";
display: inline-block;
width: 22px;
height: 20px;
vertical-align: middle;
margin: -0.2em 5px 0 0;
}
.tool_bar {
padding-top: 0;
padding-bottom: 50px;
margin-top: 40px;
margin-left: 20px;
}
.tool_bar > .weui-desktop-btn {
margin-right: 1em;
}
.weui-desktop-btn_primary {
background-color: #1AAD19;
border-color: #1AAD19;
color: #FFFFFF;
}
.weui-desktop-btn {
display: inline-block;
padding: 0 22px;
min-width: 54px;
line-height: 2.42857143;
vertical-align: middle;
text-align: center;
text-decoration: none;
border-radius: 3px;
font-size: 14px;
cursor: pointer;
border-width: 1px;
border-style: solid;
box-sizing: content-box;
}
.weui-desktop-popover__wrp {
display: inline;
position: relative;
font-size: 14px;
}
.weui-desktop-btn_default {
background-color: #FBFBFB;
border-color: #E4E8EB;
color: #353535;
}
.inner-emotion_editor {
margin: 2%;
}
</style>
<template>
<el-dialog
title="自动回复"
center
append-to-body
:visible.sync="show"
width="800px">
<div v-loading="loading">
<el-form ref="form" :model="form" :rules="rules" >
<el-col :span="4"><label>描述</label></el-col>
<el-col :span="8">
<el-form-item>
<el-input v-model="form.content" type="textarea"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="show = false">取 消</el-button>
<el-button type="primary" @click="save">确 定</el-button>
</span>
</div>
</el-dialog>
</template>
<script>
import {updateConfigApi,saveConfigApi} from "../../service/api";
import {TEACHERTYPE} from "../../util/wordbook";
import page from '../framework/page'
export default {
name: "dialogObj",
props:[
'dialogObj'
],
data(){
return{
show:false,
id: '',
loading:true,
form:{
key:'',
value:'',
desc:''
},
mediaList: [],
rules:{
value:[
{ required: true, message: '请输入关键词', trigger: 'change' }
],
desc:[
{ required: true, message: '请输入描述', trigger: 'change' }
],
key:[
{ required: true, message: '请输入Key', trigger: 'change' }
]
}
}
},
components:{
page
},
methods:{
save(){
this.$emit("reflash");
},
initDialog(){
this.show = this.dialogObj.show;
this.form.key = this.dialogObj.key;
this.form.value = this.dialogObj.value;
this.form.desc = this.dialogObj.desc;
this.loading = false
}
},
watch:{
dialogObj:{
handler: function () {
this.loading = true;
this.initDialog()
},
deep: true
},
show(value){
this.$emit("changeShow",value);
}
}
}
</script>
<style scoped lang="less">
@import "../../util/public";
/*.el-col {*/
/*height: 50px;*/
/*text-align: center;*/
/*margin-bottom: 20px;*/
/*line-height: 40px;*/
/*.el-select{*/
/*width: 100%;*/
/*}*/
/*img{*/
/*width: 50px;*/
/*border-radius: 100px;*/
/*}*/
/*label{*/
/*color: #5982e6;*/
/*}*/
/*}*/
.dialog-footer{
display: block;
text-align: center;
margin-top: 30px;
}
.msg_sender_wrp {
display: flex;
flex-flow: row wrap;
justify-content: flex-start;
align-items: center;
/*position: absolute;*/
/*left: 100%;*/
/*top: 50%;*/
width: 500px;
/*z-index: 500;*/
/*-ms-transform: translateY(-50%);*/
/*transform: translateY(-50%);*/
/*background: #FFFFFF;*/
/*box-shadow: 0 1px 20px 0 #E4E8EB;*/
/*border-radius: 2px;*/
}
.el-icon-circle-plus-outline {
font-size: 28px;
}
.weui-desktop-msg-sender__tabs {
line-height: 38px;
background-color: #FFFFFF;
}
ul, ol {
padding-left: 0;
list-style-type: none;
}
.weui-desktop-msg-sender__tab {
padding: 0 15px;
float: left;
cursor: pointer;
}
.weui-desktop-msg-sender__tab_appmsg:before {
background: transparent url(https://mp.weixin.qq.com/mpres/en_US/htmledition/pages/modules/msg_sender/svg/default/sender_appmsg3f92fe.svg) no-repeat 0 0;
}
.weui-desktop-msg-sender__tab:before {
content: " ";
display: inline-block;
width: 22px;
height: 20px;
vertical-align: middle;
margin: -0.2em 5px 0 0;
}
.weui-desktop-msg-sender__tab_text:before {
background: transparent url(https://mp.weixin.qq.com/mpres/en_US/htmledition/pages/modules/msg_sender/svg/default/sender_text3f92fe.svg) no-repeat 0 0;
}
.weui-desktop-msg-sender__tab_img:before {
background: transparent url(https://mp.weixin.qq.com/mpres/en_US/htmledition/pages/modules/msg_sender/svg/default/sender_img3f92fe.svg) no-repeat 0 0;
}
.weui-desktop-msg-sender__tab_audio:before {
background: transparent url(https://mp.weixin.qq.com/mpres/en_US/htmledition/pages/modules/msg_sender/svg/default/sender_audio3f92fe.svg) no-repeat 0 0;
}
.weui-desktop-msg-sender__tab_video:before {
background: transparent url(https://mp.weixin.qq.com/mpres/en_US/htmledition/pages/modules/msg_sender/svg/default/sender_video3f92fe.svg) no-repeat 0 0;
}
</style>
......@@ -214,13 +214,42 @@ export const editBoxApi = function (id, json) {
};
// 获取公众号菜单
const getPublicMenuUrl = `${_baseUrl}api/admin/open/menu`;
export const getPublicMenuApi = function (id) {
export const getPublicMenuApi = function () {
return Vue.prototype.$fetch(getPublicMenuUrl)
};
// 添加公众号菜单
export const savePublicMenuApi = function (json) {
return Vue.prototype.$post(getPublicMenuUrl,json)
};
// 获取配置列表
const getConfigListUrl = `${_baseUrl}api/admin/sys/config/list`;
export const getConfigListApi = function (json) {
return Vue.prototype.$fetch(getConfigListUrl, json)
};
// 新增系统配置
const saveConfigUrl = `${_baseUrl}api/admin/sys/config`;
export const saveConfigApi = function (json) {
return Vue.prototype.$post(saveConfigUrl, json)
};
// 更新关键词
const updateConfigUrl = `${_baseUrl}api/admin/sys/config`;
export const updateConfigApi = function (config_id,json) {
return Vue.prototype.$put(`${updateConfigUrl}/${config_id}`, json)
};
// 删除配置
const delConfigUrl = `${_baseUrl}api/admin/sys/config/`;
export const deleteConfigApi = function (config_id) {
return Vue.prototype.$del(`${delConfigUrl}${config_id}`)
};
// 获取配置详情
const getConfigDetailUrl = `${_baseUrl}api/admin/sys/config/`;
export const getConfigDetailApi = function (id) {
return Vue.prototype.$fetch(`${getConfigDetailUrl}${id}`)
};
// 获取素材列表
const getMediaListUrl = `${_baseUrl}api/admin/open/media/list`;
export const getMediaListApi = function (json) {
return Vue.prototype.$fetch(getMediaListUrl, json)
};
// 获取商品列表
// const getGoodsListUrl = `${_baseUrl}api/admin/goods/list`;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment