我分享的

This commit is contained in:
lmj
2022-11-09 16:30:28 +08:00
parent a55bc83772
commit 6743895a4e
2 changed files with 115 additions and 178 deletions

View File

@@ -13,6 +13,16 @@ import ajax from '@/utils/xajax.js'
const save=function(data){
return ajax.post('/xboe/m/share/add',data);
}
/**
* 我分享的全部
* @param pageIndex 第几页
* @param pageSize 每页多少行
* @param keyword 关键字搜索
* @param isRead 是否已读
* */
const findMeShare=function (query){
return ajax.post('/xboe/m/share/findMeShare',query);
}
// 删除分享
// 参数 id
const del=function(id){
@@ -134,5 +144,6 @@ const updateIsRead=function(id){
mymecourselist,
mymearticlelist,
deleteshares,
findMeShare,
updateIsRead
}

View File

@@ -1,60 +1,84 @@
<template>
<view>
<page-title :showBack="true">我的分享</page-title>
<view class="top-tab">
<!-- <view class="top-tab">
<view class="top-bar-center">
<view class="top-bar-tab" @click="clicktab(1)" :class="{ active: conType == 1 }">课程</view>
<view class="top-bar-tab" @click="clicktab(2)" :class="{ active: conType == 2 }">文章</view>
<view class="top-bar-tab" @click="clicktab(4)" :class="{ active: conType == 4 }">问答</view>
</view>
</view>
<!-- <view class="top-content-options"> -->
<!-- 是否已查看 -->
<!-- <view style="margin-right: 20upx;">
<text class="textbtn" @click="statusSelectShow = !statusSelectShow">状态</text>
</view> -->
<!--课程-->
<!-- <view class="input-search">
<u-search
v-model="query.keyword"
placeholder="标题搜索"
@search="findData(true)"
@clear="findData(true)"
:clearabled="true"
:showAction="false"
shape="square"
bgColor="#ffffff"
>
</u-search>
</view> -->
<!-- </view> -->
<!-- <view class="sea-show" v-show="statusSelectShow">
<text @click="chooseStatus(null)" :class="[isRead == null?'sea-active':'','sea-index' ]">全部</text>
<text @click="chooseStatus(true)" :class="[isRead == true?'sea-active':'','sea-index' ]">已查看</text>
<text @click="chooseStatus(false)" :class="[isRead == false?'sea-active':'','sea-index' ]">未查看</text>
</view> -->
<view v-for="(item,index) in dataList.list" :key="index">
<view v-if="item.type == 1">
<view class="course_box">
<view class="course" @click="toCourseDetail(item)">
<view class="course-img" style="position: relative;" >
<course-image :course="item" width="256upx" height="150upx"></course-image>
<view class="coureslabel">
{{ contentTypeFilter(item.contentType).text }}
</view>
</view>
<view v-if="conType == 1">
<view v-for="(item, idx) in courseList" :key="idx" class="course_box">
<view class="course" @click="toCourseDetail(item)">
<view class="course-img" style="position: relative;" >
<course-image :course="item" width="256upx" height="150upx"></course-image>
<view class="coureslabel">
{{ contentTypeFilter(item.contentType).text }}
<view class="course-content">
<text style="height: 100upx;margin-top: 6upx;" v-html="$keywordActiveShow(item.title,query.keyword)"></text>
<view class="coures-bottom">
<view class="course-author" style="margin-right: 50upx;">分享给{{ item.toAname }}</view>
<view class="withdraw" v-if="!item.isRead" @click="withdraw(item)">
<image src="../../static/images/icon/withdrawnew.png" mode=""></image>撤回
</view>
<view v-if="item.isRead" class="Viewed">
已查看
</view>
<view v-else class="notViewed">
未查看
</view>
</view>
</view>
</view>
<view class="course-content">
<!-- <view class="coursetit-sl"> -->
<text style="height: 100upx;margin-top: 6upx;" v-html="$keywordActiveShow(item.title,query.keyword)"></text>
<!-- <span class="common" :class="contentTypeFilter(item.contentType).class">{{ contentTypeFilter(item.contentType).text }}</span><span style="font-weight: bold; margin-top: 10rpx;" v-html="$keywordActiveShow(item.title,query.keyword)"></span></view> -->
<!-- <view class="course-con_source">分享日期{{ item.time }}</view> -->
<view class="coures-bottom">
<view class="course-author" style="margin-right: 50upx;">分享给{{ item.toAname }}</view>
</view>
</view>
<view v-if="item.type == 2">
<view class="article_one" >
<view>
<view @click="toArticleDetail(item)" class="articla_tit" >
<text v-html="$keywordActiveShow(item.title,query.keyword)"></text>
</view>
<text class="articla_text" @click="toArticleDetail(item)" v-html="$keywordActiveShow(item.summary,query.keyword)"></text>
<!-- <author-info :avatar="item.avatar" :name="item.sysCreateBy" :info="item.orgInfo" :sex="item.sex"></author-info> -->
<view class="artical_text_bottom">
<view class="" style="margin-top: 10upx;">
<text style="font-size: 24upx;color: #999;margin-right: 35upx;">分享给{{item.toAname}}</text>
</view>
<view class="rowbtn-right">
<view class="withdraw" v-if="item.isRead" @click="withdraw(item)">
<image src="../../static/images/icon/withdrawnew.png" mode=""></image>撤回
</view>
<view v-if="!item.isRead" class="Viewed">
已查看
</view>
<view v-else class="notViewed">
未查看
</view>
</view>
</view>
</view>
</view>
</view>
<view v-if="item.type == 4">
<view class="qa" >
<view class="qa-body" @click="toQaDetail(item.question)">
<text v-html="$keywordActiveShow(item.question.title,query.keyword)"></text>
</view>
<view class="qa-bottom" @click="toQaDetail(item.question)" v-html="$keywordActiveShow(item.question.content,query.keyword)"></view>
<view class="qa-bottombox">
<view class="qa-bottom-left">
<text style="font-size: 24upx;color: #999;margin-top: 10upx;" @click="toQaDetail(item.question)">分享给{{item.toAname}}</text>
</view>
<view class="rowbtn-right" style="margin-left: auto;">
<view class="withdraw" v-if="!item.isRead" @click="withdraw(item)">
<image src="../../static/images/icon/withdrawnew.png" mode=""></image>撤回
</view>
<view v-if="!item.isRead" class="Viewed">
<view v-if="item.isRead" class="Viewed">
已查看
</view>
<view v-else class="notViewed">
@@ -64,59 +88,9 @@
</view>
</view>
</view>
</view>
<view v-if="conType == 2">
<view class="article_one" v-for="(item, idx) in articleList" :key="idx" >
<view>
<view @click="toArticleDetail(item)" class="articla_tit" >
<text v-html="$keywordActiveShow(item.title,query.keyword)"></text>
</view>
<text class="articla_text" @click="toArticleDetail(item)" v-html="$keywordActiveShow(item.summary,query.keyword)"></text>
<!-- <author-info :avatar="item.avatar" :name="item.sysCreateBy" :info="item.orgInfo" :sex="item.sex"></author-info> -->
<view class="artical_text_bottom">
<view class="" style="margin-top: 10upx;">
<text style="font-size: 24upx;color: #999;margin-right: 35upx;">分享给{{item.toAname}}</text>
</view>
<view class="rowbtn-right">
<view class="withdraw" v-if="!item.isRead" @click="withdraw(item)">
<image src="../../static/images/icon/withdrawnew.png" mode=""></image>撤回
</view>
<view v-if="!item.isRead" class="Viewed">
已查看
</view>
<view v-else class="notViewed">
未查看
</view>
</view>
</view>
</view>
</view>
</view>
<view v-if="conType == 4">
<view v-for="(item, idx) in qaList" :key="idx" class="qa" >
<view class="qa-body" @click="toQaDetail(item.question)">
<text v-html="$keywordActiveShow(item.question.title,query.keyword)"></text>
</view>
<view class="qa-bottom" @click="toQaDetail(item.question)" v-html="$keywordActiveShow(item.question.content,query.keyword)"></view>
<view class="qa-bottombox">
<view class="qa-bottom-left">
<text style="font-size: 24upx;color: #999;margin-top: 10upx;" @click="toQaDetail(item.question)">分享给{{item.toAname}}</text>
</view>
<view class="rowbtn-right" style="margin-left: auto;">
<view class="withdraw" v-if="!item.isRead" @click="withdraw(item)">
<image src="../../static/images/icon/withdrawnew.png" mode=""></image>撤回
</view>
<view v-if="!item.isRead" class="Viewed">
已查看
</view>
<view v-else class="notViewed">
未查看
</view>
</view>
</view>
</view>
</view>
<view v-show="count>query.pageSize"><uni-load-more :status="loadStatus"></uni-load-more></view>
<view v-show="count>dataList.pageSize"><uni-load-more :status="loadStatus"></uni-load-more></view>
</view>
</template>
@@ -128,6 +102,13 @@ export default {
computed: mapState(['resourceTab']),
data() {
return {
dataList: {
pageIndex: 1,
pageSize: 10,
keyword: '',
count: 0,
list: []
},
isRead:null,
statusBtn: '全部',
selectData: [
@@ -142,7 +123,7 @@ export default {
conType: 1,
query:{
pageIndex: 1,
pageSize: 4,
pageSize: 10,
keyword:'',
isRead:null
},
@@ -160,8 +141,7 @@ export default {
this.onReachBottom();
},
async onReachBottom() {
if(this.conType==1){
if(this.courseList.length<this.count){
if(this.dataList.list.length<this.count){
this.loadStatus='loading';
this.query.pageIndex++;
await this.findData(false);
@@ -169,31 +149,8 @@ export default {
}else{
this.loadStatus='noMore';
}
}
if(this.conType==2){
if(this.articleList.length<this.count){
this.loadStatus='loading';
this.query.pageIndex++;
await this.findData(false);
this.loadStatus='more';
}else{
this.loadStatus='noMore';
}
}
if(this.conType==4){
if(this.qaList.length<this.count){
this.loadStatus='loading';
this.query.pageIndex++;
await this.findData(false);
this.loadStatus='more';
}else{
this.loadStatus='noMore';
}
}
},
methods: {
//点击切换类别时请求数据
clicktab(val) {
this.conType=val;
@@ -207,64 +164,38 @@ export default {
},
//查找数据
findData(flag) {
let $this = this;
//是否重置列表
if (flag) {
if(this.conType==1){
this.courseList=[]
}
if(this.conType==2){
this.articleList=[]
}
if(this.conType==4){
this.qaList=[]
}
}
this.query.isRead = this.isRead;
//生成查询条件
uni.showLoading({ title: '加载中...' });
//查询条件
const conList = {
1: 'mycourselist',
2: 'myarticlelist',
4: 'myqalist'
};
// console.log(this.query,'dydyyy')
apiShares[conList[this.conType]](this.query).then(rs => {
apiShares.findMeShare(this.query).then(rs => {
if (rs.status == 200) {
this.count=rs.result.count
console.log(rs);
rs.result.list.forEach(item => {
if(item.type == 4) {
item.question = {isResolve:false,title:'',content:'',bestAnswer:''};
item.question.isResolve=item.isResolve;
item.question.title=item.title;
item.question.content=item.content;
item.question.bestAnswer=item.bestAnswer;
item.question.id=item.id;
}
if(item.type == 3){
item.cases = {title:'',summary:''};
item.cases.title=item.title;
item.cases.summary=item.content;
item.cases.id=item.id;
}
if(this.conType==1){
rs.result.list.forEach(item=>{
$this.courseList.push(item)
})
});
if(flag){
this.dataList.list = rs.result.list;
}else{
this.dataList.list.push(...rs.result.list);
}
if(this.conType==2){
let userIds = [];
rs.result.list.forEach(item=>{
item.avatar=''
item.orgInfo='';
item.sex=null;
userIds.push(item.sysCreateAid);
$this.articleList.push(item)
})
$this.loadUserInfos(rs.result.list,userIds);
}
if(this.conType==4){
let userIds = [];
rs.result.list.forEach(item=>{
item.avatar=''
item.orgInfo='';
item.sex=null;
userIds.push(item.question.sysCreateAid);
$this.qaList.push(item)
})
$this.loadUserInfos(rs.result.list,userIds);
}
}else{
uni.showToast({
title: "获取数据失败",
@@ -276,8 +207,6 @@ export default {
uni.hideLoading();
}, 100);
},
withdraw(item){
apiShares.deleteshares(item.id).then(res=>{
if(res.status == 200){
@@ -765,15 +694,12 @@ export default {
}
.qa {
// margin-top: 19rpx;
// padding: 10px;
padding: 36upx 36upx;
box-shadow: #f7f7f7 0px 6px 5px;
border-radius: 4px;
background: #ffffff;
margin-top: 20upx;
padding-bottom: 15rpx;
padding-top: 0;
.qa-header {
height: 26px;