zoukankan      html  css  js  c++  java
  • 小程序单图上传到服务器

    // 上传营业执照
    fail_yingye(e) {
    var that = this;
    var uniacid = app.siteInfo.uniacid;
    var idx = e.currentTarget.dataset.index;
    var yingye = that.data.yingye;
    var openid = wx.getStorageSync('openid')
    wx.chooseImage({
    count: 1, // 默认9
    sizeType: ['original', 'compressed'],
    sourceType: ['album', 'camera'],
    success: function (res) {
    var yingyes = that.data.yingye;
    var tempFilePath = res.tempFilePaths[0];
    yingyes[idx].src = tempFilePath;
    wx.uploadFile({
    url: that.data.url + 'app/index.php?i=' + uniacid + '&c=entry&a=wxapp&do=Upload&m=pinba',
    filePath: tempFilePath,
    name: 'upfile',
    formData: {
    // 'path': 'wxchat'
    },
    success: function (res) {
    console.log(res.data)
    that.setData({
    yingyes: res.data,
    })
    // app.util.request({
    // 'url': 'entry/wxapp/Shenhe',
    // data: {
    // openid: openid,
    // uplogo: res.data
    // },
    // success: function (res) {
    // console.log(res.data.data)
    // // that.setData({
    // // myxiaofeisum: res.data.data
    // // })
    // },
    // fail: function (err) {
    // console.log(err)
    // },

    // })
    },
    fail: function (res) {
    console.log(res)
    },
    })
    that.setData({
    yingye: yingyes
    })
    console.log(yingye)
    },
    fail: function (res) { }
    })
    },
     
     
     
     
    url获取
    app.util.request({
    'url': 'entry/wxapp/url',
    'cachetime': '0',
    success: function (res) {
    console.log(res)
    that.setData({
    url: res.data
    })
    },
    })
     
     
    <!--上传营业执照 -->
    <view class='yingye sj_name'>
    <view class='font28 color_666'>上传营业执照</view>
    <view class='yingye_img' wx:for="{{yingye}}" wx:key="yy">
    <image src='{{item.src}}' data-index='{{index}}' bindtap='fail_yingye'></image>
    <view class='font26 color_666 txt_center'>{{item.txt}}</view>
    </view>
    </view>
  • 相关阅读:
    CF432D Prefixes and Suffixes
    CF126B Password
    如何实现输入历史记录功能
    python工作中总结
    今 天看到我十年前的一篇技术文章,想到不知不觉学编程十多年了,,
    现在互联网好多bug 想到都烦
    【图论】割点
    【DP】【P1941】【NOIP2014D1T3】飞扬的小鸟
    【线段树】【P3740】 [HAOI2014]贴海报
    【单调队列】【P1714】 切蛋糕
  • 原文地址:https://www.cnblogs.com/isuansuan/p/9957479.html
Copyright © 2011-2022 走看看