优化代码

This commit is contained in:
java110 2021-05-29 19:38:42 +08:00
parent ef9a364da5
commit bf6254b74e

View File

@ -86,6 +86,7 @@
<script>
const context = require("../../context/Java110Context.js");
import * as TanslateImage from '../../utils/translate-image.js';
const constant = context.constant;
const factory = context.factory;
export default {
@ -115,7 +116,7 @@
var _that = this;
wx.chooseImage({
count: 1,
sizeType: ['original', 'compressed'],
sizeType: ['compressed'],
sourceType: ['album', 'camera'],
success: function(res) {
// console.log(res)
@ -127,11 +128,20 @@
});
var tempFilePaths = res.tempFilePaths
console.log('头像地址', tempFilePaths);
//#ifdef H5
TanslateImage.translate(tempFilePaths, (_baseInfo) => {
_that.headerImg = _baseInfo;
_that._uploadOwnerHeaderImg();
wx.hideLoading()
})
//#endif
//#ifdef MP-WEIXIN
factory.base64.urlTobase64(tempFilePaths[0]).then(function(_baseInfo) {
_that.headerImg = _baseInfo;
_that._uploadOwnerHeaderImg();
wx.hideLoading()
});
//#endif
}
})
},