diff --git a/common/css/main.css b/common/css/main.css index e5f483c..4d27303 100644 --- a/common/css/main.css +++ b/common/css/main.css @@ -5,7 +5,6 @@ a{ } img{ text-align: center; - margin:0px auto; } body, html { width: 100%; diff --git a/common/function/myPubFunction.js b/common/function/myPubFunction.js index f98fd8a..86e2a9b 100644 --- a/common/function/myPubFunction.js +++ b/common/function/myPubFunction.js @@ -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; \ No newline at end of file diff --git a/components/category-bar/category-bar.vue b/components/category-bar/category-bar.vue index 07fb3a4..c586766 100644 --- a/components/category-bar/category-bar.vue +++ b/components/category-bar/category-bar.vue @@ -67,17 +67,17 @@