Преглед изворни кода

增加pageone通话记录的删除和查询

Yannay пре 2 месеци
родитељ
комит
07cf9e8f16

+ 1 - 2
components/soundRecorder/soundRecorder.vue

@@ -42,8 +42,7 @@ export default {
42 42
     },
43 43
     methods: {
44 44
         handleDelete() {
45
-            console.log('点击了删除录音的按钮')
46
-            // this.$emit('delete', this.dataInner)
45
+            this.$emit('handleDelectThisSoundRecord', this.dataInner)
47 46
         }
48 47
     }
49 48
 

+ 31 - 2
pages/orderDetailNew/components/pageOne.vue

@@ -50,7 +50,9 @@
50 50
             <view class="image-upload-container" v-if="chatRecordOrCallRecord === 'callRecords'">
51 51
                 <view>
52 52
 
53
-                    <sound-recorder v-for="item in soundRecordList" :key="item.fileName" :data="item"></sound-recorder>
53
+                    <sound-recorder v-for="item in soundRecordList" :key="item.fileName" :data="item"
54
+                        @handleDelectThisSoundRecord='handleDelectThisSoundRecord'></sound-recorder>
55
+                    <!-- <view class="add-btn" @click="addCallRecord">添加通话记录</view> -->
54 56
 
55 57
                 </view>
56 58
 
@@ -421,7 +423,34 @@ export default {
421 423
             console.log('通话记录:', data);
422 424
             this.soundRecordList = data;
423 425
         },
424
-
426
+        //删除录音
427
+        handleDelectThisSoundRecord({ id }) {
428
+            console.log('当前需要删除的录音的id是', id)
429
+            uni.showModal({
430
+                title: '提示',
431
+                content: '是否确定删除?',
432
+                confirmColor: '#6cc040',
433
+                success: async (res) => {
434
+                    if (res.confirm) {
435
+                        try {
436
+                            await uni.$u.api.deleteClueFile([id])
437
+                            uni.showToast({
438
+                                title: '删除成功',
439
+                                icon: 'success',
440
+                                duration: 2000
441
+                            })
442
+                            this.getData()
443
+                        } catch (error) {
444
+                            uni.showToast({
445
+                                title: '删除失败',
446
+                                icon: 'error',
447
+                                duration: 2000
448
+                            })
449
+                        }
450
+                    }
451
+                }
452
+            })
453
+        },
425 454
     },
426 455
 
427 456
 }