mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-22 09:16:44 +08:00
289 lines
7.0 KiB
Vue
289 lines
7.0 KiB
Vue
<template>
|
|
<div style="">
|
|
<!-- 新版 -->
|
|
<div class="qa-box" v-for="(item, idx) in items" :key="idx">
|
|
<div class="coures-head">
|
|
<div class="share-name" v-if="type=='myShare'">
|
|
分享给了<span>{{ item.toAname }}</span>
|
|
</div>
|
|
<div v-else class="share-name">
|
|
<span>{{ item.toAname }}</span>分享给了我
|
|
</div>
|
|
<div class="islook" v-if="item.isRead">已查看</div>
|
|
<div class="isunlook" v-else>未查看</div>
|
|
<div class="share-time">{{ item.time }}</div>
|
|
</div>
|
|
<div class="coures-content">
|
|
<span>【问答】</span>{{item.title}}
|
|
</div>
|
|
</div>
|
|
<!-- 旧版 -->
|
|
<!-- <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 class="qa-basic" :class="item.question.isResolve ? 'qa-solve' : 'qa-unSolve'">{{ item.question.isResolve ? '【已解决】' : '【未解决】' }}</span>
|
|
<span class="title one-line-ellipsis" v-html="$keywordActiveShow(item.question.title,keyword)"></span>
|
|
</div>
|
|
<div class="article-info-summary">
|
|
<span class="two-line-ellipsis" v-html="$keywordActiveShow(item.question.content,keyword)"></span>
|
|
</div>
|
|
<div class="bestAnswer one-line-ellipsis " v-if="item.question.isResolve">
|
|
<span>最佳回答:</span>
|
|
<span class="one-line-ellipsi" style="color: #999999;" v-html="$keywordActiveShow(item.question.bestAnswer,keyword)"></span>
|
|
|
|
</div>
|
|
</div>
|
|
<div style="display:flex;justify-content: space-between;color: rgb(153, 153, 153);font-size: 14px;">
|
|
<div class="article-info-tools">
|
|
<span>{{ item.time }}</span>
|
|
<span v-if="type=='myShare'">分享给{{ item.toAname }}</span>
|
|
<span v-else>{{ item.sysCreateBy }}分享给我</span>
|
|
<el-button v-if="item.isRead" class="common readed" style="color: #8590A6;margin-left:10px;" icon="el-icon-folder-opened" type="text">已查看</el-button>
|
|
<el-button class="common noRead" v-else style="color: #8590A6;margin-left:10px;" icon="el-icon-folder" type="text">未查看</el-button>
|
|
</div>
|
|
<div>
|
|
<el-button @click.stop="deleteshares(item)" style="color: #8590A6;margin-left:36px" v-if="!item.isRead&&type=='myShare'" icon="el-icon-refresh-right" type="text">撤回</el-button>
|
|
</div>
|
|
</div>
|
|
|
|
</div> -->
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import apiShares from '@/api/modules/shares.js';
|
|
// import interactBar from '@/components/Portal/interactBar.vue';
|
|
// import authorInfo from '@/components/Portal/authorInfo.vue';
|
|
export default {
|
|
name: 'articleItems',
|
|
props: {
|
|
items: {
|
|
//name,
|
|
type: Array,
|
|
default: () => []
|
|
},
|
|
type:{
|
|
type:String,
|
|
default:()=>{
|
|
return 'myShare'
|
|
}
|
|
},
|
|
keyword:{
|
|
type:String,
|
|
default:()=>{
|
|
return ''
|
|
}
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
};
|
|
},
|
|
components: {
|
|
},
|
|
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:'/qa/answer',query:{id:item.question.id}})
|
|
// window.open(`${this.webBaseUrl}/qa/answer?id=${item.question.id}`)
|
|
},
|
|
shareItem(idx) {
|
|
this.$refs.shareAction[idx].addShare()
|
|
},
|
|
delItem(item) {
|
|
this.$confirm('您确定要删除所选问答吗?', '删除提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
})
|
|
.then(() => {
|
|
this.$emit("confirm",item)
|
|
})
|
|
.catch(() => {
|
|
});
|
|
},
|
|
deleteshares(item){
|
|
this.$emit('confirm',item)
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.qa-box{
|
|
width: 100%;
|
|
padding: 30px 0;
|
|
border-bottom:1px solid #e9e9e9 ;
|
|
.coures-content{
|
|
margin-top: 20px;
|
|
font-size: 16px;
|
|
color: #333333;
|
|
font-weight: 600;
|
|
span{
|
|
font-size: 16px;
|
|
margin-left: -9px;
|
|
}
|
|
}
|
|
.coures-head{
|
|
display: flex;
|
|
.share-name{
|
|
font-size: 14px;
|
|
color: #666666;
|
|
margin-right: 17px;
|
|
}
|
|
.share-time{
|
|
font-size: 14px;
|
|
color: #666666;
|
|
line-height: 25px;
|
|
margin-left: auto;
|
|
}
|
|
.islook{
|
|
width: 46px;
|
|
height: 24px;
|
|
background: #eee;
|
|
font-size: 12px;
|
|
color: #666666;
|
|
line-height: 24px;
|
|
text-align: center;
|
|
border-radius: 2px;
|
|
}
|
|
.isunlook{
|
|
width: 46px;
|
|
height: 24px;
|
|
background: #FF6562;
|
|
border-radius: 2px;
|
|
font-size: 12px;
|
|
color: #fff;
|
|
line-height: 24px;
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
.one-line-ellipsis{
|
|
display: -webkit-box;
|
|
// white-space:pre-wrap;
|
|
overflow: hidden;
|
|
text-overflow:ellipsis;
|
|
-webkit-box-orient: vertical;
|
|
-webkit-line-clamp: 1;
|
|
box-sizing: border-box;
|
|
|
|
}
|
|
.two-line-ellipsis{
|
|
display: -webkit-box;
|
|
// white-space:pre-wrap;
|
|
overflow: hidden;
|
|
text-overflow:ellipsis;
|
|
-webkit-box-orient: vertical;
|
|
-webkit-line-clamp: 2;
|
|
box-sizing: border-box;
|
|
|
|
}
|
|
.text-status1 {
|
|
// border: 1px dotted #1ea0fa;
|
|
color: #1ea0fa;
|
|
}
|
|
.text-status2 {
|
|
|
|
// border: 1px dotted #00aa00;
|
|
color: #00aa00;
|
|
}
|
|
.text-status3 {
|
|
// border: 1px dotted #ff3e3e;
|
|
color: #ff3e3e;
|
|
}
|
|
.article-list {
|
|
// margin: 5px 0;
|
|
// border: 1px solid #dddddd;
|
|
// padding: 10px;
|
|
padding-bottom: 21px;
|
|
margin-top: 24px;
|
|
border-bottom: 1px solid #E8E8E8;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.article-info {
|
|
.article-info-title {
|
|
font-size: 18px;
|
|
font-weight: 500;
|
|
color: #333333;
|
|
display: flex;
|
|
justify-content: flex-start;
|
|
align-items: center;
|
|
span:first-of-type{
|
|
// margin-top: -2px;
|
|
}
|
|
.title{
|
|
margin-left: 8px;
|
|
flex-shrink: 10000;
|
|
}
|
|
.common{
|
|
margin-left: auto;
|
|
}
|
|
.readed{
|
|
color: #2AB28B;
|
|
}
|
|
.noRead{
|
|
color:#FF3E3E;
|
|
}
|
|
}
|
|
.article-info-summary {
|
|
color: #666666;
|
|
// line-height: 1.5;
|
|
font-size: 14px;
|
|
height: 40px;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin: 7px 0px;
|
|
}
|
|
.bestAnswer{
|
|
// height: 30px;
|
|
font-size: 16px;
|
|
color: #444444;
|
|
font-weight: 600;
|
|
display: flex;
|
|
align-items: center;
|
|
span:first-of-type{
|
|
flex-shrink: 0;
|
|
}
|
|
.one-line-ellipsi{
|
|
overflow: hidden;
|
|
text-overflow:ellipsis;
|
|
white-space: nowrap;
|
|
}
|
|
// padding-left: 20px;
|
|
}
|
|
.article-info-tools {
|
|
color: #999999;
|
|
display: flex;
|
|
justify-content: flex-start;
|
|
align-items: center;
|
|
>span{
|
|
font-size: 14px;
|
|
line-height: 25px;
|
|
color: #747474;
|
|
}
|
|
}
|
|
}
|
|
</style>
|