|
@@ -1,20 +1,69 @@
|
|
|
<template>
|
|
|
<view class="my-collect-page">
|
|
|
- <view class="top-wrap">
|
|
|
- <searchBox placeholder="搜索" />
|
|
|
- <van-tabs :active="active" @change="onChange">
|
|
|
- <van-tab title="标签 1">内容 1</van-tab>
|
|
|
- </van-tabs>
|
|
|
+ <view :class="['top-wrap',keywords?'top-wrap-ptb':'']">
|
|
|
+ <searchBox placeholder="搜索" @change="onChange" @search="onSearch" />
|
|
|
+ <view class="tab-box" v-show="!keywords">
|
|
|
+ <text
|
|
|
+ :class="['tab-item',active==item.val?'tab-active':'']"
|
|
|
+ v-for="item in opts"
|
|
|
+ :key="item.val"
|
|
|
+ @click="handleChangeOpt(item.val)"
|
|
|
+ >{{item.name}}</text>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
+ <view class="list-wrap">
|
|
|
+ <view class="item" v-for="(item,index) in list" :key="item.CollectionId">
|
|
|
+ <view class="c-time">{{item.CreateTime|formatCTime}}</view>
|
|
|
+ <van-swipe-cell :right-width="90">
|
|
|
+ <!-- 视频类别样式 -->
|
|
|
+ <view class="flex video-box" v-if="[2,3].includes(item.CollectionType)" @click="goDetail(item)">
|
|
|
+ <image class="img" :src="item.ImgUrl" mode="aspectFill" lazy-load="true"/>
|
|
|
+ <view class="con">
|
|
|
+ <view class="van-multi-ellipsis--l2 title">{{item.Title}}</view>
|
|
|
+ <view class="author">{{item.Author}}</view>
|
|
|
+ <view class="time">发布时间:{{item.PublishTime}}</view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <!-- 报告类型样式 -->
|
|
|
+ <view class="report-box" v-if="item.CollectionType==1" @click="goDetail(item)">
|
|
|
+ <view class="van-multi-ellipsis--l2 title">{{item.Title}}</view>
|
|
|
+ <view class="con">
|
|
|
+ <text v-if="item.ClassifyName">#{{item.ClassifyName}}</text>
|
|
|
+ <text v-if="item.ClassifySecondName" style="margin-left:20rpx">#{{item.ClassifySecondName}}</text>
|
|
|
+ <view class="time">发布时间:{{item.PublishTime}}</view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view slot="right" class="cancel-btn" @click="handleCancel(item,index)">取消收藏</view>
|
|
|
+ </van-swipe-cell>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ </view>
|
|
|
+ <view class="report-empty-box" v-if="finished&&list.length==0">
|
|
|
+ <image :src="globalImgUrls.chartEmpty" mode="widthFix" />
|
|
|
+ <view>暂无相关收藏内容</view>
|
|
|
+ </view>
|
|
|
+
|
|
|
+ <van-dialog id="van-dialog" />
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import searchBox from "@/components/searchBox/searchBox.vue";
|
|
|
+import {apiMyCollectList,apiCancelCollect} from '@/api/user'
|
|
|
+const moment=require('@/utils/moment-with-locales.min')
|
|
|
export default {
|
|
|
components: {
|
|
|
searchBox
|
|
|
},
|
|
|
+ filters: {
|
|
|
+ formatCTime(e){
|
|
|
+ if(moment().isSame(e,'year')){//当年
|
|
|
+ return moment(e).format('MM-DD')
|
|
|
+ }else{
|
|
|
+ return moment(e).format('YYYY-MM-DD')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
opts:[
|
|
@@ -34,11 +83,114 @@ export default {
|
|
|
name:'视频社区',
|
|
|
val:3,
|
|
|
},
|
|
|
- ]
|
|
|
+ ],
|
|
|
+ active:0,
|
|
|
+
|
|
|
+ page:1,
|
|
|
+ pageSize:20,
|
|
|
+ finished:false,
|
|
|
+ list:[],
|
|
|
+ keywords:'',
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onLoad(){
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ onPullDownRefresh() {
|
|
|
+ this.keywords=''
|
|
|
+ this.page=1
|
|
|
+ this.list=[]
|
|
|
+ this.finished=false
|
|
|
+ this.keywords=''
|
|
|
+ this.getList()
|
|
|
+ setTimeout(() => {
|
|
|
+ uni.stopPullDownRefresh()
|
|
|
+ }, 1500);
|
|
|
+ },
|
|
|
+ onReachBottom() {
|
|
|
+ if(this.finished) return
|
|
|
+ this.page++
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ onChange(e){
|
|
|
+ this.keywords=e
|
|
|
+ this.list=[]
|
|
|
+ },
|
|
|
+
|
|
|
+ onSearch(){
|
|
|
+ this.active=0
|
|
|
+ this.page=1
|
|
|
+ this.finished=false
|
|
|
+ this.list=[]
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+
|
|
|
+ handleChangeOpt(e){
|
|
|
+ this.active=e
|
|
|
+ this.page=1
|
|
|
+ this.finished=false
|
|
|
+ this.list=[]
|
|
|
+ this.keywords=''
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+
|
|
|
+ async getList(){
|
|
|
+ const res=await apiMyCollectList({
|
|
|
+ curr_page:this.page,
|
|
|
+ page_size:this.pageSize,
|
|
|
+ keywords:this.keywords,
|
|
|
+ from_type:this.active
|
|
|
+ })
|
|
|
+ if(res.code===200){
|
|
|
+ const arr=res.data.list
|
|
|
+ this.list=[...this.list,...arr]
|
|
|
+ this.finished=res.data.paging.is_end
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ handleCancel(item,index){
|
|
|
+ this.$dialog.confirm({
|
|
|
+ title:'',
|
|
|
+ message: '确认取消收藏?',
|
|
|
+ confirmButtonText:'确定'
|
|
|
+ }).then(()=>{
|
|
|
+ apiCancelCollect({collection_id:Number(item.CollectionId)}).then(res=>{
|
|
|
+ if(res.code===200){
|
|
|
+ uni.showToast({
|
|
|
+ title:'操作成功',
|
|
|
+ icon:'none'
|
|
|
+ })
|
|
|
+ this.list.splice(index,1)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }).catch(()=>{})
|
|
|
+ },
|
|
|
+
|
|
|
+ goDetail(item){
|
|
|
+ if(item.CollectionType==1){// 报告
|
|
|
+ if(item.ExtendId>0){
|
|
|
+ uni.navigateTo({url: `/pages-report/chapterDetail?chapterId=${item.ExtendId}`})
|
|
|
+ }else{
|
|
|
+ uni.navigateTo({url:'/pages-report/reportDetail?reportId='+item.PrimaryId})
|
|
|
+ }
|
|
|
+ }else if(item.CollectionType==2){//视频社区
|
|
|
+ //跳转tabbar不允许带参数 所以用relaunch
|
|
|
+ uni.reLaunch({url:'/pages/video/videoList?videoId='+item.PrimaryId})
|
|
|
+ }else if(item.CollectionType==3){//路演视频
|
|
|
+ uni.reLaunch({url:'/pages/roadShow/video/list?videoId='+item.PrimaryId})
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
},
|
|
|
}
|
|
|
</script>
|
|
|
+<style lang="scss">
|
|
|
+page{
|
|
|
+ padding-bottom: constant(safe-area-inset-bottom);
|
|
|
+ padding-bottom: env(safe-area-inset-bottom);
|
|
|
+}
|
|
|
+</style>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
.top-wrap{
|
|
@@ -48,6 +200,103 @@ export default {
|
|
|
right: 0;
|
|
|
z-index: 50;
|
|
|
background-color: #fff;
|
|
|
- padding-top: 20rpx;
|
|
|
+ padding: 40rpx 34rpx 0 34rpx;
|
|
|
+ box-shadow: 0px 4rpx 4rpx 0px rgba(198,198,198,0.25);
|
|
|
+ &.top-wrap-ptb{
|
|
|
+ box-shadow: none;
|
|
|
+ padding-bottom: 20rpx;
|
|
|
+ }
|
|
|
+ .tab-box{
|
|
|
+ padding-top: 40rpx;
|
|
|
+ padding-bottom: 10rpx;
|
|
|
+ .tab-item{
|
|
|
+ display: inline-block;
|
|
|
+ margin-right: 60rpx;
|
|
|
+ color: #666;
|
|
|
+ font-size: 32rpx;
|
|
|
+ }
|
|
|
+ .tab-active{
|
|
|
+ color: #333;
|
|
|
+ position: relative;
|
|
|
+ &::after{
|
|
|
+ position: absolute;
|
|
|
+ content: '';
|
|
|
+ display: block;
|
|
|
+ width: 36rpx;
|
|
|
+ height: 6rpx;
|
|
|
+ background: #E3B377;
|
|
|
+ border-radius: 3rpx;
|
|
|
+ bottom: -10rpx;
|
|
|
+ left: 50%;
|
|
|
+ transform: translateX(-50%);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+.list-wrap{
|
|
|
+ padding: 34rpx;
|
|
|
+ .item{
|
|
|
+ padding: 30rpx 0;
|
|
|
+ border-bottom: 1px solid #E5E5E5;
|
|
|
+ .c-time{
|
|
|
+ display: inline-block;
|
|
|
+ font-size: 28rpx;
|
|
|
+ padding: 5rpx 10rpx;
|
|
|
+ color: #666;
|
|
|
+ background-color: #f6f6f6;
|
|
|
+ border-radius: 3rpx;
|
|
|
+ margin-bottom: 12rpx;
|
|
|
+ }
|
|
|
+ .video-box{
|
|
|
+ .img{
|
|
|
+ width: 221rpx;
|
|
|
+ height: 192rpx;
|
|
|
+ flex-shrink: 0;
|
|
|
+ border-radius: 4rpx;
|
|
|
+ margin-right: 20rpx;
|
|
|
+ }
|
|
|
+ .con{
|
|
|
+ flex: 1;
|
|
|
+ }
|
|
|
+ .title{
|
|
|
+ font-size: 32rpx;
|
|
|
+ color: #000;
|
|
|
+ min-height: 80rpx;
|
|
|
+ }
|
|
|
+ .author{
|
|
|
+ color: #666;
|
|
|
+ min-height: 40rpx;
|
|
|
+ margin: 10rpx 0 20rpx 0;
|
|
|
+ }
|
|
|
+ .time{
|
|
|
+ color: #666;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .report-box{
|
|
|
+ .con{
|
|
|
+ text{
|
|
|
+ display: inline-block;
|
|
|
+ color: #666;
|
|
|
+ }
|
|
|
+ .time{
|
|
|
+ float: right;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .cancel-btn{
|
|
|
+ position: absolute;
|
|
|
+ top: 50%;
|
|
|
+ transform: translateY(-50%);
|
|
|
+ background: #F3A52F;
|
|
|
+ border-radius: 25px;
|
|
|
+ color: #fff;
|
|
|
+ font-size: 16px;
|
|
|
+ width: 84px;
|
|
|
+ text-align: center;
|
|
|
+ line-height: 30px;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|