8 changed files with 74 additions and 6 deletions
@ -0,0 +1,60 @@
|
||||
function dataURLToBlob(cropperData) { |
||||
let arr = cropperData.split(","); |
||||
console.log('arr',arr) |
||||
let mime = arr[0].match(/:(.*?);/)[1]; |
||||
let blobStr = atob(arr[1]); |
||||
let n = blobStr.length; |
||||
let u8arr = new Uint8Array(n); |
||||
while (n--) { |
||||
u8arr[n] = blobStr.charCodeAt(n); |
||||
} |
||||
return URL.createObjectURL(new Blob([u8arr], { type: mime })) |
||||
} |
||||
|
||||
export default { |
||||
build() { |
||||
uni.chooseImage = (params) => { |
||||
try { |
||||
if('compile' in params)params.compile(); |
||||
eshimin.getLocalPicture({ |
||||
onResponse:function (res) { |
||||
if('success' in params)params.success([dataURLToBlob(res.img)]); |
||||
} |
||||
}); |
||||
}catch (e){ |
||||
console.log(e) |
||||
if('fail' in params)params.fail(e); |
||||
} |
||||
} |
||||
uni.getLocation = (params) => { |
||||
try { |
||||
console.log('getLocation', params) |
||||
if('compile' in params)params.compile(); |
||||
eshimin.getLocation({ |
||||
onResponse:function (res) { |
||||
if('success' in params)params.success(res); |
||||
} |
||||
}); |
||||
}catch (e){ |
||||
console.log(e) |
||||
if('fail' in params)params.fail(e); |
||||
} |
||||
} |
||||
uni.makePhoneCall = (params) => { |
||||
try { |
||||
console.log('makePhoneCall', params) |
||||
if('compile' in params)params.compile(); |
||||
eshimin.getLocation({ |
||||
phoneNum:params.phoneNumber, |
||||
onResponse:function (res) { |
||||
if('success' in params)params.success(res); |
||||
} |
||||
}); |
||||
}catch (e){ |
||||
console.log(e) |
||||
if('fail' in params)params.fail(e); |
||||
} |
||||
} |
||||
}, |
||||
}; |
||||
|
Loading…
Reference in new issue