Commit 1b48b4d4 authored by wangwei's avatar wangwei

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

parents 72653d0e ea923599
......@@ -211,13 +211,6 @@
});
return
}
if (!json.item_category_ids) {
this.$message({
type: 'error',
message: '请选择盒子!'
});
return
}
switch(this.dialogObj.type){
case 1:
// this.$refs['form'].validate((valid) => {
......
......@@ -55,7 +55,7 @@
</el-option>
</el-select>
</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-option
v-for="item in options"
......@@ -181,7 +181,7 @@
title: this.form.title,
start_num: this.form.start_num,
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(',')
}
if (this.form.id) {
......
......@@ -98,20 +98,7 @@
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"
// }
],
mediaList: [],
showMedia: false,
rules:{
value:[
......
<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 class="clear-both top">
<span class="title">自动回复</span>
<el-button type="success" plain style="float: right" @click="add">添加回复</el-button>
</div>
<div v-if="showMedia && mediaList.length > 0">
<el-table
:data="mediaList"
@row-click="onChooseMedia"
style="width: 100%">
:data="list"
style="width: 100%"
max-height="800">
<el-table-column
prop="name"
label="名称">
fixed
label="类型"
width="150">
<template slot-scope="scope">
{{type | typeFilter}}
</template>
</el-table-column>
<el-table-column
prop="media_id"
label="mediaId">
label="内容">
<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
label="URL">
fixed="right"
label="操作"
width="200">
<template slot-scope="scope">
<a :href="scope.row.url">
<img style="width: 60px;" :src="scope.row.url"/>
</a>
<el-button
@click.native.prevent="editRow(scope.$index, list)"
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>
</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>
<dialog-com v-if="dialogObj.show" :dialogObj="dialogObj" @changeShow="changeShow" @reflash="getList"/>
</div>
</template>
<script>
import dialogCom from './focusReplyDialog'
import {updateConfigApi,saveConfigApi,getMediaListApi,getConfigListApi} from "../../service/api";
import page from '../framework/page'
export default {
......@@ -71,6 +77,7 @@
total:0,
nowPage:1,
id: null,
list: [],
form:{
key:'focus_reply',
value:'focus_reply',
......@@ -105,15 +112,42 @@
qr:[
{ required: true, message: '请输入二维码', trigger: 'change' }
]
},
dialogObj:{
show:false,
id:'',
index: -1,
list: []
}
}
},
components:{
page
page,
dialogCom
},
mounted(){
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:{
save(){
let json = this.form
......@@ -147,8 +181,6 @@
type: 'success',
message: '修改成功!'
});
this.$emit("reflash");
this.show = false;
})
} else {
saveConfigApi(json).then(res=>{
......@@ -206,6 +238,7 @@
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
......@@ -216,15 +249,79 @@
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>
<style scoped>
<style scoped lang="less">
.focus-reply {
padding: 30px;
}
......@@ -238,6 +335,9 @@
font-weight: 400;
line-height: 1;
}
.top {
margin-bottom: 30px;
}
.content {
padding-top: 40px;
margin-top: 24px;
......@@ -354,4 +454,14 @@
.inner-emotion_editor {
margin: 2%;
}
.shotcut {
width: 50px;
}
.clear-both{
&:after{
content: '';
display: block;
clear: both;
}
}
</style>
This diff is collapsed.
This diff is collapsed.
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