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>
  • 相关阅读:
    图形界面 Fedora Core 12/Core 11 How to log in GUI as r
    nis_client.txt
    nis_server.txt
    passwd
    samba.set
    【22.48%】【codeforces 689D】Friends and Subsequences
    【71.76%】【codeforces 732A】Buy a Shovel
    【56.74%】【codeforces 732B】Cormen --- The Best Friend Of a Man
    【43.26%】【codeforces 732C】Sanatorium
    【37.50%】【codeforces 732D】Exams
  • 原文地址:https://www.cnblogs.com/isuansuan/p/9957479.html
Copyright © 2011-2022 走看看