来人啊啊啊啊啊啊啊啊啊
如何解决wx.uploadFile上传到后台出现我们后台看不到图片的问题?wx.uploadFile 调试基础库 2.25.3 问题很严重 ,每天都用用户反馈上传成功,但是后台看不到数据。ios 比较多 android 也有,我看之前也有很多人遇到,但是你们好像一直都没有解决,请重视此问题。 wx.chooseMedia({ count: 1, mediaType: ['image', 'video'], sourceType: ['album', 'camera'], sizeType:['compressed'], maxDuration: 30, camera: 'back', success(res) { console.log(res.tempFiles.tempFilePath) console.log(res.tempFiles.tempFilePath) if (params == 0) { var nextParams = { path: res.tempFiles[0].tempFilePath, type: 'idCardPic' } list.push(nextParams); that.setData({ uploadIdFront: true, idFrontPath: res.tempFiles[0].tempFilePath, upLoadData: list, }) } else if (params == 1) { var nextParams = { path: res.tempFiles[0].tempFilePath, type: 'idCardBackPic' } list.push(nextParams); that.setData({ uploadIdReverse: true, idReversePath: res.tempFiles[0].tempFilePath, upLoadData: list, }) } else if (params == 2) { var nextParams = { path: res.tempFiles[0].tempFilePath, type: 'personPic' } list.push(nextParams); that.setData({ uploadIdHandHeld: true, idHandHeldPath: res.tempFiles[0].tempFilePath, upLoadData: list, }) } } }) }, confirm() { this.upLoadPic(this.data.upLoadData[0]) }, upLoadPic(params) { var that = this wx.uploadFile({ url: HOST_PATH + '/member/auth/mini', filePath: params.path, name: 'file', formData: { 'requestNo': util.getRandomNum(), 'token': wx.getStorageSync(TOKEN), 'realName': this.data.userName, 'idCard': this.data.userId, 'type': params.type }, success(res) { console.log(res) if (params.type == 'idCardPic') { that.upLoadPic(that.data.upLoadData[1]) } else if (params.type == 'idCardBackPic') { that.upLoadPic(that.data.upLoadData[2]) } else if (params.type == 'personPic') { wx.hideLoading(); wx.showModal({ title: '提示', content: '上传成功,请耐心等待审核结果', showCancel: false, complete: (res) => { wx.navigateBack({ //返回上个页面 }) } }) } }, fail(e) { wx.showToast({ title: e, icon: 'none', }) } }) },
2023-04-281:选择调试基础库2.26.6 并且在project.private.config 中libVersion改为和2.26.2一致 其他调试库或许好用,但是最新的几个都有问题! 2:或者选择真机调试1.0(但是会卡)
安卓调试,报错?[图片] WAServiceMainContext.js:1 [wxapplib]] [LogManagerwxb9d033a227d30766]] accessSync fail accessSync:fail no such file or directory, access '/storage/emulated/0/Android/data/com.tencent.mm/MicroMsg/wxanewfiles/2fbe01503bf123325797fe2ef8741f01/miniprogramLog/log2' Error: accessSync:fail no such file or directory, access '/storage/emulated/0/Android/data/com.tencent.mm/MicroMsg/wxanewfiles/2fbe01503bf123325797fe2ef8741f01/miniprogramLog/log2' at i (https://lib/WAServiceMainContext.js:1:1091355) at CS (https://lib/WAServiceMainContext.js:1:1771073) at https://lib/WAServiceMainContext.js:1:1771904 at d (https://lib/WAServiceMainContext.js:1:364348) at https://lib/WAServiceMainContext.js:1:364686 at https://lib/WAServiceMainContext.js:1:1772692 at d (https://lib/WAServiceMainContext.js:1:364348) at https://lib/WAServiceMainContext.js:1:364686 at https://lib/WAServiceMainContext.js:1:1772932 at d (https://lib/WAServiceMainContext.js:1:364348) {"0":"wxfile://usr/miniprogramLog/log2"}
2023-02-08// app.js const api = require('./api/api.js'); import {TOKEN} from './config/appConfig'; App({ onLaunch() { // 展示本地存储能力 const logs = wx.getStorageSync('logs') || [] logs.unshift(Date.now()) wx.setStorageSync('logs', logs) let wxCode = '' // 登录 wx.login({ success: res => { // 发送 res.code 到后台换取 openId, sessionKey, unionId wxCode = res.code api.login({ code: wxCode, from:'mini' }).then(res => { wx.setStorageSync(TOKEN, res.body.token); }) } }) this.getMenuInfo(); }, getMenuInfo: function() { let menuInfo = wx.getMenuButtonBoundingClientRect(); wx.getSystemInfo({ success: res => { // 导航栏的高度 = 状态栏高度 + 菜单按钮高度 + 菜单按钮的上下间隔的高度 this.globalData.barInfo.height = res.statusBarHeight + menuInfo.height + (menuInfo.top - res.statusBarHeight) * 2; this.globalData.barInfo.menuTop = menuInfo.top; this.globalData.barInfo.menuHeight = menuInfo.height; } }) }, globalData: { userInfo: null, barInfo: { height: null, menuHeight: null, menuTop: null } } })
微信小程序 wx.login({https://developers.weixin.qq.com/miniprogram/dev/framework/ wx.login在.app.js 的onLaunch中不能正常使用,安卓测试手机.小米noto11pro 在预览中没有问题
2023-01-04