diff --git a/src/assets/api.js b/src/assets/api.js index 4b2ae934..74e25203 100644 --- a/src/assets/api.js +++ b/src/assets/api.js @@ -389,6 +389,11 @@ export const postCreateMenu = (data) => { export const putmodifyMenu = (id,data) => { return req('put', baseurl + "/auth/menu/"+id,data) } +//删除菜单 +export const delMenu = (id) => { + return req('delete', baseurl + "/auth/menu/"+id) +} + //获取落地页下拉菜单 diff --git a/src/pages/distributor/adddistributorinfo/adddistributorinfo.less b/src/pages/distributor/adddistributorinfo/adddistributorinfo.less index c409f38d..111fc2bd 100644 --- a/src/pages/distributor/adddistributorinfo/adddistributorinfo.less +++ b/src/pages/distributor/adddistributorinfo/adddistributorinfo.less @@ -17,5 +17,5 @@ border: none!important; } .zent-dialog-r-anchor .zent-dialog-r[data-zv="9.11.0"]{ - margin-top: -180px; + margin-top: -100px; } \ No newline at end of file diff --git a/src/pages/system/menu/leftnav/leftnav.js b/src/pages/system/menu/leftnav/leftnav.js index 8afb097c..372bad01 100644 --- a/src/pages/system/menu/leftnav/leftnav.js +++ b/src/pages/system/menu/leftnav/leftnav.js @@ -17,6 +17,12 @@ export default class leftnav extends React.Component{ } } onselect=(data, target)=>{ + console.log(target); + let doms=document.querySelectorAll('.leftTree .zent-tree-content'); + doms.forEach(item=>{ + item.style.background='#fff'; + }); + target.style.background='#A8C3F0'; this.setState({ selectdom: data }); @@ -24,8 +30,6 @@ export default class leftnav extends React.Component{ } onCheck = (checked, helpInfo) => { - - console.log(88,helpInfo); this.setState({ checkedKeys: checked }); diff --git a/src/pages/system/menu/main/main.js b/src/pages/system/menu/main/main.js index c4a05c8e..b63e0e6b 100644 --- a/src/pages/system/menu/main/main.js +++ b/src/pages/system/menu/main/main.js @@ -2,35 +2,63 @@ import ReactDOM from 'react-dom'; import React, { Component } from 'react'; import "./main.less" import "../../../../assets/comm.css" -import { Card,Button,Notify,Dialog} from 'zent'; +import { Card,Button,Notify,Dialog,Sweetalert} from 'zent'; import Leftnav from "../leftnav/leftnav" import Menuright from "../menuright/menuright" import Menubody from "../menubody/menubody" -import {postCreateMenu,handelResponse} from "../../../../assets/api.js" +import {postCreateMenu,handelResponse,delMenu} from "../../../../assets/api.js" export default class menu extends React.Component{ constructor(props){ super(props) this.state={ visible:false, dialogtitle:'', - selectdom:{} + selectdom:{}, + fid:0, } } addchildmenu(){ // 实现父子组件的双向绑定 let item=this.refs.navitem.state.selectdom; if(item.id){ - Notify.clear(); - this.setState({dialogtitle:'新建子菜单',visible:true}); + this.setState({dialogtitle:'新建子菜单',visible:true,fid:item.id}); }else{ Notify.clear(); Notify.warn('请先点击选择一个菜单'); } } addmenu(){ - this.setState({dialogtitle:'添加一级菜单',visible:true}); - - + this.setState({dialogtitle:'添加一级菜单',visible:true,fid:0}); + } + //删除菜单 + delmenuBtn(){ + let item=this.refs.navitem.state.selectdom; + if(item.id){ + Sweetalert.confirm({ + type:'warning', + closeBtn:true, + title:'确认操作', + content:

是否删除[{item.title}]

, + onConfirm:()=>{ + delMenu(item.id).then(res=>{ + handelResponse(res,(response,msg)=>{ + Notify.clear(); + Notify.success(msg); + window.history.go(0); + },(err)=>{ + + }) + }).catch(err=>{ + }); + }, + onCancel: this.onCancel, + className:'questModal', + parentComponent: this + }); + }else{ + Notify.clear(); + Notify.warn('请先点击选择一个菜单'); + } } setVisible = visible => { this.setState({ visible }); @@ -41,7 +69,7 @@ export default class menu extends React.Component{ let self=this; if(menuFlag){ let data=this.refs.menubody.state.model; - data.fid=0; + data.fid=this.state.fid; postCreateMenu(data).then(res=>{ handelResponse(res,(response,msg)=>{ Notify.clear(); @@ -52,6 +80,7 @@ export default class menu extends React.Component{ }) } } + //获取点击的值 getMenuInfo(e){ this.setState({selectdom:e}); @@ -62,7 +91,8 @@ export default class menu extends React.Component{

- + +

@@ -80,6 +110,7 @@ export default class menu extends React.Component{
{/* 弹出框 */} this.setVisible(false)} @@ -92,7 +123,7 @@ export default class menu extends React.Component{ } title={this.state.dialogtitle} > - + ) diff --git a/src/pages/system/menu/menubody/menubody.js b/src/pages/system/menu/menubody/menubody.js index 193c6271..76e304c2 100644 --- a/src/pages/system/menu/menubody/menubody.js +++ b/src/pages/system/menu/menubody/menubody.js @@ -108,13 +108,13 @@ export default class adduserinfo extends React.Component{ - + - + diff --git a/src/pages/system/menu/menuright/menuright.js b/src/pages/system/menu/menuright/menuright.js index 928611b8..ab8dfc8f 100644 --- a/src/pages/system/menu/menuright/menuright.js +++ b/src/pages/system/menu/menuright/menuright.js @@ -58,7 +58,6 @@ methodsonChange = e => { } modifysubmit(){ - console.log(this.state.model); let modifyFlag=this.refs.form1.validator(); let self=this; @@ -75,6 +74,7 @@ methodsonChange = e => { handelResponse(res,(response,msg)=>{ Notify.clear(); Notify.success(msg); + window.history.go(0); },(err)=>{ }) @@ -175,13 +175,13 @@ methodsonChange = e => { - + - +