From 03c1ffc86409d939875af372795b5d37cbe07d1f Mon Sep 17 00:00:00 2001 From: wjt <1797368093@qq.com> Date: 星期六, 22 六月 2024 14:39:36 +0800 Subject: [PATCH] Merge branch 'master' of http://218.28.192.34:9999/r/sqys/sqys_xcx --- common/upload.js | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-) diff --git a/common/upload.js b/common/upload.js new file mode 100644 index 0000000..4d44e33 --- /dev/null +++ b/common/upload.js @@ -0,0 +1,27 @@ +import { config } from './config.js' +export const upload = (file) => { + return new Promise((resolve,refject) => { + uni.uploadFile({ + url: config.baseUrl + '/tool/file/upload', + filePath: file, + name: 'file', + success: val => { + const info = JSON.parse(val.data) + if(info.code == 200) { + resolve(info) + } else { + refject(info.msg) + } + + }, + fail: err => { + // uni.showToast({ + // title: '鏂囦欢涓婁紶澶辫触锛岃绋嶅悗閲嶈瘯', + // icon: 'none' + // }) + // console.log(err) + refject(err) + } + }) + }) +} \ No newline at end of file -- Gitblit v1.9.1