import config from "@/config"
import http from "@/utils/request"

export default {
	list: {
		url: `${config.API_URL}user/index`,
		name: "获得用户列表",
		get: async function(params){
			return await http.get(this.url, params);
		}
	},
	userinfo:{
		url: `${config.API_URL}user/info`,
		name: "获得用户信息",
		get: async function(params){
			return await http.get(this.url, params);
		}
	},
	add: {
		url: `${config.API_URL}user/add`,
		name: "添加用户",
		post: async function(params){
			return await http.post(this.url, params);
		}
	},
	edit: {
		url: `${config.API_URL}user/edit`,
		name: "编辑用户",
		post: async function(params){
			return await http.post(this.url, params);
		}
	},
	uppasswd:{
		url: `${config.API_URL}user/passwd`,
		name: "修改密码",
		post: async function(params){
			return await http.post(this.url, params);
		}
	},
	uprole: {
		url: `${config.API_URL}user/auth`,
		name: "编辑用户",
		post: async function(params){
			return await http.post(this.url, params);
		}
	},
	role: {
		list: {
			url: `${config.API_URL}user/role/index`,
			name: "获得角色列表",
			get: async function(params){
				return await http.get(this.url, params);
			}
		},
		edit: {
			url: `${config.API_URL}user/role/edit`,
			name: "编辑角色",
			post: async function(params){
				return await http.post(this.url, params);
			}
		},
		auth: {
			url: `${config.API_URL}user/role/auth`,
			name: "编辑角色",
			post: async function(params){
				return await http.post(this.url, params);
			}
		}
	},
	menu: {
		myMenus: {
			url: `${config.API_URL}user/menu/my`,
			name: "获取我的菜单",
			get: async function(){
				return await http.get(this.url);
			}
		},
		list: {
			url: `${config.API_URL}user/menu`,
			name: "获取菜单",
			get: async function(){
				return await http.get(this.url);
			}
		},
		add: {
			url: `${config.API_URL}user/menu`,
			name: "添加菜单",
			post: async function(data){
				return await http.post(this.url, data);
			}
		},
		edit: {
			url: `${config.API_URL}user/menu`,
			name: "编辑菜单",
			post: async function(data){
				return await http.put(this.url, data);
			}
		},
		delete: {
			url: `${config.API_URL}user/menu/delete`,
			name: "删除菜单",
			post: async function(data){
				return await http.post(this.url, data);
			}
		}
	},
	department: {
		list: {
			url: `${config.API_URL}user/department`,
			name: "获得部门列表",
			get: async function(params){
				return await http.get(this.url, params);
			}
		},
		edit: {
			url: `${config.API_URL}user/department/edit`,
			name: "编辑部门",
			post: async function(params){
				return await http.post(this.url, params);
			}
		}
	}
}
