jwyu 2 years ago
parent
commit
9f34d1bf0a
2 changed files with 98 additions and 9 deletions
  1. 1 0
      pages/report/report.vue
  2. 97 9
      pages/voice/voice.vue

+ 1 - 0
pages/report/report.vue

@@ -121,6 +121,7 @@ export default {
 			['report','/pages-report/classify'],
 			['chart','/pages/chart/chart'],
 			['buy','/pages/buy/buy'],
+      ['activity','/pages/activity/activity']
 		]),
 		tabCards: []
     }

+ 97 - 9
pages/voice/voice.vue

@@ -1,9 +1,16 @@
 <template>
     <view class="voice-play-page">
-        <view class="list-wrap">
-            <view class="item">
-                <view class="van-ellipsis title">这是一段最多显示一行的文字,多余的内容会被省略</view>
-                <view class="time">发布时间:</view>
+        <view class="empty-box" v-if="list.length==0&&finished">
+            <image
+                :src="globalImgUrls.activityNoAuth"
+                mode="widthFix"
+            />
+            <view>暂无数据</view>
+        </view>
+        <view class="list-wrap" v-else>
+            <view class="item" v-for="item in list" :key="item.BroadcastId">
+                <view class="title">{{item.BroadcastName}}</view>
+                <view class="time">发布时间:{{item.CreateTime|formatTime}}</view>
                 <view class="flex audio-box">
                     <image src="@/static/voice/pause.png" mode="widthFix" />
                     <text>06:27</text>
@@ -12,6 +19,7 @@
                 <button 
                     class="share-btn" 
                     open-type="share" 
+                    :data-item="item"
                 >
                     <image class="share-img" src="@/static/share-icon.png" mode="aspectFill"/>
                 </button>
@@ -19,24 +27,95 @@
         </view>
 
         <navigator url="/pages-voice/addVoice">
-            <view class="add-btn">新建语音</view>
+            <view class="add-btn" v-if="IsVoiceAdmin">新建语音</view>
         </navigator>
     </view>
 </template>
 
 <script>
 import {apiVoiceList} from '@/api/voice'
+import {apiGetSceneToParams} from '@/api/common'
+const moment=require('@/utils/moment-with-locales.min')
 export default {
+    filters:{
+        formatTime(e){
+            return moment(e).format('YYYY-MM-DD HH:mm:ss')
+        }
+    },
     data() {
         return {
-            
+            list:[],
+            page:1,
+            pageSize:20,
+            finished:false,
+            voiceId:0,//分享时进入的音频id
+
+            IsVoiceAdmin:false,
         }
     },
     onLoad(options){
-
+        this.init(options)
+    },
+    onShareAppMessage({from,target}) {
+        console.log(from,target);
+        let path='/pages/voice/voice?voiceId=0'
+        let title='FICC语音播报'
+        let imageUrl=''
+        if(from=='button'){
+            title=`${target.dataset.item.SectionName}:${target.dataset.item.BroadcastName}`
+            path=`/pages/voice/voice?voiceId=${target.dataset.item.BroadcastId}`
+            imageUrl=''
+        }
+        return {
+            title:title,
+            path:path,
+            imageUrl:imageUrl
+        }
+    },
+    onPullDownRefresh(){
+        this.voiceId=0
+        this.page=1
+        this.list=[]
+        this.finished=false
+        this.getVoiceList()
+        setTimeout(() => {
+            uni.stopPullDownRefresh()
+        }, 1500)
     },
+    onReachBottom() {
+        if(this.finished) return
+        this.page++
+        this.getVoiceList()
+    },
+
     methods: {
-        
+        async init(options){
+            if(options.scene){
+                const res=await apiGetSceneToParams({scene_key:options.scene})
+                if(res.code===200){
+                    const obj=JSON.parse(res.data)
+                    this.voiceId=obj.voiceId
+                }
+            }
+            this.getVoiceList()
+        },
+
+        // 获取音频列表
+        async getVoiceList(){
+            const res=await apiVoiceList({
+                page_index:this.page,
+                page_size:this.pageSize,
+                broadcast_id:Number(this.voiceId)
+            })
+            if(res.code===200){
+                this.IsVoiceAdmin=res.data.IsVoiceAdmin
+                let arr=res.data.List||[]
+                this.list=[...this.list,...arr]
+                if(arr.length===0){
+                    this.finished=true
+                }
+            }
+        }
     },
 }
 </script>
@@ -44,7 +123,16 @@ export default {
 <style lang="scss" scoped>
 .voice-play-page{
     padding: 34rpx;
-    
+}
+.empty-box{
+    text-align: center;
+    font-size: 32rpx;
+    color: #999;
+    padding-top: 150rpx;
+    image{
+        width: 80vw;
+        margin-bottom: 57rpx;
+    }
 }
 .list-wrap{
     .item{