Personal.vue
7.5 KB
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
<template>
<div class="personal_center">
<!-- 个人中心 -->
<Top :isPersonal="isPersonal"></Top>
<!-- 主体内容 -->
<div class="personal_main">
<div class="personal_box clearfix">
<!-- 左侧 -->
<div class="personal_l clearfix">
<!-- 头像等 -->
<div class="personal_header layout justify_center flex_diection align_center">
<!-- 头像 -->
<div class="personal_img">
<img :src="img" alt />
</div>
<div
class="personal_name"
>{{name}}
{{groupId == 3?"(班主任)":groupId == 2?"(家长)":group.length>0?"("+group+")":""}}
</div>
<div>{{schoolName}}</div>
</div>
<!-- 学生端 家长端 -->
<div class="personal_msg" v-show="groupId == 1 || groupId == 2">
<ul class="layout justify flex_diection personal_ul">
<li
class="personal_li"
v-for="item in msgList"
:key="item.index"
:class="{blue_personal:isBlue == item.index}"
@click="change(item.index)"
>
<img :src="isBlue == item.index?item.img2:item.img" alt class="personal_pic" />
{{item.content}}
</li>
</ul>
</div>
<!-- 教师端 -->
<div class="personal_msg" v-show="groupId == 3">
<ul class="layout justify flex_diection personal_ul">
<li
class="personal_li"
v-for="item in msgList2"
:key="item.index1"
:class="{blue_personal:isBlue == item.index1}"
@click="change(item.index1)"
>
<img :src="isBlue == item.index1?item.img2:item.img" alt class="personal_pic" />
{{item.content}}
</li>
</ul>
</div>
</div>
<!-- 右侧 -->
<div class="personal_r clearfix">
<router-view></router-view>
</div>
</div>
</div>
<Bottom2></Bottom2>
</div>
</template>
<script>
import Top from "../../common/Top";
import Bottom2 from "../../common/Bottom2";
import { post } from "@/api/http";
import { Notification } from "element-ui";
export default {
data() {
return {
// 身份判断
groupId: "",
isPersonal: 1,
img: "",
name: "",
schoolName: "",
group: "",
classical: "",
msgList2: [
{
index1: 11,
img: require("../../../assets/img/27.png"),
img2: require("../../../assets/img/40.png"),
content: "个人信息"
},
{
index1: 12,
img: require("../../../assets/img/39.png"),
img2: require("../../../assets/img/28.png"),
content: "测评管理"
},
{
index1: 17,
img: require("../../../assets/img/34.png"),
img2: require("../../../assets/img/33.png"),
content: "我的收藏"
}
],
msgList: [
{
index: 1,
img: require("../../../assets/img/27.png"),
img2: require("../../../assets/img/40.png"),
content: "个人信息"
},
{
index: 2,
img: require("../../../assets/img/39.png"),
img2: require("../../../assets/img/28.png"),
content: "测评管理"
},
{
index: 3,
img: require("../../../assets/img/38.png"),
img2: require("../../../assets/img/29.png"),
content: "选课管理"
},
{
index: 4,
img: require("../../../assets/img/37.png"),
img2: require("../../../assets/img/30.png"),
content: "活动管理"
},
{
index: 5,
img: require("../../../assets/img/36.png"),
img2: require("../../../assets/img/31.png"),
content: "学期总结"
},
{
index: 6,
img: require("../../../assets/img/35.png"),
img2: require("../../../assets/img/32.png"),
content: "生涯报告"
},
{
index: 7,
img: require("../../../assets/img/34.png"),
img2: require("../../../assets/img/33.png"),
content: "我的收藏"
}
],
isBlue: 1
};
},
methods: {
// 个人信息
inform() {
let url = "";
if (this.groupId == 1) {
url = "/api/student/inform";
} else if (this.groupId == 2) {
url = "/api/parents/inform";
} else if (this.groupId == 3) {
url = "/api/teacher/inform";
}
post(url).then(res => {
this.group = res.nianji;
this.name = res.nickname;
this.schoolName = res.school_name;
});
},
change(index) {
this.isBlue = index;
localStorage.setItem("personalIndex", index);
switch (index) {
case 1:
this.$router.push({ path: "/PersonalMsg" });
break;
case 2:
this.$router.push({ path: "/EvaluteManage" });
break;
case 3:
this.$router.push({ path: "/CourseSelect" });
break;
case 4:
this.$router.push({ path: "/ActivityManagement" });
break;
case 5:
this.$router.push({ path: "/TermSummary" });
break;
case 6:
this.$router.push({ path: "/CareeReport" });
break;
case 7:
this.$router.push({ path: "/Collection" });
break;
case 11:
this.$router.push({ path: "/PersonalMsg" });
break;
case 12:
this.$router.push({ path: "/TeachEvaDet" });
break;
case 17:
this.$router.push({ path: "/Collection" });
break;
}
}
},
components: {
Top,
Bottom2
},
mounted() {
this.inform();
},
created() {
this.img = localStorage.getItem("headImg");
this.groupId = localStorage.getItem("groupId");
if (this.groupId == 3) {
this.isBlue = 11;
} else {
// this.isBlue = 1;
if (localStorage.getItem("personalIndex")) {
this.isBlue = localStorage.getItem("personalIndex");
} else {
this.isBlue = 1;
}
}
},
destroyed(){
localStorage.removeItem("personalIndex")
},
watch: {
$route(to, form) {
if (to.name == "PersonalMsg") {
if (this.groupId == 3) {
this.isBlue = 11;
} else {
this.isBlue = 1;
}
}
}
}
};
</script>
<style scoped>
/* 个人中心主体内容 */
.personal_main {
width: 100%;
background-color: #f2f5fa;
}
.personal_box {
width: 1200px;
margin: 0 auto;
padding-top: 24px;
}
/* 左侧 */
.personal_l {
width: 180px;
height: 509px;
margin-bottom: 368px;
float: left;
}
/* 头像 */
.personal_header {
height: 187px;
border-bottom: 1px solid #eee;
color: #8c9198;
font-size: 14px;
line-height: 19px;
background: #fff;
}
.personal_img {
width: 84px;
height: 84px;
}
.personal_img img {
width: 100%;
height: 100%;
border-radius: 50%;
}
/* 姓名 */
.personal_name {
margin: 12px 0 4px;
}
.personal_msg {
background: #fff;
}
.personal_li {
height: 44px;
line-height: 44px;
text-align: left;
font-size: 14px;
color: #8c9198;
}
.personal_pic {
margin: -3px 13px 0 23px;
width: 14px;
height: 15px;
}
.personal_li:hover {
background-color: #eee;
}
.blue_personal {
color: #409eff;
}
/* 右侧 */
.personal_r {
width: 996px;
float: right;
}
</style>