Files
learning-system-portal/src/views/portal/case/Detail.vue
2022-06-08 15:50:26 +08:00

500 lines
16 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div id="case-list-content">
<portal-header current="case" :goSearch="2"></portal-header>
<div class="portal-content xcontent" style="margin-top: 30px;">
<el-breadcrumb separator-class="el-icon-arrow-right" class="breadcrumb-nav">
<el-breadcrumb-item :to="{ path: '/case' }">案例列表</el-breadcrumb-item>
<el-breadcrumb-item>案例详情</el-breadcrumb-item>
</el-breadcrumb>
<div class="xrow" style="display: flex;justify-content: space-between;">
<div style="flex: 1;">
<el-row :gutter="10">
<el-col :span="24">
<el-card :body-style="{ padding: '0px' }" class="detail">
<div class="title">{{ caseDetail.title }}</div>
<div class="label">
<author :onlyAvatar="true" :avatar="authorInfo.avatar" :sex="authorInfo.sex" ></author>
<span>作者{{ authorInfo.name }}</span>
<span>工号{{ authorInfo.code }}</span>
<span>部门{{ authorInfo.orgInfo }}</span>
<!-- <span>案例编号{{ caseDetail.id }}</span> -->
<span v-if="caseDetail.sysCreateTime">{{ caseDetail.sysCreateTime.substring(0,10) }}</span>
<interactBar :data="caseDetail" :type="3" :comments="false" :shares="true"></interactBar>
</div>
<div class="case-summary"><span>{{ caseDetail.summary }}</span></div>
<div class="btn-div" >
<span v-if="caseDetail.orgDomain" class="item">{{ caseDetail.orgDomain }}</span>
<span v-if="caseDetail.majorType" class="item">{{ caseDetail.majorType }}</span>
<span v-if="caseDetail.caseType" class="item">{{ caseDetail.caseType }}</span>
<span v-if="caseDetail.caseType1" class="item">{{ caseDetail.caseType1 }}</span>
<span v-if="caseDetail.caseType2" class="item">{{ caseDetail.caseType2 }}</span>
</div>
</el-card>
<el-card :body-style="{ padding: '0px' }" class="jianjie">
<!-- <div class="content">
{{ caseDetail.content }}
</div> -->
<pdfPreview v-if="pdfPath" :filePath="pdfPath"></pdfPreview>
</el-card>
<!-- :authorId="articleDetailData.sysCreateAid" -->
<el-row><comments @success="success" v-if="resolveId != ''" :obj-type="3" :obj-id="resolveId" :authorId="caseDetail.sysCreateAid" :toUsers="toUsers"></comments></el-row>
</el-col>
</el-row>
</div>
<div style="width: 245px;margin-left: 5px;">
<div>
<div id="fixd-box">
<el-card class="ranking-card" >
<div slot="header">
<span style="font-size: 14px;font-weight: 600;color: #333333;">好评榜</span>
</div>
<div style="padding-bottom:10px">
<el-row class="ranking-title">
<!-- <el-col :span="15" style="color: #333333;font-size: 14px;">名称</el-col> -->
<!-- <el-col :offset="4" :span="5" class="center" style="color: #333333;font-size: 14px;">分数</el-col> -->
</el-row>
<el-row class="ranking-title bacolor" v-for="(item, index) in ankingList" :key="index" >
<el-col :span="6" style="height:34px">
<img v-if="index===0" :src="`${webBaseUrl}/images/first.png`"/>
<img v-if="index===1" :src="`${webBaseUrl}/images/second.png`"/>
<img v-if="index===2" :src="`${webBaseUrl}/images/third.png`"/>
<span style="margin-left: 10px" v-if="index!=2&&index!=0&&index!=1">{{index+1}}</span>
</el-col>
<el-tooltip :enterable="false" @click.native="jumpRouter(item)" effect="light" :content="item.sysCreateUname" placement="top-start">
<el-col :span="15" style="cursor: pointer;" class="title-line-ellipsis"> {{ item.sysCreateUname }}</el-col>
</el-tooltip>
<!-- <el-col class="center" style="color: #FF8E00;" :span="5">{{ item.score }}</el-col> -->
</el-row>
</div>
</el-card>
<div style="height: 10px;"></div>
<el-card class="ranking-card" >
<div slot="header">
<span style="font-size: 14px;font-weight: 600;color: #333333;">人气榜</span>
</div>
<div style="padding-bottom:10px">
<el-row class="ranking-title">
<!-- <el-col :span="15" style="color: #333333;font-size: 14px;">名称</el-col> -->
<!-- <el-col :offset="4" :span="5" class="center" style="color: #333333;font-size: 14px;">分数</el-col> -->
</el-row>
<el-row class="ranking-title bacolor" v-for="(item, index) in Popularity" :key="index" >
<el-col :span="6" style="height:34px">
<img v-if="index===0" :src="`${webBaseUrl}/images/first.png`"/>
<img v-if="index===1" :src="`${webBaseUrl}/images/second.png`"/>
<img v-if="index===2" :src="`${webBaseUrl}/images/third.png`"/>
<span style="margin-left: 10px" v-if="index!=2&&index!=0&&index!=1">{{index+1}}</span>
</el-col>
<el-tooltip :enterable="false" @click.native="jumpRouter(item)" effect="light" :content="item.title" placement="top-start">
<el-col :span="15" style="cursor: pointer;" class="title-line-ellipsis"> {{ item.title }}</el-col>
</el-tooltip>
<!-- <el-col class="center" style="color: #FF8E00;" :span="5">{{ item.score }}</el-col> -->
</el-row>
</div>
</el-card>
<div style="height: 10px;"></div>
<el-card class="ranking-card" >
<div slot="header">
<span style="font-size: 14px;font-weight: 600;color: #333333;">热度榜</span>
</div>
<div style="padding-bottom:10px">
<el-row class="ranking-title">
<!-- <el-col :span="15" style="color: #333333;font-size: 14px;">名称</el-col> -->
<!-- <el-col :offset="4" :span="5" class="center" style="color: #333333;font-size: 14px;">分数</el-col> -->
</el-row>
<el-row class="ranking-title bacolor" v-for="(item, index) in Positive" :key="index" >
<el-col :span="6" style="height:34px">
<img v-if="index===0" :src="`${webBaseUrl}/images/first.png`"/>
<img v-if="index===1" :src="`${webBaseUrl}/images/second.png`"/>
<img v-if="index===2" :src="`${webBaseUrl}/images/third.png`"/>
<span style="margin-left: 10px" v-if="index!=2&&index!=0&&index!=1">{{index+1}}</span>
</el-col>
<el-tooltip :enterable="false" @click.native="jumpRouter(item)" effect="light" :content="item.title" placement="top-start">
<el-col :span="15" style="cursor: pointer;" class="title-line-ellipsis"> {{ item.title }}</el-col>
</el-tooltip>
<!-- <el-col class="center" style="color: #FF8E00;" :span="5">{{ item.score }}</el-col> -->
</el-row>
</div>
</el-card>
</div>
</div>
</div>
</div>
</div>
<portal-footer></portal-footer>
</div>
</template>
<script>
import { mapGetters } from 'vuex';
import portalHeader from '@/components/PortalHeader.vue';
import portalFooter from '@/components/PortalFooter.vue';
import pdfPreview from '@/components/PdfPreview/view.vue';
import interactBar from '@/components/Portal/interactBar.vue';
import comments from '@/components/Portal/comments.vue';
import apiCase from '@/api/modules/cases.js';
import apiUser from '@/api/system/user.js';
import author from '@/components/Portal/authorInfo.vue';
import apiMessage from '@/api/system/message.js';
import apiDict from "@/api/modules/dict.js"
import {encrypt} from '@/utils/jsencrypt.js';
import cookies from 'vue-cookies'
export default {
name: 'atticle',
components: { portalHeader, portalFooter, interactBar, author, comments,pdfPreview },
computed: {
...mapGetters(['userInfo'])
},
data() {
return {
toUsers:[],
ankingList:[],
Popularity:[],
Positive:[],
resolveId: '',
basePath:process.env.VUE_APP_FILE_BASE_URL,
pdfPath:'',
caseDetail: {
id:'',
filePath:''
},
ankingList:[],
authorInfo:{ aid: '', name: '', orgInfo: '', avatar: '', code: '',sex:null}
};
},
mounted() {
//this.pdfPath=this.basePath+'/case/demo1.pdf';
this.resolveId = this.$route.query.id;
if (this.resolveId) {
this.getCaseData();
}
this.getAnkingData();
this.getPopularity();
this.getPositive();
window.addEventListener(
"scroll",
this.handleScroll
);
},
methods: {
createPlayUrl(u){
let nowDate=new Date();
let ctime=parseInt(nowDate.getTime()/1000);
let beforeUrl=parseInt(nowDate.getTime()/1000)+'/'+u;
let urlSign=encodeURIComponent(encrypt(beforeUrl));
cookies.set('CASE_TIME', ctime);//写客户端的cookie保存
//以下判断是为了区分本地环境和服务器环境
if(process.env.NODE_ENV == 'development'){
this.pdfPath=process.env.VUE_APP_FILE_BASE_URL+u;
}else{
this.pdfPath=process.env.VUE_APP_BASE_API+'/xboe/m/case/content/resource?sign='+urlSign;
}
//console.log(this.pdfPath,'this.blobUrl');
},
handleScroll() {
let innerHeight = document.querySelector('#case-list-content').clientHeight
let outerHeight = document.documentElement.clientHeight
let scrollTop = document.documentElement.scrollTop
if ((outerHeight + scrollTop + 350) >= innerHeight) {
if(this.moreState == 1 && this.course.pageIndex < 4) {
this.loadMore();
}
}
if(scrollTop > 630) {
document.querySelector('#fixd-box').style.cssText = "position: fixed;top: -550px;width:245.5px";
} else {
document.querySelector('#fixd-box').style.cssText = "position: static";
}
},
getAnkingData(){
apiCase.usernameList(5).then(res=>{
if(res.status==200){
this.ankingList=res.result
// console.log(res)
}
})
},
getPopularity(){
apiCase.queryPraises(5).then(res=>{
if(res.status==200){
this.Popularity=res.result
// console.log(this.Popularity)
}
})
},
getPositive(){
apiCase.queryComments(5).then(res=>{
if(res.status==200){
this.Positive=res.result
console.log(res)
}
})
},
getCaseData() {
apiCase.detail(this.resolveId,true).then(res => {
if (res.status == 200) {
if (JSON.stringify(res.result) != '{}') {
this.caseDetail = res.result;
this.getCaseUserDetail();
if(this.caseDetail.filePath){
if(this.caseDetail.filePath){
//this.pdfPath=this.basePath+this.caseDetail.filePath;
this.createPlayUrl(this.caseDetail.filePath);
}else{
this.$message.error('无内容文件,请与管理员联系');
}
}else{
this.$message.error('内容文件不存在或已被删除,请与管理员联系');
}
}
}
});
},
getCaseUserDetail() {
apiUser.getByIds([this.caseDetail.authorId]).then(res => {
if (res.status == 200 && res.result.length>0) {
this.authorInfo = res.result[0];
this.toUsers = [
{name: res.result[0].name, aid:res.result[0].aid ,sex:res.result[0].sex}
];
//console.log(res.result,'res.result');
}
});
},
success(value){
let content=this.userInfo.name+'评论了我的案例'+'-'+this.caseDetail.title;
let query={refId:this.caseDetail.id,sendType:1,title:'系统消息',refType:3,content:content,sendName:this.userInfo.name,accpetId:this.caseDetail.sysCreateAid,acceptName:this.caseDetail.sysCreateBy}
apiMessage.save(query).then(res=>{
if(res.status==200){
}
})
// let con=value.sysCreateBy+' 评论了我的文章'+'-'+this.articleDetailData.title;
// let query={refId:value.objId,content:con,accpetId:value.sysCreateAid,sendType:1,sendName:'系统',acceptName:'文章',title:'系统消息'}
// apiMessage.save(query).then(res=>{
// if(res.status==200){
// }
// })
}
}
};
</script>
<style scoped lang="scss">
.el-card{
border:none;
}
.case-summary{
margin-top: 10px;
font-size: 16px;
color: #333;
word-break:break-all;
}
::v-deep .el-card__body{
padding: 0;
}
::v-deep .bacolor:nth-child(odd){
background-color: #f6f6f6;
padding: 0 5px;
}
::v-deep .bacolor:nth-child(even){
background-color: #fff;
padding: 0 5px;
}
.ranking-title {
line-height: 34px;
font-size: 15px;
color: #333333;
.center-titlt{
font-size: 15px;
color: #333333;
}
.center{
text-align: right;
}
img{
margin-top: 5px;
}
}
::v-deep .title-line-ellipsis{
// width: 100%;
display: -webkit-box;
overflow: hidden;
text-overflow:ellipsis;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
box-sizing: border-box;
word-break:break-all;
}
.nav {
margin-bottom: 10px;
}
.detail {
background-color: #fff;
padding: 5px 20px 10px 20px;
.title {
font-size: 20px;
line-height: 45px;
font-weight: 600;
word-break:break-all;
}
.label {
font-size: 15px;
color: #999999;
display: flex;
justify-content: flex-start;
align-items: center;
span {
margin-left: 10px;
&:last-of-type {
margin-right: auto;
}
}
}
.type {
color: #0079fe;
}
.btn-div {
margin: 8px 0;
padding-bottom: 10px;
color: #666;
.item {
margin: 0 10px 0 0px;
border: 1px solid #9e9e9e;
padding: 3px 10px;
border-radius: 8px;
}
.item-right {
float: right;
}
}
}
.jianjie {
margin: 15px 0;
background-color: #fff;
min-height: 300px;
padding: 0px 0px 10px 0px;
.content {
padding: 10px 0;
line-height: 25px;
}
.btn-div {
margin: 8px 0;
padding: 10px 0;
color: #666;
.item {
margin-right: 30px;
}
.item-right {
float: right;
}
}
}
.bottom-btn {
padding: 10px 50px;
.article-info-tools-btn {
padding: 5px 0px;
margin: 0 10px;
}
}
.bottom-div {
margin-top: 10px;
background-color: #fff;
padding: 5px 20px 10px 20px;
.title {
font-size: 16px;
font-weight: 600;
line-height: 50px;
border-bottom: 1px solid #dfdfdf;
.tip {
color: #666;
font-size: 12px;
margin: 0 10px;
}
}
.submit-div {
margin: 15px 0;
}
.bottom {
text-align: right;
}
.data {
margin-top: 10px;
background-color: #fff;
padding: 5px 20px 10px 20px;
.data-item {
border-bottom: 1px solid #dfdfdf;
margin-top: 10px;
.top {
font-size: 18px;
font-weight: 600;
span {
font-size: 14px;
color: #666;
font-weight: normal;
}
}
.text {
margin: 15px 0 5px 0;
padding-left: 40px;
line-height: 35px;
}
.huifu {
padding-left: 40px;
padding-bottom: 10px;
border-bottom: 1px solid #dfdfdf;
}
.result-div {
padding-left: 40px;
padding-top: 10px;
.top {
font-size: 16px;
}
}
.up-div {
padding: 0 15px;
.up-btn {
padding: 8px 20px;
color: #000;
}
}
img {
margin-right: 10px;
width: 30px;
border: 1px solid #eee;
border-radius: 50%;
vertical-align: middle;
}
}
}
}
.right-box {
line-height: 25px;
.ranking-card {
margin-bottom: 10px;
.el-col{
margin-bottom: 10px;
}
.center{
text-align: center;
}
}
.ranking-title {
}
.aligh-title{
font-size: 14px;
color: #333333;
}
.ranking-data {
margin: 10px 0;
color: #999999;
}
}
</style>