live.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <template>
  2. <view class="live">
  3. <view class="top">
  4. </view>
  5. <view class="head">
  6. <span class="cuIcon-back" @click="back"></span>
  7. <view class="case">
  8. 实况记录
  9. </view>
  10. </view>
  11. <view class="list">
  12. <view class="car_data">
  13. <view class="fat" v-for="item in form" :key="item.id">
  14. <view class="fat_title">{{item.name}}</view>
  15. <view class="sun" v-for="row in item.categoryList" :key="row.id">
  16. {{row.name}}
  17. <span>{{row.names}}</span>
  18. </view>
  19. </view>
  20. </view>
  21. <!-- 备注信息 -->
  22. <view class="car_data">
  23. <view class="fat">
  24. <view class="fat_title">备注信息</view>
  25. <view class="message" v-for="(item,index) in historyList" :key="item.id">
  26. <view class="top">
  27. <view class="left">
  28. <view class="img">
  29. <image :src="item.logo" mode=""></image>
  30. </view>
  31. <view class="name">
  32. {{item.merchantName}}<br />
  33. <span>{{item.createTime}}</span>
  34. </view>
  35. </view>
  36. <view class="play" v-if="item.recordUrl.length>0">
  37. <image src="/static/pause.png" mode="" @click="exchangeStatus(item),play(item)" v-if=" item.isPlay"></image>
  38. <image src="/static/play.png" mode="" @click="exchangeStatus(item),play(item)" v-else></image>
  39. </view>
  40. </view>
  41. <view class="content" >
  42. {{item.msgContent}}
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. </template>
  50. <script>
  51. import configService from '../../../common/service/config.service'
  52. export default {
  53. data() {
  54. return {
  55. taskId: 1,
  56. form: [],
  57. historyList: [],
  58. audioContext: null,
  59. }
  60. },
  61. methods: {
  62. //返回
  63. back() {
  64. uni.navigateBack({
  65. delta: 1
  66. });
  67. },
  68. getLive() {
  69. this.$http.get("/merchant/localTsCustomerServiceDict/list?taskId=" + this.taskId + '&source=' + '1').then(
  70. res => {
  71. if (res.data.code == 200) {
  72. this.form = res.data.result
  73. let list = []
  74. this.form.forEach(item => {
  75. let temp = []
  76. item.categoryList.forEach(row => {
  77. if (row.idList.length > 0) {
  78. const idSet = new Set(row.idList);
  79. // Find the names that match the ids in idList
  80. const matchedNames = row.itemList
  81. .filter(item => idSet.has(item.id)) // Filter items where the id matches
  82. .map(item => item.name) // Extract the name from the matching items
  83. .join(','); // Join names with commas
  84. row.names = matchedNames;
  85. temp.push(row)
  86. }
  87. })
  88. item.categoryList = temp
  89. if (item.categoryList.length > 0) {
  90. list.push(item)
  91. }
  92. })
  93. this.form = list
  94. }
  95. })
  96. },
  97. //播放,暂停
  98. play(item) {
  99. const audioContext = uni.createInnerAudioContext();
  100. audioContext.autoplay = true;
  101. audioContext.src = configService.apiUrl + '/' + item.recordUrl
  102. if(item.isPlay){
  103. audioContext.onPlay(() => {
  104. console.log('开始播放');
  105. });
  106. }else{
  107. audioContext.pause();
  108. console.log('音频已暂停');
  109. }
  110. },
  111. exchangeStatus(item, index) {
  112. item.isPlay = !item.isPlay
  113. this.$forceUpdate()
  114. },
  115. getHistroyList() {
  116. let data = {
  117. taskId: this.taskId
  118. }
  119. this.$http.post('/merchant/localTsCustomerServiceTaskMsg/queryList', data).then((res) => {
  120. this.historyList = res.data.result
  121. this.historyList.forEach(item => {
  122. if (item.recordUrl) {
  123. item.isPlay = false
  124. }
  125. })
  126. console.log(this.historyList);
  127. })
  128. },
  129. },
  130. onLoad(options) {
  131. this.taskId = options.taskId
  132. },
  133. mounted() {
  134. this.getLive()
  135. this.getHistroyList()
  136. }
  137. }
  138. </script>
  139. <style lang="scss" scoped>
  140. .live {
  141. width: 100vw;
  142. height: 100vh;
  143. background: #F8F8FA;
  144. display: flex;
  145. flex-direction: column;
  146. // overflow-y: auto;
  147. /*#ifdef APP-PLUS*/
  148. .top {
  149. width: 100%;
  150. height: var(--status-bar-height);
  151. background: #FFFFFF;
  152. }
  153. /*#endif*/
  154. .head {
  155. width: 100%;
  156. height: 112rpx;
  157. padding: 20rpx;
  158. display: flex;
  159. align-items: center;
  160. background: #FFFFFF;
  161. position: relative;
  162. .cuIcon-back {
  163. font-size: 40rpx;
  164. margin-right: 40rpx;
  165. }
  166. .case {
  167. position: absolute;
  168. left: 50%;
  169. transform: translateX(-50%);
  170. font-size: 36rpx;
  171. font-weight: 600;
  172. }
  173. }
  174. .list {
  175. flex: 1;
  176. overflow-y: auto;
  177. background: #F7F7F7;
  178. padding: 24rpx 30rpx;
  179. .car_data {
  180. width: 100%;
  181. .fat {
  182. background: #FFFFFF;
  183. padding: 20rpx;
  184. margin-bottom: 20rpx;
  185. border-radius: 10rpx;
  186. .fat_title {
  187. font-weight: 600;
  188. font-size: 30rpx;
  189. color: #333333;
  190. margin-bottom: 20rpx;
  191. }
  192. .sun {
  193. width: 100%;
  194. height: 73rpx;
  195. border-bottom: 1px solid #eee;
  196. display: flex;
  197. align-items: center;
  198. justify-content: space-between;
  199. font-size: 28rpx;
  200. color: #666666;
  201. span {
  202. color: #181818;
  203. }
  204. }
  205. .message {
  206. border-bottom: 1px solid #eee;
  207. padding-bottom: 16rpx;
  208. margin-bottom: 16rpx;
  209. .top {
  210. width: 100%;
  211. display: flex;
  212. align-items: center;
  213. justify-content: space-between;
  214. margin-bottom: 12rpx;
  215. .left {
  216. display: flex;
  217. align-items: center;
  218. .img {
  219. width: 68rpx;
  220. height: 68rpx;
  221. border-radius: 8rpx;
  222. overflow: hidden;
  223. margin-right: 12rpx;
  224. image {
  225. width: 100%;
  226. height: 100%;
  227. }
  228. }
  229. .name {
  230. font-size: 28rpx;
  231. color: #000000;
  232. span {
  233. font-size: 24rpx;
  234. color: #999999
  235. }
  236. }
  237. }
  238. .play {
  239. font-size: 24rpx;
  240. color: #000000;
  241. text-align: center;
  242. image {
  243. width: 40rpx;
  244. height: 40rpx;
  245. }
  246. }
  247. }
  248. .content {
  249. font-size: 26rpx;
  250. }
  251. }
  252. }
  253. }
  254. }
  255. }
  256. </style>