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
b037b4a5
Commit
b037b4a5
authored
Sep 29, 2018
by
王
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
公众号菜单
parent
ae08ff81
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
181 additions
and
75 deletions
+181
-75
index.vue
src/components/weChat/index.vue
+181
-75
No files found.
src/components/weChat/index.vue
View file @
b037b4a5
...
...
@@ -112,16 +112,16 @@
<div
class=
"frm_controls frm_vertical_pt"
>
<
template
v-if=
"selectedChildIndex === -1"
>
<el-radio-group
v-model=
"buttonList[selectedIndex].type"
@
change=
"onTypeChange"
>
<el-radio
label=
"
media_id
"
>
发送消息
</el-radio>
<el-radio
label=
"
click
"
>
发送消息
</el-radio>
<el-radio
label=
"view"
>
跳转网页
</el-radio>
<el-radio
label=
"
click"
>
关键字
</el-radio>
<el-radio
label=
"
miniprogram"
>
跳转小程序
</el-radio>
</el-radio-group>
</
template
>
<
template
v-else
>
<el-radio-group
v-model=
"buttonList[selectedIndex].sub_button[selectedChildIndex].type"
@
change=
"onTypeChange"
>
<el-radio
label=
"
media_id
"
>
发送消息
</el-radio>
<el-radio
label=
"
click
"
>
发送消息
</el-radio>
<el-radio
label=
"view"
>
跳转网页
</el-radio>
<el-radio
label=
"
click"
>
关键字
</el-radio>
<el-radio
label=
"
miniprogram"
>
跳转小程序
</el-radio>
</el-radio-group>
</
template
>
</div>
...
...
@@ -139,7 +139,7 @@
</div>
</div>
</div>
<div
v-else-if=
"buttonList[selectedIndex].type === '
media_id
'"
style=
"display: block;"
>
<div
v-else-if=
"buttonList[selectedIndex].type === '
click
'"
style=
"display: block;"
>
<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_appmsg"
:class=
"buttonList[selectedIndex].media_info && buttonList[selectedIndex].media_info.type === 'news' ? 'weui-desktop-msg-sender__tab_selected' : ''"
@
click=
"onClickSendMsg('news')"
>
图文
</li>
...
...
@@ -154,7 +154,7 @@
<el-input
type=
"textarea"
:autosize=
"
{ minRows: 4, maxRows: 8}"
v-model="content"
v-model="
buttonList[selectedIndex].media_info.
content"
placeholder="请输入内容">
</el-input>
</div>
...
...
@@ -175,8 +175,8 @@
</div>
</div>
<div
class=
"img-action"
v-if=
"buttonList[selectedIndex].media_info && buttonList[selectedIndex].media_info.type === 'image'"
>
<template
v-if=
"selectedIndex > -1 && buttonList[selectedIndex].media_info && buttonList[selectedIndex].media_info.
url
"
>
<img
style=
"max-width: 30%"
:src=
"buttonList[selectedIndex].media_info.
url
"
/>
<template
v-if=
"selectedIndex > -1 && buttonList[selectedIndex].media_info && buttonList[selectedIndex].media_info.
content
"
>
<img
style=
"max-width: 30%"
:src=
"buttonList[selectedIndex].media_info.
content
"
/>
<i
class=
"el-icon-delete"
@
click=
"deleteMedia()"
style=
"display: inline-block"
></i>
</
template
>
<div
class=
"display-b"
v-else
>
...
...
@@ -209,10 +209,10 @@
</div>
</div>
<div
class=
"img-action"
v-if=
"buttonList[selectedIndex].media_info && buttonList[selectedIndex].media_info.type === 'news'"
>
<
template
v-if=
"buttonList[selectedIndex].media_info && buttonList[selectedIndex].media_info.news_item"
>
<div
class=
"news-media"
>
<div
v-for=
"(child, childIndex) in buttonList[selectedIndex].media_info.news_item"
style=
"position: relative"
>
<div
v-if=
"buttonList[selectedIndex].media_info.news_item.length === 1"
class=
"single-cover"
>
<
template
v-if=
"buttonList[selectedIndex].media_info && buttonList[selectedIndex].media_info.
content && buttonList[selectedIndex].media_info.content.
news_item"
>
<div
class=
"news-media"
v-if=
"buttonList[selectedIndex].media_info.content.news_item.length > 0"
>
<div
v-for=
"(child, childIndex) in buttonList[selectedIndex].media_info.
content.
news_item"
style=
"position: relative"
>
<div
v-if=
"buttonList[selectedIndex].media_info.
content.
news_item.length === 1"
class=
"single-cover"
>
<div
class=
"title"
>
{{
child
.
title
}}
</div>
<img
:src=
"child.thumb_url"
style=
"width: 100%;margin-top: 20px;"
/>
<div
class=
"digest"
>
{{
child
.
digest
}}
</div>
...
...
@@ -220,7 +220,7 @@
预览文章
</a>
</div>
<div
v-else-if=
"buttonList[selectedIndex].media_info.news_item.length > 1"
class=
"clear-both bottomCover"
style=
"position: relative"
>
<div
v-else-if=
"buttonList[selectedIndex].media_info.
content.
news_item.length > 1"
class=
"clear-both bottomCover"
style=
"position: relative"
>
<div
v-if=
"childIndex === 0"
class=
"muti-cover"
>
<img
style=
"width: 100%;margin-top: 20px;"
:src=
"child.thumb_url"
/>
<div
class=
"bottom-title"
>
{{
child
.
title
}}
</div>
...
...
@@ -283,7 +283,7 @@
</div>
</div>
<div
class=
"img-action"
v-if=
"buttonList[selectedIndex].media_info && buttonList[selectedIndex].media_info.type === 'voice'"
>
<
template
v-if=
"selectedIndex > -1 && buttonList[selectedIndex].media_info && buttonList[selectedIndex].media_info.
url
"
>
<
template
v-if=
"selectedIndex > -1 && buttonList[selectedIndex].media_info && buttonList[selectedIndex].media_info.
content
"
>
<i
class=
"el-icon-delete"
@
click=
"deleteMedia()"
style=
"display: inline-block"
></i>
</
template
>
<div
class=
"display-b"
v-else
>
...
...
@@ -313,8 +313,8 @@
</div>
</div>
<div
class=
"img-action"
style=
"text-align: left"
v-if=
"buttonList[selectedIndex].media_info && buttonList[selectedIndex].media_info.type === 'video'"
>
<
template
v-if=
"selectedIndex > -1 && buttonList[selectedIndex].media_info && buttonList[selectedIndex].media_info.down_url"
>
<a
:href=
"buttonList[selectedIndex].media_info.
down_url"
>
{{
buttonList
[
selectedIndex
].
media_info
.
title
}}
</a>
<
template
v-if=
"selectedIndex > -1 && buttonList[selectedIndex].media_info && buttonList[selectedIndex].media_info.
content && buttonList[selectedIndex].media_info.content.
down_url"
>
<a
:href=
"buttonList[selectedIndex].media_info.
content.down_url"
>
{{
buttonList
[
selectedIndex
].
media_info
.
content
.
title
}}
</a>
<i
class=
"el-icon-delete"
@
click=
"deleteMedia()"
style=
"display: inline-block"
></i>
</
template
>
<div
class=
"display-b"
v-else
>
...
...
@@ -351,12 +351,28 @@
</div>
</div>
<div
v-else
class=
"menu_content url jsMain"
style=
"display: block;"
>
<p
class=
"menu_content_tips tips_global"
>
click
</p>
<p
class=
"menu_content_tips tips_global"
>
小程序
</p>
<div
class=
"frm_control_group"
>
<label
for=
""
class=
"frm_label"
>
key
</label>
<label
for=
""
class=
"frm_label"
>
url
</label>
<div
class=
"frm_controls"
>
<span
class=
"frm_input_box"
>
<input
v-model=
"buttonList[selectedIndex].key"
type=
"text"
class=
"frm_input"
/>
<input
v-model=
"buttonList[selectedIndex].url"
type=
"text"
class=
"frm_input"
value=
"http://mp.weixin.qq.com"
/>
</span>
</div>
</div>
<div
class=
"frm_control_group"
>
<label
for=
""
class=
"frm_label"
>
appid
</label>
<div
class=
"frm_controls"
>
<span
class=
"frm_input_box"
>
<input
v-model=
"buttonList[selectedIndex].appid"
type=
"text"
class=
"frm_input"
/>
</span>
</div>
</div>
<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].pagepath"
type=
"text"
class=
"frm_input"
/>
</span>
</div>
</div>
...
...
@@ -374,7 +390,7 @@
</div>
</div>
</div>
<div
v-else-if=
"buttonList[selectedIndex].sub_button[selectedChildIndex].type === '
media_id
'"
style=
"display: block;"
>
<div
v-else-if=
"buttonList[selectedIndex].sub_button[selectedChildIndex].type === '
click
'"
style=
"display: block;"
>
<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_appmsg"
:class=
"buttonList[selectedIndex].sub_button[selectedChildIndex].media_info && buttonList[selectedIndex].sub_button[selectedChildIndex].media_info.type === 'news' ? 'weui-desktop-msg-sender__tab_selected' : ''"
@
click=
"onClickSubSendMsg('news')"
>
图文
</li>
...
...
@@ -389,7 +405,7 @@
<el-input
type=
"textarea"
:autosize=
"
{ minRows: 4, maxRows: 8}"
v-model="content"
v-model="
buttonList[selectedIndex].sub_button[selectedChildIndex].media_info.
content"
placeholder="请输入内容">
</el-input>
</div>
...
...
@@ -399,19 +415,19 @@
width=
"400"
:offset=
"10"
trigger=
"manual"
v-model=
"showEmotion"
>
v-model=
"show
Sub
Emotion"
>
<div>
<emotion
@
emotion=
"handleEmotion"
:height=
"200"
></emotion
>
<emotion
2
@
emotion=
"handleSubEmotion"
:height=
"200"
></emotion2
>
</div>
<el-button
@
click=
"show
Emotion = !show
Emotion"
slot=
"reference"
type=
"text"
>
<el-button
@
click=
"show
SubEmotion = !showSub
Emotion"
slot=
"reference"
type=
"text"
>
<span
class=
"icon_emotion emotion_switch"
></span>
</el-button>
</el-popover>
</div>
</div>
<div
class=
"img-action"
v-if=
"buttonList[selectedIndex].sub_button[selectedChildIndex].media_info && buttonList[selectedIndex].sub_button[selectedChildIndex].media_info.type === 'image'"
>
<template
v-if=
"selectedIndex && selectedChildIndex > -1 && buttonList[selectedIndex].sub_button[selectedChildIndex] && buttonList[selectedIndex].sub_button[selectedChildIndex].media_info && buttonList[selectedIndex].sub_button[selectedChildIndex].media_info.
url
"
>
<img
style=
"max-width: 30%"
:src=
"buttonList[selectedIndex].sub_button[selectedChildIndex].media_info.
url"
v-if=
"buttonList[selectedIndex].sub_button[selectedChildIndex].media_info.url
"
/>
<template
v-if=
"selectedIndex && selectedChildIndex > -1 && buttonList[selectedIndex].sub_button[selectedChildIndex] && buttonList[selectedIndex].sub_button[selectedChildIndex].media_info && buttonList[selectedIndex].sub_button[selectedChildIndex].media_info.
content
"
>
<img
style=
"max-width: 30%"
:src=
"buttonList[selectedIndex].sub_button[selectedChildIndex].media_info.
content"
v-if=
"buttonList[selectedIndex].sub_button[selectedChildIndex].media_info.content
"
/>
<i
class=
"el-icon-delete"
@
click=
"deleteSubMedia()"
style=
"display: inline-block"
></i>
</
template
>
<div
class=
"display-b"
v-else
>
...
...
@@ -444,10 +460,10 @@
</div>
</div>
<div
class=
"img-action"
v-if=
"buttonList[selectedIndex].sub_button[selectedChildIndex].media_info && buttonList[selectedIndex].sub_button[selectedChildIndex].media_info.type === 'news'"
>
<
template
v-if=
"buttonList[selectedIndex].sub_button[selectedChildIndex].media_info && buttonList[selectedIndex].sub_button[selectedChildIndex].media_info.
news_item
"
>
<
template
v-if=
"buttonList[selectedIndex].sub_button[selectedChildIndex].media_info && buttonList[selectedIndex].sub_button[selectedChildIndex].media_info.
content
"
>
<div
class=
"news-media"
>
<div
v-for=
"(child, childIndex) in buttonList[selectedIndex].sub_button[selectedChildIndex].media_info.news_item"
style=
"position: relative"
>
<div
v-if=
"buttonList[selectedIndex].sub_button[selectedChildIndex].media_info.news_item.length === 1"
class=
"single-cover"
>
<div
v-for=
"(child, childIndex) in buttonList[selectedIndex].sub_button[selectedChildIndex].media_info.
content.
news_item"
style=
"position: relative"
>
<div
v-if=
"buttonList[selectedIndex].sub_button[selectedChildIndex].media_info.
content.
news_item.length === 1"
class=
"single-cover"
>
<div
class=
"title"
>
{{
child
.
title
}}
</div>
<img
:src=
"child.thumb_url"
style=
"width: 100%;margin-top: 20px;"
/>
<div
class=
"digest"
>
{{
child
.
digest
}}
</div>
...
...
@@ -455,7 +471,7 @@
预览文章
</a>
</div>
<div
v-else-if=
"buttonList[selectedIndex].sub_button[selectedChildIndex].media_info.news_item.length > 1"
class=
"clear-both bottomCover"
style=
"position: relative"
>
<div
v-else-if=
"buttonList[selectedIndex].sub_button[selectedChildIndex].media_info.
content.
news_item.length > 1"
class=
"clear-both bottomCover"
style=
"position: relative"
>
<div
v-if=
"childIndex === 0"
class=
"muti-cover"
>
<img
style=
"width: 100%;margin-top: 20px;"
:src=
"child.thumb_url"
/>
<div
class=
"bottom-title"
>
{{
child
.
title
}}
</div>
...
...
@@ -518,8 +534,8 @@
</div>
</div>
<div
class=
"img-action"
v-if=
"buttonList[selectedIndex].sub_button[selectedChildIndex].media_info && buttonList[selectedIndex].sub_button[selectedChildIndex].media_info.type === 'voice'"
>
<
template
v-if=
"selectedIndex && selectedChildIndex > -1 && buttonList[selectedIndex].sub_button[selectedChildIndex] && buttonList[selectedIndex].sub_button[selectedChildIndex].media_info && buttonList[selectedIndex].sub_button[selectedChildIndex].media_info.
url
"
>
<a
:href=
"buttonList[selectedIndex].sub_button[selectedChildIndex].media_info.
url"
v-if=
"buttonList[selectedIndex].sub_button[selectedChildIndex].media_info.url
"
>
{{
buttonList
[
selectedIndex
].
sub_button
[
selectedChildIndex
].
media_info
.
title
}}
</a>
<
template
v-if=
"selectedIndex && selectedChildIndex > -1 && buttonList[selectedIndex].sub_button[selectedChildIndex] && buttonList[selectedIndex].sub_button[selectedChildIndex].media_info && buttonList[selectedIndex].sub_button[selectedChildIndex].media_info.
content
"
>
<a
:href=
"buttonList[selectedIndex].sub_button[selectedChildIndex].media_info.
content"
v-if=
"buttonList[selectedIndex].sub_button[selectedChildIndex].media_info.content
"
>
{{
buttonList
[
selectedIndex
].
sub_button
[
selectedChildIndex
].
media_info
.
title
}}
</a>
<i
class=
"el-icon-delete"
@
click=
"deleteSubMedia()"
style=
"display: inline-block"
></i>
</
template
>
<div
class=
"display-b"
v-else
>
...
...
@@ -552,8 +568,8 @@
</div>
</div>
<div
class=
"img-action"
style=
"text-align: left"
v-if=
"buttonList[selectedIndex].sub_button[selectedChildIndex].media_info && buttonList[selectedIndex].sub_button[selectedChildIndex].media_info.type === 'video'"
>
<
template
v-if=
"selectedIndex && selectedChildIndex > -1 && buttonList[selectedIndex].sub_button[selectedChildIndex] && buttonList[selectedIndex].sub_button[selectedChildIndex].media_info && buttonList[selectedIndex].sub_button[selectedChildIndex].media_info.down_url"
>
<a
:href=
"buttonList[selectedIndex].sub_button[selectedChildIndex].media_info.
url"
v-if=
"buttonList[selectedIndex].sub_button[selectedChildIndex].media_info.down_url"
>
{{
buttonList
[
selectedIndex
].
sub_button
[
selectedChildIndex
].
media_info
.
title
}}
</a>
<
template
v-if=
"selectedIndex && selectedChildIndex > -1 && buttonList[selectedIndex].sub_button[selectedChildIndex] && buttonList[selectedIndex].sub_button[selectedChildIndex].media_info && buttonList[selectedIndex].sub_button[selectedChildIndex].media_info.
content && buttonList[selectedIndex].sub_button[selectedChildIndex].media_info.content.
down_url"
>
<a
:href=
"buttonList[selectedIndex].sub_button[selectedChildIndex].media_info.
content.down_url"
v-if=
"buttonList[selectedIndex].sub_button[selectedChildIndex].media_info.content.down_url"
>
{{
buttonList
[
selectedIndex
].
sub_button
[
selectedChildIndex
].
media_info
.
content
.
title
}}
</a>
<i
class=
"el-icon-delete"
@
click=
"deleteSubMedia()"
style=
"display: inline-block"
></i>
</
template
>
<div
class=
"display-b"
v-else
>
...
...
@@ -590,12 +606,28 @@
</div>
</div>
<div
v-else
class=
"menu_content url jsMain"
style=
"display: block;"
>
<p
class=
"menu_content_tips tips_global"
>
click
</p>
<p
class=
"menu_content_tips tips_global"
>
小程序
</p>
<div
class=
"frm_control_group"
>
<label
for=
""
class=
"frm_label"
>
url
</label>
<div
class=
"frm_controls"
>
<span
class=
"frm_input_box"
>
<input
v-model=
"buttonList[selectedIndex].sub_button[selectedChildIndex].url"
type=
"text"
class=
"frm_input"
value=
"http://mp.weixin.qq.com"
/>
</span>
</div>
</div>
<div
class=
"frm_control_group"
>
<label
for=
""
class=
"frm_label"
>
key
</label>
<label
for=
""
class=
"frm_label"
>
appid
</label>
<div
class=
"frm_controls"
>
<span
class=
"frm_input_box"
>
<input
v-model=
"buttonList[selectedIndex].sub_button[selectedChildIndex].key"
type=
"text"
class=
"frm_input"
/>
<input
v-model=
"buttonList[selectedIndex].sub_button[selectedChildIndex].appid"
type=
"text"
class=
"frm_input"
/>
</span>
</div>
</div>
<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].pagepath"
type=
"text"
class=
"frm_input"
/>
</span>
</div>
</div>
...
...
@@ -627,19 +659,21 @@
</template>
<
script
>
import
{
getPublicMenuApi
,
savePublicMenuApi
,
getMediaListApi
,
get
Media
Api
}
from
"../../service/api"
;
import
{
getPublicMenuApi
,
savePublicMenuApi
,
getMediaListApi
,
get
ConfigListApi
,
saveConfigApi
,
updateConfig
Api
}
from
"../../service/api"
;
import
draggable
from
'vuedraggable'
import
{
MessageBox
}
from
'element-ui'
;
import
page
from
'../framework/page'
import
page2
from
'../framework/page'
import
emotion
from
'../framework/Emotion/index'
import
emotion2
from
'../framework/Emotion/index'
export
default
{
name
:
"index"
,
components
:
{
draggable
,
page
,
page2
,
emotion
emotion
,
emotion2
},
data
(){
return
{
...
...
@@ -660,13 +694,29 @@
showMedia
:
false
,
mediaList
:
[],
showEmotion
:
false
,
content
:
''
showSubEmotion
:
false
,
content
:
''
,
keywordsList
:
[],
keywordsMap
:
new
Map
()
}
},
mounted
(){
this
.
get
Menu
();
this
.
get
ConfigList
();
},
methods
:{
getConfigList
(){
getConfigListApi
({
key
:
'menu_keywords'
}).
then
(
res
=>
{
this
.
keywordsList
=
res
.
list
;
res
.
list
.
forEach
((
i
)
=>
{
let
obj
=
{
id
:
i
.
id
,
desc
:
i
.
desc
?
JSON
.
parse
(
i
.
desc
)[
0
]
:
[]
}
this
.
keywordsMap
.
set
(
i
.
value
,
obj
);
})
this
.
getMenu
();
})
},
getName
(){
if
(
this
.
selectedChildIndex
===
-
1
){
return
this
.
buttonList
[
this
.
selectedIndex
].
name
||
''
...
...
@@ -681,7 +731,7 @@
this
.
selectedIndex
=
0
this
.
selectedChildIndex
=
-
1
this
.
showOrder
=
false
;
//
this.searchMenu();
this
.
searchMenu
();
}
})
...
...
@@ -689,8 +739,10 @@
searchMenu
(){
let
list
=
this
.
buttonList
;
for
(
let
i
=
0
;
i
<
list
.
length
;
i
++
)
{
if
(
list
[
i
].
media_id
){
this
.
getMediaApi
(
i
,
-
1
,
list
[
i
].
media_id
);
if
(
list
[
i
].
key
){
if
(
this
.
keywordsMap
.
has
(
list
[
i
].
key
)){
this
.
buttonList
[
i
].
media_info
=
this
.
keywordsMap
.
get
(
list
[
i
].
key
).
desc
}
}
else
if
(
list
[
i
].
sub_button
&&
list
[
i
].
sub_button
.
length
>
0
){
this
.
searchSubMenu
(
i
);
}
...
...
@@ -699,25 +751,10 @@
searchSubMenu
(
i
){
let
list
=
this
.
buttonList
[
i
].
sub_button
;
for
(
let
j
=
0
;
j
<
list
.
length
;
j
++
)
{
if
(
list
[
j
].
media_id
){
this
.
getMediaApi
(
i
,
j
,
list
[
j
].
media_id
);
}
}
},
getMediaApi
(
index1
,
index2
,
id
){
getMediaApi
(
id
).
then
((
res
)
=>
{
if
(
res
&&
res
.
news_item
&&
res
.
news_item
.
length
>
0
)
{
let
media_info
=
{};
media_info
.
news_item
=
res
.
news_item
media_info
.
type
=
'news'
if
(
index2
>
-
1
)
{
this
.
buttonList
[
index1
].
sub_button
[
index2
].
media_info
=
media_info
}
else
{
this
.
buttonList
[
index1
].
media_info
=
media_info
if
(
list
[
j
].
key
&&
this
.
keywordsMap
.
has
(
list
[
j
].
key
)){
this
.
buttonList
[
i
].
sub_button
[
j
].
media_info
=
this
.
keywordsMap
.
get
(
list
[
j
].
key
).
desc
}
}
})
},
clickMenu
(
index
,
item
){
this
.
selectedIndex
=
index
...
...
@@ -743,6 +780,15 @@
type
:
'view'
,
url
:
''
}
if
(
this
.
buttonList
[
this
.
selectedIndex
].
key
){
delete
this
.
buttonList
[
this
.
selectedIndex
].
key
}
if
(
this
.
buttonList
[
this
.
selectedIndex
].
media_info
){
delete
this
.
buttonList
[
this
.
selectedIndex
].
media_info
}
if
(
this
.
buttonList
[
this
.
selectedIndex
].
type
){
delete
this
.
buttonList
[
this
.
selectedIndex
].
type
}
this
.
buttonList
[
this
.
selectedIndex
].
sub_button
.
push
(
item
)
this
.
selectedChildIndex
=
this
.
buttonList
[
this
.
selectedIndex
].
sub_button
.
length
-
1
},
...
...
@@ -789,18 +835,42 @@
onTypeChange
(
val
){
console
.
log
(
'onTypeChange'
,
val
)
},
searchSubButton
(
firstIndex
,
list
){
list
.
forEach
((
item
,
index
)
=>
{
if
(
item
.
type
&&
item
.
type
===
'click'
&&
!
item
.
key
){
this
.
buttonList
[
firstIndex
].
sub_button
[
index
].
key
=
`menuKey_
${
firstIndex
+
1
}
_
${
index
+
1
}
`
}
})
},
onSave
(){
let
buttonList
=
this
.
buttonList
this
.
buttonList
.
forEach
((
item
,
index
)
=>
{
if
(
item
.
type
&&
item
.
type
===
'click'
&&
!
item
.
key
){
this
.
buttonList
[
index
].
key
=
`menuKey_
${
index
+
1
}
`
}
if
(
item
.
sub_button
&&
item
.
sub_button
.
length
>
0
){
this
.
searchSubButton
(
index
,
item
.
sub_button
)
}
})
let
json
=
{
buttons
:
JSON
.
stringify
(
buttonList
)
buttons
:
JSON
.
stringify
(
this
.
buttonList
)
}
let
_this
=
this
;
savePublicMenuApi
(
json
).
then
(
res
=>
{
if
(
res
.
errcode
===
0
){
this
.
$message
({
type
:
'success'
,
message
:
'保存成功!'
});
this
.
getMenu
();
this
.
buttonList
.
forEach
((
item
)
=>
{
if
(
item
.
key
&&
!
_this
.
keywordsMap
.
has
(
item
.
key
)){
_this
.
onSaveConfig
(
item
);
}
else
if
(
item
.
key
&&
_this
.
keywordsMap
.
has
(
item
.
key
)){
_this
.
onUpdateConfig
(
_this
.
keywordsMap
.
get
(
item
.
key
).
id
,
item
)
}
if
(
item
.
sub_button
&&
item
.
sub_button
.
length
>
0
){
this
.
onSaveSubConfig
(
item
.
sub_button
)
}
})
}
else
{
MessageBox
({
title
:
'错误!'
,
...
...
@@ -810,6 +880,33 @@
}
})
},
onSaveSubConfig
(
list
){
list
.
forEach
((
item
)
=>
{
if
(
item
.
key
&&
!
this
.
keywordsMap
.
has
(
item
.
key
)){
this
.
onSaveConfig
(
item
);
}
else
if
(
item
.
key
&&
this
.
keywordsMap
.
has
(
item
.
key
)){
this
.
onUpdateConfig
(
this
.
keywordsMap
.
get
(
item
.
key
).
id
,
item
)
}
})
},
onSaveConfig
(
item
){
let
json
=
{
key
:
'menu_keywords'
,
value
:
item
.
key
,
desc
:
JSON
.
stringify
([
item
.
media_info
])
}
saveConfigApi
(
json
).
then
(()
=>
{
})
},
onUpdateConfig
(
id
,
item
){
let
json
=
{
key
:
'menu_keywords'
,
value
:
item
.
key
,
desc
:
JSON
.
stringify
([
item
.
media_info
])
}
updateConfigApi
(
id
,
json
).
then
(()
=>
{
})
},
onPageChange
(
val
){
this
.
nowPage
=
val
this
.
getMediaList
(
this
.
buttonList
[
this
.
selectedIndex
].
media_info
.
type
)
...
...
@@ -846,17 +943,18 @@
onChooseMedia
(
val
){
let
selectedIndex
=
this
.
selectedIndex
;
let
_type
=
this
.
buttonList
[
selectedIndex
].
media_info
.
type
;
let
_menuIndex
=
selectedIndex
+
1
;
this
.
buttonList
[
selectedIndex
].
key
=
`menuKey_
${
_menuIndex
}
`
if
(
_type
===
'image'
)
{
this
.
buttonList
[
selectedIndex
].
media_id
=
val
.
media_id
;
this
.
buttonList
[
selectedIndex
].
media_info
.
url
=
val
.
url
;
this
.
buttonList
[
selectedIndex
].
key
=
'image'
this
.
buttonList
[
selectedIndex
].
media_info
.
content
=
val
.
url
;
}
else
if
(
_type
===
'news'
){
this
.
buttonList
[
selectedIndex
].
media_id
=
val
.
media_id
;
this
.
buttonList
[
selectedIndex
].
media_info
=
val
.
content
;
this
.
buttonList
[
selectedIndex
].
media_info
.
content
=
val
.
content
;
this
.
buttonList
[
selectedIndex
].
media_info
.
type
=
'news'
;
}
else
if
(
_type
===
'video'
){
this
.
buttonList
[
selectedIndex
].
media_id
=
val
.
media_id
;
this
.
buttonList
[
selectedIndex
].
media_info
=
val
.
info
;
this
.
buttonList
[
selectedIndex
].
media_info
.
content
=
val
.
info
;
this
.
buttonList
[
selectedIndex
].
media_info
.
type
=
'video'
;
}
this
.
showMedia
=
false
;
...
...
@@ -865,17 +963,18 @@
onChooseSubMedia
(
val
){
let
selectedIndex
=
this
.
selectedIndex
;
let
selectedChildIndex
=
this
.
selectedChildIndex
;
this
.
buttonList
[
selectedIndex
].
sub_button
[
selectedChildIndex
].
key
=
`menuKey_
${
selectedIndex
+
1
}
_
${
selectedChildIndex
+
1
}
`
let
_type
=
this
.
buttonList
[
selectedIndex
].
sub_button
[
selectedChildIndex
].
media_info
.
type
;
if
(
_type
===
'image'
)
{
this
.
buttonList
[
selectedIndex
].
sub_button
[
selectedChildIndex
].
media_id
=
val
.
media_id
;
this
.
buttonList
[
selectedIndex
].
sub_button
[
selectedChildIndex
].
media_info
.
url
=
val
.
url
;
this
.
buttonList
[
selectedIndex
].
sub_button
[
selectedChildIndex
].
media_info
.
content
=
val
.
url
;
}
else
if
(
_type
===
'news'
){
this
.
buttonList
[
selectedIndex
].
sub_button
[
selectedChildIndex
].
media_id
=
val
.
media_id
;
this
.
buttonList
[
selectedIndex
].
sub_button
[
selectedChildIndex
].
media_info
=
val
.
content
;
this
.
buttonList
[
selectedIndex
].
sub_button
[
selectedChildIndex
].
media_info
.
content
=
val
.
content
;
this
.
buttonList
[
selectedIndex
].
sub_button
[
selectedChildIndex
].
media_info
.
type
=
'news'
;
}
else
if
(
_type
===
'video'
){
this
.
buttonList
[
selectedIndex
].
sub_button
[
selectedChildIndex
].
media_id
=
val
.
media_id
;
this
.
buttonList
[
selectedIndex
].
sub_button
[
selectedChildIndex
].
media_info
=
val
.
info
;
this
.
buttonList
[
selectedIndex
].
sub_button
[
selectedChildIndex
].
media_info
.
content
=
val
.
info
;
this
.
buttonList
[
selectedIndex
].
sub_button
[
selectedChildIndex
].
media_info
.
type
=
'video'
;
}
this
.
showMedia
=
false
;
...
...
@@ -902,7 +1001,7 @@
this
.
$forceUpdate
();
},
deleteMedia
(){
let
_type
=
this
.
buttonList
[
selectedIndex
].
media_info
.
type
;
let
_type
=
this
.
buttonList
[
this
.
selectedIndex
].
media_info
.
type
;
this
.
buttonList
[
this
.
selectedIndex
].
media_id
=
''
;
if
(
_type
===
'image'
)
{
this
.
buttonList
[
this
.
selectedIndex
].
media_info
.
url
=
''
;
...
...
@@ -917,14 +1016,14 @@
this
.
$forceUpdate
();
},
deleteSubMedia
(){
let
_type
=
this
.
buttonList
[
selectedIndex
].
sub_button
[
selectedChildIndex
].
media_info
.
type
;
let
selectedIndex
=
this
.
selectedIndex
;
let
selectedChildIndex
=
this
.
selectedChildIndex
;
let
_type
=
this
.
buttonList
[
selectedIndex
].
sub_button
[
selectedChildIndex
].
media_info
.
type
;
this
.
buttonList
[
selectedIndex
].
sub_button
[
selectedChildIndex
].
media_id
=
''
;
if
(
_type
===
'image'
)
{
this
.
buttonList
[
selectedIndex
].
sub_button
[
selectedChildIndex
].
media_info
.
url
=
''
;
}
else
if
(
_type
===
'text'
){
this
.
buttonList
[
selectedIndex
].
sub_button
[
selectedChildIndex
].
media_info
.
content
=
''
;
}
else
{
this
.
buttonList
[
selectedIndex
].
sub_button
[
selectedChildIndex
].
media_info
=
{
type
:
_type
...
...
@@ -933,7 +1032,14 @@
this
.
$forceUpdate
();
},
handleEmotion
(
i
)
{
this
.
content
+=
i
this
.
buttonList
[
this
.
selectedIndex
].
media_info
.
content
+=
i
;
this
.
$forceUpdate
();
},
handleSubEmotion
(
i
)
{
let
selectedIndex
=
this
.
selectedIndex
;
let
selectedChildIndex
=
this
.
selectedChildIndex
;
this
.
buttonList
[
selectedIndex
].
sub_button
[
selectedChildIndex
].
media_info
.
content
+=
i
;
this
.
$forceUpdate
();
},
}
...
...
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