MajorSearch.vue
5.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
<template>
<!-- 专业搜索 -->
<div class="major_search">
<div class="major_det_box">
<!-- 面包屑 -->
<div class="major_title layout align_left">
<el-breadcrumb separator="|">
<el-breadcrumb-item @click.native="toMajorIndex">首页</el-breadcrumb-item>
<el-breadcrumb-item>专业数据库</el-breadcrumb-item>
<el-breadcrumb-item class="last_brand">搜索“{{keyword == "" || keyword.trim().length ==0?'全部':keyword}}”</el-breadcrumb-item>
</el-breadcrumb>
</div>
<!-- 信息 -->
<div class="major_det_msg clearfix">
<!-- 左侧专业详情 -->
<div class="major_det_l">
<div class="major_l_box layout align_left flex_diection">
<!-- 学科名称 -->
<div class="layout justify align_center major_name">
<h1>搜索“{{keyword == "" || keyword.trim().length ==0?'全部':keyword}}”</h1>
</div>
<!-- 下属专业 -->
<div class="layout align_left flex_diection branch_box">
<div class="layout flex_diection similar_box">
<div class="branch_det" v-for="item in branchList" :key="item.id">
<h3
@click="majorDetail(item)"
>{{item.major_category == 1?"【本科】":"【专科】"}}{{item.name}}</h3>
<div class="branch_summary">{{item.introduce}}</div>
</div>
</div>
</div>
</div>
<!-- 分页 -->
<el-pagination
background
layout="prev, pager, next"
:page-count="total"
@current-change="handleCurrentChange"
></el-pagination>
</div>
<!-- 右侧跳转链接 -->
<div class="major_link_r clearfix">
<div class="link_img" @click="classify()">
<img src="@/assets/img/major2.png" alt />
</div>
<!-- 热门专业 -->
<div class="link_hot_major clearfix" v-show="botList.length>0">
<!-- 上层标题 -->
<div class="hot_major_top layout align_center">
<h2 class="white_h2">热门专业</h2>
</div>
<!-- 下层内容 -->
<div class="hot_major_bot clearfix">
<div
class="bot_content"
v-for="item in botList"
:key="item.id"
@click="hotMajor(item)"
>{{item.name}}</div>
</div>
</div>
<!-- 重点学科 -->
<div class="link_img" @click="discipline()">
<img src="@/assets/img/major3.png" alt />
</div>
<!-- 双一流学科 -->
<div class="link_img" @click="doubleFirst()">
<img src="@/assets/img/major4.png" alt />
</div>
<!-- 高校学科评估结果 -->
<div class="link_img" @click="assessResult()">
<img src="@/assets/img/major5.png" alt />
</div>
</div>
</div>
</div>
</div>
</template>
<script>
import { post } from "@/api/http";
export default {
data() {
return {
keyword: "",
// 专业名称
majorName: "",
// 概述
summary: "",
targets: "",
// 热门专业
botList: [],
// 下属专业
branchList: [],
// 分页
total: 0,
page: 1
};
},
methods: {
// 专业首页
toMajorIndex(){
this.$router.push({path:"/Major"})
},
// 分页
handleCurrentChange(val) {
this.page = val;
this.getMajorsSearchList();
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
},
// 专业详情
majorDetail(item) {
this.$router.push({ path: "/HotMajor", query: { id: item.id } });
},
// 热门专业
hotMajor(item) {
this.$router.push({ path: "/HotMajor", query: { id: item.id } });
},
// 教育部专业分类
classify() {
this.$router.push({ path: "/Major" });
},
// 重点学科
discipline() {
this.$router.push({ path: "/KeyDiscipline" });
},
// 双一流学科
doubleFirst() {
this.$router.push({ path: "/DoubleFirst" });
},
// 高校学科评估结果
assessResult() {
this.$router.push({ path: "/AssessResult" });
},
// 二级专业详情
getMajorsSearchList() {
let url = "/api/major/getMajorsSearchList/";
let params = {
keyword: this.keyword,
page: this.page
};
post(url, params).then(res => {
this.branchList = res.majors_list;
this.total = res.total_page;
});
},
// 热门专业
getHotList() {
let url = "/api/major/getHotList/";
post(url).then(res => {
this.botList = res.hot_list;
});
}
},
mounted() {
this.keyword = this.$route.query.keyWord;
this.getMajorsSearchList();
this.getHotList();
}
};
</script>
<style scoped>
@import "../../../../style/majorDetail.css";
@import "../../../../style/majorSearch.css";
.major_search {
background-color: #f2f5fa;
}
h1 {
position: relative;
}
h1::after {
content: "";
display: block;
width: 770px;
height: 1px;
background-color: #eee;
position: absolute;
bottom: -10px;
left: 0;
}
h3::before {
content: "";
display: block;
height: 14px;
width: 4px;
border-radius: 2px;
background-color: #409eff;
position: absolute;
left: -4px;
top: 5px;
}
.similar_box {
margin-left: 14px;
}
.branch_box {
width: 100%;
}
</style>