菜单接口
This commit is contained in:
parent
dea38aa840
commit
bbfdd35fd4
|
@ -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)
|
||||
}
|
||||
|
||||
|
||||
|
||||
//获取落地页下拉菜单
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -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
|
||||
});
|
||||
|
|
|
@ -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: <p>是否删除<b>[{item.title}]</b>?</p>,
|
||||
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{
|
|||
<Card style={{ width:'100%' }}>
|
||||
<p className="menuBtn">
|
||||
<Button type="primary" icon="plus" onClick={this.addchildmenu.bind(this)}>新建子菜单</Button>
|
||||
<Button type="info" onClick={this.addmenu.bind(this)}>添加一级菜单</Button>
|
||||
<Button type="warn" onClick={this.addmenu.bind(this)}>添加一级菜单</Button>
|
||||
<Button type="danger" onClick={this.delmenuBtn.bind(this)}>删除菜单</Button>
|
||||
</p>
|
||||
</Card>
|
||||
<div className="menu-body">
|
||||
|
@ -80,6 +110,7 @@ export default class menu extends React.Component{
|
|||
</div>
|
||||
{/* 弹出框 */}
|
||||
<Dialog
|
||||
style={{width:'50%'}}
|
||||
visible={this.state.visible}
|
||||
className="questModal"
|
||||
onClose={() => this.setVisible(false)}
|
||||
|
@ -92,7 +123,7 @@ export default class menu extends React.Component{
|
|||
}
|
||||
title={this.state.dialogtitle}
|
||||
>
|
||||
<Menubody ref="menubody" />
|
||||
<Menubody ref="menubody" fid={this.state.fid}/>
|
||||
</Dialog>
|
||||
</div>
|
||||
)
|
||||
|
|
|
@ -108,13 +108,13 @@ export default class adduserinfo extends React.Component{
|
|||
<FormItem required={false} labelname="是否显示">
|
||||
<RadioGroup onChange={this.statusChange} value={this.state.model.status}>
|
||||
<RadioButton value="1" >是</RadioButton>
|
||||
<RadioButton value="5" >否</RadioButton>
|
||||
<RadioButton value="0" >否</RadioButton>
|
||||
</RadioGroup>
|
||||
</FormItem>
|
||||
<FormItem required={false} labelname="是否验证登陆">
|
||||
<RadioGroup onChange={this.authChange} value={this.state.model.auth}>
|
||||
<RadioButton value="1" >是</RadioButton>
|
||||
<RadioButton value="5" >否</RadioButton>
|
||||
<RadioButton value="0" >否</RadioButton>
|
||||
</RadioGroup>
|
||||
</FormItem>
|
||||
<FormItem required={false} labelname="菜单图标">
|
||||
|
|
|
@ -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 => {
|
|||
<FormItem required={false} labelname="是否显示">
|
||||
<RadioGroup onChange={this.statusChange} value={this.state.model.status}>
|
||||
<RadioButton value={1} >是</RadioButton>
|
||||
<RadioButton value={5} >否</RadioButton>
|
||||
<RadioButton value={0} >否</RadioButton>
|
||||
</RadioGroup>
|
||||
</FormItem>
|
||||
<FormItem required={false} labelname="是否验证登陆">
|
||||
<RadioGroup onChange={this.authChange} value={this.state.model.auth}>
|
||||
<RadioButton value={1} >是</RadioButton>
|
||||
<RadioButton value={5} >否</RadioButton>
|
||||
<RadioButton value={0} >否</RadioButton>
|
||||
</RadioGroup>
|
||||
</FormItem>
|
||||
<FormItem required={false} labelname="菜单图标">
|
||||
|
|
Loading…
Reference in New Issue