/**
 *@des 公共接口
 *@author zhengjinyi
 *@date 2020/03/19 14:56:57
 *@param registerByPass
 */
import requestUrl from '@/services/config.env.js'

/**
 *上传图片
 */
export function uploadFileImage() {
    return new Promise(function(resolve, reject) {
        uni.chooseImage({
            count: 1, //默认1
            sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
            sourceType: ['album'], //从相册选择
            success: (res) => {
                const tempFilePaths = res.tempFilePaths
                const uploadTask = uni.uploadFile({
                    url: requestUrl +
                        '/formData/MultiPictareaddData',
                    filePath: tempFilePaths[0],
                    name: 'file',
                    header: {
                        'Content-Type': 'multipart/form-data',
                    },
                    formData: {
                        'user': 'test'
                    },
                    success: function(res) {
                        resolve(res)
                    },
                    error: function(e) {
                        reject(res)
                    }
                })
            }
        })
    })
}
