CareerDetail.vue
7.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
<template>
<!--详情页 -->
<div class="career_detail">
<Top :active="active"></Top>
<div class="career_det_wrap">
<!-- 面包屑 -->
<div class="major_title layout align_left">
<el-breadcrumb separator="|">
<el-breadcrumb-item>首页</el-breadcrumb-item>
<el-breadcrumb-item>学习资源</el-breadcrumb-item>
<el-breadcrumb-item>{{detList.type == 1?"推荐书籍":detList.type == 2?"生涯案例":"生涯故事"}}</el-breadcrumb-item>
<el-breadcrumb-item>{{detList.name}}</el-breadcrumb-item>
</el-breadcrumb>
</div>
<div class="career_det_box clearfix">
<!-- 左侧 -->
<div class="career_det_l">
<div class="career_l_box">
<!-- 书籍信息 -->
<div class="book_msg layout flex_row">
<dl>
<dt>
<img :src="detList.image" alt />
</dt>
<dd class="layout flex_row align_left" @click="collect()">
<div class="career_l_img">
<img :src="isFavorite == 0?src1:src2" alt />
</div>
<i class="career_collect">收藏</i>
</dd>
</dl>
<div class="book_det_msg layout flex_diection align_left">
<div class="book_title">{{detList.name}}</div>
<div class="book_source">
{{detList.author}}
<i>{{detList.createtime | date}}</i>
</div>
<div class="book_source">标签:{{detList.sign}}</div>
<div class="book_other">{{detList.description}}</div>
</div>
</div>
<!-- 书籍介绍 -->
<div class="book_introduc" v-html="detList.content"></div>
<!-- 附件 -->
<div class="book_annex" v-if="showfujian">
<div class="book_annex_top">附件:</div>
<div class="book_annex_bot">
<div class="annex_bot_single layout flex_row justify align_center" v-show="detList.files">
<div>{{detList.name}}</div>
<div class="layout">
<div class="annex_btn" @click="previewSource()">在线预览</div>
<div class="annex_btn" @click="downSource()">下载资源</div>
</div>
</div>
<div class="annex_bot_single single_tips">*部分浏览器无法在线预览,请升级浏览器版本或下载资源阅读</div>
</div>
</div>
</div>
</div>
<!-- 右侧 -->
<div class="career_det_r">
<dl class="dl_r_list" v-for="(item,index) in resourseList" :key="index" @click="showDet(item)">
<dt>
<img :src="item.image" alt />
</dt>
<dd class="other_book_msg">
<p class="other_title">{{item.name}}</p>
<span class="other_intro">{{item.description}}</span>
</dd>
</dl>
</div>
</div>
</div>
<Bottom2></Bottom2>
<!-- 报告详情预览 -->
<PreviewDialog :previewVisible.sync="previewVisible" :reportId="reportId" :type="type" v-if="previewVisible"></PreviewDialog>
</div>
</template>
<script>
// 详情预览
import PreviewDialog from "../SchoolSelection/University/PreviewDialog";
import pdf from "vue-pdf";
import Top from "../../common/Top";
import Bottom2 from "../../common/Bottom2";
import { post } from "@/api/http";
export default {
data() {
return {
previewVisible:false,
active: 4,
id: "",
detList: [],
isFavorite: "",
src1: require("../../../assets/img/career.png"),
src2: require("../../../assets/img/star1.png"),
// 推荐资源
resourseList: [],
// pdf文件
pdfSrc:"",
showfujian:true
};
},
methods: {
showDet(item) {
this.id = item.id;
this.getBooksDetail();
},
// 收藏/取消收藏
collect() {
let url = "/api/common/favorite";
let params = {
object_id: this.detList.id,
type: 4
};
post(url, params).then(res => {
this.isFavorite = !this.isFavorite;
});
},
// 预览文档
previewSource(){
this.previewVisible = true;
this.reportId = this.id;
this.type = 2;
},
// 下载文档
downSource(){
window.open(this.pdfSrc,"_blank");
},
// 学习资源详情
getBooksDetail() {
let url = "/api/resource/getBooksDetail/";
let params = {
id: this.id
};
post(url, params).then(res => {
this.detList = res;
this.pdfSrc = res.files;
this.isFavorite = res.is_favorite;
if(res.files.length == 0){
this.showfujian = false
}
});
},
// 学习资源推荐数据
getRecommendList() {
let url = "/api/resource/getRecommendList/";
post(url).then(res => {
this.resourseList = res.res_list;
});
}
},
components: {
Top,
Bottom2,
pdf,
PreviewDialog
},
mounted() {
this.id = this.$route.query.id;
this.getBooksDetail();
this.getRecommendList();
},
watch:{
'$route'(to,from){
this.id = this.$route.query.id;
this.getBooksDetail();
}
},
};
</script>
<style scoped>
.career_detail {
background-color: #f2f5fa;
width: 100%;
}
.career_det_wrap {
width: 1200px;
margin: 0 auto;
font-size: 14px;
color: #8c9198;
}
.career_det_box {
width: 1200px;
}
/* 左侧 */
.career_det_l {
float: left;
width: 844px;
background-color: #fff;
}
.career_l_box {
padding: 26px;
}
dt {
width: 248px;
height: 146px;
margin: 0;
padding: 0;
}
dt img {
width: 100%;
height: 100%;
}
dd {
margin-top: 17px;
}
.career_l_img {
width: 20px;
height: 18px;
line-height: 12px;
margin-right: 5px;
}
.career_l_img img {
width: 100%;
height: 100%;
}
.career_collect {
line-height: 19px;
}
/* 书籍信息 */
.book_det_msg {
margin-left: 38px;
}
.book_title {
color: #34485e;
font-size: 18px;
margin-bottom: 14px;
text-align: left
}
.book_source {
margin-bottom: 14px;
}
.book_source i {
margin-left: 40px;
}
.book_other {
color: #5b5e63;
width: 506px;
text-align: left;
}
/* 书籍介绍 */
.book_introduc {
margin: 23px 0 29px 0;
text-align: left;
}
/* 附件 */
.book_annex_top {
color: #5b5e63;
position: relative;
text-align: left;
}
/* .book_annex_top::after{
position: absolute;
content: "";
display: block;
width:744px;
height:0;
border:1px dashed #E6E6E6;
bottom:5px;
right:3px;
} */
.book_annex_bot {
margin-top: -5px;
}
.annex_bot_single {
width: 744px;
border-top: 1px dashed #e6e6e6;
margin-left: 42px;
color: #409eff;
}
.annex_btn {
padding: 5px 28px;
border: 1px solid #409eff;
border-radius: 3px;
margin: 9px 0 9px 19px;
}
.single_tips {
font-size: 12px;
color: #8c9198;
text-align: left;
padding-top: 15px;
}
/* 右侧 */
.career_det_r {
float: right;
padding: 35px 46px;
background-color: #fff;
}
.dl_r_list{
margin-bottom: 20px;
}
.other_book_msg {
width: 248px;
text-align: left;
}
.other_title {
font-size: 18px;
color: #34485e;
text-align: center;
margin-bottom: 10px;
}
.other_intro {
font-size: 12px;
}
dl:hover .other_title {
color: #409eff;
}
</style>