Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
A
admin-base
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
new-sing
admin-base
Commits
6fc8d04c
Commit
6fc8d04c
authored
Sep 18, 2018
by
王
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
关键词回复
parent
01c6f046
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
133 additions
and
65 deletions
+133
-65
autoReply.vue
src/components/weChat/autoReply.vue
+6
-3
autoReplyDialog.vue
src/components/weChat/autoReplyDialog.vue
+127
-62
No files found.
src/components/weChat/autoReply.vue
View file @
6fc8d04c
...
@@ -13,9 +13,9 @@
...
@@ -13,9 +13,9 @@
<el-form
label-position=
"top"
class=
"demo-table-expand"
>
<el-form
label-position=
"top"
class=
"demo-table-expand"
>
<el-form-item
label=
"回复内容"
>
<el-form-item
label=
"回复内容"
>
<div
v-for=
"(item, index) in JSON.parse(props.row.desc)"
>
<div
v-for=
"(item, index) in JSON.parse(props.row.desc)"
>
<span>
内容
:
{{
item
.
content
}}
</span>
<span
v-if=
"item.content && item.type==='text'"
>
回复
{{
index
+
1
}}
:
{{
item
.
content
}}
</span>
<span
v-if=
"item.
teacher_id"
>
老师ID:
{{
item
.
teacher_id
}}
</span>
<span
v-if=
"item.
content && item.type==='image'"
>
回复
{{
index
+
1
}}
:
<img
class=
"img"
:src=
"item.content"
/>
</span>
<span
v-if=
"item.
start_at"
>
开课时间:
{{
item
.
start_at
}}
</span>
<span
v-if=
"item.
variable"
>
回复
{{
index
+
1
}}
:老师二维码
</span>
</div>
</div>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
...
@@ -126,4 +126,7 @@
...
@@ -126,4 +126,7 @@
.add-btn {
.add-btn {
margin: 10px 0;
margin: 10px 0;
}
}
.img {
width: 10%;
}
</
style
>
</
style
>
src/components/weChat/autoReplyDialog.vue
View file @
6fc8d04c
...
@@ -22,8 +22,9 @@
...
@@ -22,8 +22,9 @@
<template
v-if=
"form.desc"
>
<template
v-if=
"form.desc"
>
<div
v-for=
"(item, index) in JSON.parse(form.desc)"
class=
"msg-item"
>
<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>
<span
class=
"msg-text"
v-if=
"item.type==='text'"
>
{{
item
.
content
}}
</span>
<img
v-else-if=
"item.type==='image'"
:src=
"item.content"
/>
<img
v-else-if=
"item.type==='image' && item.content"
:src=
"item.content"
/>
<i
v-if=
"item.type === 'text'"
class=
"el-icon-edit"
@
click=
"onEditText(item, index)"
></i>
<span
v-else-if=
"item.variable"
class=
"msg-text"
>
我的老师二维码
</span>
<i
class=
"el-icon-edit"
@
click=
"onEditText(item, index)"
></i>
<i
class=
"el-icon-delete"
@
click=
"onDelText(item, index)"
></i>
<i
class=
"el-icon-delete"
@
click=
"onDelText(item, index)"
></i>
</div>
</div>
</
template
>
</
template
>
...
@@ -51,27 +52,7 @@
...
@@ -51,27 +52,7 @@
<!--<!–<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_audio" @click="getMediaList('voice')">语音</li>–>-->
<!--<!–<li class="weui-desktop-msg-sender__tab weui-desktop-msg-sender__tab_video" @click="getMediaList('video')">视频</li>–>-->
<!--<!–<li class="weui-desktop-msg-sender__tab weui-desktop-msg-sender__tab_video" @click="getMediaList('video')">视频</li>–>-->
<!--</ul>-->
<!--</ul>-->
<div
v-if=
"showType"
class=
"more-info"
>
<div
v-if=
"showType"
class=
"more-info clear-both"
>
<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=
"上课时间"
>
<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>
<
template
v-if=
"type=== 'text'"
>
<
template
v-if=
"type=== 'text'"
>
<el-input
<el-input
type=
"textarea"
type=
"textarea"
...
@@ -79,13 +60,37 @@
...
@@ -79,13 +60,37 @@
placeholder="请输入内容"
placeholder="请输入内容"
v-model="content">
v-model="content">
</el-input>
</el-input>
<div
style=
"float: right"
>
<el-popover
placement=
"bottom-end"
width=
"400"
:offset=
"10"
trigger=
"hover"
v-model=
"showEmotion"
>
<div>
<emotion
@
emotion=
"handleEmotion"
:height=
"200"
></emotion>
</div>
<el-button
@
click=
"showEmotion = !showEmotion"
slot=
"reference"
type=
"text"
>
<span
class=
"icon_emotion emotion_switch"
></span>
</el-button>
</el-popover>
<el-button
@
click=
"addTeacherName"
type=
"warning"
plain
>
添加老师名字
</el-button>
<el-button
@
click=
"addTeacherAlias"
type=
"success"
plain
>
添加老师别名
</el-button>
</div>
</
template
>
</
template
>
<
template
v-if=
"type==='image'"
>
<
template
v-if=
"type==='image'"
>
<div
style=
"margin-bottom: 25px;color: 888;"
v-if=
"!imageContent.url"
@
click=
"getMediaList('image')"
>
+从素材库中选择
</div>
<div
v-if=
"imageContent.url"
class=
"img"
>
<div
v-if=
"imageContent.url"
class=
"img"
>
<img
:src=
"imageContent.url"
/>
<img
:src=
"imageContent.url"
/>
<i
class=
"el-icon-delete"
@
click=
"imageContent=
{url:'',media_id:''}">
</i>
<i
class=
"el-icon-delete"
@
click=
"imageContent=
{url:'',media_id:''}">
</i>
</div>
</div>
<div
v-if=
"imageContent.variable"
class=
"img my-teacher"
>
<div>
老师二维码
</div>
<i
class=
"el-icon-delete"
@
click=
"imageContent=
{url:'',media_id:'',variable:''}">
</i>
</div>
<div
class=
"display-b"
>
<div
class=
"choose_item"
style=
"color: #888;"
@
click=
"getMediaList('image')"
>
+从素材库中选择
</div>
<div
class=
"choose_item"
style=
"color: #888;"
@
click=
"addTeacherQrcode"
>
+添加老师二维码
</div>
</div>
<div
v-if=
"showMedia && mediaList.length > 0"
>
<div
v-if=
"showMedia && mediaList.length > 0"
>
<el-table
<el-table
:data=
"mediaList"
:data=
"mediaList"
...
@@ -136,6 +141,7 @@
...
@@ -136,6 +141,7 @@
<
script
>
<
script
>
import
{
updateConfigApi
,
saveConfigApi
,
getMediaListApi
,
getTeacherListApi
}
from
"../../service/api"
;
import
{
updateConfigApi
,
saveConfigApi
,
getMediaListApi
,
getTeacherListApi
}
from
"../../service/api"
;
import
page
from
'../framework/page'
import
page
from
'../framework/page'
import
emotion
from
'../framework/Emotion/index'
export
default
{
export
default
{
name
:
"dialogObj"
,
name
:
"dialogObj"
,
props
:[
props
:[
...
@@ -143,8 +149,10 @@
...
@@ -143,8 +149,10 @@
],
],
data
(){
data
(){
return
{
return
{
editIndex
:
-
1
,
title
:
''
,
title
:
''
,
show
:
false
,
show
:
false
,
showEmotion
:
false
,
id
:
''
,
id
:
''
,
loading
:
true
,
loading
:
true
,
showType
:
false
,
showType
:
false
,
...
@@ -188,7 +196,8 @@
...
@@ -188,7 +196,8 @@
}
}
},
},
components
:{
components
:{
page
page
,
emotion
},
},
methods
:{
methods
:{
getTeacher
(){
getTeacher
(){
...
@@ -198,7 +207,6 @@
...
@@ -198,7 +207,6 @@
},
},
save
(){
save
(){
let
json
=
{}
let
json
=
{}
console
.
log
(
'this.form'
,
this
.
form
)
if
(
this
.
dialogObj
.
id
){
if
(
this
.
dialogObj
.
id
){
this
.
$refs
[
'form'
].
validate
((
valid
)
=>
{
this
.
$refs
[
'form'
].
validate
((
valid
)
=>
{
if
(
valid
){
if
(
valid
){
...
@@ -228,26 +236,26 @@
...
@@ -228,26 +236,26 @@
});
});
}
}
},
},
addContent
(
type
,
content
,
mediaId
)
{
addContent
(
type
,
content
,
mediaId
,
my_teacher
)
{
let
_form
=
this
.
form
;
let
_form
=
this
.
form
;
let
_desc
=
_form
.
desc
?
JSON
.
parse
(
_form
.
desc
)
:
[];
let
_desc
=
_form
.
desc
?
JSON
.
parse
(
_form
.
desc
)
:
[];
let
obj
=
{};
let
obj
=
{
if
(
content
)
{
type
:
type
obj
=
{
type
:
type
,
content
:
content
};
};
if
(
content
)
{
obj
.
content
=
content
}
}
if
(
mediaId
)
{
if
(
mediaId
)
{
obj
.
media_id
=
mediaId
;
obj
.
media_id
=
mediaId
;
}
}
if
(
this
.
teacher_id
)
{
if
(
my_teacher
)
{
obj
.
teacher_id
=
this
.
teacher_id
obj
.
variable
=
my_teacher
}
if
(
this
.
start_at
)
{
obj
.
start_at
=
this
.
start_at
}
}
if
(
this
.
editIndex
>
-
1
)
{
_desc
.
splice
(
this
.
editIndex
,
1
,
obj
);
}
else
{
_desc
.
push
(
obj
);
_desc
.
push
(
obj
);
}
_form
.
desc
=
JSON
.
stringify
(
_desc
);
_form
.
desc
=
JSON
.
stringify
(
_desc
);
this
.
form
=
_form
;
this
.
form
=
_form
;
this
.
showType
=
false
;
this
.
showType
=
false
;
...
@@ -270,17 +278,39 @@
...
@@ -270,17 +278,39 @@
this
.
type
=
type
;
this
.
type
=
type
;
},
},
onAddContent
(){
onAddContent
(){
console
.
log
(
'onAddContent'
)
this
.
editIndex
=
-
1
;
this
.
title
=
'添加回复'
;
this
.
title
=
'添加回复'
;
this
.
content
=
''
;
this
.
content
=
''
;
this
.
imageContent
=
{
this
.
imageContent
=
{
url
:
''
,
url
:
''
,
media_id
:
''
media_id
:
''
,
variable
:
''
};
};
this
.
teacher_id
=
''
;
this
.
teacher_id
=
''
;
this
.
start_at
=
''
;
this
.
start_at
=
''
;
this
.
showType
=
true
;
this
.
showType
=
true
;
},
},
onEditText
(
item
,
index
)
{
this
.
title
=
'编辑回复'
;
this
.
type
=
item
.
type
;
this
.
editIndex
=
index
;
if
(
this
.
type
===
'text'
)
{
this
.
content
=
item
.
content
;
}
else
{
if
(
item
.
content
)
{
this
.
imageContent
=
{
url
:
item
.
content
,
media_id
:
item
.
media_id
};
}
if
(
item
.
variable
)
{
this
.
imageContent
=
{
variable
:
item
.
variable
};
}
}
this
.
showType
=
true
;
},
close
(){
close
(){
this
.
content
=
''
;
this
.
content
=
''
;
this
.
imageContent
=
{
this
.
imageContent
=
{
...
@@ -299,16 +329,19 @@
...
@@ -299,16 +329,19 @@
message
:
'请输入文本内容'
message
:
'请输入文本内容'
});
});
}
else
{
}
else
{
this
.
addContent
(
'text'
,
this
.
content
,
''
);
this
.
addContent
(
'text'
,
this
.
content
,
''
,
''
);
}
}
}
else
if
(
this
.
type
===
'image'
)
{
}
else
if
(
this
.
type
===
'image'
)
{
if
(
!
this
.
imageContent
.
url
)
{
if
(
!
this
.
imageContent
.
url
&&
!
this
.
imageContent
.
variable
)
{
this
.
$message
({
this
.
$message
({
showClose
:
true
,
showClose
:
true
,
message
:
'请选择图片'
message
:
'请选择图片'
});
});
}
else
{
}
else
{
this
.
addContent
(
this
.
type
,
this
.
imageContent
.
url
,
this
.
imageContent
.
media_id
);
let
_myTeacher
=
this
.
imageContent
.
variable
?
this
.
imageContent
.
variable
:
''
;
let
_url
=
this
.
imageContent
.
url
?
this
.
imageContent
.
url
:
''
;
let
_mediaId
=
this
.
imageContent
.
media_id
?
this
.
imageContent
.
media_id
:
''
;
this
.
addContent
(
this
.
type
,
_url
,
_mediaId
,
_myTeacher
);
}
}
}
}
},
},
...
@@ -318,7 +351,6 @@
...
@@ -318,7 +351,6 @@
page
:
this
.
nowPage
,
page
:
this
.
nowPage
,
limit
:
this
.
limit
limit
:
this
.
limit
};
};
// this.showType = false;
this
.
loading
=
true
;
this
.
loading
=
true
;
this
.
showMedia
=
true
;
this
.
showMedia
=
true
;
getMediaListApi
(
json
).
then
(
res
=>
{
getMediaListApi
(
json
).
then
(
res
=>
{
...
@@ -341,24 +373,8 @@
...
@@ -341,24 +373,8 @@
confirmButtonText
:
'确定'
,
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
cancelButtonText
:
'取消'
}).
then
(({
value
})
=>
{
}).
then
(({
value
})
=>
{
this
.
addContent
(
'text'
,
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
=
newDesc
[
index
]
_desc
.
type
=
'text'
;
_desc
.
content
=
value
;
newDesc
.
splice
(
index
,
1
,
_desc
);
_form
.
desc
=
JSON
.
stringify
(
newDesc
);
})
})
this
.
form
=
_form
;
},
},
onDelText
(
item
,
index
)
{
onDelText
(
item
,
index
)
{
let
_form
=
this
.
form
;
let
_form
=
this
.
form
;
...
@@ -383,11 +399,25 @@
...
@@ -383,11 +399,25 @@
this
.
form
=
_form
;
this
.
form
=
_form
;
},
},
onChooseMedia
(
val
){
onChooseMedia
(
val
){
// this.addContent(this.type, val.url, val.media_id);
this
.
imageContent
=
val
this
.
imageContent
=
val
this
.
showMedia
=
false
;
this
.
showMedia
=
false
;
},
addTeacherQrcode
(){
this
.
showMedia
=
false
;
this
.
imageContent
=
{
variable
:
'my_teacher'
}
}
},
},
handleEmotion
(
i
)
{
this
.
content
+=
i
},
addTeacherName
(){
this
.
content
+=
'{my_teacher_name}'
},
addTeacherAlias
(){
this
.
content
+=
'{my_teacher_alias}'
},
},
watch
:{
watch
:{
dialogObj
:{
dialogObj
:{
handler
:
function
()
{
handler
:
function
()
{
...
@@ -406,6 +436,17 @@
...
@@ -406,6 +436,17 @@
<
style
scoped
lang=
"less"
>
<
style
scoped
lang=
"less"
>
@import "../../util/public";
@import "../../util/public";
.emotion_switch {
float: left;
height: 28px;
line-height: 999em;
overflow: hidden;
background: transparent url(https://res.wx.qq.com/mpres/en_US/htmledition/pages/modules/reply/images/icon_emotion_switch.png) no-repeat 0 0;
width: 20px;
height: 20px;
vertical-align: middle;
display: inline-block;
}
.msg-item {
.msg-item {
margin-bottom: 10px;
margin-bottom: 10px;
img {
img {
...
@@ -499,6 +540,30 @@
...
@@ -499,6 +540,30 @@
display: block;
display: block;
}
}
.tool_bar {
.tool_bar {
float: right;
margin-top: 20px;
margin-top: 20px;
}
}
.choose_item {
margin-bottom: 25px;
color: rgb(136, 136, 136);
height: 80px;
line-height: 80px;
width: 45%;
border: 1px dashed;
text-align: center;
}
.display-b {
display: flex;
flex-flow: row nowrap;
justify-content: space-between;
align-items: center;
}
.my-teacher {
width: 25%;
height: 80px;
background-color: #eee;
line-height: 80px;
text-align: center;
margin-bottom: 10px;
}
</
style
>
</
style
>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment