index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <template>
  2. <view class="callRecord_wrap">
  3. <view v-if="dataList.length > 0" class="timeline-list">
  4. <view v-for="(data, index) in dataList" :key="index" class="timeline-item">
  5. <view class="timeline-icon">
  6. <uni-icons type="phone" size="20" color="#6cc040"></uni-icons>
  7. </view>
  8. <view class="timeline-content">
  9. <view class="timestamp">{{ titleText(data) }}</view>
  10. <view class="info_top">
  11. <view class="info_left">
  12. <text class="name_text">{{ data.caller }} 打给 {{ data.callee }}</text>
  13. </view>
  14. <view class="info_right">
  15. {{ data.type === 1 ? data.followState : '' }}
  16. </view>
  17. <view class="delete-btn" @tap="handleDelete({ id: data.id })">
  18. <uni-icons type="trash" size="20" color="#ff6666"></uni-icons>
  19. </view>
  20. </view>
  21. <view class="file_name">{{data.fileName}}</view>
  22. <view class="call_file">
  23. <view class="audio-container">
  24. <audio :src="data.fileUrl" controls ></audio>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. <view v-else class="empty_wrap">
  31. <uni-icons type="empty" size="60" color="#cccccc"></uni-icons>
  32. <text class="empty-text">暂无通话记录</text>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. export default {
  38. props: {
  39. clueId: {
  40. type: [String, Number],
  41. required: true
  42. },
  43. clueDetail: {
  44. type: Object,
  45. default: () => ({})
  46. }
  47. },
  48. data() {
  49. return {
  50. dataList: []
  51. }
  52. },
  53. methods: {
  54. titleText(data) {
  55. return `${data.createTime} 号码(${data.caller}) ${(data.type === 1 ? data.hangupCauseName: '上传录音')}`
  56. },
  57. handleDelete({
  58. id
  59. }) {
  60. uni.showModal({
  61. title: '提示',
  62. content: '是否确定删除?',
  63. confirmColor: '#6cc040',
  64. success: async (res) => {
  65. if (res.confirm) {
  66. try {
  67. await uni.$u.api.deleteClueFile([id])
  68. uni.showToast({
  69. title: '删除成功',
  70. icon: 'success',
  71. duration: 2000
  72. })
  73. this.getData()
  74. } catch (error) {
  75. uni.showToast({
  76. title: '删除失败',
  77. icon: 'error',
  78. duration: 2000
  79. })
  80. }
  81. }
  82. }
  83. })
  84. },
  85. async getData() {
  86. const {
  87. data
  88. } = await uni.$u.api.getCallClueFileByClueId({
  89. clueId: this.clueId
  90. });
  91. this.dataList = data;
  92. },
  93. },
  94. mounted() {
  95. this.getData();
  96. },
  97. beforeDestroy(){
  98. uni.$off('uploadRecordSuccess');
  99. },
  100. created() {
  101. uni.$on('uploadRecordSuccess',()=>{
  102. this.getData();
  103. });
  104. }
  105. }
  106. </script>
  107. <style lang="scss" scoped>
  108. .callRecord_wrap {
  109. position: relative;
  110. padding: 20rpx;
  111. min-height: 400px;
  112. box-sizing: border-box;
  113. .loading-mask {
  114. position: absolute;
  115. top: 0;
  116. left: 0;
  117. right: 0;
  118. bottom: 0;
  119. background-color: rgba(255, 255, 255, 0.8);
  120. display: flex;
  121. justify-content: center;
  122. align-items: center;
  123. z-index: 999;
  124. }
  125. .timeline-list {
  126. .timeline-item {
  127. display: flex;
  128. margin-bottom: 30rpx;
  129. .timeline-icon {
  130. width: 60rpx;
  131. height: 60rpx;
  132. border-radius: 50%;
  133. background-color: #f1f3f4;
  134. display: flex;
  135. justify-content: center;
  136. align-items: center;
  137. margin-right: 20rpx;
  138. flex-shrink: 0;
  139. }
  140. .timeline-content {
  141. width:690rpx;
  142. .timestamp {
  143. font-size: 24rpx;
  144. color: #999;
  145. margin-bottom: 10rpx;
  146. }
  147. .info_top {
  148. display: flex;
  149. justify-content: space-between;
  150. align-items: center;
  151. margin-bottom: 20rpx;
  152. .info_left {
  153. .name_text {
  154. font-size: 28rpx;
  155. font-weight: 500;
  156. }
  157. }
  158. .info_right {
  159. color: #6cc040;
  160. font-size: 26rpx;
  161. }
  162. }
  163. .file_name{
  164. color: #999;
  165. font-size: 26rpx;
  166. }
  167. .call_file {
  168. width: 100%;
  169. border-radius: 12rpx;
  170. display: flex;
  171. align-items: center;
  172. justify-content: space-between;
  173. box-sizing: border-box;
  174. .audio-container {
  175. width: 100%;
  176. }
  177. }
  178. }
  179. }
  180. }
  181. .empty_wrap {
  182. text-align: center;
  183. padding: 100rpx 0;
  184. .empty-text {
  185. display: block;
  186. margin-top: 30rpx;
  187. color: #999;
  188. font-size: 28rpx;
  189. }
  190. }
  191. }
  192. </style>