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
e99afee9
Commit
e99afee9
authored
Sep 11, 2018
by
王
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
菜单管理
parent
1bf64e23
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
134 additions
and
79 deletions
+134
-79
index.vue
src/components/weChat/index.vue
+134
-79
No files found.
src/components/weChat/index.vue
View file @
e99afee9
...
@@ -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"
>
{{
selected
Item
&&
selectedItem
.
name
}}
</h4>
<h4
class=
"global_info"
>
{{
selected
ChildIndex
!==
-
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=
"selected
Item
.name"
type=
"text"
class=
"frm_input js_menu_name"
@
input=
"onInput"
/>
<input
:value=
"selected
ChildIndex === -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=
"selected
Item
.type"
@
change=
"onTypeChange"
>
<el-radio-group
v-model=
"selected
ChildIndex === -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
.
selectedI
tem
)
this
.
buttonList
[
this
.
selectedIndex
].
sub_button
.
push
(
i
tem
)
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
.
selectedI
tem
)
this
.
buttonList
.
push
(
i
tem
)
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
({
...
...
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