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>
  • 相关阅读:
    编译器内置宏实现调试信息输出
    走进C标准库(4)——"stdio.h"中的putc
    走进C标准库(5)——"stdio.h"中的其他部分函数
    走进C标准库(2)——"stdio.h"中的fopen函数
    [转]深度探索C语言函数可变长参数
    C语言I博客作业02
    C语言I博客作业02
    第一周c语音作业
    什么是模块化,模块化的好处又是什么?
    服务端渲染和客户端渲染
  • 原文地址:https://www.cnblogs.com/isuansuan/p/9957479.html
Copyright © 2011-2022 走看看