diff --git a/utils/functions.js b/utils/functions.js index c97c2e9..873c31c 100644 --- a/utils/functions.js +++ b/utils/functions.js @@ -329,47 +329,6 @@ const api = { resolve(data); }) }, - uploadOssFile:(file)=>{ - return new Promise((resolve, reject) => { - getSTS({}).then(res => { - // const client = new OSS(res.data); - // console.log(file); - uni.showLoading({ - title:'上传中' - }) - let timer = new Date(); - let address = timer.getFullYear() + '' + (timer.getMonth() + 1) + '' + timer.getDate(); - address = 'upload/' + address + '/'; - var imageSrc = file; - let str = file.substr(file.lastIndexOf('.')); - let nameStr = address + timer.getTime() + str; - uni.uploadFile({ - url: `${oss}`, //仅为示例,非真实的接口地址 - filePath:file, - name: 'file', - header: { - "content-type": "application/json;charset=utf-8", - }, - formData:Object.assign({ - name:nameStr, - key:nameStr, - success_action_status: '200', - },res.data), - success: (uploadFileRes) => { - uni.hideLoading() - resolve ({show_path:oss+'/' + nameStr}); - // relove(JSON.parse(uploadFileRes.data).data) - // console.log(JSON.parse(uploadFileRes.data).data); - }, - fail:(res) =>{ - uni.hideLoading() - console.log(res) - return {}; - } - }); - }); - }) - }, logout:(reLaunch = true,confirm = true) => { return new Promise((resolve, reject) => { if(confirm){