166 lines
3.6 KiB
JavaScript
166 lines
3.6 KiB
JavaScript
|
// pages/customFlow/index.js
|
||
|
var myRequest = require("../../utils/api.js");
|
||
|
const innerAudioContext = wx.createInnerAudioContext({
|
||
|
useWebAudioImplement: false // 是否使用 WebAudio 作为底层音频驱动,默认关闭。对于短音频、播放频繁的音频建议开启此选项,开启后将获得更优的性能表现。由于开启此选项后也会带来一定的内存增长,因此对于长音频建议关闭此选项
|
||
|
})
|
||
|
Page({
|
||
|
|
||
|
/**
|
||
|
* 页面的初始数据
|
||
|
*/
|
||
|
data: {
|
||
|
autosize:{
|
||
|
minHeight: 70
|
||
|
},
|
||
|
orderId:'',
|
||
|
actionList:[],
|
||
|
orderStatus:'',
|
||
|
itemInfo:'',
|
||
|
device:{},
|
||
|
filePath:'',
|
||
|
isPlay:false,
|
||
|
playText:'播放',
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面加载
|
||
|
*/
|
||
|
onLoad(options) {
|
||
|
|
||
|
this.setData({
|
||
|
orderId:options.orderId,
|
||
|
})
|
||
|
|
||
|
this.deviceInfo()
|
||
|
|
||
|
},
|
||
|
deviceInfo(){
|
||
|
myRequest.myRequest('deviceRepairOrder/supporter/orderDetail/'+this.data.orderId,{
|
||
|
},'get').then(res=>{
|
||
|
let info = res.data
|
||
|
let address=info.device.provinceName+info.device.cityName+info.device.areaName+info.device.townName+info.device.community
|
||
|
this.setData({
|
||
|
orderStatus:info.orderStatus,
|
||
|
itemInfo:info,
|
||
|
filePath:info.faultVoice,
|
||
|
device:{
|
||
|
name:info.device.name,
|
||
|
address,
|
||
|
ownerPhone:info.device.ownerPhone
|
||
|
}
|
||
|
})
|
||
|
this.getActionList()
|
||
|
})
|
||
|
},
|
||
|
//播放声音
|
||
|
playCorder: function () {
|
||
|
|
||
|
if(!this.data.filePath){
|
||
|
wx.showToast({
|
||
|
title: '请录音后播放!',
|
||
|
icon: 'none',
|
||
|
duration: 1500
|
||
|
})
|
||
|
return
|
||
|
}
|
||
|
if(this.data.isPlay){
|
||
|
wx.showToast({
|
||
|
title: '播放中。。。。',
|
||
|
icon: 'none',
|
||
|
duration: 1500
|
||
|
})
|
||
|
return
|
||
|
}
|
||
|
|
||
|
innerAudioContext.src = this.data.filePath,
|
||
|
innerAudioContext.play()
|
||
|
innerAudioContext.onPlay(() => {
|
||
|
console.log('开始播放')
|
||
|
this.setData({
|
||
|
playText:'播放中。。。',
|
||
|
|
||
|
isPlay:true,
|
||
|
})
|
||
|
|
||
|
})
|
||
|
innerAudioContext.onEnded(()=>{
|
||
|
clearInterval(this.data.timer);
|
||
|
this.setData({
|
||
|
isPlay:false,
|
||
|
playText:'播放',
|
||
|
})
|
||
|
|
||
|
console.log('结束播放')
|
||
|
})
|
||
|
innerAudioContext.onError((res) => {
|
||
|
console.log(res.errMsg)
|
||
|
console.log(res.errCode)
|
||
|
})
|
||
|
},
|
||
|
getActionList(){
|
||
|
let that =this;
|
||
|
myRequest.myRequest('deviceRepairOrder/action/list/'+this.data.orderId,{
|
||
|
},'get').then(res=>{
|
||
|
res.data[0].actionInfo = this.data.itemInfo
|
||
|
this.setData({
|
||
|
actionList:res.data
|
||
|
})
|
||
|
|
||
|
|
||
|
|
||
|
})
|
||
|
},
|
||
|
gotoDevluate(){
|
||
|
wx.navigateTo({
|
||
|
url: '../evaluate/index?item='+JSON.stringify(this.data.itemInfo),
|
||
|
})
|
||
|
},
|
||
|
/**
|
||
|
* 生命周期函数--监听页面初次渲染完成
|
||
|
*/
|
||
|
onReady() {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面显示
|
||
|
*/
|
||
|
onShow() {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面隐藏
|
||
|
*/
|
||
|
onHide() {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 生命周期函数--监听页面卸载
|
||
|
*/
|
||
|
onUnload() {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 页面相关事件处理函数--监听用户下拉动作
|
||
|
*/
|
||
|
onPullDownRefresh() {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 页面上拉触底事件的处理函数
|
||
|
*/
|
||
|
onReachBottom() {
|
||
|
|
||
|
},
|
||
|
|
||
|
/**
|
||
|
* 用户点击右上角分享
|
||
|
*/
|
||
|
onShareAppMessage() {
|
||
|
|
||
|
}
|
||
|
})
|