SD-20230427NBFT\Administrator 8 months ago
parent fa651cdfda
commit 5c50ecdf8e
  1. 5
      config/api.js
  2. 26
      config/unit.js
  3. 7
      pagesA/merge/face_1.vue

@ -281,5 +281,10 @@ var api = {
const app_config = uni.getStorageSync('app_config');
return app_config.public_url + url;
},
getOssurl(){
const app_config = uni.getStorageSync('app_config');
return app_config.public_url;
},
}
module.exports = api;

@ -4,17 +4,23 @@ var unit ={
getImgInfo:function(filePath){
function getInfo(resolve, reject) {
uni.getImageInfo({
src: filePath,
success: function (image) {
resolve(image);
},
fail: (res) => {
reject(res);
},
});
try {
uni.getImageInfo({
src: filePath,
success: function (image) {
resolve(image);
},
fail: (res) => {
reject(res);
},
});
return new Promise(getInfo);
} catch (error) {
console.log(error)
}
}
return new Promise(getInfo);
},
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

Loading…
Cancel
Save