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

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

@ -4,6 +4,8 @@ var unit ={
getImgInfo:function(filePath){ getImgInfo:function(filePath){
function getInfo(resolve, reject) { function getInfo(resolve, reject) {
try {
uni.getImageInfo({ uni.getImageInfo({
src: filePath, src: filePath,
success: function (image) { success: function (image) {
@ -13,8 +15,12 @@ var unit ={
reject(res); reject(res);
}, },
}); });
}
return new Promise(getInfo); return new Promise(getInfo);
} catch (error) {
console.log(error)
}
}
}, },
compressImg:function(filePath, config = {}){ compressImg:function(filePath, config = {}){

@ -127,7 +127,7 @@
var _this = this; var _this = this;
_this.checkAuth(); _this.checkAuth();
this.setSuccessFiles(); this.setSuccessFiles();
console.log('~~~~~~~~~~~~~~~~~~')
}, },
methods: { methods: {
@ -245,7 +245,10 @@
let address = _date.getFullYear() + '' + (_date.getMonth() + 1) + '' + _date.getDate(); let address = _date.getFullYear() + '' + (_date.getMonth() + 1) + '' + _date.getDate();
let fileName = address + _date.getTime() + ext_name; let fileName = address + _date.getTime() + ext_name;
const img_info = await unit.getImgInfo(filePath); const img_info = await unit.getImgInfo(filePath);
if(typeof(img_info) == 'undefined' || !img_info){
this.$com.showError('图片格式错误!请重试!');
return false;
}
let { let {
width, width,
height height

Loading…
Cancel
Save