1、最先上实际效果图:
2、微信小程序wxml编码:
view >3、微信小程序js编码,data里要界定2个主要参数,pjpic,um,各自纪录提交的照片详细地址及其提交的照片总数,默认设置设定数最多提交3个:
data: { pjpic: , um: 0 //照片提交关联涵数 bindpicup: function () { var that = this; var yscpic = that.data.pjpic; //获得当今提交的照片相对路径 var um = that.data.um; //获得当今提交的照片总数 var um = 3 - um; //设定数最多提交3个照片 if (um==0){ wx.showToast({ title: 提交总数已达3张 , icon: none , mask: true, duration: 2000 return false; //认证根据之后,刚开始挑选照片chooseImage wx.chooseImage({ count: um, //数最多能够挑选的照片数量 //sizeType: [ compressed ], // 能够特定是原照還是缩小图,默认设置两者都是有 sourceType: [ album , camera ], // 能够特定来源于是相册图片還是照相机,默认设置两者都是有 success: function (res) { // 回到选中相片的当地文档相对路径目录,tempFilePath能够做为img标识的src特性显示信息照片 var tempFilePaths = res.tempFilePaths; //起动提交等候中... wx.showToast({ title: 已经提交... , icon: loading , mask: true, duration: 10000 var uploadImgCount = 0; for (var i = 0, h = tempFilePaths.length; i h; i++) { wx.uploadFile({ url: con.theme_up, filePath: tempFilePaths[i], name: uploadfilepic , formData: { imgIndex : i header: { Content-Type : multipart/form-data success: function (res) { var data = JSON.parse(res.data); //回到的数据信息文件格式是{ msg : .jpg } ,务必要开展文件格式化,才可以根据data.msg获得这一网络服务器上储存的照片名字 uploadImgCount++; console.log(data.msg); if (yscpic== ){ yscpic = data.msg; } else { yscpic = yscpic + | + data.msg; //假如是最终一张,则掩藏等候中 if (uploadImgCount == tempFilePaths.length) { wx.hideToast(); that.setData({ pjpic: yscpic,um: um + uploadImgCount }) //把提交的照片名字、照片总数储存 console.log( 照片提交结束 fail: function (res) { wx.hideToast(); wx.showModal({ title: 不正确提醒 , content: 提交照片不成功 , showCancel: false, success: function (res) { } },4、css编码:
.uploadview{ padding:20rpx 0rpx 10rpx; .uploadview image{ display:inline-block; float:left; width:80rpx; height:80rpx; margin: 0rpx; margin-left: 80rpx; .uploadview text.righttips{ display:inline-block; float:left; font-size:0.8em; line-height:40rpx; margin-left: 30rpx; .uploadview text.bottips{ display:block; font-size:0.8em; color:#ff3333; line-height:40rpx; padding:15rpx 0rpx; text-align:center; }5、后台管理文档,asp版,立即另附缩小文档,上边的提交js编码里,恳求偏向upload.asp文档就可以
asp照片提交文档,可用于手机微信微信小程序.rar
时期sdcms网站模版网 - 一个认真制作sdcms网站模版的网站
在这里里,您不但能选购到时下最佳质的sdcms网站模版,同时也可以为您出示sdcms程序改动、二次开发设计等作用订制,及其sdcms系统软件或模版bug修补,本网站将全心全意全意思是您出示极致服务和售后服务,热烈欢迎个人收藏本网站。