chat.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. // compontents/chat/chat.js
  2. Component({
  3. /**
  4. * 组件的属性列表
  5. */
  6. properties: {
  7. productionData: {
  8. type: Object,
  9. value: {}
  10. },
  11. title: {
  12. type: String,
  13. value: ''
  14. },
  15. query: {
  16. type: String,
  17. value: ''
  18. },
  19. type: {
  20. type: String,
  21. value: ''
  22. },
  23. columnType: {
  24. type: String,
  25. value: ''
  26. },
  27. },
  28. /**
  29. * 组件的初始数据
  30. */
  31. data: {
  32. text: '',
  33. chatDatas: [],
  34. animationData: {},
  35. },
  36. /**
  37. * 组件的方法列表
  38. */
  39. methods: {
  40. uploadImage (e) {
  41. const type = this.properties.type;
  42. const columnType = this.properties.columnType;
  43. wx.navigateTo({
  44. url: '../input_content/input_content?type=' + type + '&columnType=' + columnType
  45. })
  46. },
  47. listenerButtonPreviewImage: function(e) {
  48. let imgUrl = [];
  49. imgUrl.push(e.target.dataset.img);
  50. wx.previewImage({
  51. current: '', // 当前显示图片的http链接
  52. urls: imgUrl, // 需要预览的图片http链接列表
  53. //这根本就不走
  54. success: function(res) {
  55. //console.log(res);
  56. },
  57. //也根本不走
  58. fail: function() {
  59. //console.log('fail')
  60. }
  61. })
  62. },
  63. //分享
  64. shareImage: function(e){
  65. console.log(e);
  66. //分享查询单条的时候会用到这两个值
  67. const postId = e.currentTarget.dataset.postsid;
  68. this.share.showPopup(postId);
  69. },
  70. //跳转详情页
  71. particulars: function (e) {
  72. const postId = e.currentTarget.dataset.postsid;
  73. wx.navigateTo({
  74. url: '../../pages/particulars/particulars?postId=' + postId
  75. })
  76. },
  77. //查看更多
  78. examine: function () {
  79. //console.log(1)
  80. var myEventDetail = {} // detail对象,提供给事件监听函数
  81. var myEventOption = {} // 触发事件的选项
  82. this.triggerEvent('myevent', myEventDetail, myEventOption)
  83. }
  84. },
  85. ready: function(){
  86. this.share = this.selectComponent("#share");
  87. }
  88. })