infor.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <template>
  2. <view class="content">
  3. <view class="topbar" v-show="isIphone">
  4. </view>
  5. <!-- #ifdef MP-WEIXIN -->
  6. <view class="topbar">
  7. </view>
  8. <!-- #endif -->
  9. <view class="status_bar">
  10. <view class="left" @click="goBack()"><u-icon name="arrow-left"></u-icon>返回</view>
  11. <span style="font-size: 36rpx;">详情</span>
  12. <view class="right"></view>
  13. </view>
  14. <view class="mainCont">
  15. <view class="card">
  16. <view class="top">
  17. <view class="left">{{ form.troubleCode }}</view>
  18. <view v-show="form.troubleState == 1" class="right" style="color: #33CC00">待处理</view>
  19. <view v-show="form.troubleState == 2" class="right" style="color: #33CC00">处理中</view>
  20. <view v-show="form.troubleState == 3" class="right" style="color: #CCCCCC">已完成</view>
  21. <!-- <view class="right" v-show="current == 1" style="color: #33CC00;">处理中</view>
  22. <view class="right" v-show="current == 2" style="color: #CCCCCC">已关闭</view> -->
  23. </view>
  24. <view class="bottom">
  25. <view>所在位置:{{ form.location }}</view>
  26. <view v-show="form.troubleType != 2">内容描述:{{ form.description }}</view>
  27. <view v-show="form.troubleType == 2">内容描述:语音信息{{ playTime }}"</view>
  28. <view>上报时间:{{ form.createDate }}</view>
  29. <view v-show="form.troubleType == 2 && !isIphone" class="soundPlay" @click="soundPlay">{{ playTime }}"<u-icon
  30. name="wifi" class="trans">
  31. </u-icon>
  32. </view>
  33. <view v-show="form.troubleType == 2 && isIphone" class="soundPlay" @click="soundPlay">
  34. 点击播放
  35. </view>
  36. <view class="imageupload">
  37. <view class="imagebox">
  38. <u-image width="80px" height="80px" :key="index" v-for="(item,index) in fileList"
  39. :src="item.filePath"></u-image>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. <view class="card">
  45. <view class="top">
  46. <view class="left">处理进度</view>
  47. </view>
  48. <view class="bottom" style="padding: 10px 20px">
  49. <u-time-line>
  50. <u-time-line-item nodeTop="2" v-for="(item, index) in processList" :key="index">
  51. <template v-slot:node>
  52. <view class="u-node" style="background: #blue;">
  53. </view>
  54. </template>
  55. <!-- 此处自定义了左边内容,用一个图标替代 -->
  56. <template v-slot:content>
  57. <view>
  58. <view class="u-order-title">
  59. {{ item.content }}
  60. </view>
  61. <view>
  62. {{ item.creatorName }} {{ item.createDate }}
  63. </view>
  64. </view>
  65. </template>
  66. </u-time-line-item>
  67. </u-time-line>
  68. </view>
  69. </view>
  70. </view>
  71. </view>
  72. </template>
  73. <script>
  74. const NET = require('@/utils/request')
  75. const API = require('@/config/api')
  76. export default {
  77. onLoad(option) {
  78. uni.getSystemInfo({
  79. success: (res) => {
  80. console.log(res)
  81. if (res.model == 'iPhone') {
  82. this.isIphone = true;
  83. }
  84. },
  85. fail: (err) => {
  86. console.log(err)
  87. }
  88. })
  89. console.log(option.id);
  90. NET.request(API.htroubleDetail, {
  91. troubleId: option.id
  92. }, 'GET').then(res => {
  93. this.form = res.data;
  94. this.fileList = res.data.fileList.filter(a => a.fileType == 2);
  95. this.soundFile = res.data.fileList.filter(a => a.fileType == 1).length ? res.data.fileList.filter(
  96. a => a.fileType == 1)[0] : null;
  97. this.processList = res.data.processList;
  98. if (this.soundFile) {
  99. if (this.isIphone) {
  100. // EbeiPlugins.getAudioDuration(this.soundFile.filePath, (res) => {
  101. // this.playTime = res
  102. // })
  103. // EbeiPlugins.getAudioDuration(
  104. // 'https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-hello-uniapp/2cc220e0-c27a-11ea-9dfb-6da8e309e0d8.mp3',
  105. // (res) => {
  106. // console.log(res)
  107. // this.playTime = res
  108. // })
  109. } else {
  110. this.innerAudioContext = uni.createInnerAudioContext();
  111. this.innerAudioContext.src =
  112. this.soundFile.filePath;
  113. this.innerAudioContext.onCanplay(() => {
  114. this.playTime = Math.floor(this.innerAudioContext.duration)
  115. console.log(this.innerAudioContext.duration)
  116. });
  117. }
  118. }
  119. }).catch(error => {
  120. this.$refs.uToast.show({
  121. title: error.msg,
  122. type: 'warning',
  123. })
  124. })
  125. },
  126. onReady() {
  127. if (this.isIphone) {
  128. document.getElementsByClassName('mainCont')[0].style.height = document.getElementsByClassName('mainCont')[
  129. 0].clientHeight - 25 + 'px'
  130. }
  131. },
  132. data() {
  133. return {
  134. isIphone: false,
  135. playTime: 0,
  136. playIng: false,
  137. soundFile: null,
  138. fileList: [],
  139. processList: [],
  140. form: {},
  141. innerAudioContext: null,
  142. }
  143. },
  144. methods: {
  145. goBack() {
  146. uni.navigateBack({
  147. delta: 1
  148. });
  149. },
  150. soundPlay() {
  151. if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
  152. this.playIng = true
  153. EbeiPlugins.playAudioRecord(this.soundFile.filePath, 0, (res) => {
  154. this.playIng = false
  155. }, (err) => {
  156. })
  157. // EbeiPlugins.playAudioRecord(
  158. // 'https://bjetxgzv.cdn.bspapp.com/VKCEYUGU-hello-uniapp/2cc220e0-c27a-11ea-9dfb-6da8e309e0d8.mp3',
  159. // 0, (res) => {
  160. // this.playIng = false
  161. // }, (err) => {
  162. // })
  163. } else {
  164. if (this.playIng) {
  165. this.innerAudioContext.stop();
  166. // this.innerAudioContext.destory();
  167. // this.innerAudioContext = null;
  168. this.playIng = false;
  169. return false;
  170. }
  171. this.innerAudioContext.play();
  172. this.playIng = true;
  173. this.innerAudioContext.onPlay(() => {
  174. console.log('开始播放');
  175. });
  176. this.innerAudioContext.onError((res) => {
  177. console.log(res.errMsg);
  178. console.log(res.errCode);
  179. });
  180. }
  181. }
  182. }
  183. }
  184. </script>
  185. <style lang="scss">
  186. .mainCont {
  187. height: calc(100% - 80rpx);
  188. padding: 10px 0 10px 0;
  189. box-sizing: border-box;
  190. overflow-y: auto;
  191. }
  192. .imageupload {
  193. margin-bottom: 10px;
  194. padding: 5px 0px;
  195. background: #fff;
  196. .imagebox {
  197. .u-image {
  198. display: inline-block;
  199. margin: 10px 10px 0 0;
  200. }
  201. }
  202. }
  203. .soundPlay {
  204. margin-top: 10px;
  205. padding: 0 10px;
  206. height: 30px;
  207. line-height: 30px !important;
  208. width: 75%;
  209. text-align: right;
  210. color: #fff;
  211. background-color: #2d8cf0;
  212. border-radius: 5px;
  213. }
  214. .u-node {
  215. width: 12px;
  216. height: 12px;
  217. border-radius: 22px;
  218. display: flex;
  219. justify-content: center;
  220. align-items: center;
  221. background: #6aa0f7;
  222. }
  223. .u-order-title {
  224. // margin-bottom: 20px;
  225. }
  226. .trans {
  227. transform: rotate(90deg);
  228. }
  229. </style>