Commit 1cec5b57 authored by Qingyu Deng's avatar Qingyu Deng

fix: refactored get role method

parent 7018a549
...@@ -265,7 +265,7 @@ import { ...@@ -265,7 +265,7 @@ import {
getWithdrawAudit, getWithdrawAudit,
getApplyDetail, getApplyDetail,
getFreezingFund, getFreezingFund,
getAll_role_list, getRolesForUser,
} from "../../../service/Withdrawal/withdrawal"; } from "../../../service/Withdrawal/withdrawal";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import { fetchCurrentUser } from "../../../service/user"; import { fetchCurrentUser } from "../../../service/user";
...@@ -334,9 +334,9 @@ export default { ...@@ -334,9 +334,9 @@ export default {
const res = await this.getPermissionsAll(); const res = await this.getPermissionsAll();
console.log(res); console.log(res);
if(!res) { if (!res) {
this.$router.push({name: 'Forbidden'}) this.$router.push({ name: "Forbidden" });
return return;
} }
let withdrawlPermission = res.filter( let withdrawlPermission = res.filter(
...@@ -363,7 +363,7 @@ export default { ...@@ -363,7 +363,7 @@ export default {
// 不能够信赖 store 中的 email,无法知道全局中的 fetchCurrentUser 处理完毕 // 不能够信赖 store 中的 email,无法知道全局中的 fetchCurrentUser 处理完毕
// 是一个重构的点 // 是一个重构的点
const { user } = await fetchCurrentUser(); const { user } = await fetchCurrentUser();
const res = await getAll_role_list(user.email); const res = await getRolesForUser(user.email);
this.permissions = res; this.permissions = res;
return res; return res;
......
import axios from '../utils/request'; import axios from "../utils/request";
// import qs from 'qs'; // import qs from 'qs';
//角色列表 //角色列表
export async function getRole_list (parmasRole_list, appid) { export async function getRole_list(parmasRole_list, appid) {
const opts = { const opts = {
method: "post", method: "post",
url: "/api/v1/merchant/authority/role_list", url: "/api/v1/merchant/authority/role_list",
...@@ -13,7 +13,7 @@ export async function getRole_list (parmasRole_list, appid) { ...@@ -13,7 +13,7 @@ export async function getRole_list (parmasRole_list, appid) {
return await axios(opts); return await axios(opts);
} }
//添加角色 //添加角色
export async function getAdd_role (parmasAdd_role, appid) { export async function getAdd_role(parmasAdd_role, appid) {
const opts = { const opts = {
method: "post", method: "post",
url: "/api/v1/merchant/authority/add_role", url: "/api/v1/merchant/authority/add_role",
...@@ -25,7 +25,7 @@ export async function getAdd_role (parmasAdd_role, appid) { ...@@ -25,7 +25,7 @@ export async function getAdd_role (parmasAdd_role, appid) {
// return res; // return res;
} }
//角色编辑 //角色编辑
export async function getUpdate_role (parmasUpdate_role, appid) { export async function getUpdate_role(parmasUpdate_role, appid) {
const opts = { const opts = {
method: "post", method: "post",
url: "/api/v1/merchant/authority/update_role", url: "/api/v1/merchant/authority/update_role",
...@@ -37,7 +37,7 @@ export async function getUpdate_role (parmasUpdate_role, appid) { ...@@ -37,7 +37,7 @@ export async function getUpdate_role (parmasUpdate_role, appid) {
// return res; // return res;
} }
//角色详情 //角色详情
export async function get_role_info (role_id, appid) { export async function get_role_info(role_id, appid) {
const opts = { const opts = {
method: "post", method: "post",
url: "/api/v1/merchant/authority/get_role_info", url: "/api/v1/merchant/authority/get_role_info",
...@@ -52,7 +52,7 @@ export async function get_role_info (role_id, appid) { ...@@ -52,7 +52,7 @@ export async function get_role_info (role_id, appid) {
// return res.result; // return res.result;
} }
//角色删除 //角色删除
export async function getDelete_role (role_id, appid) { export async function getDelete_role(role_id, appid) {
const opts = { const opts = {
method: "post", method: "post",
url: "/api/v1/merchant/authority/delete_role", url: "/api/v1/merchant/authority/delete_role",
...@@ -68,7 +68,7 @@ export async function getDelete_role (role_id, appid) { ...@@ -68,7 +68,7 @@ export async function getDelete_role (role_id, appid) {
} }
//权限列表 //权限列表
export async function getAll_role_list (user_email, appid) { export async function getAll_role_list(user_email, appid) {
const opts = { const opts = {
method: "post", method: "post",
url: "/api/v1/merchant/authority/get_role_list", url: "/api/v1/merchant/authority/get_role_list",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment