Commit 1b48b4d4 authored by wangwei's avatar wangwei

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

parents 72653d0e ea923599
...@@ -211,13 +211,6 @@ ...@@ -211,13 +211,6 @@
}); });
return return
} }
if (!json.item_category_ids) {
this.$message({
type: 'error',
message: '请选择盒子!'
});
return
}
switch(this.dialogObj.type){ switch(this.dialogObj.type){
case 1: case 1:
// this.$refs['form'].validate((valid) => { // this.$refs['form'].validate((valid) => {
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
</el-option> </el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="周几不上课" prop="rest_week_day"> <el-form-item label="周几不上课">
<el-select v-model="form.rest_week_day" multiple placeholder="请选择"> <el-select v-model="form.rest_week_day" multiple placeholder="请选择">
<el-option <el-option
v-for="item in options" v-for="item in options"
...@@ -181,7 +181,7 @@ ...@@ -181,7 +181,7 @@
title: this.form.title, title: this.form.title,
start_num: this.form.start_num, start_num: this.form.start_num,
start_at: this.form.start_at, start_at: this.form.start_at,
rest_week_day: this.form.rest_week_day.join(','), rest_week_day: this.form.rest_week_day ? this.form.rest_week_day.join(',') : '',
teacher_ids: this.teacherList.join(',') teacher_ids: this.teacherList.join(',')
} }
if (this.form.id) { if (this.form.id) {
......
...@@ -98,20 +98,7 @@ ...@@ -98,20 +98,7 @@
desc:'' desc:''
}, },
textContent: '', textContent: '',
mediaList: [ 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, showMedia: false,
rules:{ rules:{
value:[ value:[
......
<template> <template>
<div class="focus-reply"> <div class="focus-reply">
<div class="title">自动回复</div> <div class="clear-both top">
<div class="content"> <span class="title">自动回复</span>
<div class="inner" v-loading="loading"> <el-button type="success" plain style="float: right" @click="add">添加回复</el-button>
<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>
<div v-if="showMedia && mediaList.length > 0">
<el-table <el-table
:data="mediaList" :data="list"
@row-click="onChooseMedia" style="width: 100%"
style="width: 100%"> max-height="800">
<el-table-column <el-table-column
prop="name" fixed
label="名称"> label="类型"
width="150">
<template slot-scope="scope">
{{type | typeFilter}}
</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
prop="media_id" label="内容">
label="mediaId"> <template slot-scope="scope">
<div v-if="scope.row.type === 'text'">
{{scope.row.content}}
</div>
<a v-else-if="scope.row.type === 'image'" :href="scope.row.content" target="_blank">
<img class="shotcut" :src="scope.row.content">
</a>
</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="URL"> fixed="right"
label="操作"
width="200">
<template slot-scope="scope"> <template slot-scope="scope">
<a :href="scope.row.url"> <el-button
<img style="width: 60px;" :src="scope.row.url"/> @click.native.prevent="editRow(scope.$index, list)"
</a> type="text"
size="small">
编辑
</el-button>
<el-button
@click.native.prevent="deleteRow(scope.$index, list)"
type="text"
size="small">
移除
</el-button>
<el-button
v-if="scope.$index!==0"
@click.native.prevent="moveRow(scope.$index-1,scope.$index)"
type="text"
size="small">
上移
</el-button>
<el-button
v-if="scope.$index!==list.length-1"
@click.native.prevent="moveRow(scope.$index,scope.$index + 1)"
type="text"
size="small">
下移
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<page :total="total" v-model="nowPage"/> <dialog-com v-if="dialogObj.show" :dialogObj="dialogObj" @changeShow="changeShow" @reflash="getList"/>
</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> </div>
</template> </template>
<script> <script>
import dialogCom from './focusReplyDialog'
import {updateConfigApi,saveConfigApi,getMediaListApi,getConfigListApi} from "../../service/api"; import {updateConfigApi,saveConfigApi,getMediaListApi,getConfigListApi} from "../../service/api";
import page from '../framework/page' import page from '../framework/page'
export default { export default {
...@@ -71,6 +77,7 @@ ...@@ -71,6 +77,7 @@
total:0, total:0,
nowPage:1, nowPage:1,
id: null, id: null,
list: [],
form:{ form:{
key:'focus_reply', key:'focus_reply',
value:'focus_reply', value:'focus_reply',
...@@ -105,15 +112,42 @@ ...@@ -105,15 +112,42 @@
qr:[ qr:[
{ required: true, message: '请输入二维码', trigger: 'change' } { required: true, message: '请输入二维码', trigger: 'change' }
] ]
},
dialogObj:{
show:false,
id:'',
index: -1,
list: []
} }
} }
}, },
components:{ components:{
page page,
dialogCom
}, },
mounted(){ mounted(){
this.getList() this.getList()
}, },
filters: {
typeFilter(value){
if(!value) return '';
if(value === 'text') {
return '文字'
} else if(value === 'image') {
return '图片'
} else {
return val
}
},
contentFilter(row){
if (row.type === 'text') {
return row.content
} else if (row.type === 'image'){
let content = `<img src='${row.content}'>`
return content;
}
}
},
methods:{ methods:{
save(){ save(){
let json = this.form let json = this.form
...@@ -147,8 +181,6 @@ ...@@ -147,8 +181,6 @@
type: 'success', type: 'success',
message: '修改成功!' message: '修改成功!'
}); });
this.$emit("reflash");
this.show = false;
}) })
} else { } else {
saveConfigApi(json).then(res=>{ saveConfigApi(json).then(res=>{
...@@ -206,6 +238,7 @@ ...@@ -206,6 +238,7 @@
if (res.total > 0) { if (res.total > 0) {
this.id = res.list[0].id; this.id = res.list[0].id;
let _desc = JSON.parse(res.list[0].desc); let _desc = JSON.parse(res.list[0].desc);
this.list = _desc || [];
this.type = _desc[0].type; this.type = _desc[0].type;
if (this.type === 'text') { if (this.type === 'text') {
this.content = _desc[0].content this.content = _desc[0].content
...@@ -216,15 +249,79 @@ ...@@ -216,15 +249,79 @@
media_id: _desc[0].media_id media_id: _desc[0].media_id
} }
} }
console.log('this.type', _desc)
} }
}) })
}, },
add(){
this.dialogObj = {
show: true,
id: null,
index: -1,
list: this.list
}
},
editRow(index, row){
this.dialogObj = {
show: true,
id: this.id,
index: index,
list: this.list
}
},
deleteRow(index , list){
let desc = list;
desc.splice(index,1);
let json = {
key: 'focus_reply',
value: 'focus_reply'
}
json.desc = JSON.stringify(desc)
this.$confirm('此操作将删除该文件, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
updateConfigApi(this.id,json).then(res=>{
this.$message({
type: 'success',
message: '删除成功!'
});
this.getList();
})
}).catch(()=>{
this.$message({
type: 'success',
message: '已取消删除!'
});
})
},
moveRow(first,second){
let _first = this.list[first];
let _second = this.list[second];
this.list[first] = _second;
this.list[second] = _first;
let desc = this.list;
let json = {
key: 'focus_reply',
value: 'focus_reply'
}
json.desc = JSON.stringify(desc)
updateConfigApi(this.id,json).then(res=>{
this.$message({
type: 'success',
message: '保存成功!'
});
this.getList();
})
},
changeShow(){
this.dialogObj.show = false;
}
} }
} }
</script> </script>
<style scoped> <style scoped lang="less">
.focus-reply { .focus-reply {
padding: 30px; padding: 30px;
} }
...@@ -238,6 +335,9 @@ ...@@ -238,6 +335,9 @@
font-weight: 400; font-weight: 400;
line-height: 1; line-height: 1;
} }
.top {
margin-bottom: 30px;
}
.content { .content {
padding-top: 40px; padding-top: 40px;
margin-top: 24px; margin-top: 24px;
...@@ -354,4 +454,14 @@ ...@@ -354,4 +454,14 @@
.inner-emotion_editor { .inner-emotion_editor {
margin: 2%; margin: 2%;
} }
.shotcut {
width: 50px;
}
.clear-both{
&:after{
content: '';
display: block;
clear: both;
}
}
</style> </style>
<template>
<el-dialog
title="自动回复"
center
:visible.sync="show"
:close="close"
width="800px">
<div class="focus-reply">
<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">
<el-button @click="close">取 消</el-button>
<el-button class="weui-desktop-btn weui-desktop-btn_primary" @click="save">保存</el-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>
</el-dialog>
</template>
<script>
import {updateConfigApi,saveConfigApi,getMediaListApi,getConfigListApi} from "../../service/api";
import page from '../framework/page'
export default {
name: "focusReplyDialog",
props:[
'dialogObj'
],
data(){
return{
show: false,
loading:false,
total:0,
nowPage:1,
id: null,
list: [],
index: -1,
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.initDialog()
},
filters: {
},
methods:{
initDialog(){
console.log('initDialog',this.dialogObj )
this.show = this.dialogObj.show;
if (this.dialogObj.id) {
this.id = this.dialogObj.id;
}
this.index = this.dialogObj.index
this.list = this.dialogObj.list
if (this.index === -1) {
this.type = 'text'
this.content = ''
} else {
this.type = this.list[this.index].type;
if (this.type === 'text') {
this.content = this.list[this.index].content
} else if (this.type === 'image') {
this.imageContent = {
type: 'image',
content: this.list[this.index].content,
media_id: this.list[this.index].media_id
}
}
}
},
close(){
this.$emit("changeShow", false);
},
save(){
let json = this.form
let _desc = this.list;
if (this.type === 'text') {
if (!this.content) {
this.$message({
showClose: true,
message: '请输入文本内容'
});
return;
}
let obj = {
type : this.type,
content: this.content
};
if (this.id){
_desc[this.index] = obj
} else {
_desc.push(obj)
}
} else if (this.type === 'image') {
if (!this.imageContent) {
this.$message({
showClose: true,
message: '请选择图片'
});
return
}
if (this.id){
_desc[this.index] = this.imageContent
} else {
_desc.push(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.$emit("changeShow", false);
this.show = false;
})
} else {
saveConfigApi(json).then(res=>{
this.$message({
type: 'success',
message: '保存成功!'
});
this.$emit("reflash");
this.$emit("changeShow", false);
})
}
},
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.list = _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 {
}
.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%;
}
.shotcut {
width: 50px;
}
</style>
...@@ -52,44 +52,45 @@ ...@@ -52,44 +52,45 @@
<div id="js_rightBox" class="portable_editor to_left" style="display: block;"> <div id="js_rightBox" class="portable_editor to_left" style="display: block;">
<div class="editor_inner"> <div class="editor_inner">
<div class="menu_form_hd flex-bt"> <div class="menu_form_hd flex-bt">
<h4 class="global_info"> {{selectedItem && selectedItem.name}} </h4> <h4 class="global_info"> {{selectedChildIndex !== -1 ? buttonList[selectedIndex].sub_button[selectedChildIndex].name : buttonList[selectedIndex].name}} </h4>
<div class="global_extra"> <div class="global_extra">
<a v-if="selectedChildIndex === -1" href="javascript:void(0);" @click="delMenu">删除菜单</a> <a v-if="selectedChildIndex === -1" href="javascript:void(0);" @click="delMenu">删除菜单</a>
<a v-else href="javascript:void(0);" @click="delSubMenu">删除子菜单</a> <a v-else href="javascript:void(0);" @click="delSubMenu">删除子菜单</a>
</div> </div>
</div> </div>
<div class="menu_form_bd" id="view"> <div class="menu_form_bd" id="view">
<div id="js_innerNone" style="display: block;" class="msg_sender_tips tips_global" v-if="selectedItem && selectedItem.sub_button.length > 0"> <div id="js_innerNone" style="display: block;" class="msg_sender_tips tips_global" v-if="buttonList[selectedIndex] && buttonList[selectedIndex].sub_button.length > 0">
已添加子菜单,仅可设置菜单名称。 已添加子菜单,仅可设置菜单名称。
</div> </div>
<div class="frm_control_group js_setNameBox"> <div class="frm_control_group js_setNameBox">
<label for="" class="frm_label"> <strong class="title js_menuTitle">{{selectedChildIndex === -1 ? '菜单名称' : '子菜单名称'}}</strong> </label> <label for="" class="frm_label"> <strong class="title js_menuTitle">{{selectedChildIndex === -1 ? '菜单名称' : '子菜单名称'}}</strong> </label>
<div class="frm_controls"> <div class="frm_controls">
<span class="frm_input_box with_counter counter_in append"> <span class="frm_input_box with_counter counter_in append">
<input :value="selectedItem.name" type="text" class="frm_input js_menu_name" @input="onInput"/> <input :value="selectedChildIndex === -1 ? buttonList[selectedIndex].name : buttonList[selectedIndex].sub_button[selectedChildIndex].name" type="text" class="frm_input js_menu_name" @input="onInput"/>
</span> </span>
<p class="frm_msg fail js_titleEorTips dn" v-if="showErrorTips">字数超过上限</p> <p class="frm_msg fail js_titleEorTips dn" v-if="showErrorTips">字数超过上限</p>
<p class="frm_msg fail js_titlenoTips dn" style="display: none;">请输入菜单名称</p> <p class="frm_msg fail js_titlenoTips dn" style="display: none;">请输入菜单名称</p>
<p class="frm_tips js_titleNolTips">字数不超过4个汉字或8个字母</p> <p class="frm_tips js_titleNolTips">字数不超过4个汉字或8个字母</p>
</div> </div>
</div> </div>
<div class="frm_control_group" :class="selectedItem && (selectedItem.sub_button.length === 0 || selectedChildIndex > -1) ? '' : 'hideMenu'"> <div class="frm_control_group" :class="(selectedChildIndex == -1 && buttonList[selectedIndex].sub_button.length > 0 )? 'hideMenu' : ''">
<label for="" class="frm_label"> <strong class="title js_menuContent">{{selectedChildIndex === -1 ? '菜单内容' : '子菜单内容'}}</strong> </label> <label for="" class="frm_label"> <strong class="title js_menuContent">{{selectedChildIndex === -1 ? '菜单内容' : '子菜单内容'}}</strong> </label>
<div class="frm_controls frm_vertical_pt"> <div class="frm_controls frm_vertical_pt">
<el-radio-group v-model="selectedItem.type" @change="onTypeChange"> <el-radio-group v-model="selectedChildIndex === -1 ? buttonList[selectedIndex].type : buttonList[selectedIndex].sub_button[selectedChildIndex].type" @change="onTypeChange">
<el-radio label="click">发送消息</el-radio> <el-radio label="click">发送消息</el-radio>
<el-radio label="view">跳转网页</el-radio> <el-radio label="view">跳转网页</el-radio>
</el-radio-group> </el-radio-group>
</div> </div>
</div> </div>
<div class="menu_content_container" :class="selectedItem && selectedItem.sub_button.length === 0 ? '' : 'hideMenu'"> <div class="menu_content_container" :class="(selectedChildIndex == -1 && buttonList[selectedIndex].sub_button.length > 0 )? 'hideMenu' : ''">
<div v-if="selectedItem.type === 'view'" class="menu_content url jsMain" id="url" style="display: block;"> <template v-if="selectedChildIndex == -1">
<div v-if="buttonList[selectedIndex].type === 'view'" class="menu_content url jsMain" id="url" style="display: block;">
<p class="menu_content_tips tips_global">订阅者点击该子菜单会跳到以下链接</p> <p class="menu_content_tips tips_global">订阅者点击该子菜单会跳到以下链接</p>
<div class="frm_control_group"> <div class="frm_control_group">
<label for="" class="frm_label">页面地址</label> <label for="" class="frm_label">页面地址</label>
<div class="frm_controls"> <div class="frm_controls">
<span class="frm_input_box"> <span class="frm_input_box">
<input v-model="selectedItem.url" type="text" class="frm_input" name="urlText" /> <input v-model="buttonList[selectedIndex].url" type="text" class="frm_input" name="urlText" />
</span> </span>
</div> </div>
</div> </div>
...@@ -100,11 +101,37 @@ ...@@ -100,11 +101,37 @@
<label for="" class="frm_label">key</label> <label for="" class="frm_label">key</label>
<div class="frm_controls"> <div class="frm_controls">
<span class="frm_input_box"> <span class="frm_input_box">
<input v-model="selectedItem.key" type="text" class="frm_input" name="clickKey"/> <input v-model="buttonList[selectedIndex].key" type="text" class="frm_input" name="clickKey"/>
</span> </span>
</div> </div>
</div> </div>
</div> </div>
</template>
<template v-else>
<div v-if="buttonList[selectedIndex].sub_button[selectedChildIndex].type === 'view'" class="menu_content url jsMain" style="display: block;">
<p class="menu_content_tips tips_global">订阅者点击该子菜单会跳到以下链接</p>
<div class="frm_control_group">
<label for="" class="frm_label">页面地址</label>
<div class="frm_controls">
<span class="frm_input_box">
<input v-model="buttonList[selectedIndex].sub_button[selectedChildIndex].url" type="text" class="frm_input" name="urlText" />
</span>
</div>
</div>
</div>
<div v-else class="menu_content url jsMain" style="display: block;">
<p class="menu_content_tips tips_global">click</p>
<div class="frm_control_group">
<label for="" class="frm_label">key</label>
<div class="frm_controls">
<span class="frm_input_box">
<input v-model="buttonList[selectedIndex].sub_button[selectedChildIndex].key" type="text" class="frm_input" name="clickKey"/>
</span>
</div>
</div>
</div>
</template>
</div> </div>
</div> </div>
</div> </div>
...@@ -155,20 +182,12 @@ ...@@ -155,20 +182,12 @@
this.selectedIndex = index this.selectedIndex = index
this.selectedChildIndex = -1 this.selectedChildIndex = -1
this.selectedItem = item this.selectedItem = item
getPublicMenuApi().then(res=> {
if (res.menu && res.menu.button) {
this.buttonList = res.menu.button
}
})
}, },
clickSubMenu(index, item){ clickSubMenu(index, item){
this.selectedChildIndex = index this.selectedChildIndex = index
this.selectedItem = item this.selectedItem = item
getPublicMenuApi().then(res=> { console.log('clickSubMenu', this.buttonList)
if (res.menu && res.menu.button) { console.log('click sub menu', this.buttonList[this.selectedIndex].sub_button[this.selectedChildIndex].type);
this.buttonList = res.menu.button
}
})
}, },
onInput(val) { onInput(val) {
let value = val.target.value let value = val.target.value
...@@ -182,19 +201,27 @@ ...@@ -182,19 +201,27 @@
this.selectedItem.name = value this.selectedItem.name = value
}, },
addSubMenu(){ addSubMenu(){
getPublicMenuApi().then(res=> { let item = {
if (res.menu && res.menu.button) {
this.buttonList = res.menu.button
this.selectedItem = {
name: '子菜单名', name: '子菜单名',
sub_button: [], sub_button: [],
type: 'view', type: 'view',
url: '' url: ''
} }
this.buttonList[this.selectedIndex].sub_button.push(this.selectedItem) this.buttonList[this.selectedIndex].sub_button.push(item)
this.selectedChildIndex = this.buttonList[this.selectedIndex].sub_button.length - 1 this.selectedChildIndex = this.buttonList[this.selectedIndex].sub_button.length - 1
} // getPublicMenuApi().then(res=> {
}) // if (res.menu && res.menu.button) {
// this.buttonList = res.menu.button
// this.selectedItem = {
// name: '子菜单名',
// sub_button: [],
// type: 'view',
// url: ''
// }
// this.buttonList[this.selectedIndex].sub_button.push(this.selectedItem)
// this.selectedChildIndex = this.buttonList[this.selectedIndex].sub_button.length - 1
// }
// })
}, },
delSubMenu(){ delSubMenu(){
this.$confirm('此操作将删除该子菜单?', '提示', { this.$confirm('此操作将删除该子菜单?', '提示', {
...@@ -202,31 +229,45 @@ ...@@ -202,31 +229,45 @@
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
getPublicMenuApi().then(res => {
if (res.menu && res.menu.button) {
this.buttonList = res.menu.button
this.buttonList[this.selectedIndex].sub_button.splice(this.selectedChildIndex, 1) this.buttonList[this.selectedIndex].sub_button.splice(this.selectedChildIndex, 1)
this.selectedChildIndex = this.buttonList[this.selectedIndex].sub_button.length - 1 this.selectedChildIndex = this.buttonList[this.selectedIndex].sub_button.length - 1
this.selectedItem = this.selectedChildIndex > -1 ? this.buttonList[this.selectedIndex][this.selectedChildIndex] : this.buttonList[this.selectedIndex] this.selectedItem = this.selectedChildIndex > -1 ? this.buttonList[this.selectedIndex][this.selectedChildIndex] : this.buttonList[this.selectedIndex]
} // getPublicMenuApi().then(res => {
}); // if (res.menu && res.menu.button) {
// this.buttonList = res.menu.button
// this.buttonList[this.selectedIndex].sub_button.splice(this.selectedChildIndex, 1)
// this.selectedChildIndex = this.buttonList[this.selectedIndex].sub_button.length - 1
// this.selectedItem = this.selectedChildIndex > -1 ? this.buttonList[this.selectedIndex][this.selectedChildIndex] : this.buttonList[this.selectedIndex]
// }
// });
}); });
}, },
onAddMenu(){ onAddMenu(){
getPublicMenuApi().then(res=> { let item = {
if (res.menu && res.menu.button) {
this.buttonList = res.menu.button
this.selectedItem = {
name: '菜单名', name: '菜单名',
sub_button: [], sub_button: [],
type: 'view', type: 'view',
url: '' url: ''
} }
this.buttonList.push(this.selectedItem) this.buttonList.push(item)
this.selectedIndex = this.buttonList.length - 1 this.selectedIndex = this.buttonList.length - 1
this.selectedChildIndex = -1 this.selectedChildIndex = -1
} console.log('this.buttonList', this.buttonList)
}) console.log('this.buttonList selectedChildIndex', this.selectedChildIndex)
// getPublicMenuApi().then(res=> {
// if (res.menu && res.menu.button) {
// this.buttonList = res.menu.button
// this.selectedItem = {
// name: '菜单名',
// sub_button: [],
// type: 'view',
// url: ''
// }
// this.buttonList.push(this.selectedItem)
// this.selectedIndex = this.buttonList.length - 1
// this.selectedChildIndex = -1
// }
// })
}, },
delMenu(){ delMenu(){
this.$confirm('此操作将删除该菜单?', '提示', { this.$confirm('此操作将删除该菜单?', '提示', {
...@@ -234,18 +275,30 @@ ...@@ -234,18 +275,30 @@
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
getPublicMenuApi().then(res=> {
if (res.menu && res.menu.button) {
this.buttonList = res.menu.button
this.buttonList.splice(this.selectedIndex,1) this.buttonList.splice(this.selectedIndex,1)
this.selectedItem = this.buttonList.length > 0 ? this.buttonList[0] : { if (this.buttonList.length == 0 ){
this.buttonList.push({
name: '菜单名', name: '菜单名',
sub_button: [], sub_button: [],
type: 'view', type: 'view',
url: ''} url: ''
this.selectedChildIndex = -1
}
}) })
}
this.selectedIndex = this.buttonList.length -1;
this.selectedChildIndex = -1
// getPublicMenuApi().then(res=> {
// if (res.menu && res.menu.button) {
// this.buttonList = res.menu.button
// this.buttonList.splice(this.selectedIndex,1)
// this.selectedItem = this.buttonList.length > 0 ? this.buttonList[0] : {
// name: '菜单名',
// sub_button: [],
// type: 'view',
// url: ''}
// this.selectedChildIndex = -1
// }
// })
}); });
}, },
onTypeChange(val){ onTypeChange(val){
...@@ -253,15 +306,17 @@ ...@@ -253,15 +306,17 @@
}, },
onSave(){ onSave(){
let buttonList = this.buttonList let buttonList = this.buttonList
if (this.selectedIndex > -1 && this.selectedChildIndex > -1) { // if (this.selectedIndex > -1 && this.selectedChildIndex > -1) {
buttonList[this.selectedIndex].sub_button[this.selectedChildIndex] = this.selectedItem // buttonList[this.selectedIndex].sub_button[this.selectedChildIndex] = this.selectedItem
} // }
if (this.selectedIndex > -1 && this.selectedChildIndex === -1) { // if (this.selectedIndex > -1 && this.selectedChildIndex === -1) {
buttonList[this.selectedIndex] = this.selectedItem // buttonList[this.selectedIndex] = this.selectedItem
} // }
let json = { let json = {
buttons: JSON.stringify(buttonList) buttons: JSON.stringify(buttonList)
} }
console.log('json', buttonList)
return
savePublicMenuApi(json).then(res=>{ savePublicMenuApi(json).then(res=>{
if (res.errcode === 0){ if (res.errcode === 0){
this.$message({ this.$message({
......
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