1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<template>
<div class="admin-conatiner">
<Header title="管理员信息" />
<ul>
<li v-for="(item, index) in list" :key="index" @click="goDetail(item)">
<span>{{ item.userName }}</span>
<img
v-if="item.id === currentUserId"
src="@/assets/images/applets/edit.png"
alt
/>
<img
v-if="item.id !== currentUserId"
src="@/assets/images/applets/detail.png"
alt
/>
</li>
</ul>
<my-tabbar active="2"></my-tabbar>
</div>
</template>
<script>
import Header from "@/components/Header/index.vue";
export default {
components: { Header },
data() {
return {
list: [],
currentUserId: JSON.parse(localStorage.getItem("userInfo")).id,
};
},
mounted() {
this.getList();
},
methods: {
// 获取管理员列表
getList() {
let vm = this;
let param = {
_index: 1,
_size: 10,
type: JSON.parse(localStorage.getItem("userInfo")).type,
};
vm.$https(
{
url: "tUser/getPageList",
method: "get",
authType: this.backToken,
},
param
)
.then((res) => {
if (res.data.resultCode === "200") {
let data = res.data.data;
vm.list = data.records;
} else {
this.$toast(res.data.message);
}
})
.catch(function (err) {
console.log(err);
});
},
goDetail(item) {
if (item.id === this.currentUserId) {
// 修改页面
this.$router.push({
path: "/adminInfo",
query: { id: item.id, disabled: false },
});
} else {
// 详情页面
this.$router.push({
path: "/adminInfo",
query: { id: item.id, disabled: true },
});
}
},
},
};
</script>
<style lang="scss" scoped>
.admin-conatiner {
width: 100%;
height: 100vh;
padding: 50px 24px 60px;
display: flex;
flex-direction: column;
box-sizing: border-box;
ul {
list-style: none;
}
li {
display: flex;
justify-content: space-between;
background: #f8f8f8;
border-radius: 33px;
font-size: 16px;
padding: 12px;
color: #333333;
margin-top: 20px;
img {
width: 24px;
height: 24px;
}
}
}
</style>