38 lines
1.3 KiB
JavaScript
38 lines
1.3 KiB
JavaScript
export const goDetail = (news, navTitle, navPath, router) => {
|
|
console.log(news)
|
|
// 只要有链接就跳转
|
|
if(news.newsContentLink) {
|
|
window.open(news.newsContentLink);
|
|
return;
|
|
}
|
|
|
|
// 文章
|
|
if(news.newsContentType === '1') {
|
|
router.push(`/newsViewDetailText/${news.newsContentId}?navTitle=${navTitle}&navPath=${encodeURIComponent(navPath)}`)
|
|
return;
|
|
}
|
|
// 图片
|
|
if(news.newsContentType === '2') {
|
|
router.push(`/newsViewDetailImage/${news.newsContentId}?navTitle=${navTitle}&navPath=${encodeURIComponent(navPath)}`)
|
|
return;
|
|
}
|
|
// 音频
|
|
if(news.newsContentType === '3') {
|
|
router.push(`/newsViewDetailAudio/${news.newsContentId}?navTitle=${navTitle}&navPath=${encodeURIComponent(navPath)}`)
|
|
return;
|
|
}
|
|
// 视频
|
|
if(news.newsContentType === '4') {
|
|
router.push(`/newsViewDetailVideo/${news.newsContentId}?navTitle=${navTitle}&navPath=${encodeURIComponent(navPath)}`)
|
|
return;
|
|
}
|
|
// PDF
|
|
if(news.newsContentType === '5') {
|
|
router.push(`/newsViewDetailPdf/${news.newsContentId}?navTitle=${navTitle}&navPath=${encodeURIComponent(navPath)}`)
|
|
return;
|
|
}
|
|
// 链接
|
|
if(news.newsContentType === '6') {
|
|
return;
|
|
}
|
|
} |