ProfessionByCode.vue
5.9 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
<template>
<div class="profession_by_code">
<div class="profession_code_box">
<!-- 职业查找条件 -->
<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="codeSearch()" >搜索</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>搜索<i class="search_code">“{{value}}{{value2}}{{value3}}型”</i></h2>
<!-- 搜索到的结果 -->
<div class="search_result layout flex_diection" v-show="item.id" v-for="item in codeList" :key="item.id">
<div class="result_title" @click="hotProfession(item)">
{{item.name}}
<i>{{item.interest}}</i>
</div>
<div class="profession_explain">{{item.introduce}}</div>
</div>
<div class="no_content" v-show="!codeList">暂无数据</div>
<!-- 分页 -->
<div class="pagation" v-show="codeList">
<el-pagination
background
layout="prev, pager, next"
:page-count="totalPage"
@current-change="handleCurrentChange"
></el-pagination>
</div>
</div>
</div>
</template>
<script>
import { post } from "@/api/http";
export default {
data() {
return {
value: "",
value2: "",
value3: "",
totalPage:0,
page: 1,
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: [],
codeList: [],
interestArr: [],
};
},
methods: {
// 分页
handleCurrentChange(val) {
this.page = val;
this.getSearchList();
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
},
// 推荐职业
getHotAndRecommendList() {
let url = "/api/profession/getHotAndRecommendList/";
post(url).then(res => {
this.list = res.recommend_list;
});
},
// 职业详情
hotProfession(item) {
this.$router.push({ path: "/Occupation", query: { id: item.id } });
},
// 根据兴趣代码搜索
codeSearch(){
this.interestArr = [];
this.interestArr.push(this.value,this.value2,this.value3)
this.getSearchList();
},
// 筛选职业
getSearchList() {
let str = "";
str = this.interestArr.toString();
let strCode = "";
strCode = str.replace(/,/g, " ");
let url = "/api/profession/getSearchList/";
let params = {
interest: strCode,
page: this.page
};
post(url, params).then(res => {
this.totalPage = res.total_page;
this.codeList = res.profession_list;
});
}
},
mounted() {
this.interestArr = this.$route.query.interest;
this.getSearchList();
this.value = this.interestArr[0];
this.value2 = this.interestArr[1];
this.value3 = this.interestArr[2];
this.getHotAndRecommendList();
}
};
</script>
<style scoped>
@import "../../../../style/profession.css";
.profession_by_code {
width: 100%;
background-color: #f2f5fa;
}
.profession_code_box {
width: 1200px;
margin: 0 auto;
padding-top: 36px;
}
.profess_condition {
margin-top: 0;
}
h2 {
margin-bottom: 0;
}
.search_result {
margin: 0 auto;
width: 1200px;
background-color: #fff;
text-align: left;
margin-top: 20px;
}
/* .search_result:hover{
background-color: #f1f2f1;
} */
.search_result:hover .result_title{
color:#409eff;
}
.result_title {
font-weight: bold;
font-size: 16px;
color: #34485e;
border-bottom: 1px solid #eee;
padding: 14px;
}
.result_title i {
color: #409eff;
}
.profession_explain {
font-size: 14px;
color: #8c9198;
padding: 14px;
}
.pagation{
margin-top:34px;
/* text-align: right; */
}
/* 搜索的代码 */
.search_code{
color: #409eff;
margin-left:10px;
}
/* 暂无数据 */
.no_content{
text-align: left;
font-size:14px;
color: #34485E;
margin-top:34px;
}
</style>