jwyu 2 years ago
parent
commit
fa668de571

+ 1 - 1
api/user.js

@@ -79,7 +79,7 @@ export const apiSetMyinfo = params => {
  * @param source_agent //操作来源:1-小程序 2-小程序 PC 3-弘则研究公众号 4-Web PC
  */
 export const apiSetCollect=params=>{
-	return httpPost('/collection/collect',params)
+	return httpPost('/collection/collect',{source_agent:1,...params})
 }
 
 /**

+ 72 - 0
components/collectBox/collectBox.vue

@@ -0,0 +1,72 @@
+<template>
+    <view class="collect-box" @click.stop.prevent="handleClick">
+        <image class="icon" :src="cid>0?require('@/static/collect-s.png'):require('@/static/collect.png')" mode="aspectFill" />
+    </view>
+</template>
+
+<script>
+import {apiSetCollect,apiCancelCollect} from '@/api/user'
+export default {
+    props:{
+        type:{//收藏类型:1-研报; 2-视频社区; 3-微路演视频
+            type:Number,
+            default:0
+        },
+        primaryId:{// 藏类型主ID(如报告id,视频id)
+            default:0
+        },
+        extendId:{//扩展ID-如研报章节ID
+            default:0
+        },
+        collectId:{//收藏的id 大于0说明收藏了
+            default:0,
+        }
+    },
+    data() {
+        return {
+            cid:this.collectId
+        }
+    },
+    methods: {
+        handleClick(){
+            if(this.cid>0){
+                apiCancelCollect({
+                    collection_id:Number(this.cid)
+                }).then(res=>{
+                    if(res.code===200){
+                        uni.showToast({
+                            title:'取消收藏!',
+                            icon:'none'
+                        })
+                        this.cid=0
+                    }
+                })
+            }else{
+                apiSetCollect({
+                    collection_type:this.type,
+                    primary_id:Number(this.primaryId),
+                    extend_id:Number(this.extendId)
+                }).then(res=>{
+                    if(res.code===200){
+                        uni.showToast({
+                            title:'收藏成功!',
+                            icon:'none'
+                        })
+                        this.cid=res.data
+                    }
+                })
+            }
+        }
+    },
+
+}
+</script>
+
+<style lang="scss" scoped>
+.collect-box{
+    .icon{
+        width: 34rpx;
+        height: 34rpx;
+    }
+}
+</style>

+ 13 - 2
pages-roadShow/video/list.vue

@@ -36,6 +36,12 @@
                     <text class="tag">{{item.chart_permission_name}}</text>
                     <text class="title">{{item.title}}</text>
                 </view>
+                <collectBox
+                    :type="3"
+                    :primaryId="item.road_video_id"
+                    :collectId="item.collection_id"
+                    class="share-btn collect-btn"
+                />
                 <button 
                     class="share-btn" 
                     open-type="share" 
@@ -116,10 +122,12 @@ import {apiRoadShowVideoList,apiRoadShowVideoPlayLog} from '@/api/roadShow'
 import {apiGetSceneToParams,apiUserBindPermission} from '@/api/common'
 import noAuth from './components/noAuth.vue'
 import dragButton from '@/components/dragButton/dragButton.vue'
+import collectBox from '@/components/collectBox/collectBox.vue'
 export default {
     components:{
         noAuth,
-        dragButton
+        dragButton,
+        collectBox
     },
     data() {
         return {
@@ -342,7 +350,7 @@ export default {
             padding: 30rpx 34rpx;
             position: relative;
             .title-box{
-                padding-right: 40rpx;
+                margin-right: 110rpx;
             }
             .share-btn{
                 position: absolute;
@@ -361,6 +369,9 @@ export default {
                 width: 32.5rpx;
                 height: 32rpx;
             }
+            .collect-btn{
+                right: 96rpx;
+            }
             .tag{
                 color: #E4B478;
                 background-color: #333;

+ 13 - 2
pages-roadShow/video/search.vue

@@ -23,6 +23,12 @@
                     <text class="tag">{{item.chart_permission_name}}</text>
                     <text class="title">{{item.title}}</text>
                 </view>
+                <collectBox
+                    :type="3"
+                    :primaryId="item.road_video_id"
+                    :collectId="item.collection_id"
+                    class="share-btn collect-btn"
+                />
                 <button 
                     class="share-btn" 
                     open-type="share" 
@@ -51,9 +57,11 @@
 <script>
 import searchBox from '@/components/searchBox/searchBox.vue'
 import {apiRoadShowVideoList,apiRoadShowVideoPlayLog} from '@/api/roadShow'
+import collectBox from '@/components/collectBox/collectBox.vue'
 export default {
     components: {
-        searchBox
+        searchBox,
+        collectBox
     },
     data() {
         return {
@@ -177,7 +185,7 @@ page{
             padding: 30rpx 34rpx;
             position: relative;
             .title-box{
-                padding-right: 40rpx;
+                margin-right: 110rpx;
             }
             .share-btn{
                 position: absolute;
@@ -196,6 +204,9 @@ page{
                 width: 32.5rpx;
                 height: 32rpx;
             }
+            .collect-btn{
+                right: 96rpx;
+            }
             .tag{
                 color: #E4B478;
                 background-color: #333;

+ 256 - 7
pages-user/myCollect.vue

@@ -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>

+ 2 - 1
pages.json

@@ -416,7 +416,8 @@
 			"van-dialog": "/wxcomponents/vant/dialog/index",
 			"van-cell": "/wxcomponents/vant/cell/index",
 			"van-tree-select": "/wxcomponents/vant/tree-select/index",
-			"van-datetime-picker": "/wxcomponents/vant/datetime-picker/index"
+			"van-datetime-picker": "/wxcomponents/vant/datetime-picker/index",
+			"van-swipe-cell": "/wxcomponents/vant/swipe-cell/index"
 		}
 	}
 }

+ 13 - 2
pages/roadShow/video/list.vue

@@ -36,6 +36,12 @@
                     <text class="tag">{{item.chart_permission_name}}</text>
                     <text class="title">{{item.title}}</text>
                 </view>
+                <collectBox
+                    :type="3"
+                    :primaryId="item.road_video_id"
+                    :collectId="item.collection_id"
+                    class="share-btn collect-btn"
+                />
                 <button 
                     class="share-btn" 
                     open-type="share" 
@@ -116,10 +122,12 @@ import {apiRoadShowVideoList,apiRoadShowVideoPlayLog} from '@/api/roadShow'
 import {apiGetSceneToParams,apiUserBindPermission} from '@/api/common'
 import noAuth from './components/noAuth.vue'
 import dragButton from '@/components/dragButton/dragButton.vue'
+import collectBox from '@/components/collectBox/collectBox.vue'
 export default {
     components:{
         noAuth,
-        dragButton
+        dragButton,
+        collectBox
     },
     data() {
         return {
@@ -342,7 +350,7 @@ export default {
             padding: 30rpx 34rpx;
             position: relative;
             .title-box{
-                padding-right: 40rpx;
+                margin-right: 110rpx;
             }
             .share-btn{
                 position: absolute;
@@ -361,6 +369,9 @@ export default {
                 width: 32.5rpx;
                 height: 32rpx;
             }
+            .collect-btn{
+                right: 96rpx;
+            }
             .tag{
                 color: #E4B478;
                 background-color: #333;

+ 3 - 4
pages/user/user.vue

@@ -53,10 +53,9 @@
 			</view>
 			<view class="flex item-card" >
 				<image src="@/static/message_ico.png" mode="widthFix" />
-				<view class="label flex" style="align-items: center;">消息通知 
-					<text class="unread-ico" v-if="userInfo.un_read">{{userInfo.un_read}}</text> 
-				</view>
+				<view class="label flex" style="align-items: center;">消息通知</view>
 				<view class="right-text look" @click="toMessageHadle">
+					<text class="unread-ico" v-if="userInfo.un_read">{{userInfo.un_read}}</text> 
 					<van-icon name="arrow"></van-icon>
 				</view>
 			</view>
@@ -83,7 +82,7 @@
 			</navigator>
 			<navigator url="/pages-user/myCollect">
 				<view class="flex item-card">
-					<image src="../../static/voice/mine-voice-icon.png" mode="widthFix" />
+					<image src="../../static/collect-user-icon.png" mode="widthFix" />
 					<text class="label">我的收藏</text>
 					<view class="right-text look">
 						<van-icon name="arrow"></van-icon>

+ 13 - 2
pages/video/videoList.vue

@@ -32,6 +32,12 @@
                     <text class="tag">{{item.variety_tag_name}}</text>
                     <text class="title">{{item.title}}</text>
                 </view>
+                <collectBox
+                    :type="2"
+                    :primaryId="item.community_video_id"
+                    :collectId="item.collection_id"
+                    class="share-btn collect-btn"
+                />
                 <button 
                     class="share-btn" 
                     open-type="share" 
@@ -114,11 +120,13 @@ import {apiGetSceneToParams,apiGetTagTree} from '@/api/common'
 import noAuth from './components/noAuth.vue'
 import dragButton from '@/components/dragButton/dragButton.vue'
 import commnet from './components/comment.vue'
+import collectBox from '@/components/collectBox/collectBox.vue'
 export default {
     components:{
         noAuth,
         commnet,
-        dragButton
+        dragButton,
+        collectBox
     },
     data() {
         return {
@@ -336,7 +344,7 @@ export default {
             padding: 30rpx 34rpx;
             position: relative;
             .title-box{
-                padding-right: 40rpx;
+                margin-right: 110rpx;
             }
             .share-btn{
                 position: absolute;
@@ -355,6 +363,9 @@ export default {
                 width: 32.5rpx;
                 height: 32rpx;
             }
+            .collect-btn{
+                right: 96rpx;
+            }
             .tag{
                 color: #E4B478;
                 background-color: #333;

+ 13 - 2
pages/video/videoSearch.vue

@@ -23,6 +23,12 @@
                     <text class="tag">{{item.chart_permission_name}}</text>
                     <text class="title">{{item.title}}</text>
                 </view>
+                <collectBox
+                    :type="2"
+                    :primaryId="item.community_video_id"
+                    :collectId="item.collection_id"
+                    class="share-btn collect-btn"
+                />
                 <button 
                     class="share-btn" 
                     open-type="share" 
@@ -52,10 +58,12 @@
 import searchBox from '@/components/searchBox/searchBox.vue'
 import {apiVideoList,apiVideoPlayLog} from '@/api/video'
 import commnet from './components/comment.vue'
+import collectBox from '@/components/collectBox/collectBox.vue'
 export default {
     components: {
         searchBox,
-        commnet
+        commnet,
+        collectBox
     },
     data() {
         return {
@@ -178,7 +186,7 @@ page{
             padding: 30rpx 34rpx;
             position: relative;
             .title-box{
-                padding-right: 40rpx;
+                margin-right: 110rpx;
             }
             .share-btn{
                 position: absolute;
@@ -197,6 +205,9 @@ page{
                 width: 32rpx;
                 height: 32rpx;
             }
+            .collect-btn{
+                right: 96rpx;
+            }
             .tag{
                 color: #E4B478;
                 background-color: #333;

+ 37 - 63
pages/voice/voice.vue

@@ -23,7 +23,6 @@
             </van-tabs>
         </view>
           
-          
         <view class="empty-box" v-if="list.length==0&&finished">
             <image
                 :src="globalImgUrls.activityNoAuth"
@@ -42,20 +41,19 @@
                     />
                     <text>{{item.VoicePlaySeconds|formatVoiceTime}}</text>
                 </view>
-                <button class="publish-btn" @click.stop="handleSendMsgItem(item)" v-if="item.CouldSendMsg">
-                    <image class="publish-img" src="@/static/voice/publish.png" mode="widthFix"/>
-                </button>
-                <button class="del-btn" @click.stop="handleDelItem(item)" v-if="item.IsAuthor">
-                    <image class="del-img" src="@/static/voice/del.png" mode="widthFix"/>
-                </button>
-                <button 
-                    class="share-btn" 
-                    open-type="share" 
-                    :data-item="item"
-                    @click.stop=""
-                >
-                    <image class="share-img" src="@/static/share-icon.png" mode="aspectFill"/>
-                </button>
+                <view class="opt-box">
+                    <image style="width:34rpx;height:34rpx" src="@/static/voice/publish.png" mode="widthFix" @click.stop="handleSendMsgItem(item)" v-if="item.CouldSendMsg"/>
+                    <image style="width:34rpx;height:34rpx" src="@/static/voice/del.png" mode="widthFix" v-if="item.IsAuthor" @click.stop="handleDelItem(item)" />
+                    <image style="width:32rpx;height:32rpx" src="@/static/voice/creat-poster-icon.png" mode="aspectFill" />
+                    <button 
+                        class="share-btn" 
+                        open-type="share" 
+                        :data-item="item"
+                        @click.stop=""
+                    >
+                        <image class="share-img" src="@/static/share-icon.png" mode="aspectFill"/>
+                    </button>
+                </view>
             </view>
         </view>
 
@@ -503,58 +501,34 @@ export default {
         border-bottom: 1px solid #CDCDCD;
         padding: 30rpx 0;
         position: relative;
-        .publish-btn{
-            position: absolute;
-            right: 192rpx;
-            bottom: 30rpx;
-            width: 36rpx;
-            height: 36rpx;
-            background-color: transparent;
-            line-height: 1;
-            padding: 0;
-            &::after{
-                border: none;
+        .opt-box{
+            position: relative;
+            float: right;
+            bottom: 40rpx;
+            display: flex;
+            image{
+                margin-left: 40rpx;
             }
-        }
-        .publish-img{
-            width: 34rpx;
-            height: 34rpx;
-        }
-        .del-btn{
-            position: absolute;
-            right: 96rpx;
-            bottom: 30rpx;
-            width: 36rpx;
-            height: 36rpx;
-            background-color: transparent;
-            line-height: 1;
-            padding: 0;
-            &::after{
-                border: none;
+            .share-btn{
+                background-color: transparent;
+                width: 36rpx;
+                height: 36rpx;
+                line-height: 1;
+                padding: 0;
+                margin-left: 40rpx;
+                &::after{
+                    border: none;
+                }
+                .share-img{
+                    width: 32.5rpx;
+                    height: 32rpx;
+                    margin-left: 0;
+                }
             }
-        }
-        .del-img{
-            width: 34rpx;
-            height: 34rpx;
+            
         }
 
-        .share-btn{
-            position: absolute;
-            bottom: 30rpx;
-            right: 0rpx;
-            background-color: transparent;
-            width: 36rpx;
-            height: 36rpx;
-            line-height: 1;
-            padding: 0;
-            &::after{
-                border: none;
-            }
-        }
-        .share-img{
-            width: 32.5rpx;
-            height: 32rpx;
-        }
+
         .title{
             font-size: 32rpx;
         }

BIN
static/collect-s.png


BIN
static/collect-user-icon.png


BIN
static/collect.png


BIN
static/voice/creat-poster-icon.png