import fly from '@/common/bin/fly.js'
|
import config from '@/common/config/index.js'
|
import store from '@/store'
|
class App {
|
protocol(params){
|
return fly.post('/Protocol/Protocol',params)
|
}
|
getDescribe(params){
|
return fly.post('/user/getDescribe',params)
|
}
|
uploadImage(filePath,file){
|
return new Promise((resolve,reject)=>{
|
let uploadTask = uni.uploadFile({
|
url: config.host + '/image',
|
filePath: filePath,
|
file: file,
|
name: 'file',
|
fail: (err) => {
|
reject(err)
|
},
|
success: (res) => {
|
try {
|
resolve(JSON.parse(res.data))
|
} catch (error) {
|
reject(error)
|
//TODO handle the exception
|
}
|
}
|
})
|
uploadTask.onProgressUpdate((res) => {
|
// console.log('上传进度' + res.progress);
|
// console.log('已经上传的数据长度' + res.totalBytesSent);
|
// console.log('预期需要上传的数据总长度' + res.totalBytesExpectedToSend);
|
});
|
})
|
}
|
}
|
export default App
|