Browse Source

初步完成yb9.2

jwyu 2 years ago
parent
commit
23e04ebe5e
3 changed files with 31 additions and 8 deletions
  1. 8 0
      api/voice.js
  2. 22 7
      pages-voice/myVoice.vue
  3. 1 1
      pages/voice/voice.vue

+ 8 - 0
api/voice.js

@@ -101,3 +101,11 @@ export const apiVoiceEdit=params=>{
 export const apiVoicePublish=params=>{
     return httpPost('/voice/broadcast/publish',params)
 }
+
+/**
+ * 我的语音数量统计
+ * @param author_id
+ */
+export const apiMyVoiceCount=params=>{
+    return httpGet('/voice/broadcast/list_count',params)
+}

+ 22 - 7
pages-voice/myVoice.vue

@@ -59,7 +59,7 @@
 </template>
 
 <script>
-import {apiVoiceList,apiVoicePlayRecord,apiVoiceDel,apiVoiceSendMsg,apiVoicePublish} from '@/api/voice'
+import {apiVoiceList,apiVoicePlayRecord,apiVoiceDel,apiVoiceSendMsg,apiVoicePublish,apiMyVoiceCount} from '@/api/voice'
 import audioBox from '@/components/audioBox/audioBox.vue'
 const moment=require('@/utils/moment-with-locales.min')
 export default {
@@ -101,17 +101,20 @@ export default {
                 {
                     lable:'未发布',
                     count:0,
-                    value:0
+                    value:0,
+                    key:'Unpublished'
                 },
                 {
                     lable:'已发布',
                     count:0,
-                    value:1
+                    value:1,
+                    key:'Published'
                 },
                 {
                     lable:'全部',
                     count:0,
-                    value:2
+                    value:2,
+                    key:'All'
                 }
             ],
 
@@ -119,6 +122,7 @@ export default {
         }
     },
     onLoad(){
+        this.getCount()
         this.getList()
     },
     onShow(){
@@ -175,6 +179,16 @@ export default {
             }
         },
 
+        //获取数量
+        async getCount(){
+            const res=await apiMyVoiceCount({author_id:this.$store.state.user.userInfo.user_id})
+            if(res.code===200){
+                this.statusOpt.forEach(item => {
+                    item.count=res.data[item.key]
+                })
+            }
+        },
+
         //状态改变
         handleOptChange(item){
             this.status=item.value
@@ -224,11 +238,10 @@ export default {
                 message: '确定要删除该语音播报吗?',
                 confirmButtonText:'确定'
             }).then(()=>{
-                if(this.temAudio.item&&this.temAudio.item.id==item.BroadcastId){
+                if(this.curVoiceId==item.BroadcastId&&!this.curAudioPaused){
                     //删除的音频正好在播放则暂停
                     this.globalBgMusic.stop()
                 }
-                
                 apiVoiceDel({broadcast_id:Number(item.BroadcastId)}).then(res=>{
                     if(res.code===200){
                         uni.showToast({
@@ -238,7 +251,8 @@ export default {
                         this.page=1
                         this.list=[]
                         this.finished=false
-                        this.getVoiceList()
+                        this.getList()
+                        this.getCount()
                     }
                 })
             }).catch(()=>{})
@@ -266,6 +280,7 @@ export default {
                         this.list=[]
                         this.finished=false
                         this.getList()
+                        this.getCount()
                     }else{
                         uni.showToast({
                             title:sendRes.msg,

+ 1 - 1
pages/voice/voice.vue

@@ -362,7 +362,7 @@ export default {
                 message: '确定要删除该语音播报吗?',
                 confirmButtonText:'确定'
             }).then(()=>{
-                if(this.temAudio.item&&this.temAudio.item.id==item.BroadcastId){
+                if(this.curVoiceId==item.BroadcastId&&!this.curAudioPaused){
                     //删除的音频正好在播放则暂停
                     this.globalBgMusic.stop()
                 }