export const uploadFile = (options) => {
	return new Promise((resolve, reject) => {
		console.log('options', options)
		let header = {}
		// header['Content-Type'] = "multipart/form-data"
		try {
			console.log('token'+ uni.getStorageSync('token'))
			const value = uni.getStorageSync('token'); //取存本地的token
			if (value) {
				console.log('token'+value)
				header['token'] = value
			}else{
				uni.navigateTo({
					url: '/pages/login/login',
				})
			}
			
		} catch (e) {
			// error
		}
		uni.uploadFile({
			url: options.url,
			name: 'file',
			filePath: options.filePath.img,
			formData: {
				"module": options.type
			},
			header,
			success: (res) => {
				// return res
				resolve(res) //如果请求成功，调用resolve返回数据
			},
			fail:(err)=>{
				uni.showToast({
					titil:"接口请求异常"
				})
				reject(err)
			}
		})
	})
}
