日常修改
This commit is contained in:
parent
257eab643e
commit
fd6310b8f1
@ -1,5 +1,3 @@
|
||||
import userApi from '../../api/user';
|
||||
|
||||
Component({
|
||||
|
||||
/**
|
||||
@ -8,7 +6,15 @@ Component({
|
||||
properties: {
|
||||
start:{
|
||||
type:Boolean,
|
||||
value:false
|
||||
value:false,
|
||||
observer(s){
|
||||
console.log(s);
|
||||
if(s){
|
||||
this.start();
|
||||
}else{
|
||||
this.stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -41,24 +47,15 @@ Component({
|
||||
|
||||
}
|
||||
},
|
||||
observers:{
|
||||
"start"(s){
|
||||
if(s){
|
||||
this.start();
|
||||
}else{
|
||||
this.stop();
|
||||
}
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 组件的方法列表
|
||||
*/
|
||||
methods: {
|
||||
async downloadResource(){
|
||||
this.data.emptyAudio = `${wx.env.USER_DATA_PATH}/empty.mp3`;
|
||||
this.data.emptyAudio = `${wx.env.USER_DATA_PATH}/empty.wav`;
|
||||
const emptyServerPath = 'https://dman-1311994147.cos.ap-chengdu.myqcloud.com/static/silence_file.wav';
|
||||
this.data.haveOrderAudio = `${wx.env.USER_DATA_PATH}/haveorder.wav`;
|
||||
const haveOrderPath = 'https://dman-1311994147.cos.ap-chengdu.myqcloud.com/static/new_order.mp3'
|
||||
this.data.haveOrderAudio = `${wx.env.USER_DATA_PATH}/haveorder.mp3`;
|
||||
const haveOrderPath = 'https://dman-1311994147.cos.ap-chengdu.myqcloud.com/static/new_order.mp3';
|
||||
await this.download(this.data.emptyAudio,emptyServerPath);
|
||||
await this.download(this.data.haveOrderAudio,haveOrderPath);
|
||||
},
|
||||
@ -68,7 +65,7 @@ Component({
|
||||
const fs = wx.getFileSystemManager();
|
||||
fs.accessSync(localPath);
|
||||
} catch (error) {
|
||||
await userApi.downloadFile(serverPath,localPath);
|
||||
await this.downloadFile(serverPath,localPath);
|
||||
}
|
||||
},
|
||||
start(){
|
||||
@ -102,6 +99,23 @@ Component({
|
||||
// innerAudioContext.onEnded(()=>{
|
||||
// innerAudioContext.destroy();
|
||||
// })
|
||||
},
|
||||
downloadFile(url,filePath){
|
||||
console.log('download',url,filePath);
|
||||
return new Promise((rs,rj)=>{
|
||||
wx.downloadFile({
|
||||
url: url,
|
||||
filePath: filePath,
|
||||
success: (result) => {
|
||||
console.log('success',result);
|
||||
rs()
|
||||
},
|
||||
fail: (res) => {
|
||||
console.log('error',res.errMsg,url,filePath);
|
||||
rj()
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -1,4 +1,3 @@
|
||||
/* components/navBar.wxss */
|
||||
.nav-bar{
|
||||
}
|
||||
.nav-bar-content{
|
||||
@ -48,4 +47,5 @@
|
||||
flex:1;
|
||||
text-align: center;
|
||||
}
|
||||
.nav-bar-content .right{flex:1;}
|
||||
.nav-bar-content .right{flex:1;}
|
||||
|
||||
|
||||
@ -371,13 +371,11 @@ Page({
|
||||
wx.chooseMedia({
|
||||
count:this.data.maxChooseImgCount - this.data.tempImgs.length,
|
||||
mediaType:['image'],
|
||||
sourceType:['camera'],
|
||||
success:(res)=>{
|
||||
this.setData({
|
||||
tempImgs:this.data.tempImgs.concat(res.tempFiles)
|
||||
});
|
||||
wx.nextTick(()=>{
|
||||
console.log('nextTick');
|
||||
this.uploadImages();
|
||||
})
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user