lalala 6 years ago
parent
commit
2001d662b4
1 changed files with 23 additions and 12 deletions
  1. 23 12
      mobile-code/src/admin/setting/wx-menu.vue

+ 23 - 12
mobile-code/src/admin/setting/wx-menu.vue

@@ -110,8 +110,8 @@ export default {
 			// 按钮列表
 			// 按钮列表
 			btnData: [],
 			btnData: [],
 			// 打开的弹窗是否是父级菜单
 			// 打开的弹窗是否是父级菜单
-			isModifyParents: false,
-			isAdd: false
+			isModifyParents: false
+			// isAdd: false
 		}
 		}
 	},
 	},
 	computed: {
 	computed: {
@@ -153,7 +153,7 @@ export default {
 		menuClickFn(item, index) {
 		menuClickFn(item, index) {
 			this.operateLeft = index * 192 + 130
 			this.operateLeft = index * 192 + 130
 
 
-			this.isAdd = false
+			// this.isAdd = false
 			this.isModifyParents = true
 			this.isModifyParents = true
 			this.activeIndex = index
 			this.activeIndex = index
 
 
@@ -219,12 +219,12 @@ export default {
 						this.menuData[this.activeIndex][i] = form[i];
 						this.menuData[this.activeIndex][i] = form[i];
 					});
 					});
 				} else {
 				} else {
-					if (this.isAdd) {
-						this.btnData.push(form)
-					} else {
+					// if (this.isAdd) {
+					// 	this.btnData.push(form)
+					// } else {
 						this.btnData[this.subActiveIndex] = form;
 						this.btnData[this.subActiveIndex] = form;
 						this.$set(this.btnData, this.subActiveIndex, form)
 						this.$set(this.btnData, this.subActiveIndex, form)
-					}
+					// }
 					console.log('江总555', this.btnData)
 					console.log('江总555', this.btnData)
 					console.log('江总666', this.activeIndex)
 					console.log('江总666', this.activeIndex)
 					// this.menuData[this.activeIndex].children = JSON.parse(JSON.stringify(this.btnData))
 					// this.menuData[this.activeIndex].children = JSON.parse(JSON.stringify(this.btnData))
@@ -238,7 +238,7 @@ export default {
 		// operate组件 ======================
 		// operate组件 ======================
 		operateFn(index) {
 		operateFn(index) {
 			console.log('我点击了按钮!', index)
 			console.log('我点击了按钮!', index)
-			this.isAdd = false
+			// this.isAdd = false
 			this.isModifyParents = false
 			this.isModifyParents = false
 			this.subActiveIndex = index
 			this.subActiveIndex = index
 
 
@@ -252,20 +252,31 @@ export default {
 			this.addModule = true
 			this.addModule = true
 		},
 		},
 		operateDelFn(index) {
 		operateDelFn(index) {
-			this.isAdd = false
+			// this.isAdd = false
 			this.isModifyParents = false
 			this.isModifyParents = false
 			console.log('我删除了!', index)
 			console.log('我删除了!', index)
 			this.btnData.splice(index, 1);
 			this.btnData.splice(index, 1);
 			this.menuData[this.activeIndex].children = JSON.parse(JSON.stringify(this.btnData))
 			this.menuData[this.activeIndex].children = JSON.parse(JSON.stringify(this.btnData))
 		},
 		},
 		operateAddFn() {
 		operateAddFn() {
-			this.isAdd = true
-			this.isModifyParents = false
 			if (this.btnData && this.btnData.length > 4) {
 			if (this.btnData && this.btnData.length > 4) {
 				this.$msg('子菜单不能超过五个!')
 				this.$msg('子菜单不能超过五个!')
 				return false
 				return false
 			}
 			}
-			this.addModule = true
+			
+			let form = {
+				name: '子菜单名',
+				menuOption: 0,
+				replyUrl: '',
+				targetId: 0
+			}
+			// this.isAdd = true
+			// this.isModifyParents = false
+			
+			this.btnData.push(form)
+			this.$set(this.menuData[this.activeIndex], 'children', JSON.parse(JSON.stringify(this.btnData)))
+
+			// this.addModule = true
 		}
 		}
 	}
 	}
 }
 }