position.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // components/fulltime/fulltime.js
  2. Component({
  3. /**
  4. * 组件的属性列表
  5. */
  6. properties: {
  7. // 渲染列表
  8. list: {
  9. type: Array,
  10. value: []
  11. },
  12. // 是否可以滚动
  13. isScroll: {
  14. type: Boolean,
  15. value: true
  16. },
  17. // 更多消息
  18. showNoMore: {
  19. type: String,
  20. value: "没有更多信息..."
  21. },
  22. // 控制高薪拼工图片显示
  23. show_img: {
  24. type: Boolean,
  25. value: true
  26. },
  27. margin: {
  28. type: Number,
  29. value: 10
  30. }
  31. },
  32. /**
  33. * 组件的初始数据
  34. */
  35. data: {
  36. myFormat: ['天', '时', '分', '秒'],
  37. },
  38. /**
  39. * 组件的方法列表
  40. */
  41. methods: {
  42. doArrow(e) {
  43. const index = e.currentTarget.dataset.index;
  44. const list = this.data.list;
  45. this.setData({
  46. [`list[${index}].up`]: !list[index].up
  47. })
  48. },
  49. action(e) {
  50. const date = wx.getStorageSync('detail_time');
  51. let times = wx.getStorageSync('detail_times') || 0;
  52. const _date = new Date().getTime();
  53. if (!date || _date - date > 86400000) {
  54. if (times < 2) {
  55. // 上报详情订阅信息
  56. wx.aldPushSubscribeMessage({
  57. eventId: '5ea139ed6df4251c4a09a4bf',
  58. success: () => {
  59. wx.setStorageSync('detail_times', 2);
  60. wx.setStorageSync('detail_time', new Date().getTime())
  61. },
  62. fail: () => {
  63. times++;
  64. wx.setStorageSync('detail_times', times);
  65. if (times === 2) {
  66. wx.setStorageSync('detail_time', new Date().getTime())
  67. }
  68. }
  69. });
  70. }
  71. }
  72. this.triggerEvent('action', e.currentTarget.dataset)
  73. }
  74. }
  75. })