Commit d33e62c0 authored by 王's avatar

自动回复

parent 3a8c0e47
...@@ -10,12 +10,13 @@ ...@@ -10,12 +10,13 @@
style="width: 100%"> style="width: 100%">
<el-table-column type="expand"> <el-table-column type="expand">
<template slot-scope="props"> <template slot-scope="props">
<el-form label-position="left" class="demo-table-expand"> <el-form label-position="top" class="demo-table-expand">
<el-form-item label="关键词">
<span>{{ props.row.value }}</span>
</el-form-item>
<el-form-item label="回复内容"> <el-form-item label="回复内容">
<div v-for="(item, index) in JSON.parse(props.row.desc)">{{ item.content }}</div> <div v-for="(item, index) in JSON.parse(props.row.desc)">
<span>内容:{{ item.content }}</span>
<span v-if="item.teacher_id"> 老师ID:{{item.teacher_id}}</span>
<span v-if="item.start_at"> 开课时间:{{item.start_at}}</span>
</div>
</el-form-item> </el-form-item>
</el-form> </el-form>
</template> </template>
......
This diff is collapsed.
...@@ -5,6 +5,30 @@ ...@@ -5,6 +5,30 @@
:visible.sync="dialogObj.show" :visible.sync="dialogObj.show"
width="800px"> width="800px">
<div class="focus-reply"> <div class="focus-reply">
<div class="header">
<el-form label-width="120px" inline>
<el-form-item label="老师">
<el-select v-model="teacher_id" placeholder="请选择" clearable>
<el-option
v-for="(data,index) in teacherList"
:key="index"
:label="data.name"
:value="data.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="上课时间" prop="start_at">
<el-date-picker
v-model="start_at"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
type="date"
:picker-options="pickerOptions1"
placeholder="选择日期">
</el-date-picker>
</el-form-item>
</el-form>
</div>
<div class="content"> <div class="content">
<div class="inner" v-loading="loading"> <div class="inner" v-loading="loading">
<ul class="weui-desktop-msg-sender__tabs"> <ul class="weui-desktop-msg-sender__tabs">
...@@ -39,7 +63,7 @@ ...@@ -39,7 +63,7 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<page :total="total" v-model="nowPage"/> <page :total="total" v-model="nowPage" :limit="limit" @pageChange="onPageChange"/>
</div> </div>
</div> </div>
<div class="inner-emotion_editor" v-else-if="type === 'text'"> <div class="inner-emotion_editor" v-else-if="type === 'text'">
...@@ -67,7 +91,7 @@ ...@@ -67,7 +91,7 @@
</template> </template>
<script> <script>
import {updateConfigApi,saveConfigApi,getMediaListApi,getConfigListApi} from "../../service/api"; import {updateConfigApi,saveConfigApi,getMediaListApi,getConfigListApi,getTeacherListApi} from "../../service/api";
import page from '../framework/page' import page from '../framework/page'
export default { export default {
name: "focusReplyDialog", name: "focusReplyDialog",
...@@ -80,6 +104,7 @@ ...@@ -80,6 +104,7 @@
loading:false, loading:false,
total:0, total:0,
nowPage:1, nowPage:1,
limit: 5,
id: null, id: null,
list: [], list: [],
index: -1, index: -1,
...@@ -92,21 +117,16 @@ ...@@ -92,21 +117,16 @@
imageContent: '', imageContent: '',
type: 'text', type: 'text',
mediaList: [], mediaList: [],
mediaListMock: [ 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, showMedia: false,
teacher_id: '',
teacherList: [],
start_at: '',
pickerOptions1: {
disabledDate(time) {
return !(time.getTime() > Date.now());
}
},
rules:{ rules:{
value:[ value:[
{ required: true, message: '请输入规则名称', trigger: 'change' } { required: true, message: '请输入规则名称', trigger: 'change' }
...@@ -124,11 +144,17 @@ ...@@ -124,11 +144,17 @@
page page
}, },
mounted(){ mounted(){
this.initDialog() this.initDialog();
this.getTeacher();
}, },
filters: { filters: {
}, },
methods:{ methods:{
getTeacher(){
getTeacherListApi({page: 1, limit: 1000}).then(res=>{
this.teacherList = res.list
})
},
initDialog(){ initDialog(){
if (this.dialogObj.id) { if (this.dialogObj.id) {
this.id = this.dialogObj.id; this.id = this.dialogObj.id;
...@@ -142,6 +168,8 @@ ...@@ -142,6 +168,8 @@
this.content = '' this.content = ''
} else { } else {
this.type = this.list[this.index].type; this.type = this.list[this.index].type;
this.teacher_id = this.list[this.index].teacher_id ? this.list[this.index].teacher_id : '';
this.start_at = this.list[this.index].start_at ? this.list[this.index].start_at : '';
if (this.type === 'text') { if (this.type === 'text') {
this.content = this.list[this.index].content this.content = this.list[this.index].content
} else if (this.type === 'image') { } else if (this.type === 'image') {
...@@ -172,6 +200,12 @@ ...@@ -172,6 +200,12 @@
type : this.type, type : this.type,
content: this.content content: this.content
}; };
if (this.teacher_id) {
obj.teacher_id = this.teacher_id
}
if (this.start_at) {
obj.start_at = this.start_at
}
if (this.index > -1) { if (this.index > -1) {
_desc[this.index] = obj _desc[this.index] = obj
} else { } else {
...@@ -185,6 +219,12 @@ ...@@ -185,6 +219,12 @@
}); });
return return
} }
if (this.teacher_id) {
this.imageContent.teacher_id = this.teacher_id
}
if (this.start_at) {
this.imageContent.start_at = this.start_at
}
if (this.index > -1) { if (this.index > -1) {
_desc[this.index] = this.imageContent _desc[this.index] = this.imageContent
} else { } else {
...@@ -213,10 +253,15 @@ ...@@ -213,10 +253,15 @@
}) })
} }
}, },
onPageChange(val){
this.nowPage = val
this.getMediaList(this.type)
},
getMediaList(type){ getMediaList(type){
let json = { let json = {
type: type, type: type,
page: this.nowPage page: this.nowPage,
limit: this.limit
}; };
this.loading = true; this.loading = true;
getMediaListApi(json).then(res=>{ getMediaListApi(json).then(res=>{
...@@ -254,26 +299,7 @@ ...@@ -254,26 +299,7 @@
obj.media_id = mediaId; obj.media_id = mediaId;
} }
this.imageContent = obj this.imageContent = obj
}, }
getList(){
getConfigListApi({key: this.form.key}).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
}
}
}
})
},
} }
} }
</script> </script>
......
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