University.vue
17.0 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
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
<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="universityName"
@keyup.enter="universitySearch()"
/>
<div class="search_tips" @click="universitySearch()">搜索</div>
</div>
<!-- 热门大学 -->
<div class="hot_major clearfix">
<div class="hot_major_title">热门大学:</div>
<!-- 大学名称 -->
<div
class="hot_major_name"
v-for="item in hotList"
:key="item.id"
@click="toUniversity(item)"
>{{item.name}}</div>
</div>
<!-- 院校地区 -->
<div class="university_address clearfix">
<div class="university_title">院校地区</div>
<div class="clearfix university_provinces">
<div
:class="{university_province_hover:isAddress == item.id}"
class="university_province"
v-for="item in addressList"
:key="item.id"
@click="changeAdd(item)"
>{{item.city_name}}</div>
</div>
</div>
<!-- 学校类别 -->
<div class="university_address clearfix">
<div class="university_title">学校类别</div>
<div class="clearfix university_provinces">
<div
:class="{university_province_hover:isType == item.id}"
class="university_province"
v-for="item in typeList"
:key="item.id"
@click="changeType(item)"
>{{item.type_name}}</div>
</div>
</div>
<!-- 办学性质 -->
<div class="university_address clearfix">
<div class="university_title">办学性质</div>
<div class="clearfix university_provinces">
<div
:class="{university_province_hover:isNatrue == item.id}"
class="university_province"
v-for="item in natrueList"
:key="item.id"
@click="changeNatrue(item)"
>{{item.nature_name}}</div>
</div>
</div>
<!-- 学历层次 -->
<div class="university_address clearfix">
<div class="university_title">学历层次</div>
<div class="clearfix university_provinces">
<div
:class="{university_province_hover:isRecord == item.id}"
class="university_province"
v-for="item in recordList"
:key="item.id"
@click="changeRecord(item)"
>{{item.record_name}}</div>
</div>
</div>
<!-- 特别属性 -->
<div class="university_address clearfix">
<div class="university_title">特别属性</div>
<div class="clearfix university_provinces">
<div
:class="{university_province_hover:isSort == item.id}"
class="university_province"
v-for="item in sortList"
:key="item.id"
@click="changeSort(item)"
>{{item.sort_name}}</div>
</div>
</div>
<!-- 分数查询 -->
<div class="university_address clearfix">
<div class="clearfix">
<div class="university_title">分数查询</div>
<div class="clearfix university_provinces school_select">
<div class="search_select layout flex_row align_center">
<div class="search_title">招生地区:</div>
<el-select v-model="city" @change="getCityId">
<el-option
v-for="item in addressList"
:key="item.city_name"
:label="item.city_name"
:value="item.id"
></el-option>
</el-select>
</div>
<div class="search_select layout flex_row align_center">
<div class="search_title">查询年份:</div>
<el-select v-model="year">
<el-option
v-for="(item,index) in yearList"
:key="index"
:label="item.year"
:value="item.year"
></el-option>
</el-select>
</div>
<div class="search_select layout flex_row align_center">
<div class="search_title">类别:</div>
<el-select v-model="type" @change="getType">
<el-option
v-for="item in branchList"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</div>
<div class="search_select layout flex_row align_center">
<div class="search_title">批次:</div>
<el-select v-model="batch" placeholder="不限">
<el-option
v-for="item in batchList"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</div>
<div class="search_select layout flex_row align_center">
<div class="search_title">高考总分:</div>
<input type="text" v-model="score" />
<div class="university_tips">
<i v-show="!score">请填写高考总分</i>(*筛选出录取记录分数低于所填分数的学校)
</div>
</div>
</div>
</div>
<!-- 已选成绩 -->
<div class="choiced_selection" v-show="isSelect">
{{province}} / {{year}} / 高考总分{{score}} / {{stand}}
<i
class="delete_symbol"
@click="showSelect"
>×</i>
</div>
<!-- 分数查询按钮 -->
<div class="choice_btn layout align_center justify_center">
<!-- 按最低分查 -->
<div class="choice_btn_l" @click="miniScore()">{{miniCon}}</div>
<!-- 按平均分查 -->
<div class="choice_btn_r" @click="average()">{{averageCon}}</div>
</div>
</div>
<!-- 搜索结果 -->
<div class="university_search_result" id="search">
<!-- 结果标题 -->
<div class="university_result_title layout align_left flex_row">
<!-- 图标 -->
<div class="result_icon">
<img src="@/assets/img/23.png" alt />
</div>
<div class="result_tip">搜索结果</div>
<div>
共
<i class="university_num">{{totalNum}}</i>所院校
</div>
</div>
<!-- 搜索的院校 -->
<div
class="searched_university layout flex_diection"
v-show="resultList.length"
v-for="item in resultList"
:key="item.id"
>
<div class="layout flex_row justify">
<!-- 院校 -->
<div class="layout flex_row university_msg" @click="toUniversity(item)">
<!-- 院校logo -->
<div class="university_logo clearfix">
<img :src="item.images" alt />
</div>
<!-- 院校信息 -->
<div class="university_det_msg layout flex_diection justify align_left">
<div class="university_name layout align_center flex_row">
<i class="university_hover_color">{{item.name}}</i>
<i class="nine" v-show="item.is_985 == 1">985</i>
<i class="two" v-show="item.is_211 == 1">211</i>
</div>
<div>
中国校友会排名:
<img src="@/assets/img/54.png" alt v-show="item.rank==1" />
<img src="@/assets/img/55.png" alt v-show="item.rank==2" />
<img src="@/assets/img/53.png" alt v-show="item.rank==3" />
<i v-show="item.rank>3">{{item.rank}}</i>
<i v-show="item.rank==0">-</i>
</div>
<div>学校类别:{{item.type_name?item.type_name:'-'}}</div>
<div>隶属单位:{{item.belong?item.belong:'-'}}</div>
<div class="clearfix">
<div class="advantage_title">专业优势:</div>
<div class="advantage">{{item.profession?item.profession:'-'}}</div>
</div>
</div>
</div>
<!-- 录取情况 -->
<div
class="university_det_msg university_enroll layout flex_diection justify align_left"
v-show="item.batch"
>
<div class="university_name">{{year}} {{province}} {{typeName}} 录取情况</div>
<div>批次:{{item.batch}}</div>
<div>平均分:{{item.average}}</div>
<div>最低分:{{item.min}}</div>
</div>
<!-- 收藏 -->
<div
class="university_collection"
:class="{university_collectioned:item.is_favorite }"
@click="joinCollect(item)"
>{{item.is_favorite ?"已收藏":"收藏"}}</div>
</div>
<!-- 学校联系方式 -->
<div class="university_contact layout flex_row align_center" v-show="isSelect">
<div>
<img src="@/assets/img/43.png" alt class="university_contact_icon" />
学校地址:{{item.address?item.address:'-'}}
</div>
<div class="university_phone">
<img src="@/assets/img/42.png" alt class="university_contact_icon" />
联系方式:{{item.phone?item.phone:'-'}}
</div>
<div>
<img src="@/assets/img/41.png" alt class="university_contact_icon" />
电子邮箱:{{item.email?item.email:'-'}}
</div>
</div>
</div>
<!-- 分页 -->
<el-pagination
background
layout="prev, pager, next"
:page-count="total"
:current-page = "page"
@current-change="handleCurrentChange"
></el-pagination>
</div>
</div>
</div>
</template>
<script>
import { post } from "@/api/http";
export default {
data() {
return {
// 搜索院校名称
universityName: "",
// 分页
total: 0,
totalNum: "",
isSelect: false,
major_name: "",
isChoice: 0,
isUnder: true,
// 热门学校列表
hotList: [],
// 地区
addressList: [],
addressList: [],
isAddress: "",
// 学校类别
typeList: [],
isType: "",
// 办学性质
natrueList: [],
isNatrue: "",
// 学历层次
recordList: [],
isRecord: "",
// 特别属性
sortList: [],
isSort: "",
city: 3,
province: "天津市",
provinceId: "3",
year: "2018",
type: 1,
typeName: "理科",
batch: "",
stand: "",
// 分数
score: "",
searchId: "",
// 平均分
averageCon: "按平均分查询",
// 最低分
miniCon: "按最低分查询",
// 查询年份
yearList: [],
// 类别
branchList: [],
// 批次
batchList: [],
resultList: [],
page: 1
};
},
methods: {
// 收藏/取消收藏
joinCollect(item) {
let url = "/api/common/favorite";
let params = {
object_id: item.id,
type: 1
};
post(url, params).then(res => {
item.is_favorite = !item.is_favorite;
});
},
// 分页
handleCurrentChange(val) {
this.page = val;
this.getSchoolList();
document.getElementById("search").scrollIntoView();
},
// 院校地区
changeAdd(item) {
this.isAddress = item.id;
this.page = 1;
this.getSchoolList();
},
// 学校类别
changeType(item) {
this.isType = item.id;
this.page = 1;
this.getSchoolList();
},
// 办学性质
changeNatrue(item) {
this.isNatrue = item.id;
this.page = 1;
this.getSchoolList();
},
// 学历层次
changeRecord(item) {
this.isRecord = item.id;
this.page = 1;
this.getSchoolList();
},
// 特别属性
changeSort(item) {
this.isSort = item.id;
this.page = 1;
this.getSchoolList();
},
// 分数查询
// 招生地区
getCityId(id) {
let obj = {};
obj = this.addressList.find(item => {
return item.id === id;
});
this.province = obj.city_name;
this.provinceId = obj.id;
},
// 类别
getType(id) {
let obj = {};
obj = this.branchList.find(item => {
return item.id === id;
});
this.typeName = obj.name;
},
// 最低分
miniScore() {
this.stand = this.miniCon;
if (this.score) {
this.searchId = 1;
this.isSelect = true;
this.page = 1;
this.getSchoolList();
}
},
// 平均分
average() {
this.stand = this.averageCon;
if (this.score) {
this.searchId = 2;
this.isSelect = true;
this.page = 1;
this.getSchoolList();
}
},
// 大学院校列表
getSchoolList() {
let url = "/api/school/getSchoolList/";
let params = {
city_id: this.isAddress,
school_type_id: this.isType,
nature_id: this.isNatrue,
school_record_id: this.isRecord,
sort_id: this.isSort,
province_id: this.provinceId,
year: this.year,
branch: this.type,
batch: this.batch,
score: this.score,
search_sort: this.searchId,
page: this.page
};
post(url, params).then(res => {
this.resultList = res.school_list;
// 总页数
this.total = res.total_page;
// 总数
this.totalNum = res.school_count;
});
},
// 分数选择 ×号
showSelect() {
this.isSelect = false;
this.getSchoolList();
},
// 大学详情
toUniversity(item) {
this.$router.push({
path: "/UniversityIntroduc",
query: { id: item.id }
});
},
// 搜索
universitySearch() {
this.$router.push({
path: "/UniversitySearch",
query: { keyWord: this.universityName }
});
},
// 筛选条件数据
getSchoolSearch() {
let url = "/api/school/getSchoolSearch/";
post(url).then(res => {
// 地区
this.addressList = res.city;
this.addressList.unshift({id:"",city_name:"不限"});
// 学校类别
this.typeList = res.type;
this.typeList.unshift({id:"",type_name:"不限"});
// 办学性质
this.natrueList = res.natrue;
this.natrueList.unshift({id:"",nature_name:"不限"});
// 学历层次
this.recordList = res.record;
this.recordList.unshift({id:"",record_name:"不限"});
// 特别属性
this.sortList = res.sort;
this.sortList.unshift({id:"",sort_name:"不限"});
// 年份
this.yearList = res.year;
// 类别
this.branchList = res.branch;
// 批次
this.batchList = res.batch;
let obj = {};
obj["id"] = "";
obj["name"] = "不限";
this.batchList.unshift(obj);
});
},
// 热门学校列表
getHotList() {
let url = "/api/school/getHotList/";
post(url).then(res => {
this.hotList = res.hot_list;
});
}
},
mounted() {
this.getHotList();
this.getSchoolSearch();
this.getSchoolList();
}
};
</script>
<style scoped>
@import "../../../../style/schoolFirstPage.css";
.major_search {
font-size: 14px;
color: #8c9198;
}
.hot_major {
margin-bottom: 32px;
}
/* 院校地址 */
.university_address {
padding: 22px;
background-color: #fff;
margin-top: 20px;
}
.university_title {
font-weight: bold;
color: #34485e;
font-size: 16px;
line-height: 30px;
margin-right: 36px;
float: left;
}
/* 省份 */
.university_provinces {
float: right;
width: 1056px;
}
.university_province {
width: 92px;
height: 32px;
text-align: center;
line-height: 32px;
border-radius: 3px;
float: left;
margin-right: 4px;
}
.university_province_hover {
color: #fff;
background-color: #409eff;
}
/* 招生查询 */
.search_select {
float: left;
margin-right: 72px;
margin-bottom: 19px;
}
.search_title {
margin-right: 20px;
}
.university_tips {
color: #f44a5e;
font-size: 12px;
margin-left: 7px;
}
/* 已选成绩 */
.choiced_selection {
margin-left: 100px;
text-align: left;
color: #409eff;
width: 369px;
height: 30px;
line-height: 30px;
background-color: #f2f5fa;
padding-left: 17px;
}
/* ×号 */
.delete_symbol {
float: right;
margin-right: 9px;
font-size: 6px;
color: #8c9198;
}
/* 分数查询按钮 */
.choice_btn {
width: 100%;
margin: 0 auto;
margin-top: 30px;
}
.choice_btn_l,
.choice_btn_r {
width: 185px;
height: 40px;
background-color: #409eff;
text-align: center;
line-height: 40px;
color: #fff;
border-radius: 3px;
}
.choice_btn_l {
margin-right: 180px;
}
.university_hover_color:hover {
color: #409eff;
}
</style>