// compontents/chat/chat.js

Component({
  /**
   * 组件的属性列表
   */
  properties: {
    productionData: {
      type: Object,
      value: {}
    },
    title: {
      type: String,
      value: ''      
    },
    query: {
      type: String,
      value: ''          
    },
    type: {
      type: String,
      value: '' 
    },
    columnType: {
      type: String,
      value: '' 
    },
  },

  /**
   * 组件的初始数据
   */
  data: {
    text: '',
    chatDatas: [],
    animationData: {},
  },

  /**
   * 组件的方法列表
   */
  methods: {
    uploadImage (e) {
      const type = this.properties.type;
      const columnType = this.properties.columnType;
      wx.navigateTo({
        url: '../input_content/input_content?type=' + type + '&columnType=' + columnType 
      })
    },
    listenerButtonPreviewImage: function(e) {
      let imgUrl = [];
      imgUrl.push(e.target.dataset.img);
      wx.previewImage({
          current: '', // 当前显示图片的http链接
          urls: imgUrl, // 需要预览的图片http链接列表
          //这根本就不走
          success: function(res) {
              //console.log(res);
          },
          //也根本不走
          fail: function() {
              //console.log('fail')
          }
      })
    },
    shareImage: function(e){
      console.log(e);
      //分享查询单条的时候会用到这两个值
      const postId = e.currentTarget.dataset.postsid;
      this.share.showPopup(postId);
    },
    examine: function () {
      //console.log(1)
      var myEventDetail = {} // detail对象,提供给事件监听函数
      var myEventOption = {} // 触发事件的选项
      this.triggerEvent('myevent', myEventDetail, myEventOption)
    }
  },
  ready: function(){
    this.share = this.selectComponent("#share");
  }
})