fix
13404089107
6 天以前 2e90f57e7d28d6a949247ef39b487d3e75b56683
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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