mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-19 15:56:45 +08:00
Merge branch 'dev' of https://codeup.aliyun.com/6265f483e4166464dc2f9c14/boeu/portal into dev
This commit is contained in:
167
src/components/Case/caseItems.vue
Normal file
167
src/components/Case/caseItems.vue
Normal file
@@ -0,0 +1,167 @@
|
||||
<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.cases.title,keyword)"></span>
|
||||
|
||||
</div>
|
||||
<div v-html="$keywordActiveShow(item.cases.summary,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 apiShares from '@/api/modules/shares.js';
|
||||
export default {
|
||||
name:'caseItems',
|
||||
props:{
|
||||
items: {
|
||||
//name,
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
type:{
|
||||
type:String,
|
||||
default:()=>{
|
||||
return 'myShare'
|
||||
}
|
||||
},
|
||||
keyword:{
|
||||
type:String,
|
||||
default:()=>{
|
||||
return ''
|
||||
}
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
jumpRouter(item){
|
||||
if(this.type!='myShare'){
|
||||
apiShares.updateIsRead(item.id).then(res=>{
|
||||
if(res.status==200){
|
||||
this.$emit('confirm',item)
|
||||
}
|
||||
})
|
||||
}
|
||||
this.$router.push({path:'/case/detail',query:{id:item.cases.id}})
|
||||
// window.open(`${this.webBaseUrl}/article/detail?id=${item.objId}`)
|
||||
},
|
||||
deleteshares(item){
|
||||
this.$emit('confirm',item)
|
||||
},
|
||||
},
|
||||
created() {
|
||||
console.log(this.items)
|
||||
},
|
||||
|
||||
}
|
||||
</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>
|
||||
@@ -1,21 +1,21 @@
|
||||
<template>
|
||||
<div style="">
|
||||
<div class="article-list" v-for="(item,idx) in items" :key="idx">
|
||||
<div class="article-info">
|
||||
<div class="article-info-title">
|
||||
<router-link :to="'/case/detail?id='+item.cases.id" target="_blank" style="padding-left: 5px;">{{item.cases.title}}</router-link>
|
||||
<div class="article-info ">
|
||||
<div class="article-info-title title-line-ellipsis" >
|
||||
<router-link :to="'/case/detail?id='+item.cases.id" target="_blank" >{{item.cases.title}}</router-link>
|
||||
<div class="article-info-date">
|
||||
<el-button @click="delItem(item)" type="text" icon="el-icon-remove">取消收藏</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="article-info-summary">
|
||||
<div class="article-info-summary three-line-ellipsis">
|
||||
{{item.cases.summary}}
|
||||
</div>
|
||||
<div class="article-info-tools">
|
||||
<authorInfo :avatar="item.avatar" :name="item.name" :info="item.orgInfo"></authorInfo>
|
||||
<span>发布时间:{{ item.cases.sysCreateTime | timeFilter }}</span>
|
||||
<span>收藏时间:{{ item.time | timeFilter }}</span>
|
||||
<interactBar :type="0" :data="item.cases" :shares="false" :views="false"></interactBar>
|
||||
<!-- <interactBar :type="0" :data="item.cases" :shares="false" :views="false"></interactBar> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -58,6 +58,26 @@
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.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;
|
||||
}
|
||||
.three-line-ellipsis{
|
||||
width: 100%;
|
||||
display: -webkit-box;
|
||||
overflow: hidden;
|
||||
text-overflow:ellipsis;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
box-sizing: border-box;
|
||||
word-break:break-all;
|
||||
}
|
||||
.article-status1{
|
||||
padding: 3px;
|
||||
border: 1px dotted #1EA0FA;
|
||||
@@ -75,8 +95,8 @@
|
||||
}
|
||||
.article-list {
|
||||
margin: 5px 0;
|
||||
border: 1px solid #dddddd;
|
||||
padding: 10px;
|
||||
border-bottom: 1px solid #dddddd;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.article-info {
|
||||
@@ -97,10 +117,12 @@
|
||||
}
|
||||
}
|
||||
.article-info-summary {
|
||||
height: 65px;
|
||||
|
||||
line-height: 25px;
|
||||
color: #999999;
|
||||
}
|
||||
.article-info-tools {
|
||||
height: 45px;
|
||||
color: #999999;
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
|
||||
@@ -135,7 +135,7 @@ export default {
|
||||
.one-line-ellipsis{
|
||||
display: -webkit-box;
|
||||
white-space:pre-wrap;
|
||||
word-wrap: break-word;
|
||||
// word-wrap: break-word;
|
||||
word-break:break-all;
|
||||
overflow: hidden;
|
||||
text-overflow:ellipsis;
|
||||
|
||||
@@ -26,12 +26,12 @@
|
||||
@link-clicked="currentPage = $event">
|
||||
</pdf> -->
|
||||
</div>
|
||||
<div class="pdf-footer">
|
||||
<div v-if="totalPages>initNum" class="pdf-footer" >
|
||||
<!-- <el-button icon="el-icon-arrow-left" @click="prePage('footer')" :disabled="loadedRatio !== 1"></el-button>
|
||||
<span v-if="loadedRatio !== 1" style="margin:0 10px;">0 / 0</span>
|
||||
<span v-else style="margin:0 10px;">{{ currentPage }} / {{ pageCount }}</span>
|
||||
<el-button @click="nextPage('footer')" :disabled="loadedRatio !== 1" icon="el-icon-arrow-right"></el-button> -->
|
||||
<el-button type="primary" @click="clickMore()">加载更多</el-button>
|
||||
<el-button type="primary" @click="clickMore()" v-if="moreState == 1">加载更多</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -59,21 +59,33 @@ export default {
|
||||
src: "",
|
||||
showPages: undefined,
|
||||
totalPages:0,
|
||||
initNum:3,
|
||||
scale: 100, //放大系数
|
||||
loadedRatio:0,// 加载进度
|
||||
showProgress:true,
|
||||
moreState:1,// 1 加载更多 2 加载中 3无数据
|
||||
isscroll:false,
|
||||
pdfpage:0,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
// /case/demo.pdf
|
||||
let pdfPath=this.$Constants.fileBaseUrl+'/case/demo.pdf';
|
||||
this.loadInitPdf(pdfPath);
|
||||
//this.initSrc(this.filePath);
|
||||
if(this.filePath){
|
||||
this.loadInitPdf(this.filePath);
|
||||
}
|
||||
window.addEventListener(
|
||||
"scroll",
|
||||
this.handleScroll
|
||||
);
|
||||
},
|
||||
beforeDestroy(){
|
||||
window.removeEventListener("scroll",this.handleScroll);
|
||||
},
|
||||
watch:{
|
||||
filePath(newVal){
|
||||
//this.getNumPages(newVal);
|
||||
this.initSrc(newVal);
|
||||
if(newVal){
|
||||
this.loadInitPdf(newVal);
|
||||
}
|
||||
},
|
||||
loadedRatio(newVal){
|
||||
// 直接使用loadedRatio控制进度条没有加载效果
|
||||
@@ -87,41 +99,88 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
loadProgress(e){
|
||||
console.log(e,'loadProgress');
|
||||
console.log(e,'loadProgress');
|
||||
},
|
||||
loadedPageHandle(e){
|
||||
console.log(e,'loadedPageHandle');
|
||||
console.log(e,'loadedPageHandle');
|
||||
this.pdfpage = e;
|
||||
|
||||
},
|
||||
loadPdfHandle(e){
|
||||
console.log(e,'loadPdfHandle');
|
||||
console.log(e,'loadPdfHandle');
|
||||
},
|
||||
clickMore(){
|
||||
if(this.totalPages>this.showPages){
|
||||
this.showPages++;
|
||||
this.showPages++;
|
||||
}
|
||||
},
|
||||
this.isscroll = true;
|
||||
|
||||
},
|
||||
//加载页面
|
||||
loadInitPdf(url) {
|
||||
|
||||
if(url && url.indexOf('.pdf')>-1){
|
||||
let loadingTask = pdf.createLoadingTask(url);
|
||||
this.src=loadingTask;
|
||||
|
||||
loadingTask.promise.then((pdf) =>{
|
||||
console.log(pdf)
|
||||
this.totalPages=pdf.numPages;
|
||||
if(pdf.numPages>3){
|
||||
this.showPages = 3;
|
||||
}else{
|
||||
|
||||
|
||||
if(pdf.numPages>this.initNum){
|
||||
this.showPages = this.initNum;
|
||||
|
||||
} else{
|
||||
this.showPages =pdf.numPages;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}).catch((err) =>{
|
||||
this.$message.error("加载内容失败,请联系管理员");
|
||||
});
|
||||
|
||||
}
|
||||
},
|
||||
initSrc(url){
|
||||
if(url && url.indexOf('.pdf')>-1){
|
||||
//this.src = url;
|
||||
|
||||
handleScroll() {
|
||||
let el_anking = document.querySelector('#case-list-content');
|
||||
let innerHeight = document.querySelector('#pdf-perView').clientHeight
|
||||
let outerHeight = document.documentElement.clientHeight
|
||||
let scrollTop = document.documentElement.scrollTop
|
||||
|
||||
if(this.isscroll){
|
||||
this.showPages++;
|
||||
this.debounce(this.loadInitPdf(),5000);
|
||||
|
||||
}
|
||||
},
|
||||
// console.log(this.pdfpage,'000')
|
||||
// console.log(this.totalPages,this.pdfpage)
|
||||
if(this.pdfpage >= this.totalPages){
|
||||
this.isscroll = false
|
||||
this.moreState = 3
|
||||
// console.log('hcuewhf')
|
||||
}
|
||||
// if(scrollTop > 400) {
|
||||
// document.querySelector('#articleAnking').style.cssText = "position: fixed;top: 0;width:242.5px";
|
||||
// } else {
|
||||
// document.querySelector('#articleAnking').style.cssText = "position: static";
|
||||
// }
|
||||
},
|
||||
|
||||
|
||||
debounce(func, wait) {// 非立即执行
|
||||
let timeout;
|
||||
return function () {
|
||||
let context = this;
|
||||
let args = arguments;
|
||||
if (timeout) clearTimeout(timeout);
|
||||
timeout = setTimeout(() => {
|
||||
func.apply(context, args)
|
||||
}, wait);
|
||||
}
|
||||
},
|
||||
prePage(type) {
|
||||
if (this.currentPage > 1) {
|
||||
this.currentPage--;
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
<div v-if="showTop" class="comments-top">
|
||||
<div class="comments-top-left">评论 <span style="color: #797979;">{{total}}条</span>
|
||||
<el-checkbox v-if="objType ==2" class="btn" v-model="value" type="primary">只看作者</el-checkbox>
|
||||
<el-checkbox v-if="objType ==3" class="btn" v-model="value" type="primary">{{value?'查看所有':'只看案主'}}</el-checkbox>
|
||||
<el-checkbox v-if="objType ==3" class="btn" v-model="value" type="primary">{{value?'查看所有':'只看案主 @案主可以给他发私信哦'}}</el-checkbox>
|
||||
</div>
|
||||
<div class="comments-top-right" v-if="objType !==2">
|
||||
<!-- <div class="comments-top-right" v-if="objType !==2">
|
||||
<span @click="showList(false)" v-if="listShow">收起<i class="el-icon-arrow-down"></i></span>
|
||||
<span @click="showList(true)" v-else >打开<i class="el-icon-arrow-up"></i></span>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
<div class="comments-input" v-if="!readonly">
|
||||
<div class="grid-content bg-purple">
|
||||
@@ -320,6 +320,7 @@
|
||||
this.loadData();
|
||||
},
|
||||
inputValue(val,oldVal) {
|
||||
console.log("333333");
|
||||
let fu = val.substr(-1);
|
||||
if(fu == '@'&&!oldVal) {
|
||||
this.toUserId = '';
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
|
||||
<div v-if="views" style="cursor: default;" :style="`min-width: ${nodeWidth};`" class="interact-bar-btn" :class="{cursor:!readonly}">
|
||||
<el-tooltip effect="light" content="浏览量" placement="top">
|
||||
<svg-icon style="margin-right: 0;font-size: 16px;" icon-class="views"></svg-icon>
|
||||
<svg-icon style="margin-right: 0;font-size: 16px;" icon-class="browse"></svg-icon>
|
||||
</el-tooltip>
|
||||
<span class="interact-bar-value"> {{ data.views}}</span>
|
||||
</div>
|
||||
@@ -238,21 +238,25 @@ export default {
|
||||
})
|
||||
},
|
||||
checkHas(){
|
||||
if(this.type>0){
|
||||
apiPraises.has(this.type,this.data.id).then(rs=>{
|
||||
if(rs.status==200 && rs.result){
|
||||
this.isPraise=true;
|
||||
}else{
|
||||
this.isPraise=false;
|
||||
}
|
||||
});
|
||||
apiFavorites.has(this.type,this.data.id).then(rs=>{
|
||||
if(rs.status==200 && rs.result){
|
||||
this.isFavorite=true;
|
||||
}else{
|
||||
this.isFavorite=false;
|
||||
}
|
||||
})
|
||||
if(this.type>0 && !this.readonly && this.data.id){
|
||||
if(this.favorites){
|
||||
apiFavorites.has(this.type,this.data.id).then(rs=>{
|
||||
if(rs.status==200 && rs.result){
|
||||
this.isFavorite=true;
|
||||
}else{
|
||||
this.isFavorite=false;
|
||||
}
|
||||
})
|
||||
}
|
||||
if(this.praises){
|
||||
apiPraises.has(this.type,this.data.id).then(rs=>{
|
||||
if(rs.status==200 && rs.result){
|
||||
this.isPraise=true;
|
||||
}else{
|
||||
this.isPraise=false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
addShare(){
|
||||
|
||||
@@ -78,10 +78,10 @@
|
||||
<svg-icon icon-class="teather"></svg-icon>
|
||||
<span slot="title">教师管理</span>
|
||||
</el-menu-item>
|
||||
<!-- <el-menu-item index="/case/manage" v-show="curIdentity == 3">
|
||||
<el-menu-item index="/case/manage" v-show="curIdentity == 3">
|
||||
<svg-icon icon-class="case"></svg-icon>
|
||||
<span slot="title">案例管理</span>
|
||||
</el-menu-item> -->
|
||||
</el-menu-item>
|
||||
<el-menu-item index="/manage/ugroups" v-show="curIdentity == 3">
|
||||
<svg-icon icon-class="audience" style="font-size:16px"></svg-icon>
|
||||
<span slot="title">受众管理</span>
|
||||
|
||||
Reference in New Issue
Block a user