RequireAttachment.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <view class="container" @touchmove.stop.prevent>
  3. <view class="container_head">
  4. 报修录音
  5. </view>
  6. <view class="container_form">
  7. <view class="audio" v-if="incidentData.reqRecord">
  8. <sy-audio ref="audio" isCountDown :src='pageData.audioSrc' audioTitle="" subheading=""></sy-audio>
  9. </view>
  10. </view>
  11. <view class="container_foot">
  12. <view class="foot_btns">
  13. <view class="know" @click="know">知道了</view>
  14. </view>
  15. </view>
  16. </view>
  17. <view class="mask" @touchmove.stop.prevent></view>
  18. </template>
  19. <script setup>
  20. import { defineEmits, ref, reactive, defineProps } from 'vue'
  21. import { onLoad } from '@dcloudio/uni-app'
  22. import { useLoginUserStore } from '@/stores/loginUser'
  23. import { api_wechatIncidentRecord } from "@/http/api.js"
  24. const emit = defineEmits(['cancelEmit', 'knowEmit']);
  25. const { incidentData } = defineProps({
  26. incidentData: Object,
  27. });
  28. const loginUserStore = useLoginUserStore();
  29. // 页面数据
  30. const pageData = reactive({
  31. audioSrc: '',//音频
  32. });
  33. const audio = ref(null);
  34. // 取消
  35. function cancel(){
  36. emit('cancelEmit')
  37. }
  38. // 确认
  39. function know(){
  40. audio.value && audio.value.audioDestroy()
  41. emit('knowEmit');
  42. }
  43. // 获取报修录音
  44. function getRepairAudio() {
  45. uni.showLoading({
  46. title: "加载中",
  47. mask: true,
  48. });
  49. api_wechatIncidentRecord(incidentData.id).then((res) => {
  50. uni.hideLoading();
  51. res.data = res.data || [];
  52. res.data.forEach(v => {
  53. v.previewUrl = location.origin + "/file" + v.relativeFilePath;
  54. })
  55. res.data[0] && (pageData.audioSrc = res.data[0].previewUrl);
  56. });
  57. }
  58. onLoad((option) => {
  59. incidentData.reqRecord && getRepairAudio();
  60. })
  61. </script>
  62. <style lang="scss" scoped>
  63. .mask{
  64. position: fixed;
  65. left: 0;
  66. top: 0;
  67. right: 0;
  68. bottom: 0;
  69. background-color: rgba(0, 0, 0, 0.4);
  70. z-index: 999;
  71. }
  72. .container{
  73. position: fixed;
  74. left: 50%;
  75. top: 50%;
  76. transform: translate(-50%, -50%);
  77. z-index: 9999;
  78. width: 690rpx;
  79. background-color: #fff;
  80. border-radius: 10rpx;
  81. .container_head{
  82. padding: 55rpx;
  83. font-size: 32rpx;
  84. color: #333;
  85. text-align: center;
  86. }
  87. .container_form{
  88. padding: 0 55rpx;
  89. .repairImgList{
  90. margin-bottom: 55rpx;
  91. display: flex;
  92. justify-content: space-between;
  93. align-items: center;
  94. gap: 15rpx;
  95. .repairImg{
  96. width: 184rpx;
  97. height: 186rpx;
  98. }
  99. }
  100. .audio{
  101. margin-bottom: 45rpx;
  102. }
  103. }
  104. .container_foot{
  105. .foot_btns{
  106. display: flex;
  107. border-top: 1rpx solid #DDDDDD;
  108. .know{
  109. flex: 1;
  110. font-size: 32rpx;
  111. padding: 30rpx;
  112. display: flex;
  113. justify-content: center;
  114. color: $uni-primary;
  115. }
  116. }
  117. }
  118. }
  119. </style>