index.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. var app = getApp();
  2. Component({
  3. /**
  4. * 组件的属性列表
  5. */
  6. properties: {
  7. refresh: {
  8. type: Boolean,
  9. value: false,
  10. observer: function (t) {
  11. if (t) this.setData({ list: [] }), this.getPinList();
  12. }
  13. },
  14. diyInfo: {
  15. type: Object,
  16. observer: function (t) {
  17. if (t) {
  18. let list = t.list || [];
  19. list.forEach((item, index)=>{
  20. if(item.imageUrl.indexOf('http')==-1) {
  21. list[index].imageUrl = t.host + item.imageUrl;
  22. }
  23. })
  24. this.setData({ style: t.style*1-1, styleList: list });
  25. }
  26. }
  27. },
  28. skin: {
  29. type: Object
  30. }
  31. },
  32. data: {
  33. style: 0,
  34. list: [],
  35. styleList: [],
  36. placeholdeImg: app.globalData.placeholdeImg
  37. },
  38. attached() {
  39. this.getPinList();
  40. },
  41. /**
  42. * 组件的方法列表
  43. */
  44. methods: {
  45. getPinList: function () {
  46. let that = this;
  47. var community = wx.getStorageSync('community');
  48. let head_id = community.communityId || '';
  49. var token = wx.getStorageSync('token');
  50. app.util.request({
  51. url: 'entry/wxapp/index',
  52. data: {
  53. controller: 'group.get_pintuan_list',
  54. is_index: 1,
  55. head_id,
  56. token
  57. },
  58. dataType: 'json',
  59. success: function (res) {
  60. if (res.data.code == 0) {
  61. let pinList = {};
  62. let { list, pintuan_index_coming_img, pintuan_index_show } = res.data;
  63. pinList.list = list || [];
  64. pinList.img = pintuan_index_coming_img || '';
  65. pinList.show = pintuan_index_show || 0;
  66. that.setData({ pinList })
  67. console.log('pinList', pinList)
  68. }
  69. }
  70. })
  71. },
  72. goLink: function(event) {
  73. let url = event.currentTarget.dataset.link;
  74. url && wx.navigateTo({ url })
  75. }
  76. }
  77. })