1
This commit is contained in:
@@ -5,7 +5,6 @@ a{
|
||||
}
|
||||
img{
|
||||
text-align: center;
|
||||
margin:0px auto;
|
||||
}
|
||||
body, html {
|
||||
width: 100%;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { reject } from "lodash";
|
||||
|
||||
/**
|
||||
* 自定义公共函数
|
||||
*/
|
||||
@@ -78,5 +80,27 @@ myfn.convertCurrency = function(money) {
|
||||
}
|
||||
return chineseStr;
|
||||
}
|
||||
/**
|
||||
* 网络路径转base64
|
||||
* @param {Object} url
|
||||
*/
|
||||
myfn.urlTobase64 = function(url) {
|
||||
return new Promise((reso, reject) => {
|
||||
|
||||
uni.request({
|
||||
url: url,
|
||||
method: 'GET',
|
||||
responseType: 'arraybuffer',
|
||||
success: async res => {
|
||||
let base64 = uni.arrayBufferToBase64(res.data); //把arraybuffer转成base64
|
||||
reso(base64)
|
||||
},
|
||||
fail() {
|
||||
reject()
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
export default myfn;
|
||||
Reference in New Issue
Block a user