diff --git a/miniprogram/pages/reportRepair/assign/detail/detail.js b/miniprogram/pages/reportRepair/assign/detail/detail.js index c97e778..c70ae6a 100644 --- a/miniprogram/pages/reportRepair/assign/detail/detail.js +++ b/miniprogram/pages/reportRepair/assign/detail/detail.js @@ -14,6 +14,8 @@ Page({ IMG_NAME: app.IMG_NAME, id: '', detail: {}, + innerAudioContext: null, // 音频对象 + innerAudioContextIsPlay: false, // 音频对象-是否播放 }, /** @@ -33,12 +35,69 @@ Page({ }, getDetail(id) { - reportDetailRq(id).then(res=>{ - console.log("reportDetailRq" , res); + let _this = this + reportDetailRq(id).then(res => { + console.log("reportDetailRq", res); let detail = res.data + let repairVoice = detail.repairVoice + let repairImages = detail.repairImages + // 音频 + if (repairVoice) { + detail.voiceObj = JSON.parse(repairVoice) + detail.voiceObj.url = app.IMG_NAME + detail.voiceObj.url + } + // 图片/视频 + if (repairImages) { + detail.fileList = JSON.parse(repairImages).map(item => { + return { + url: app.IMG_NAME + item.url, + name: item.url, + } + }) + } + _this.setData({ + detail + }) }) }, + // 播放语音 + startAudio() { + console.log('startAudio'); + let _this = this + // 获取innerAudioContext实例 + let innerAudioContext = _this.data.innerAudioContext + let innerAudioContextIsPlay = _this.data.innerAudioContextIsPlay + if (!innerAudioContext) { + // 全局设置播放声音 + wx.setInnerAudioOption({ + obeyMuteSwitch: false + }); + innerAudioContext = wx.createInnerAudioContext() + // 设置音频文件的路径 + innerAudioContext.src = _this.data.detail.voiceObj.url + innerAudioContextIsPlay = false + innerAudioContext.onEnded(() => { + _this.setData({ + innerAudioContextIsPlay: false + }) + }) + } + if (innerAudioContextIsPlay) { // 播放中 + innerAudioContext.stop() + innerAudioContextIsPlay = false + } else { // 未播放 + innerAudioContext.play() + innerAudioContextIsPlay = true + } + // + _this.setData({ + innerAudioContext, + innerAudioContextIsPlay + }) + }, + + // 确认损坏 jumpAffirm() { diff --git a/miniprogram/pages/reportRepair/assign/detail/detail.json b/miniprogram/pages/reportRepair/assign/detail/detail.json index 02854d6..4fec603 100644 --- a/miniprogram/pages/reportRepair/assign/detail/detail.json +++ b/miniprogram/pages/reportRepair/assign/detail/detail.json @@ -1,6 +1,7 @@ { "navigationStyle": "custom", "usingComponents": { - "van-icon": "@vant/weapp/icon/index" + "van-icon": "@vant/weapp/icon/index", + "van-uploader": "@vant/weapp/uploader/index" } } \ No newline at end of file diff --git a/miniprogram/pages/reportRepair/assign/detail/detail.wxml b/miniprogram/pages/reportRepair/assign/detail/detail.wxml index fe4f4ae..c4395cb 100644 --- a/miniprogram/pages/reportRepair/assign/detail/detail.wxml +++ b/miniprogram/pages/reportRepair/assign/detail/detail.wxml @@ -3,7 +3,7 @@ - + 返回 详情 @@ -16,39 +16,66 @@ - YG123081273812 - 空调 - 待派单 + {{detail.sn}} + {{detail.typeName + '/' + detail.repairDeviceName}} + {{detail.status}} 报修信息 - 设备名称 - 320828282828320828282828320828282828320828282828v + 报修名称 + {{detail.repairName}} - 设备地址 - 302会议室 + 故障等级 + {{detail.repairLevel}} - 维修描述 - 电脑蓝屏 + 故障时间 + {{detail.failureDate}} - 损坏凭证 + 故障类型 + {{detail.typeName + '/' + detail.repairDeviceName}} + + + 故障地点 + {{detail.addressName + '/' + detail.roomName}} + + + 门牌号 + {{detail.area}} + + + 联系电话 + {{detail.phone}} + + + 报修人姓名 + {{detail.name}} + + + 故障描述 + {{detail.content}} + + + 语音 - + + + {{detail.voiceObj.time}} s + - 报修人 - 13652025563 - - - 报修时间 - 2024-06-10 23:59:59 + 故障图片/视频 + + + + + diff --git a/miniprogram/pages/reportRepair/assign/detail/detail.wxss b/miniprogram/pages/reportRepair/assign/detail/detail.wxss index 4ee75be..d012a94 100644 --- a/miniprogram/pages/reportRepair/assign/detail/detail.wxss +++ b/miniprogram/pages/reportRepair/assign/detail/detail.wxss @@ -154,6 +154,17 @@ word-break: break-all; } +.mainView .reportView .itemView .content .voiceView { + display: flex; + justify-content: flex-start; + align-items: center; +} + +.mainView .reportView .itemView .content .voiceView .voiceTimeView{ + margin-left: 10rpx; + font-size: 24rpx; +} + .mainView .reportView .itemView .content .imgView { width: 100rpx; height: 100rpx; @@ -191,4 +202,4 @@ .bottomFixView .btn.red { background: #ee6f21; -} +} \ No newline at end of file