IT门户, 中国互联网人工智能物联网行业资讯平台--公众IT
新闻来源:互联网资料整理       发布时间:2023/4/5 15:02:03       共计:4600 浏览

前言:

2小时前小编发现微信小程序用户:【08】提出了一个关于“wx.uploadFile方法上传图片,部分图片后台无法获取怎么回事?”的问题,在问题中开发者08对该问题做了如下阐述:

问题类型:


  • API和组件:

问题描述:

// that.showBack();

wx.chooseImage({

count: 1,

sizeType: [original],

sourceType: [camera],

success (res) {

// tempFilePath可以作为img标签的src属性显示图片

const tempFilePaths = res.tempFilePaths;

if(isAlbum == 1){

isChange = true;

}

that.setData({

isChange‘:isChange,

imageSrc‘:tempFilePaths,

});

that.uploadImg(this.data.imageSrc,this.data.resType);

}

})

//上传图片

uploadImg:function (filePath,number) {

// wx.showLoading({

// title: ‘上传中’,

// mask:true,

// })

console.log(上传图片路劲);

console.log(filePath[0]);

console.log(第二个路径);

console.log(this.data.imageSrc[0]);

var that = this;

var resType = number;

var tempFile = filePath;

// var resType = that.data.resType;

wx.uploadFile({

filePath: this.data.imageSrc[0],

url:baseURL + /fillinPersonalPhoto‘,

name:’file‘,

formData:{

uid:wx.getStorageSync(uid),

pid:that.data.pid,

xuhao:that.data.resType,

},

success:function (res) {

console.log(上传图片成功);

wx.showToast({

title: 上传成功‘,

icon:’none

})

// var isAlbum = that.data.isAlbum;

var isChange = false;

var typeFile = ”;

var typeClick = ”;

var typeWidth = 0‘;

var typeHeight = 0‘;

if(resType == 1){

typeFile = topImgFile‘;

typeClick = isTopClick‘;

typeWidth = topWidth

typeHeight = topHeight

}else if(resType == 2){

typeFile = normalImgFile‘;

typeClick = isNormalClick‘;

typeWidth = normalWidth

typeHeight = normalHeight

}else if(resType == 3){

typeFile = gestureImgFile‘;

typeClick = isGestureClick‘;

typeWidth = gestureWidth

typeHeight = gestureHeight

}

that.setData({

[typeWidth]:’100%‘,

[typeHeight]:’100%‘,

[typeClick]:true,

[typeFile] : tempFile,

// ‘isChange’:isChange,

}),

that.getAllClick();

console.log(res);

var data = JSON.parse(res.data);

console.log(data);

},

fail:function (res) {

console.log(上传失败);

// wx.hideLoading({

// success: (res) => {},

// })

wx.showToast({

title: 上传失败‘,

icon:’none

})

console.log(res);

},

complete:()=>{

console.log(图片上传complete);

wx.showToast({

title: 上传成功‘,

icon:’none

})

// wx.hideLoading({

// success: (res) => {},

// })

}

})

},

注:以上是微信小程序开发者:”08″对于本问题的一些阐述,这里做一个引用,我们将实时关注微信小程序助手对该问题提出的解决方案。

解决方案:

【1小时前】微信小程序技术运营专员对用户08提出的wx.uploadFile方法上传图片,部分图片后台无法获取怎么回事?给予如下回复

你好,麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

结语:

微信官方智能小程序开源联盟对于整个行业而言是一次机遇,让所有人都有机会享受到小程序所到来的红利。另一方面,对于微信官方自身而言,智能小程序开源联盟或许是其又一次业绩腾飞的潜在动力

如果您也在使用微信小程序,请关注我们,如果您有关于微信小程序的使用问题请关注我们,如果您要找百度小程序模板、微信小程序模板请关注小程序模板网或者去微信开放社区找官方人员给予解决,相信微信官方在小程序上的发力会是一个里程碑!

版权说明:
本网站凡注明“公众IT 原创”的皆为本站原创文章,如需转载请注明出处!
本网转载皆注明出处,遵循行业规范,如发现作品内容版权或其它问题的,请与我们联系处理!
您可以扫描右侧微信二维码联系我们。
网站首页 关于我们 联系我们 合作联系 会员说明 新闻投稿 隐私协议 网站地图