mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-22 17:26:43 +08:00
2022年5月29日从svn移到git
This commit is contained in:
375
src/views/portal/article/Detail.vue
Normal file
375
src/views/portal/article/Detail.vue
Normal file
@@ -0,0 +1,375 @@
|
||||
<template>
|
||||
<div id="article-index">
|
||||
<portal-header current="article" :goSearch="3"></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: '/article' }">文章列表</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 >
|
||||
<div>
|
||||
<!-- <div v-else>我四娘娘</div> -->
|
||||
<!-- <el-card :body-style="{ padding: '0px',background: '#f6f7fb' }" class="detail"> -->
|
||||
<div class="detail">
|
||||
<div class="title">{{articleDetailData.title}}</div>
|
||||
<div class="label">
|
||||
<div style="margin-top: 5px;">
|
||||
<author :avatar="articleDetailData.avatar" :name="articleDetailData.name" :sex="articleDetailData.sex"></author>
|
||||
</div>
|
||||
<div style="margin-top: 8px;">
|
||||
<time-show :time="articleDetailData.sysCreateTime"></time-show>
|
||||
</div>
|
||||
<!-- <author :avatar="articleDetailData.avatar" :name="articleDetailData.name" :info="articleDetailData.orgInfo" ></author> -->
|
||||
<!-- :readonly="true" -->
|
||||
<interactBar :type="2" :data="articleDetailData" :comments="false" :praises="false" :views="false"></interactBar>
|
||||
<!-- <div style="padding-top: 5px;padding-left: 5px;"> 作者:{{ articleDetailData.name }}  部门:{{ articleDetailData.orgInfo }}  发布时间:<time-show :time="articleDetailData.sysCreateTime"></time-show> </div> -->
|
||||
</div>
|
||||
<div class="content ql-container">
|
||||
<div class="ql-editor">
|
||||
<div class="qltext" style="word-break:break-all;" v-html="articleDetailData.content"></div>
|
||||
</div>
|
||||
<!-- html内容 -->
|
||||
<!-- <img v-if="$route.query.id==1" style="width: 100%;" :src="`${webBaseUrl}/temp/articleOne.png`"/> -->
|
||||
<!-- <div v-if="$route.query.id==1">我是谁</div> -->
|
||||
<!-- <img v-else-if="$route.query.id==2" style="width: 100%;" :src="`${webBaseUrl}/temp/articleTwo.png`"/> -->
|
||||
<!-- <img v-else style="width: 100%;" :src="`${webBaseUrl}/temp/articleTwo.png`"/> -->
|
||||
<!-- html内容-->
|
||||
<!-- <img :src="process.env.VUE_APP_FILE_BASE_URL+articleDetailData."/> -->
|
||||
</div>
|
||||
<!-- </el-card> -->
|
||||
<div style="margin-top:10px;">
|
||||
<interactBar :type="2" :data="articleDetailData" :theme='2' :comments="false" :views="false"></interactBar>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!--评论-->
|
||||
<div>
|
||||
<comments v-if="articleId!=''" @success="success" :obj-type="2" :obj-id="articleId" :toUsers="toUsers" :authorId="articleDetailData.sysCreateAid"></comments>
|
||||
</div>
|
||||
</el-row>
|
||||
</div>
|
||||
<div style="width: 245px;margin-left: 5px;">
|
||||
|
||||
<el-row class="right-box">
|
||||
|
||||
|
||||
<div id="article-detail">
|
||||
<el-button @click="openDialog" style="width: 100%;height: 37px;border-radius: 0;margin-bottom:15px;" type="primary">写文章</el-button>
|
||||
<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 :offset="4" :span="10" style="color: #333333;font-size: 14px;">姓名</el-col>
|
||||
<el-col :span="10" style="text-align: right;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-col :span="18" class="one-line-ellipsis"> {{ item.sysCreateUname }}</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
|
||||
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!--以下是评论信息-->
|
||||
|
||||
</div>
|
||||
<!-- <div style="display: none;">
|
||||
<interactBar res="interactBar" :type="2" :data="articleDetailData" :comments="false" :views="false"></interactBar>
|
||||
</div> -->
|
||||
<el-dialog title="创建文章" :visible.sync="diagSync" :close-on-click-modal="false" width="900px" custom-class="g-dialog">
|
||||
<editItems v-if="diagSync" :jumpLimit="false" :editForm="{}" @success="saveSuccess"></editItems>
|
||||
</el-dialog>
|
||||
<portal-footer></portal-footer>
|
||||
<portalFloatTools></portalFloatTools>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import portalFloatTools from '@/components/PortalFloatTools.vue';
|
||||
import { mapGetters } from "vuex";
|
||||
import portalHeader from "@/components/PortalHeader.vue";
|
||||
import portalFooter from "@/components/PortalFooter.vue";
|
||||
import timeShow from '@/components/Portal/daytimeShow.vue';
|
||||
import interactBar from "@/components/Portal/interactBar.vue";
|
||||
import author from '@/components/Portal/authorInfo.vue';
|
||||
import comments from "@/components/Portal/comments.vue";
|
||||
import apiArticle from "@/api/modules/article.js"
|
||||
import apiUser from '@/api/system/user.js';
|
||||
import apiMessage from '@/api/system/message.js';
|
||||
import apiPraises from '@/api/modules/praises.js';
|
||||
import apiShares from '@/api/modules/shares.js';
|
||||
import apiFavorites from '@/api/modules/favorites.js';
|
||||
import editItems from '@/components/Article/editItems.vue';
|
||||
import "quill/dist/quill.core.css";
|
||||
import "quill/dist/quill.snow.css";
|
||||
import "quill/dist/quill.bubble.css";
|
||||
export default {
|
||||
components: { portalHeader, portalFooter,interactBar,comments,timeShow,author,editItems,portalFloatTools},
|
||||
computed: {
|
||||
...mapGetters(["userInfo"]),
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
shareInfo:{
|
||||
name:'',
|
||||
load:false,
|
||||
list:[]
|
||||
},
|
||||
shareShow:false,
|
||||
toUsers: [],
|
||||
articleId:'',
|
||||
shareUsers:[],
|
||||
articleDetailData:{
|
||||
avatar:'',
|
||||
name:'',
|
||||
orgInfo:'',
|
||||
code:'',
|
||||
sex:null,
|
||||
|
||||
},
|
||||
ankingList: [],
|
||||
diagSync:false,//控制弹窗
|
||||
isPraise:false,
|
||||
isFavorite: false,
|
||||
};
|
||||
},
|
||||
created(){
|
||||
|
||||
},
|
||||
mounted() {
|
||||
this.articleId=this.$route.query.id;
|
||||
//console.log(this.$route.query.id,'this.$route.query.id');
|
||||
this.getArticleDetail()
|
||||
this.$watermark.set(this.userInfo.name+this.userInfo.loginName);
|
||||
this.getAnkingData();
|
||||
window.addEventListener(
|
||||
"scroll",
|
||||
this.handleScroll
|
||||
);
|
||||
},
|
||||
beforeDestroy(){
|
||||
window.removeEventListener("scroll",this.handleScroll);
|
||||
},
|
||||
methods: {
|
||||
handleScroll() {
|
||||
let el_anking = document.querySelector('#articleAnking');
|
||||
//console.log(el_anking.clientWidth,'clientWidth');
|
||||
//el_anking.wid
|
||||
let innerHeight = document.querySelector('#article-index').clientHeight
|
||||
let outerHeight = document.documentElement.clientHeight
|
||||
let scrollTop = document.documentElement.scrollTop
|
||||
if(scrollTop > 400) {
|
||||
document.querySelector('#article-detail').style.cssText = "position: fixed;top: 0;width:242.5px";
|
||||
} else {
|
||||
document.querySelector('#article-detail').style.cssText = "position: static";
|
||||
}
|
||||
},
|
||||
saveSuccess(data){
|
||||
this.diagSync=false;
|
||||
this.articleList.pageIndex = 1;
|
||||
this.articleList.list = [];
|
||||
this.getArticleList();
|
||||
},
|
||||
openDialog(){
|
||||
this.diagSync=true
|
||||
},
|
||||
getAnkingData() {
|
||||
apiArticle.countsUsername(5).then(res => {
|
||||
if (res.status == 200) {
|
||||
this.ankingList = res.result;
|
||||
}
|
||||
});
|
||||
},
|
||||
//获取文章详细信息
|
||||
getArticleDetail(){
|
||||
apiArticle.detail(this.articleId,true).then(res=>{
|
||||
if(res.status==200){
|
||||
res.result.avatar='';
|
||||
res.result.name='';
|
||||
res.result.orgInfo='';
|
||||
res.result.sex=null;
|
||||
this.articleDetailData=res.result;
|
||||
//if(this.articleDetailData.toString()!='{}'){
|
||||
this.getAuthorInfo(this.articleDetailData)
|
||||
|
||||
//}
|
||||
}
|
||||
}).catch(err=>{
|
||||
this.$message.error("获取数据失败")
|
||||
})
|
||||
},
|
||||
//获取文章发布人的人物信息
|
||||
getAuthorInfo(data){
|
||||
let ids=[data.sysCreateAid]
|
||||
apiUser.getByIds(ids).then(res=>{
|
||||
if(res.status==200){
|
||||
this.articleDetailData=Object.assign(this.articleDetailData,res.result[0])
|
||||
this.toUsers = [
|
||||
{name: res.result[0].name, aid:res.result[0].aid ,sex:res.result[0].sex}
|
||||
];
|
||||
}
|
||||
})
|
||||
},
|
||||
success(value){
|
||||
let content=this.userInfo.name+'评论了我的文章'+'-'+this.articleDetailData.title;
|
||||
let query={refId:this.articleDetailData.id,sendType:1,title:'系统消息',refType:2,content:content,sendName:this.userInfo.name,acceptId:this.articleDetailData.sysCreateAid,acceptName:this.articleDetailData.sysCreateBy}
|
||||
apiMessage.save(query).then(res=>{
|
||||
if(res.status==200){
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
//获取文章评论人的人物信息
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
||||
::v-deep .el-card__body{
|
||||
padding: 0;
|
||||
}
|
||||
::v-deep .bacolor:nth-child(odd){
|
||||
background-color: #fff;
|
||||
padding: 0 5px;
|
||||
}
|
||||
::v-deep .bacolor:nth-child(even){
|
||||
background-color: #f6f6f6;
|
||||
padding: 0 5px;
|
||||
}
|
||||
.qltext{
|
||||
font-size: 15px;
|
||||
font-weight: normal;
|
||||
line-height: 50px;
|
||||
color: #454545;
|
||||
line-height: 24px;
|
||||
::v-deep img{
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
}
|
||||
.detail {
|
||||
background-color: #fff;
|
||||
padding: 5px 20px 10px 20px;
|
||||
.title {
|
||||
font-size: 22px;
|
||||
text-align: center;
|
||||
line-height: 33px;
|
||||
color: #121212 ;
|
||||
font-weight: 500;
|
||||
margin-top: 20px;
|
||||
word-break:break-all;
|
||||
}
|
||||
.label {
|
||||
font-size: 15px;
|
||||
color: #999999;
|
||||
display: flex;
|
||||
padding: 10px 0;
|
||||
align-items: center;
|
||||
font-size: 12px;
|
||||
span{
|
||||
margin-left: 10px;
|
||||
}
|
||||
.interact-bar{
|
||||
margin-left: auto;
|
||||
}
|
||||
}
|
||||
.btn-div {
|
||||
|
||||
margin: 8px 0;
|
||||
text-align: right;
|
||||
padding-bottom: 10px;
|
||||
font-size: 15px;
|
||||
color: #454545 ;
|
||||
border-bottom: 1px solid #dfdfdf;
|
||||
.item {
|
||||
margin: 0 8px 0 25px;
|
||||
}
|
||||
.item-right {
|
||||
float: right;
|
||||
}
|
||||
}
|
||||
.content {
|
||||
padding: 20px 0;
|
||||
// line-height: 25px;
|
||||
// text-indent: 2em;
|
||||
// color: #444444;
|
||||
// font-size: 16px;
|
||||
overflow-x: hidden;
|
||||
min-height: 200px;
|
||||
}
|
||||
.ql-container{
|
||||
// font-size: 14px;
|
||||
.ql-editor{
|
||||
padding: 0;
|
||||
line-height: 1.6;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.right-box {
|
||||
.add-btn {
|
||||
width: 100%;
|
||||
padding: 15px 0;
|
||||
}
|
||||
.ranking-title {
|
||||
line-height: 34px;
|
||||
.center-titlt{
|
||||
font-size: 15px;
|
||||
color: #333333;
|
||||
}
|
||||
.center{
|
||||
text-align: right;
|
||||
}
|
||||
img{
|
||||
margin-top: 5px;
|
||||
}
|
||||
}
|
||||
.ranking-data {
|
||||
margin: 10px 0;
|
||||
color: #999999;
|
||||
}
|
||||
}
|
||||
// .ref-article-div {
|
||||
// background-color: #fff;
|
||||
// .change {
|
||||
// float: right;
|
||||
// }
|
||||
// .list-item {
|
||||
// padding: 5px 10px;
|
||||
// }
|
||||
// .list-item:not(:last-child) {
|
||||
// border-bottom: 1px solid #dfdfdf;
|
||||
// }
|
||||
// img {
|
||||
// width: 120px;
|
||||
// border: 1px solid #eee;
|
||||
// border-radius: 5px;
|
||||
// vertical-align: middle;
|
||||
// }
|
||||
// .an-div {
|
||||
// text-align: left;
|
||||
// .tip {
|
||||
// line-height: 35px;
|
||||
// color: #666;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
</style>
|
||||
Reference in New Issue
Block a user