E企盈小程序营销工具技术服务商 热线:4006-838-530

小程序图片九龙坡区E企盈小程序上传

E企盈小程序直播系统

// 调用摄像头 button class='photo_left_text' bindtap='addphoto'添加照片/button开通空调清洗小程序电话:4006-838-530

data:{ album: ["album","camera"],//相册或者摄像头}//选择照片  addphoto(e){    let that = this;    wx.showActionSheet({//选择相册或者拍照api      itemList: ['相册选择', '拍照'],      success: (res) = {        if (res.tapIndex == 0) {   开通淘宝速达小程序电话:4006-838-530       // 相册          wx.showLoading({            title: '上传中',          });          wx.chooseImage({//获取图片            count: "1",//获取图片数量最多能从相册获取9张            sizeType: ["original"],            sourceType: [that.data.album[res.tapIndex]],            success: function (res) {              that.phonts(res.tempFilePaths[0]);            },          })        } else {          // 相机          wx.showLoading({            title: '上传中',          });          wx.chooseImage({            count: "1",            sizeType: ["original"],            sourceType: [that.data.album[res.tapIndex]],            success: function (res) {              that.phonts(res.tempFilePaths[0]);            },          })        }      }    })  },  //调用后台接口把图片上传到后台并返回路径  phonts(t){    let that=th开通无痕内裤小程序电话:4006-838-530is;    wx.uploadFile({      url: 'https://test.com',//后台接口      filePath: t,      name: 'file',//后台接口的名字      success(r) {        console.log('成功', r)        wx.hideLoading();        that.setData({          photo: r.data        });      },      fail(e) {        console.log("失败", e)      }    })  },

赞(0) 打赏
未经允许不得转载:E企盈小程序开发-热线:4006-838-530 » 小程序图片九龙坡区E企盈小程序上传
分享到: 更多 (0)
E企盈小程序直播营销卖货系统

评论 抢沙发

E企盈小程序开发

联系我们联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏