mirror of
https://gitee.com/elegant_wings/dbd-meeting-wx-small.git
synced 2025-06-22 00:49:37 +08:00
196 lines
4.3 KiB
JavaScript
196 lines
4.3 KiB
JavaScript
const app = getApp()
|
|
|
|
|
|
import {
|
|
getDetailRq,
|
|
getStatusName
|
|
} from "../../../../api/repair/repair.js"
|
|
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
IMG_NAME: app.IMG_NAME,
|
|
title: '详情',
|
|
id: '',
|
|
detail: {},
|
|
files: {},
|
|
currentLog: {},
|
|
innerAudioContext: null, // 音频对象
|
|
innerAudioContextIsPlay: false, // 音频对象-是否播放
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad(options) {
|
|
console.log('onLoad', options);
|
|
let _this = this
|
|
_this.setData({
|
|
...options
|
|
})
|
|
_this.getDetail(options.id)
|
|
},
|
|
|
|
back() {
|
|
wx.navigateBack()
|
|
},
|
|
|
|
getDetail(id) {
|
|
let _this = this
|
|
getDetailRq({
|
|
id
|
|
}).then(res => {
|
|
console.log("getDetailRq", res);
|
|
// 详情
|
|
let detail = res.repair
|
|
detail.statusName = getStatusName(detail.status)
|
|
// 附件
|
|
let files = res.files
|
|
files.repair = files.repair.map(item => {
|
|
item.url = app.IMG_NAME + item.url
|
|
return item
|
|
})
|
|
files.voice = files.voice.map(item => {
|
|
item.url = app.IMG_NAME + item.url
|
|
return item
|
|
})
|
|
// 日志
|
|
if (detail.logId) {
|
|
let firstLog = res.log.find(item => item.id == detail.logId)
|
|
if (firstLog) {
|
|
let preLog = res.log.find(item => item.id == firstLog.pid)
|
|
_this.setData({
|
|
currentLog: preLog
|
|
})
|
|
}
|
|
}
|
|
|
|
_this.setData({
|
|
detail,
|
|
files
|
|
})
|
|
})
|
|
},
|
|
|
|
// 播放语音
|
|
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.files.voice[0].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() {
|
|
let _this = this
|
|
wx.navigateTo({
|
|
url: `/pages/reportRepair/assign/affirm/affirm?id=${_this.data.id}`,
|
|
})
|
|
},
|
|
|
|
|
|
// 提交反馈
|
|
jumpFeedback() {
|
|
let _this = this
|
|
wx.navigateTo({
|
|
url: `/pages/reportRepair/assign/feedback/feedback?id=${_this.data.id}`,
|
|
})
|
|
},
|
|
|
|
// 无效
|
|
jumpInvalid() {
|
|
let _this = this
|
|
wx.navigateTo({
|
|
url: `/pages/reportRepair/assign/nullify/nullify?id=${_this.data.id}`,
|
|
})
|
|
},
|
|
|
|
// 重新派单
|
|
jumpAgain() {
|
|
let _this = this
|
|
wx.navigateTo({
|
|
url: `/pages/reportRepair/assign/again/again?id=${_this.data.id}`,
|
|
})
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom() {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage() {
|
|
|
|
}
|
|
}) |