Browse Source

Merge branch 'master' of http://8.136.199.33:3000/hongze/hongze_yb_xcx

hbchen 2 years ago
parent
commit
a558a7fef1

+ 10 - 0
api/common.js

@@ -67,4 +67,14 @@ export const apiGetTagTree = params=>{
  */
 export const apiUserBindPermission=()=>{
     return httpGet('/company/permission/bind',{})
+}
+
+/**
+ * 更新媒体播放记录时长
+ * @param id 日志ID
+ * @param stop_seconds 访问时长
+ * @param source 来源:1-问答社区; 2-语音播报; 3-视频社区; 4-路演视频
+ */
+export const apiViewLogUpdate=params=>{
+    return httpPost('/public/view_log/update',params)
 }

+ 19 - 0
api/report.js

@@ -107,4 +107,23 @@ export const apiChapterTickerValue=params=>{
  */
 export const apiReportPPtImgs=params=>{
     return httpGet('/report/ppt_img',params)
+}
+
+/**
+ * 品种类型报告中品种筛选项
+ * @param classify_id 分类id
+ */
+export const apiGoodsPermissionList=params=>{
+    return httpGet('/company/permission/commodities',params)
+}
+
+/**
+ * 按品种查询报告列表
+ * @param chart_permission_id 品种id
+ * @param classify_id 分类id
+ * @param current_index
+ * @param page_size
+ */
+export const apiReportListForVariety=params=>{
+    return httpGet('/report/variety/list',params)
 }

+ 16 - 1
components/audioBox/audioBox.vue

@@ -54,6 +54,7 @@
 </template>
 
 <script>
+import {apiViewLogUpdate} from '@/api/common'
 export default {
     filters:{
         formatVoiceTime(e){
@@ -120,6 +121,7 @@ export default {
             const curAudio=this.$store.state.audio.list[this.$store.state.audio.index]
             setTimeout(() => {
                 if(this.globalBgMusic.src!=curAudio.url){
+                    this.handleUpdateAudioPlayTime()
                     this.globalBgMusic.src=curAudio.url 
                     this.globalBgMusic.title=curAudio.title
                 }
@@ -141,16 +143,18 @@ export default {
             })
             this.globalBgMusic.onPause(()=>{
                 console.log('音频暂停');
+                this.handleUpdateAudioPlayTime()
                 this.play=false
                 this.$store.commit('audio/updateAudioPause',true)
             })
             this.globalBgMusic.onStop(()=>{
                 console.log('音频停止');
+                this.handleUpdateAudioPlayTime()
                 this.$store.commit('audio/removeAudio')
             })
             this.globalBgMusic.onEnded(()=>{
                 console.log('音频onEnded');
-
+                this.handleUpdateAudioPlayTime()
                 const index=this.$store.state.audio.index 
                 if(index==this.$store.state.audio.list.length-1){
                     this.$store.commit('audio/removeAudio')
@@ -212,6 +216,17 @@ export default {
             }
         },
 
+        // 记录音频播放 时长
+        handleUpdateAudioPlayTime(){
+            if(!this.$store.state.audio.recordId||this.$store.state.audio.curTime==0) return
+            apiViewLogUpdate({
+                id:this.$store.state.audio.recordId,
+                stop_seconds:parseInt(this.$store.state.audio.curTime),
+                source:this.$store.state.audio.lastType
+            }).then(res=>{
+                console.log('音频播放时间记录成功');
+            })
+        }
     },
 }
 </script>

+ 1 - 1
mixin/index.js

@@ -52,7 +52,7 @@ module.exports = {
      * 报告时间格式化
      */
     formatReportTime(e){
-      return moment(e).format('YYYY.MM.DD')
+      return moment(e).format('YYYY-MM-DD')
     }
 
   },

+ 1 - 0
mixin/questionMixin.js

@@ -405,6 +405,7 @@ export default {
                 }).then((res)=>{
                     if(res.code===200){
                       console.log('音频id为'+audioItem.community_question_audio_id+'点击次数+1')  
+                      this.$store.commit('audio/addAudioRecordId',{recordId:res.data,source:1})
                     }
                 })
             }

+ 11 - 3
pages-report/classify.vue

@@ -2,7 +2,7 @@
   <view class="classify-page">
     <swiper class="swiper" autoplay interval>
       <swiper-item>
-        <image @click="goFiccService" :src="globalImgUrls.ficcServiceImg" mode="aspectFill"/>
+        <image @click="goFiccService" :src="globalImgUrls.ficcServiceImg+'?t='+new Date().getDay()" mode="aspectFill"/>
       </swiper-item>
     </swiper>
     <view class="list">
@@ -45,7 +45,7 @@ export default {
     },
 
     goDetail(item){
-      //redirect_type : 跳转页面类型:1,专栏列表,2报告列表,3专栏详情
+      //redirect_type : 跳转页面类型:1,专栏列表,2报告列表,3专栏详情,4品种类型列表
       if(item.redirect_type==1){
         uni.navigateTo({ url: `/pages-report/specialColumn/list?classifyId=${item.classify_id_first}&classifyName=${item.classify_name_first}` })
       }
@@ -55,6 +55,9 @@ export default {
       if(item.redirect_type==3){
         uni.navigateTo({url:'/pages-report/specialColumn/detail?columnId='+item.classify_id_second})
       }
+      if(item.redirect_type==4){
+        uni.navigateTo({url:`/pages-report/reportForVariety/list?classifyId=${item.classify_id_first}&classifyName=${item.classify_name_first}`})
+      }
     },
 
     goFiccService(){
@@ -63,7 +66,12 @@ export default {
   }
 };
 </script>
-
+<style>
+page{
+    padding-bottom: constant(safe-area-inset-bottom);
+    padding-bottom: env(safe-area-inset-bottom);
+}
+</style>
 <style lang="scss" scoped>
 .classify-page {
   padding: 34rpx;

+ 366 - 0
pages-report/reportForVariety/list.vue

@@ -0,0 +1,366 @@
+<template>
+    <view class="varietyauth-report-list">
+        <view class="top-variety-box">
+            <view class="first-nav">
+                <text 
+                    :class="['first-nav-item',item.id===firstVarietyId?'active':'']" 
+                    v-for="item in varietyList" 
+                    :key="item.id"
+                    @click="handleSelectFirstVariety(item)"
+                >{{item.classify_name}}</text>
+            </view>
+            <view class="sub-nav">
+                <text 
+                    :class="['sub-nav-item',item.chart_permission_id===secVarietyId?'active':'']" 
+                    v-for="item in secVarietyList" 
+                    :key="item.chart_permission_id"
+                    @click="handleSelectSecVariety(item)"
+                >{{item.chart_permission_name}}</text>
+            </view>
+        </view>
+        <view class="report-empty-box" v-if="finished&&list.length==0">
+            <image :src="globalImgUrls.chartEmpty" mode="widthFix" />
+            <view>暂无报告</view>
+        </view>
+        <view class="report-list-wrap" v-else>
+            <view class="flex item" v-for="item in list" :key="item.report_id" @click="goReportDetail(item)">
+                <image class="img" :src="item.report_img_url" mode="aspectFill" lazy-load />
+                <view class="con">
+                    <view class="van-multi-ellipsis--l2 title">{{item.title}}</view>
+                    <view class="info">{{item.classify_name_second}} · {{item.stage}}期 | {{item.publish_time|formatReportTime}}</view>
+                </view>
+                <view class="audio-box" @click.stop="handleClickAudio(item)">
+                    <image src="../static/a-pause.png" mode="aspectFill"/>
+                </view>
+            </view>
+        </view>
+
+        <!-- 音频弹窗 -->
+        <audioBox v-if="showAudioPop"></audioBox>
+
+        <!-- 分享海报 -->
+        <sharePoster 
+        :style="{bottom:'190rpx'}" 
+        :shareData="{
+            type:'report_list',
+            code_page:'pages-report/reportForVariety/list',
+            code_scene:code_scene,
+            data:shareParams
+        }"></sharePoster>
+    </view>
+</template>
+
+<script>
+import {apiGetSceneToParams} from '@/api/common'
+import {apiGoodsPermissionList,apiReportListForVariety} from '@/api/report'
+import audioBox from '../components/audioBox.vue'
+const moment=require('@/utils/moment-with-locales.min')
+export default {
+    computed:{
+        showAudioPop(){//是否显示音频弹窗
+            return this.$store.state.report.audioData.show 
+        },
+        curAudioReportId(){//当前播放的音频所属报告
+            return this.$store.state.report.audioData.reportId
+        },
+        curAudioPaused(){//当前音频是否暂停状态
+            return this.$store.state.report.audioData.paused
+        },
+        shareParams(){
+            let obj={
+                list_title:this.classifyName,
+                img_1:'',
+                title_1:'',
+                abstract_1:'',
+                abstract_1_style:'',
+                time_1:'',
+                img_2:'',
+                title_2:'',
+                abstract_2:'',
+                abstract_2_style:'',
+                time_2:'',
+            }
+            if(this.list[0]){
+                obj.img_1=this.list[0].report_img_url
+                obj.title_1=this.list[0].title 
+                obj.abstract_1=this.list[0].classify_name_second
+                obj.time_1=`${this.list[0].stage}期 | ${moment(this.list[0].publish_time).format('YYYY.MM.DD')}`
+                obj.abstract_1_style=this.list[0].classify_name_second?'':'display:none'
+            }
+            if(this.list[1]){
+                obj.img_2=this.list[1].report_img_url
+                obj.title_2=this.list[1].title 
+                obj.abstract_2=this.list[1].classify_name_second
+                obj.time_2=`${this.list[1].stage}期 | ${moment(this.list[1].publish_time).format('YYYY.MM.DD')}`
+                obj.abstract_2_style=this.list[1].classify_name_second?'':'display:none'
+            }
+            return obj
+        },
+        code_scene(){
+            return JSON.stringify({classifyId:this.classifyId,classifyName:this.classifyName})
+        }
+    },
+    components: {
+        audioBox
+    },
+    data() {
+        return {
+            classifyId:0,
+            classifyName:'',
+            varietyList:[],
+            firstVarietyId:0,//选择的一级品种id
+            secVarietyList:[],//二级品种
+            secVarietyId:0,//选择的二级品种id
+
+            list:[],
+            finished:false,
+            page:1,
+            pageSize:20
+        }
+    },
+    onLoad(opt){
+        this.init(opt)
+    },
+    onPullDownRefresh() {
+        this.page=1
+        this.list=[]
+        this.finished=false
+        this.getPermissionList()
+        setTimeout(() => {
+            uni.stopPullDownRefresh()
+        }, 1500);
+    },
+    onReachBottom() {
+        if(this.finished) return
+        this.page++
+        this.getList()
+    },
+    onShareAppMessage() {
+        return {
+            title:`FICC【${this.classifyName}】`
+        }
+    },
+    methods: {
+        async init(opt){
+            let classifyId=opt.classifyId||0
+            let classifyName=opt.classifyName
+            if(opt.scene){
+                const res=await apiGetSceneToParams({scene_key:opt.scene})
+                if(res.code===200){
+                    const obj=JSON.parse(res.data)
+                    classifyId=obj.classifyId
+                    classifyName=obj.classifyName
+                }
+            }
+            this.classifyId=classifyId
+            this.classifyName=decodeURIComponent(classifyName)
+            uni.setNavigationBarTitle({ title: this.classifyName })
+            this.getPermissionList()
+        },
+
+        //获取用户已绑定品种
+        async getPermissionList(){
+            const res=await apiGoodsPermissionList({
+                classify_id:Number(this.classifyId),
+            })
+            if(res.code===200){
+                let arr=res.data.permission_list||[]
+                //如果一个权限都没有则返回到分类列表
+                if(arr.length===0){
+                    uni.showToast({
+                        title: '暂无权限',
+                        icon: 'none'
+                    })
+                    setTimeout(() => {
+                        uni.reLaunch({
+                            url: '/pages-report/classify',
+                        });
+                    }, 1500);
+                    
+                    return
+                }
+                this.varietyList=arr
+                this.handleSelectFirstVariety(this.varietyList[0])
+            }
+        },
+
+        //选择一级品种
+        handleSelectFirstVariety(item){
+            this.firstVarietyId=item.id
+            this.secVarietyList=item.list
+            this.handleSelectSecVariety(item.list[0])
+        },
+        //选择二级品种
+        handleSelectSecVariety(item){
+            this.secVarietyId=item.chart_permission_id
+            this.page=1
+            this.finished=false
+            this.list=[]
+            this.getList()
+        },
+
+        async getList(){
+            const res=await apiReportListForVariety({
+                chart_permission_id:Number(this.secVarietyId),
+                classify_id:Number(this.classifyId),
+                current_index:this.page,
+                page_size:this.pageSize
+            })
+            if(res.code===200){
+                const arr=res.data.list||[]
+                this.list=[...this.list,...arr]
+                this.finished=res.data.paging.is_end
+            }
+        },
+
+        // 跳转报告详情
+        goReportDetail(item){
+            if(['晨报','周报'].includes(item.classify_name_first)){
+                uni.navigateTo({url: `/pages-report/chapterDetail?chapterId=${item.report_chapter_id}`})
+            }else{
+                uni.navigateTo({url:'/pages-report/reportDetail?reportId='+item.report_id})
+            }
+        },
+
+        handleClickAudio(item){
+            if(!item.auth_ok) return
+            if(!item.video_list||item.video_list.length==0){
+                uni.showToast({
+                    title: '暂无音频',
+                    icon: 'none'
+                })
+                return
+            }
+            // 判断是否为同一个音频
+            if(this.$store.state.report.audioData.reportId==item.report_id){
+                if(this.globalBgMusic.paused){
+                    this.globalBgMusic.play()
+                    this.$store.commit('showPopAudio')
+                }else{
+                    this.globalBgMusic.pause()
+                }
+            }else{
+                this.$store.commit('addAudio', {list:item.video_list,reportId:item.report_id})
+            }
+        },
+    },
+}
+</script>
+
+<style>
+page{
+    padding-bottom: constant(safe-area-inset-bottom);
+    padding-bottom: env(safe-area-inset-bottom);
+}
+</style>
+
+<style lang="scss" scoped>
+.top-variety-box{
+    padding: 40rpx 34rpx 0 34rpx;
+    box-shadow: 0px 4rpx 4rpx rgba(198, 198, 198, 0.25);
+    background-color: #fff;
+    position: sticky;
+    left: 0;
+    right: 0;
+    top: 0;
+    z-index: 50;
+    .first-nav-item{
+        display: inline-block;
+        min-width: 140rpx;
+        line-height: 70rpx;
+        margin-right: 30rpx;
+        font-size: 32rpx;
+        color: #666;
+        text-align: center;
+        background: #F5F5F5;
+        border-radius: 4px;
+        box-sizing: border-box;
+        padding: 0 20rpx;
+        margin-bottom: 16rpx;
+        &.active{
+            color: #E3B377;
+            background: #FDF8F2;
+        }
+    }
+    .sub-nav{
+        overflow-x: auto;
+        white-space: nowrap;
+        padding: 16rpx 0;
+        &::-webkit-scrollbar{
+            width: 0;
+            height: 0;
+            display: none;
+        }
+        .sub-nav-item{
+            display: inline-block;
+            position: relative;
+            margin-right: 50rpx;
+            font-size: 28rpx;
+            color: #666;
+            position: relative;
+            &.active{
+                color: #E3B377;
+                &::after{
+                    content: '';
+                    display: block;
+                    width: 54rpx;
+                    height: 4rpx;
+                    background-color: #E3B377;
+                    position: absolute;
+                    bottom: -16rpx;
+                    left: 50%;
+                    transform: translateX(-50%);
+                }
+            }
+        }
+    }
+}
+.report-list-wrap{
+    padding: 34rpx;
+    .item{
+        margin-bottom: 30rpx;
+        position: relative;
+        .img{
+            width: 90rpx;
+            height: 120rpx;
+            background-color: #f5f5f5;
+            border-radius: 8rpx;
+            overflow: hidden;
+            margin-right: 19rpx;
+            flex-shrink: 0;
+        }
+        .con{
+            padding-right: 100rpx;
+            flex: 1;
+        }
+        .title{
+            font-size: 28rpx;
+            font-weight: bold;
+            margin-bottom: 10rpx;
+            min-height: 70rpx;
+        }
+        .info{
+            font-size: 24rpx;
+            color: #9C9791;
+        }
+        .audio-box{
+            position: absolute;
+            top: 50%;
+            transform: translateY(-50%);
+            width: 22px;
+            height: 20px;
+            background: linear-gradient(180deg, #F3A52F 0%, #E3B377 100%);
+            border-radius: 6px;
+            right: 20rpx;
+            text-align: center;
+            image{
+                width: 12px;
+                height: 12px;
+                position: relative;
+                top: 1px;
+            }
+        }
+
+    }
+}
+</style>

+ 51 - 52
pages-report/reportList.vue

@@ -24,11 +24,13 @@
         <image class="img" :src="item.report_img_url" mode="aspectFill" lazy-load />
         <view class="con">
           <view class="title" v-html="item.title"></view>
-          <view class="info" v-html="item.classify_name_second"></view>
-          <view class="time">{{item.stage}}期 | {{item.publish_time|formatReportTime}}</view>
-          <view :class="['audio-box',!item.auth_ok&&'grey-audio-box']" @click.stop="handleClickAudio(item)" v-if="item.auth_ok">
-            <image :src="curAudioReportId==item.report_id&&!curAudioPaused?'./static/audio-s.png':'./static/audio.png'" mode="aspectFill"/>
-            <text>{{curAudioReportId==item.report_id&&!curAudioPaused?'暂停':'播放'}}</text>
+          <view class="info">
+            <view v-html="item.classify_name_second" style="display:inline-block"></view>
+            <text v-if="item.classify_name_second" style="display:inline-block;margin:0 10rpx">&nbsp;·&nbsp;</text>
+            <text>{{item.stage}}期 | {{item.publish_time|formatReportTime}}</text>
+          </view>
+          <view class="audio-box" v-if="item.auth_ok" @click.stop="handleClickAudio(item)">
+            <image :src="curAudioReportId==item.report_id&&!curAudioPaused?'./static/a-play.png':'./static/a-pause.png'" mode="aspectFill"/>
           </view>
         </view>
       </view>
@@ -36,7 +38,7 @@
 
     <!-- 筛选 -->
     <van-popup :show="showFilter" position="bottom" :safe-area-inset-bottom="false" round @close="showFilter=false">
-        <view class="filter-wrap">
+        <view class="filter-wrap" @touchmove.stop>
             <view class="flex top">
                 <text style="color:#000">筛选</text>
                 <text style="color:#E3B377" @click="showFilter=false">取消</text>
@@ -93,10 +95,12 @@ export default {
         img_1:'',
         title_1:'',
         abstract_1:'',
+        abstract_1_style:'',
         time_1:'',
         img_2:'',
         title_2:'',
         abstract_2:'',
+        abstract_2_style:'',
         time_2:'',
       }
       if(this.list[0]){
@@ -104,12 +108,14 @@ export default {
         obj.title_1=this.list[0].title 
         obj.abstract_1=this.list[0].classify_name_second
         obj.time_1=`${this.list[0].stage}期 | ${moment(this.list[0].publish_time).format('YYYY.MM.DD')}`
+        obj.abstract_1_style=this.list[0].classify_name_second?'':'display:none'
       }
       if(this.list[1]){
         obj.img_2=this.list[1].report_img_url
         obj.title_2=this.list[1].title 
         obj.abstract_2=this.list[1].classify_name_second
         obj.time_2=`${this.list[1].stage}期 | ${moment(this.list[1].publish_time).format('YYYY.MM.DD')}`
+        obj.abstract_2_style=this.list[1].classify_name_second?'':'display:none'
       }
       return obj
     },
@@ -274,7 +280,8 @@ export default {
 
 <style>
 page{
-  padding-bottom: 0;
+  padding-bottom: constant(safe-area-inset-bottom);
+  padding-bottom: env(safe-area-inset-bottom);
 }
 </style>
 <style lang="scss" scoped>
@@ -298,58 +305,50 @@ page{
 }
 .report-list-wrap {
   padding: 0 34rpx;
-  .item {
-    padding-bottom: 30rpx;
+  .item{
     margin-bottom: 30rpx;
-    border-bottom: 1px solid #EDEDED;
-    .img {
-      width: 120rpx;
-      height: 180rpx;
+    position: relative;
+    .img{
+      width: 90rpx;
+      height: 120rpx;
       background-color: #f5f5f5;
+      border-radius: 8rpx;
+      overflow: hidden;
+      margin-right: 19rpx;
       flex-shrink: 0;
-      margin-right: 20rpx;
-      border-radius: 16rpx;
     }
-    .con {
+    .con{
+      padding-right: 100rpx;
       flex: 1;
-      position: relative;
-      overflow: hidden;
-      .title {
-        font-size: 32rpx;
-        font-weight: bold;
-        margin-bottom: 8rpx;
-      }
-      
-      .time {
-        position: absolute;
-        color: #666666;
-        bottom: 0;
-        left: 0;
-        font-size: 28rpx;
-      }
-      .audio-box {
-        position: absolute;
-        bottom: 0;
-        right: 0;
-        width: 99rpx;
-        height: 39rpx;
-        background: #E3B377;
-        border-radius: 20rpx;
-        color: #fff;
-        font-size: 24rpx;
-        display: flex;
-        justify-content: center;
-        align-items: center;
-        image{
-          width: 30rpx;
-          height: 30rpx;
-          margin-right: 4rpx;
-        }
-      }
-      .grey-audio-box {
-        background: linear-gradient(114deg, #b0b0b0 0%, #e5e2e2 100%);
+    }
+    .title{
+      font-size: 28rpx;
+      font-weight: bold;
+      margin-bottom: 10rpx;
+      min-height: 70rpx;
+    }
+    .info{
+      font-size: 24rpx;
+      color: #9C9791;
+    }
+    .audio-box{
+      position: absolute;
+      top: 50%;
+      transform: translateY(-50%);
+      width: 22px;
+      height: 20px;
+      background: linear-gradient(180deg, #F3A52F 0%, #E3B377 100%);
+      border-radius: 6px;
+      right: 20rpx;
+      text-align: center;
+      image{
+        width: 12px;
+        height: 12px;
+        position: relative;
+        top: 1px;
       }
     }
+
   }
 }
 .filter-wrap{

BIN
pages-report/static/a-pause.png


BIN
pages-report/static/a-play.png


+ 30 - 1
pages-roadShow/video/search.vue

@@ -38,6 +38,8 @@
                     enable-play-gesture
                     :id="item.road_video_id"
                     @ended="handleVideoEnd"
+                    @pause="handleVideoPause"
+                    @timeupdate="handleTimeUpdate"
                     v-if="item.road_video_id==curVideoId"
                 ></video>
                 <image @click="handelClickPlay(item)" v-else class="poster" :src="item.cover_img_url" mode="aspectFill" lazy-load/>
@@ -51,6 +53,7 @@
 <script>
 import searchBox from '@/components/searchBox/searchBox.vue'
 import {apiRoadShowVideoList,apiRoadShowVideoPlayLog} from '@/api/roadShow'
+import {apiViewLogUpdate} from '@/api/common'
 export default {
     components: {
         searchBox
@@ -65,7 +68,9 @@ export default {
             pageSize:10,
 
             curVideoId:0,
-            curVideoIns:null
+            curVideoIns:null,
+            curVideoTime:0,
+            videoRecordId:0,
         }
     },
     onReachBottom() {
@@ -130,6 +135,7 @@ export default {
             apiRoadShowVideoPlayLog({video_id:Number(item.road_video_id)}).then(res=>{
                 if(res.code===200){
                     console.log('视频埋点成功');
+                    this.videoRecordId=res.data
                 }
             })
         },
@@ -142,6 +148,29 @@ export default {
                 this.curVideoId=0
                 this.curVideoIns=null
             }, 200);
+        },
+
+        //时长变化
+        handleTimeUpdate(e){
+            // console.log(this.curVideoId,e.detail.currentTime);
+            this.curVideoTime=e.detail.currentTime
+        },
+
+        handleVideoPause(){
+            // console.log(`视频 pause---${this.videoRecordId}----${this.curVideoTime}`);
+            this.handleUpdateVideoPlayTime()
+        },
+
+        // 更新播放时长
+        handleUpdateVideoPlayTime(){
+            if(!this.videoRecordId) return
+            apiViewLogUpdate({
+                id:this.videoRecordId,
+                stop_seconds:parseInt(this.curVideoTime),
+                source:4
+            }).then(res=>{
+                console.log('更新播放时长成功');
+            })
         }
     },
 }

+ 1 - 0
pages-voice/myVoice.vue

@@ -338,6 +338,7 @@ export default {
             })
             if(res.code===200){
                 console.log('上报音频播放记录');
+                this.$store.commit('audio/addAudioRecordId',{recordId:res.data,source:2})
             }
         }
     },

+ 1 - 0
pages-voice/voiceDetail.vue

@@ -201,6 +201,7 @@ export default {
             })
             if(res.code===200){
                 console.log('上报音频播放记录');
+                this.$store.commit('audio/addAudioRecordId',{recordId:res.data,source:2})
             }
         },
 

+ 7 - 0
pages.json

@@ -252,6 +252,13 @@
 					"style":{
 						"navigationStyle": "custom"
 					}
+				},
+				//按用户有权限品种分的报告列表页
+				{
+					"path": "reportForVariety/list",
+					"style":{
+						"enablePullDownRefresh": true
+					}
 				}
 			]
 		},

+ 2 - 1
pages/pc.vue

@@ -22,7 +22,8 @@ const mapObj=new Map([
     ['pages/voice/voice','/voice/list'],
     ['pages-voice/voiceDetail','/voice/detail'],
     ['pages-roadShow/video/list','/roadshow/video/list'],
-    ['pages/roadShow/video/list','/roadshow/video/list']
+    ['pages/roadShow/video/list','/roadshow/video/list'],
+    ['pages-report/reportForVariety/list','/report/varietyreportlist']
 ])//map映射小程序页面路径对应h5页面路径
 import {apiUserInfo} from '@/api/user'
 import {apiGetSceneToParams} from '@/api/common'

+ 29 - 1
pages/roadShow/video/list.vue

@@ -51,6 +51,8 @@
                     enable-play-gesture
                     :id="item.road_video_id"
                     @ended="handleVideoEnd"
+                    @pause="handleVideoPause"
+                    @timeupdate="handleTimeUpdate"
                     v-if="item.road_video_id==curVideoId"
                 ></video>
                 <image @click="handelClickPlay(item)" v-else class="poster" :src="item.cover_img_url" mode="aspectFill" lazy-load/>
@@ -113,7 +115,7 @@
 </template>
 <script>
 import {apiRoadShowVideoList,apiRoadShowVideoPlayLog} from '@/api/roadShow'
-import {apiGetSceneToParams,apiUserBindPermission} from '@/api/common'
+import {apiGetSceneToParams,apiUserBindPermission,apiViewLogUpdate} from '@/api/common'
 import noAuth from './components/noAuth.vue'
 import dragButton from '@/components/dragButton/dragButton.vue'
 export default {
@@ -136,6 +138,8 @@ export default {
 
             curVideoId:0,
             curVideoIns:null,
+            curVideoTime:0,
+            videoRecordId:0,
 
             isAuth:true,
             noAuthData:null,
@@ -282,6 +286,7 @@ export default {
             apiRoadShowVideoPlayLog({video_id:Number(item.road_video_id)}).then(res=>{
                 if(res.code===200){
                     console.log('视频埋点成功');
+                    this.videoRecordId=res.data
                 }
             })
         },
@@ -294,6 +299,29 @@ export default {
                 this.curVideoId=0
                 this.curVideoIns=null
             }, 200);
+        },
+
+        //时长变化
+        handleTimeUpdate(e){
+            // console.log(this.curVideoId,e.detail.currentTime);
+            this.curVideoTime=e.detail.currentTime
+        },
+
+        handleVideoPause(){
+            // console.log(`视频 pause---${this.videoRecordId}----${this.curVideoTime}`);
+            this.handleUpdateVideoPlayTime()
+        },
+
+        // 更新播放时长
+        handleUpdateVideoPlayTime(){
+            if(!this.videoRecordId) return
+            apiViewLogUpdate({
+                id:this.videoRecordId,
+                stop_seconds:parseInt(this.curVideoTime),
+                source:4
+            }).then(res=>{
+                console.log('更新播放时长成功');
+            })
         }
     },
 }

+ 29 - 1
pages/video/videoList.vue

@@ -48,6 +48,8 @@
                     enable-play-gesture
                     :id="item.community_video_id"
                     @ended="handleVideoEnd"
+                    @pause="handleVideoPause"
+                    @timeupdate="handleTimeUpdate"
                     v-if="item.community_video_id==curVideoId"
                 ></video>
                 <image @click="handelClickPlay(item)" v-else class="poster" :src="item.cover_img_url" mode="aspectFill" lazy-load/>
@@ -110,7 +112,7 @@
 <script>
 import {apiVideoList,apiVideoPlayLog} from '@/api/video'
 import {apiOptionList} from '@/api/question'
-import {apiGetSceneToParams,apiGetTagTree} from '@/api/common'
+import {apiGetSceneToParams,apiGetTagTree,apiViewLogUpdate} from '@/api/common'
 import noAuth from './components/noAuth.vue'
 import dragButton from '@/components/dragButton/dragButton.vue'
 import commnet from './components/comment.vue'
@@ -135,6 +137,8 @@ export default {
 
             curVideoId:0,
             curVideoIns:null,
+            curVideoTime:0,
+            videoRecordId:0,
 
             isAuth:true,
             noAuthData:null,
@@ -277,6 +281,7 @@ export default {
             apiVideoPlayLog({video_id:Number(item.community_video_id)}).then(res=>{
                 if(res.code===200){
                     console.log('视频埋点成功');
+                    this.videoRecordId=res.data
                 }
             })
         },
@@ -289,6 +294,29 @@ export default {
                 this.curVideoId=0
                 this.curVideoIns=null
             }, 200);
+        },
+
+         //时长变化
+        handleTimeUpdate(e){
+            // console.log(this.curVideoId,e.detail.currentTime);
+            this.curVideoTime=e.detail.currentTime
+        },
+
+        handleVideoPause(){
+            // console.log(`视频 pause---${this.videoRecordId}----${this.curVideoTime}`);
+            this.handleUpdateVideoPlayTime()
+        },
+
+        // 更新播放时长
+        handleUpdateVideoPlayTime(){
+            if(!this.videoRecordId) return
+            apiViewLogUpdate({
+                id:this.videoRecordId,
+                stop_seconds:parseInt(this.curVideoTime),
+                source:3
+            }).then(res=>{
+                console.log('更新播放时长成功');
+            })
         }
     },
 }

+ 30 - 1
pages/video/videoSearch.vue

@@ -39,6 +39,8 @@
                     enable-play-gesture
                     :id="item.community_video_id"
                     @ended="handleVideoEnd"
+                    @pause="handleVideoPause"
+                    @timeupdate="handleTimeUpdate"
                     v-if="item.community_video_id==curVideoId"
                 ></video>
                 <image @click="handelClickPlay(item)" v-else class="poster" :src="item.cover_img_url" mode="aspectFill" lazy-load/>
@@ -51,6 +53,7 @@
 <script>
 import searchBox from '@/components/searchBox/searchBox.vue'
 import {apiVideoList,apiVideoPlayLog} from '@/api/video'
+import {apiViewLogUpdate} from '@/api/common'
 import commnet from './components/comment.vue'
 export default {
     components: {
@@ -67,7 +70,9 @@ export default {
             pageSize:10,
 
             curVideoId:0,
-            curVideoIns:null
+            curVideoIns:null,
+            curVideoTime:0,
+            videoRecordId:0,
         }
     },
     onReachBottom() {
@@ -132,6 +137,7 @@ export default {
             apiVideoPlayLog({video_id:Number(item.community_video_id)}).then(res=>{
                 if(res.code===200){
                     console.log('视频埋点成功');
+                    this.videoRecordId=res.data
                 }
             })
         },
@@ -144,6 +150,29 @@ export default {
                 this.curVideoId=0
                 this.curVideoIns=null
             }, 200);
+        },
+
+        //时长变化
+        handleTimeUpdate(e){
+            // console.log(this.curVideoId,e.detail.currentTime);
+            this.curVideoTime=e.detail.currentTime
+        },
+
+        handleVideoPause(){
+            // console.log(`视频 pause---${this.videoRecordId}----${this.curVideoTime}`);
+            this.handleUpdateVideoPlayTime()
+        },
+
+        // 更新播放时长
+        handleUpdateVideoPlayTime(){
+            if(!this.videoRecordId) return
+            apiViewLogUpdate({
+                id:this.videoRecordId,
+                stop_seconds:parseInt(this.curVideoTime),
+                source:3
+            }).then(res=>{
+                console.log('更新播放时长成功');
+            })
         }
     },
 }

+ 1 - 0
pages/voice/voice.vue

@@ -423,6 +423,7 @@ export default {
             })
             if(res.code===200){
                 console.log('上报音频播放记录');
+                this.$store.commit('audio/addAudioRecordId',{recordId:res.data,source:2})
             }
         }
     },

+ 7 - 0
store/modules/audio.js

@@ -11,6 +11,8 @@ const audioModules={
         questionId:0,//当前是哪个问答的音频
         paused:true,//当前是否音频正在播放 true暂停状态
         curTime:0,//当前正在播放的音频播放的时间
+        recordId:0,//播放记录id
+        lastType:0,//上次播放的是那种的音频,用于更新媒体播放记录时长中的source
     },
     mutations: {
         addAudio(state,e){
@@ -51,6 +53,11 @@ const audioModules={
         // 关闭弹窗
         closePopAudio(state){
             state.show=false
+        },
+        // 设置播放记录id
+        addAudioRecordId(state,e){
+            state.recordId=e.recordId
+            state.lastType=e.source
         }
     }
 }