zoukankan      html  css  js  c++  java
  • 小程序图片上传

    wxml部分:

    <view class='tupian'>
    <image bindtap="chooseimage" style='33.33%;height:73px;' src="../../images/tupian.png" hidden='{{hiddentupian}}'/>
    <block wx:for="{{tempFilePaths}}" wx:key="{{index}}" >
    <image src="{{tempFilePaths[index]}}" mode="aspecFill" style='33.33%;height:73px;float:right' />
    </block>
    </view>

    js部分:

    chooseimage: function () {
    var that = this;
    wx.chooseImage({
    count: 3, // 默认9
    sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
    sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
    success: function (res) {
    that.setData({
    tempFilePaths: res.tempFilePaths,
    hiddentupian:true,
    })
    }
    })
    },

    submit部分:

    wx.uploadFile({
    url: url + '/fabu/fabu!upload.action', //仅为示例,非真实的接口地址
    method: 'post',
    filePath: tpsc[i],
    name: 'file',
    formData: {
    'filen': result11[i],
    },
    header: {
    "Content-Type": "multipart/form-data"
    },
    success: function (res) {
    var data = res.data
    }
    })

  • 相关阅读:
    转移到新的个人独立博客。
    hdu5618 (三维偏序,cdq分治)
    平衡树维护动态凸包
    poj1986 LCA
    hdu2586 LCA
    LCA最近公共祖先 ST+RMQ在线算法
    hdu 3401 单调队列优化DP
    【转】单调队列优化DP
    CodeForces 548D 单调栈
    hdu3530 单调队列
  • 原文地址:https://www.cnblogs.com/zcy1995/p/9361391.html
Copyright © 2011-2022 走看看