Browse Source

发布做多次点击处理

jwyu 2 years ago
parent
commit
b26acdce27
2 changed files with 9 additions and 1 deletions
  1. 8 0
      pages-voice/addVoice.vue
  2. 1 1
      pages/voice/voice.vue

+ 8 - 0
pages-voice/addVoice.vue

@@ -169,6 +169,7 @@ export default {
             mainActiveIndex:0,
             mainActiveIndex:0,
             activeId:0,//选择的板块id
             activeId:0,//选择的板块id
 
 
+            isPublished:false,//是否正在发布,方式快速点击发布多条
         }
         }
     },
     },
     onLoad(){
     onLoad(){
@@ -392,6 +393,7 @@ export default {
 
 
         // 发布
         // 发布
         handlePublish(){
         handlePublish(){
+            if(this.isPublished) return
             if(!this.form.title||!this.form.variety_id){
             if(!this.form.title||!this.form.variety_id){
                 uni.showToast({
                 uni.showToast({
 					title:'请将内容填写完整',
 					title:'请将内容填写完整',
@@ -409,6 +411,10 @@ export default {
                 author_id:Number(this.$store.state.user.userInfo.user_id),
                 author_id:Number(this.$store.state.user.userInfo.user_id),
                 author:this.$store.state.user.userInfo.real_name
                 author:this.$store.state.user.userInfo.real_name
             }
             }
+            this.isPublished=true
+            uni.showLoading({
+				title:'发布中...'
+			})
             uni.uploadFile({
             uni.uploadFile({
                 url: baseApiUrl + "/voice/broadcast/add",
                 url: baseApiUrl + "/voice/broadcast/add",
                 filePath: this.temAudio.url,
                 filePath: this.temAudio.url,
@@ -446,6 +452,8 @@ export default {
                 },
                 },
                 complete: () => {
                 complete: () => {
                     console.log('con');
                     console.log('con');
+                    uni.hideLoading()
+                    this.isPublished=false
                 }
                 }
             });
             });
               
               

+ 1 - 1
pages/voice/voice.vue

@@ -24,7 +24,7 @@
                     <text v-if="item.BroadcastId==temAudio.id">{{temAudio.curTime|formatVoiceTime}}</text>
                     <text v-if="item.BroadcastId==temAudio.id">{{temAudio.curTime|formatVoiceTime}}</text>
                     <text v-else>{{item.VoicePlaySeconds|formatVoiceTime}}</text>
                     <text v-else>{{item.VoicePlaySeconds|formatVoiceTime}}</text>
                 </view>
                 </view>
-                <button class="del-btn">
+                <button class="del-btn" @click="handleDelItem(item)">
                 <image class="del-img" src="@/static/voice/del.png" @click="handleDelItem(item)" mode="widthFix" v-if="item.IsAuthor" />
                 <image class="del-img" src="@/static/voice/del.png" @click="handleDelItem(item)" mode="widthFix" v-if="item.IsAuthor" />
                 </button>
                 </button>
                 <button 
                 <button