Files
learning-system-portal/src/components/Article/shareItems.vue
2022-06-13 17:53:16 +08:00

205 lines
4.9 KiB
Vue

<template>
<div style="">
<div class="article-list" v-for="(item, idx) in items" :key="idx">
<div class="article-info" @click="jumpRouter(item)">
<div class="article-info-title">
<span v-if="item.isRead" class="readed">已查看</span>
<span class="noRead" v-else>未查看</span>
<span class="title one-line-ellipsis" v-html="$keywordActiveShow(item.title,keyword)"></span>
</div>
<div v-html="$keywordActiveShow(item.summary || item.content,keyword)" class="article-info-summary two-line-ellipsis">
</div>
<!-- v-html="$keywordActiveShow(item.summary,keyword)" -->
<div style="display:flex;justify-content: space-between;">
<div class="article-info-tools">
<!-- <authorInfo :avatar="item.avatar" :name="item.name" :info="item.orgInfo"></authorInfo> -->
<span style="color: #999999;">{{ item.time }}</span>
<span v-if="type=='myShare'" style="color: #999999;font-size: 14px;">分享给{{item.toAname}}</span>
<span v-else>{{item.sysCreateBy}}分享给我</span>
<!-- <interactBar ref="shareDialog" :type="0" :data="item" :shares="false" :views="false"></interactBar> -->
</div>
<div>
<el-button style="color: #8590A6;" v-if="!item.isRead&&type=='myShare'" type="text" icon="el-icon-refresh-right" @click.stop="deleteshares(item)">撤回</el-button>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
// import interactBar from '@/components/Portal/interactBar.vue';
// import authorInfo from '@/components/Portal/authorInfo.vue';
import apiShares from '@/api/modules/shares.js';
export default {
name: 'articleItems',
props: {
items: {
//name,
type: Array,
default: () => []
},
type:{
type:String,
default:()=>{
return 'myShare'
}
},
keyword:{
type:String,
default:()=>{
return ''
}
}
},
data() {
return {
};
},
updated(){
},
components: {
// interactBar,
// authorInfo
},
methods: {
jumpRouter(item){
if(item.type){
if(this.type!='myShare'){
apiShares.updateIsRead(item.shareId).then(res=>{
if(res.status==200){
this.$emit('confirm',item)
}
})
}
}else{
if(this.type!='myShare'){
apiShares.updateIsRead(item.id).then(res=>{
if(res.status==200){
this.$emit('confirm',item)
}
})
}
}
this.$router.push({path:'/article/detail',query:{id:item.objId || item.id}})
// window.open(`${this.webBaseUrl}/article/detail?id=${item.objId}`)
},
deleteshares(item){
this.$emit('confirm',item)
},
// shareItem(idx) {
// this.$refs.shareDialog[idx].addShare()
// },
// delItem(item) {
// this.$confirm('您确定要删除所选文章吗?', '删除提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning'
// })
// .then(() => {
// this.$emit("confirm",item)
// })
// .catch(() => {
// });
// },
}
};
</script>
<style lang="scss" scoped>
.article-status1 {
padding: 3px;
border: 1px dotted #1ea0fa;
color: #1ea0fa;
}
.article-status2 {
padding: 3px;
border: 1px dotted #00aa00;
color: #00aa00;
}
.article-status3 {
padding: 3px;
border: 1px dotted #ff0000;
color: #ff0000;
}
.article-list {
border-bottom: 1px solid #dddddd;
// padding: 10px;
padding-bottom: 20px;
margin-top: 20px;
border-bottom: 1px solid #e9e9e9;
cursor: pointer;
}
.article-info {
cursor: pointer;
.article-info-title {
font-size: 16px;
font-weight: 400;
display: flex;
justify-content: flex-start;
align-items: center;
.readed{
font-size: 18px;
color: #3e7fff;
// margin-bottom: 6px;
}
.noRead{
font-size: 18px;
color:#FF3E3E;
// margin-bottom: 6px;
}
.title{
line-height: 25px;
margin-left: 10px;
font-size: 18px;
flex-shrink: 10000;
font-weight: 500;
color: #333333;
}
.el-button{
margin-left: auto;
}
// .article-info-date {
// height: 40px;
// line-height: 40px;
// float: right;
// font-weight: 200;
// color: #999999;
// i {
// margin-right: 5px;
// }
// }
}
.article-info-summary {
height: 46px;
font-weight: 200;
font-size: 16px;
line-height: 1.5;
margin:7px 0;
}
.article-info-tools {
color: #999999;
display: flex;
justify-content: flex-start;
align-items: center;
>span{
font-size: 14px;
color: #747474;
// margin-top: -2px;
}
// >span:first-of-type{
// margin-left: 10px;
// }
// >span:last-of-type{
// margin-top: -4px;
// margin-right:auto;
// }
}
}
</style>