E企盈营销工具技术服务商 热线:4006-838-530

微信小程序上传图片,视频及永新县E企盈小程序预览

wxml!– 图片预览 –view class=’preview-warp’ wx:if=”{{urls}}”  image  src='{{urls}}’ //viewview class=”prew_video” hidden=”{{chooesVideo==”}}”  video bindfullscreenchange=”bindVideoScreenChange” src=”{{chooesVideo}}” /video/view!– 按钮组 –view class=’upimg’ bindtap=’chooseImg’上传图片/viewview class=’upvideo’ bindtap=’cho开通面包券小程序电话:4006-838-530d #000;  background: #fff}

js//index.jsvar app = getApp()var count = 0;Page({  data: {    chooesVideo:”,    //上传视频地址    tipHide: false,    chooseTypeHide: true,  },  /**     * 生命周期函数–监听页面加载     */  onLoad: function (options) {    console.log(options.status)  },  /**     * 生命周期函数–监听页面初次渲染完成     */  onReady: function (res) {    this.videoContext = wx.createVideoContext(‘prew_video’);  },/**   * 上传图片   */  chooseImg:function() {    let that = this    wx.chooseImage({      count: 1, // 默认9      sizeType: [‘original’, ‘compressed’], // 可以指定是原图还是压缩图,默认二者都有      sourceType: [‘album’, ‘camera’], // 可以指定来源是相册还是相机,默认二者都有      success: function (res) {        console.log(res)        var tempFilePaths = res.tempFilePaths        that.data.images = tempFilePaths        // 多图片        // that.data.urls = that.data.urls.concat(tempFilePaths)        // 单图片        that.data.urls = tempFilePaths[0]        that.setData({          images: tempFilePaths[0],          urls: that.data.urls        })      }    })  },  /**   * 上传视频   */  chooseVideo:function(){    let that = this    wx.chooseVideo({      sourceType: [‘album’, ‘camera’],      maxDuration: 60,      camer开通荧光告示贴小程序电话:4006-838-530a: ‘back’,      success: function (res) {        that.setData({          chooesVideo: res.tempFilePath        })      }    })  },  /**     * 全屏改变     */  bindVideoScreenChange: function (e) {    var status = e.detail.fullScreen;    var play = {      playVideo: false    }    if (status) {      play.playVideo = true;    } else {      this.videoContext.pause();    }    this.setData(play);  }})

赞(0) 打赏
未经允许不得转载:E企盈小程序开发-热线:4006-838-530 » 微信小程序上传图片,视频及永新县E企盈小程序预览
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

模王系统开发

联系我们升级日志

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏