联调前端用户管理及角色管理
This commit is contained in:
@@ -19,11 +19,6 @@ export default {
|
||||
method: 'get'
|
||||
|
||||
})
|
||||
},
|
||||
GetRolesByUserId(userId) {
|
||||
return myaxios({
|
||||
url: `/Role/GetRolesByUserId?userId=${userId}`,
|
||||
method: 'get'
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,10 +22,10 @@ export default {
|
||||
method: 'get'
|
||||
})
|
||||
},
|
||||
GetAxiosByRouter(router) {
|
||||
GetRoleListByUserId(userId) {
|
||||
return myaxios({
|
||||
url: `/User/GetAxiosByRouter?router=${router}`,
|
||||
url: `/User/GetRoleListByUserId?userId=${userId}`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
@@ -3,7 +3,20 @@ export default {
|
||||
getItem(url) {
|
||||
return myaxios({
|
||||
url: url,
|
||||
method: 'get'
|
||||
method: 'post',
|
||||
data: {
|
||||
parameters: [
|
||||
{
|
||||
key: "isDeleted",
|
||||
value: "0",
|
||||
type: 0
|
||||
|
||||
}
|
||||
],
|
||||
orderBys: [
|
||||
"id"
|
||||
]
|
||||
}
|
||||
})
|
||||
},
|
||||
addItem(url, data) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import axios from 'axios'
|
||||
import store from '../store/index'
|
||||
import vm from '../main'
|
||||
import JsonBig from 'json-bigint'
|
||||
// import VuetifyDialogPlugin from 'vuetify-dialog/nuxt/index';
|
||||
const myaxios = axios.create({
|
||||
// baseURL:'/'//
|
||||
@@ -9,6 +10,13 @@ const myaxios = axios.create({
|
||||
headers: {
|
||||
'Authorization': 'Bearer ' + ""
|
||||
},
|
||||
//雪花id精度问题
|
||||
transformResponse: [ data => {
|
||||
const json = JsonBig({
|
||||
storeAsString: true
|
||||
})
|
||||
return json.parse(data)
|
||||
}],
|
||||
})
|
||||
// 请求拦截器
|
||||
myaxios.interceptors.request.use(function(config) {
|
||||
|
||||
@@ -12,17 +12,18 @@
|
||||
</material-card>
|
||||
</template>
|
||||
<script>
|
||||
import userApi from "../api/userApi"
|
||||
export default {
|
||||
created() {
|
||||
this.init();
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
userApi.GetAxiosByRouter(this.$route.path).then(resp=>{
|
||||
this.axiosUrls=resp.data;
|
||||
})
|
||||
|
||||
this.axiosUrls = {
|
||||
get: "/role/GetList",
|
||||
update: "/role/Update",
|
||||
del: "/role/DeleteList",
|
||||
add: "/role/Add",
|
||||
};
|
||||
}
|
||||
},
|
||||
data: () => ({
|
||||
@@ -31,9 +32,9 @@ export default {
|
||||
},
|
||||
headers: [
|
||||
{ text: "编号", align: "start", value: "id" },
|
||||
{ text: "角色名", value: "role_name", sortable: false },
|
||||
{ text: "云盘地址", value: "file_path", sortable: false },
|
||||
{ text: "简介", value: "introduce", sortable: false },
|
||||
{ text: "角色名", value: "roleName", sortable: false },
|
||||
// { text: "云盘地址", value: "file_path", sortable: false },
|
||||
// { text: "简介", value: "introduce", sortable: false },
|
||||
{ text: "操作", value: "actions", sortable: false },
|
||||
],
|
||||
defaultItem: {
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
</template>
|
||||
<script>
|
||||
import userApi from "../api/userApi";
|
||||
import roleApi from "../api/roleApi";
|
||||
export default {
|
||||
created() {
|
||||
this.init();
|
||||
@@ -36,12 +35,14 @@ export default {
|
||||
methods: {
|
||||
async showItem(item) {
|
||||
var strInfo = "";
|
||||
roleApi.GetRolesByUserId(item.id).then(async (resp) => {
|
||||
const roleData = resp.data;
|
||||
userApi.GetRoleListByUserId(item.id).then(async (resp) => {
|
||||
var roleData = resp.data;
|
||||
strInfo += "拥有的角色:<br>";
|
||||
roleData.forEach((u) => {
|
||||
strInfo += u.role_name + "<br>";
|
||||
});
|
||||
if (roleData != null) {
|
||||
roleData.forEach((u) => {
|
||||
strInfo += u.roleName + "<br>";
|
||||
});
|
||||
}
|
||||
|
||||
strInfo += "<hr>";
|
||||
Object.keys(item).forEach(async function (key) {
|
||||
@@ -58,12 +59,16 @@ export default {
|
||||
});
|
||||
},
|
||||
init() {
|
||||
userApi.GetAxiosByRouter(this.$route.path).then((resp) => {
|
||||
this.axiosUrls = resp.data;
|
||||
});
|
||||
roleApi.getRole().then((resp) => {
|
||||
this.roleItems = resp.data;
|
||||
});
|
||||
this.axiosUrls = {
|
||||
get: "/user/GetList",
|
||||
update: "/user/Update",
|
||||
del: "/user/DeleteList",
|
||||
add: "/user/Add",
|
||||
};
|
||||
|
||||
// roleApi.getRole().then((resp) => {
|
||||
// this.roleItems = resp.data;
|
||||
// });
|
||||
},
|
||||
setRole() {
|
||||
var userIds = [];
|
||||
@@ -95,8 +100,7 @@ export default {
|
||||
roleItems: [],
|
||||
axiosUrls: {},
|
||||
headers: [
|
||||
{ text: "编号", align: "start", value: "id" },
|
||||
{ text: "用户名", value: "username", sortable: false },
|
||||
{ text: "用户名", value: "userName", sortable: false },
|
||||
{ text: "密码", value: "password", sortable: false },
|
||||
{ text: "图标", value: "icon", sortable: false },
|
||||
{ text: "昵称", value: "nick", sortable: true },
|
||||
@@ -110,11 +114,11 @@ export default {
|
||||
defaultItem: {
|
||||
username: "test",
|
||||
password: "123",
|
||||
icon: "mdi-lock",
|
||||
icon: "",
|
||||
nick: "橙子",
|
||||
age: 18,
|
||||
address: "中国",
|
||||
phone: "",
|
||||
phone: "123456789",
|
||||
},
|
||||
}),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user