123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156 |
- // pages/feedback/feedback.js
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- maxlength: 500,
- number: 0,
- value: "",
- imgs: [
- {
- type: "video",
- url: "http://wxsnsdy.tc.qq.com/105/20210/snsdyvideodownload?filekey=30280201010421301f0201690402534804102ca905ce620b1241b726bc41dcff44e00204012882540400&bizid=1023&hy=SH&fileparam=302c020101042530230204136ffd93020457e3c4ff02024ef202031e8d7f02030f42400204045a320a0201000400"
- },
- {
- type: "image",
- url: "https://img1.baidu.com/it/u=202543353,3627416815&fm=26&fmt=auto"
- },
- {
- type: "image",
- url: "https://img0.baidu.com/it/u=745609344,230882238&fm=26&fmt=auto"
- },
- {
- type: "image",
- url: "https://img0.baidu.com/it/u=286636366,3227707112&fm=26&fmt=auto"
- },
- {
- type: "image",
- url: "https://img1.baidu.com/it/u=2450865760,444795162&fm=26&fmt=auto"
- },
- {
- type: "image",
- url: "https://img0.baidu.com/it/u=4226275504,4103997964&fm=26&fmt=auto"
- },
- {
- type: "image",
- url: "https://img0.baidu.com/it/u=2247422843,411257408&fm=26&fmt=auto"
- },
- ]
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- },
- /**
- * 监听文本域
- */
- bindTextAreaInput(e) {
- this.setData({
- number: e.detail.cursor,
- value: e.detail.value
- })
- },
- /**
- * 预览图片和视频
- */
- previewMedia(e) {
- let arr = this.data.imgs
- let current = e.currentTarget.dataset.index
- wx.previewMedia({
- sources: arr,
- current
- })
- },
- /**
- * 删除列表项
- */
- onDeleteItem(e) {
- let imgs = this.data.imgs;
- imgs.splice(e.currentTarget.dataset.index, 1);
- this.setData({ imgs })
- console.log(imgs)
- },
- /**
- * 选择图片
- */
- chooseImage() {
- let that = this;
- let imgs = this.data.imgs;
- let count = 9 - this.data.imgs.length
- wx.chooseImage({
- count,
- sizeType: ['original', 'compressed'],
- sourceType: ['album', 'camera'],
- success (res) {
- const tempFilePaths = res.tempFilePaths
- tempFilePaths.forEach((item) => {
- imgs.push({
- type: 'image',
- url: item
- })
- })
- that.setData({
- imgs
- })
- }
- })
- }
- })
|