Profession.vue
8.7 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
<template>
<!-- 职业大全 -->
<div class="major_search clearfix">
<div class="major_box clearfix">
<!-- 搜索框 -->
<div class="search_input clearfix layout flex_row align_center">
<input type="text" placeholder="职业查询" v-model="professionCon" @keyup.enter="professionSearch()"/>
<div class="search_tips" @click="professionSearch()">搜索</div>
</div>
<!-- 热门职业 -->
<div class="hot_pro clearfix">
<div class="hot_major_title">热门职业:</div>
<div class="clearfix hot_profession">
<!-- 职业名称 -->
<div
class="hot_major_name"
v-for="item in hotList"
:key="item.id"
@click="hotProfession(item)"
>{{item.name}}</div>
</div>
</div>
<!-- 职业查找条件 -->
<div class="profess_condition layout flex_diection">
<!-- 兴趣代码查找 -->
<div class="condition_code layout flex_row align_left">
<div class="code_title">兴趣代码查找</div>
<div class="school_select pro_select layout flex_row align_center">
<div class="search_title">1-</div>
<el-select v-model="value">
<el-option
v-for="item in addressList"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</div>
<div class="school_select pro_select layout flex_row align_center">
<div class="search_title">2-</div>
<el-select v-model="value2">
<el-option
v-for="item in addressList"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</div>
<div class="school_select pro_select layout flex_row align_center">
<div class="search_title">3-</div>
<el-select v-model="value3">
<el-option
v-for="item in addressList"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</div>
<!-- 按钮 -->
<div class="code_btn" @click="search()">搜索</div>
</div>
<!-- 职业推荐查找 -->
<div class="condition_recommend clearfix">
<div class="code_title">职业推荐查找</div>
<div class="profession_box">
<div class="profession_det" v-for="item in list" :key="item.id" @click="hotProfession(item)">{{item.name}}</div>
</div>
</div>
</div>
<!-- 职业分类 -->
<h2>职业分类</h2>
<div class="clearfix">
<div class="classification layout flex_row justify">
<div
class="classific_box"
v-for="item in classificList"
:key="item.id"
@mouseenter="show(item)"
@mouseleave="hidden(item)"
>
<div class="classification_single layout flex_diection justify_center align_center">
<div class="classific_single_img">
<img :src="item.img" alt />
</div>
<div class="classific_single_content">{{item.sort_name}}</div>
</div>
<div class="mask" v-show="isMask == item.id">
<div class="mask_box">
<div
class="mask_profession"
v-for="items in item.child"
:key="items.id"
@click="professionIntro(items)"
>{{items.sort_name}}</div>
</div>
</div>
</div>
</div>
<div class="classification layout flex_row justify">
<div
class="classific_box"
v-for="item in classificList2"
:key="item.id"
@mouseenter="show(item)"
@mouseleave="hidden(item)"
>
<div class="classification_single layout flex_diection justify_center align_center">
<div class="classific_single_img">
<img :src="item.img" alt />
</div>
<div class="classific_single_content">{{item.sort_name}}</div>
</div>
<div class="mask" v-show="isMask == item.id">
<div class="mask_box">
<div
class="mask_profession"
v-for="items in item.child"
:key="items.id"
@click="professionIntro(items)"
>{{items.sort_name}}</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import { post } from "@/api/http";
export default {
data() {
return {
// 搜索内容
professionCon: "",
isChoice: 0,
// 热门专业列表
hotList: [],
value: "R",
value2: "",
value3: "",
addressList: [
{
value: "R",
label: "R型 (实际型)"
},
{
value: "I",
label: "I型 (传统型)"
},
{
value: "A",
label: "A型 (艺术型)"
},
{
value: "S",
label: "S型 (社会型)"
},
{
value: "E",
label: "E型 (企业型)"
},
{
value: "C",
label: "C型 (传统型)"
}
],
list: [],
// 遮罩层
isMask: "",
classificList: [],
classificList2: [],
};
},
methods: {
// 职业搜索
professionSearch(key) {
this.$router.push({ path: "/ProfessionIntroduc", query: { key: this.professionCon } });
},
// 职业介绍
professionIntro(item) {
localStorage.setItem("sortId",item.id);
localStorage.setItem("sortName",item.sort_name);
this.$router.push({ path: "/ProfessionIntroduc", query: { sort: item } });
},
// 职业分类遮罩层
show(item) {
this.isMask = item.id;
},
hidden() {
this.isMask = "";
},
// 热门职业
hotProfession(item) {
this.$router.push({ path: "/Occupation", query: { id: item.id } });
},
// 代码搜索
search() {
this.$router.push({
path: "/ProfessionByCode",
query: { interest: [this.value, this.value2, this.value3] }
});
},
// 热门及推荐职业
getHotAndRecommendList() {
let url = "/api/profession/getHotAndRecommendList/";
post(url).then(res => {
this.hotList = res.hot_list;
this.list = res.recommend_list;
});
},
// 职业分类列表
getSortList() {
let url = "/api/profession/getSortList/";
post(url).then(res => {
this.classificList = res.slice(0, 3);
for (let obj of this.classificList) {
switch (obj.id) {
case 1:
obj["img"] = require("../../../../assets/img/64.png");
break;
case 6:
obj["img"] = require("../../../../assets/img/67.png");
break;
case 11:
obj["img"] = require("../../../../assets/img/66.png");
break;
}
}
this.classificList2 = res.slice(3, 6);
for (let obj of this.classificList2) {
switch (obj.id) {
case 19:
obj["img"] = require("../../../../assets/img/63.png");
break;
case 25:
obj["img"] = require("../../../../assets/img/68.png");
break;
case 29:
obj["img"] = require("../../../../assets/img/65.png");
break;
}
}
});
}
},
mounted() {
this.getHotAndRecommendList();
this.getSortList();
}
};
</script>
<style scoped>
@import "../../../../style/schoolFirstPage.css";
@import "../../../../style/profession.css";
.hot_pro {
margin-left: 205px;
margin-top: 16px;
}
.hot_major_title {
float: left;
}
.hot_major_name {
float: left;
margin-bottom: 14px;
}
/* 职业分类 */
.classification {
margin-bottom: 16px;
}
.classification_single {
width: 389px;
height: 213px;
background: #fff;
border-radius: 3px;
}
.classific_single_content {
color: #0d1e2e;
font-size: 32px;
margin-top: 25px;
}
/* 单个 */
.classific_box {
position: relative;
}
.mask {
width: 389px;
height: 213px;
background-color: #000;
opacity: 0.8;
border-radius: 3px;
position: absolute;
top: 0;
left: 0;
}
.mask_box {
padding: 33px 30px;
}
.mask_profession {
float: left;
margin-right: 20px;
margin-bottom: 14px;
font-size: 16px;
color: #fff;
}
.mask_profession:hover {
color: #409eff;
}
</style>