@ -281,5 +281,10 @@ var api = {
const app_config = uni.getStorageSync('app_config');
return app_config.public_url + url;
},
getOssurl(){
return app_config.public_url;
}
module.exports = api;
@ -4,6 +4,8 @@ var unit ={
getImgInfo:function(filePath){
function getInfo(resolve, reject) {
try {
uni.getImageInfo({
src: filePath,
success: function (image) {
@ -13,8 +15,12 @@ var unit ={
reject(res);
});
return new Promise(getInfo);
} catch (error) {
console.log(error)
compressImg:function(filePath, config = {}){
@ -127,7 +127,7 @@
var _this = this;
_this.checkAuth();
this.setSuccessFiles();
console.log('~~~~~~~~~~~~~~~~~~')
methods: {
@ -245,7 +245,10 @@
let address = _date.getFullYear() + '' + (_date.getMonth() + 1) + '' + _date.getDate();
let fileName = address + _date.getTime() + ext_name;
const img_info = await unit.getImgInfo(filePath);
if(typeof(img_info) == 'undefined' || !img_info){
this.$com.showError('图片格式错误!请重试!');
return false;
let {
width,
height