You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.1 KiB
53 lines
1.1 KiB
export let goPage = (url, params = {}, type = 'navigateTo') => {
|
|
uni.$u.route({
|
|
url,
|
|
params,
|
|
type
|
|
})
|
|
}
|
|
|
|
import setObj from '@/config/site.config.js';
|
|
let { H5_API, WX_API,httpPrefix } = setObj
|
|
var _url = H5_API+ WX_API + httpPrefix
|
|
|
|
|
|
|
|
export function uploadImgApi(filePath, imgName, imgLink='image') {
|
|
console.log(filePath)
|
|
let token = 'Bearer '+ uni.getStorageSync('token')
|
|
let timer = new Date() * 1
|
|
return new Promise((reslove, reject)=>{
|
|
// 上传图片到服务器
|
|
uni.uploadFile({
|
|
url: _url + 'infra/file/upload',//接口
|
|
filePath: filePath,//要上传的图片的本地路径
|
|
name: 'file',
|
|
// complain
|
|
formData: {
|
|
path: imgLink+'/'+ uni.$u.date(timer, 'yyyy-mm-dd')+'/'+timer + '-'+ imgName,
|
|
type: 1,
|
|
fileSuffix: "png"
|
|
},
|
|
header: {
|
|
Authorization: token,
|
|
// 'tenant-id': '1704459882232553474'
|
|
},
|
|
success(res) {
|
|
console.log('上传成功??')
|
|
console.log(res)
|
|
let res2 = JSON.parse(res.data)
|
|
reslove(res2.data)
|
|
|
|
},
|
|
fail(error) {
|
|
return Promise.reject(error)
|
|
},
|
|
complete: (err)=> {
|
|
uni.hideLoading();
|
|
}
|
|
})
|
|
})
|
|
}
|
|
|
|
|
|
|