Top.vue
10.3 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
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
<template>
<!-- 头部 -->
<div class="wrap">
<div class="main layout justify align_center">
<!-- logo -->
<div class="logo">
<img src="@/assets/img/3.png" alt />
</div>
<!-- 导航栏 -->
<div class="nav">
<ul class="nav_ul layout align_center justify" v-show="groupId == 1 || groupId == 2">
<li class="nav_ul_li" :class="{nav_border:num == 0}" @click="change(0)">首页</li>
<li class="nav_ul_li" :class="{nav_border:num == 1}" @click="change(1)">生涯测评</li>
<li
class="nav_ul_li"
:class="{nav_border:num == 2}"
@click="change(2)"
v-show="groupNumber == 1||groupNumber == ''"
>选课建议</li>
<li
class="nav_ul_li"
:class="{nav_border:num == 3}"
@click="change(3)"
@mouseenter="showWis()"
@mouseleave="hiddenWis()"
>
智慧选校
<div class="nav_icon icon_block"></div>
<ol class="wisdom" v-show="isWis">
<li
v-for="(item,index) in wisdomList"
:key="index"
:class="{wisdom_choice:isWisdom == index}"
@click="toWisdom(index)"
>{{item}}</li>
</ol>
</li>
<li
class="nav_ul_li"
:class="{nav_border:num == 4}"
@click="change(4)"
@mouseenter="showStu()"
@mouseleave="hiddenStu()"
>
生涯学习
<div class="nav_icon icon_block"></div>
<ol class="study" v-show="isStu">
<li
v-for="(item,index) in studyList"
:class="{wisdom_choice:isCareer == index || isCareerTop == index}"
:key="index"
@click="toCareer(index)"
>{{item}}</li>
</ol>
</li>
</ul>
<ul class="nav_ul layout align_center justify" v-show="groupId == 3">
<li class="nav_ul_li" :class="{nav_border:num == 0}" @click="change(0)">首页</li>
<li class="nav_ul_li" :class="{nav_border:num == 1}" @click="change(1)">学生测评</li>
<li class="nav_ul_li" :class="{nav_border:num == 2}" @click="change(2)">学生列表</li>
<li
class="nav_ul_li"
:class="{nav_border:num == 3}"
@click="change(3)"
@mouseenter="showWis()"
@mouseleave="hiddenWis()"
>
智慧选校
<div class="nav_icon icon_block"></div>
<ol class="wisdom" v-show="isWis">
<li
v-for="(item,index) in wisdomList"
:class="{wisdom_choice:isWisdom == index}"
:key="index"
@click="toWisdom(index)"
>{{item}}</li>
</ol>
</li>
<li
class="nav_ul_li"
:class="{nav_border:num == 4}"
@click="change(4)"
@mouseenter="showStu()"
@mouseleave="hiddenStu()"
>
生涯学习
<div class="nav_icon icon_block"></div>
<ol class="study" v-show="isStu">
<li
v-for="(item,index) in studyList"
:class="{wisdom_choice:isCareer == index || isCareerTop == index}"
:key="index"
@click="toCareer(index)"
>{{item}}</li>
</ol>
</li>
</ul>
</div>
<!-- 未登录 -->
<div class="name layout align_center justify" v-show="login_or" @click="outLogin">
<div class="pic_box">
<img src="../../assets/img/106.png" alt />
</div>
<p class="name_status">未登录</p>
</div>
<!-- 登录 -->
<div class="name layout align_center justify" v-show="!login_or">
<div class="pic_box">
<img :src="headImg" alt />
</div>
<p class="name_status">{{nickName}}</p>
<p class="name_status personal" :class="{personal_color:isBlue == 1}" @click="Personal">个人中心</p>
<p class="sign_out" @click="outLogin">退出</p>
</div>
</div>
</div>
</template>
<script>
import { post } from "@/api/http";
export default {
props: ["active", "isPersonal","isCareerTop"],
data() {
return {
// 是否登陆
login_or: true,
isWis: false,
isStu: false,
num: -1,
wisdomList: ["大学专业", "大学院校", "职业大全"],
studyList: ["推荐书籍", "生涯案例", "生涯故事", "视频资源"],
nickName: "",
headImg: "",
isBlue: 0,
// 身份判断
groupId: "",
groupNumber: "",
isWisdom: -1,
isCareer: -1
};
},
methods: {
// 跳转 改变颜色
change: function(index) {
// localStorage.removeItem("wisdomIndex");
// localStorage.removeItem("careerIndex");
if (this.groupId == 3) {
// 教师端
if (localStorage.getItem("userName")) {
this.num = index;
switch (index) {
case 0:
this.$router.push({ path: "/Index", query: { active: 0 } });
break;
case 1:
this.$router.push({ path: "/StudentEvalute" });
break;
case 2:
this.$router.push({ path: "/StudentList" });
break;
}
}
} else {
if (localStorage.getItem("userName")) {
this.num = index;
switch (index) {
case 0:
this.$router.push({ path: "/Index", query: { active: 0 } });
break;
case 1:
this.$router.push({ path: "/Evalution" });
break;
case 2:
this.$router.push({ path: "/CourseSuggest" });
break;
}
}
}
},
// 智慧选校下属跳转
toWisdom(index) {
this.isWisdom = index;
localStorage.setItem("wisdomIndex",index);
switch (index) {
case 0:
this.$router.push({ path: "/Major", query: { isNav: 0 } });
break;
case 1:
this.$router.push({ path: "/University", query: { isNav: 1 } });
break;
case 2:
this.$router.push({ path: "/Profession", query: { isNav: 2 } });
break;
}
},
// 生涯学习下属
toCareer(index) {
this.isCareer = index;
this.isCareerTop = -1;
this.$store.commit("changeStatus",this.isCareer)
localStorage.setItem("careerIndex",index);
switch (index) {
case 0:
this.$router.push({ path: "/CareerLearn", query: { isNav: 0 } });
break;
case 1:
this.$router.push({ path: "/CareerLearn", query: { isNav: 1 } });
break;
case 2:
this.$router.push({ path: "/CareerLearn", query: { isNav: 2 } });
break;
case 3:
this.$router.push({ path: "/VideoSource", query: { isNav: 0 } });
break;
}
},
showWis: function() {
this.isWis = true;
},
hiddenWis: function() {
this.isWis = false;
},
showStu: function() {
this.isStu = true;
},
hiddenStu: function() {
this.isStu = false;
},
// 个人中心
Personal: function() {
this.isBlue = 1;
this.num = -1;
this.$router.push({ path: "/personal" });
},
// 退出
outLogin: function() {
post("/api/common/logout").then(res => {
let test = localStorage.getItem("schoolSymbol");
localStorage.clear();
this.$router.push({ path: "/login/" + test });
});
}
},
mounted() {
// this.isCareer = localStorage.getItem("careerIndex");
this.isWisdom = localStorage.getItem("wisdomIndex");
if (this.active >= 0) {
this.num = this.active;
}
this.groupId = localStorage.getItem("groupId");
},
created() {
this.groupNumber = localStorage.getItem("groupNumber");
this.num = this.$route.query.active;
this.nickName = localStorage.getItem("nickName");
this.headImg = localStorage.getItem("headImg");
if (localStorage.getItem("userId")) {
this.login_or = false;
}
this.isBlue = this.isPersonal;
if(this.$route.query.isCareerTop){
this.isCareerTop = this.$route.query.isCareerTop;
this.isCareer = -1;
}else{
this.isCareer = this.$store.state.isCareer ;
}
// console.log(this.isCareerTop,"首页")
},
watch:{
isCareer(newV,oldV){
// console.log(newV,oldV,"首页")
if(newV == 3){
this.isCareer = newV
}else{
this.isCareer = -1
}
}
},
};
</script>
<style scoped>
.wrap {
width: 100%;
background-color: #fff;
}
.main {
width: 1200px;
height: 100px;
margin: 0 auto;
}
/* logo */
.logo {
width: 173px;
height: 58px;
}
.logo img {
width: 100%;
height: 100%;
}
/* 导航栏 */
.nav_ul {
font-size: 18px;
width: 687px;
height: 100px;
color: #06121e;
}
.nav_ul_li {
width: 120px;
height: 98px;
border-bottom: 2px solid #fff;
line-height: 100px;
position: relative;
}
.nav_border {
border-bottom: 2px solid #409eff !important;
color: #409eff;
}
.position_li {
position: relative;
}
/* 智慧选校 */
.wisdom {
width: 120px;
height: 161px;
z-index: 9999;
background: rgba(255, 255, 255, 1);
position: relative;
}
/* 生涯学习 */
.study {
width: 120px;
height: 214px;
background: rgba(255, 255, 255, 1);
z-index: 9999;
border-radius: 0px 0px 3px 3px;
position: relative;
}
.wisdom li,
.study li {
font-size: 18px;
color: #8c9198;
line-height: 50px;
z-index: 888;
}
.wisdom_choice {
background-color: #eeeeee;
}
/* 向下箭头 */
.nav_icon {
position: absolute;
top: 43px;
right: 0;
width: 15px;
height: 15px;
background-image: url("../../assets/img/105.png");
background-size: contain;
background-position: 0 0;
background-repeat: no-repeat;
margin-left: 10px;
display: none;
}
.icon_block {
display: block;
}
/* 登录人 */
.pic_box {
width: 40px;
height: 40px;
border-radius: 50%;
}
.pic_box img {
width: 100%;
height: 100%;
border-radius: 50%;
}
.name_status {
font-size: 14px;
color: #5b5e63;
margin-left: 10px;
margin-right: 14px;
}
.personal {
margin-left: 0;
}
.personal_color {
color: #409eff;
}
/* 退出 */
.sign_out {
font-size: 14px;
color: #bdc4ce;
}
</style>