article.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. //var api = require("../../api.js"), app = getApp(),
  2. var is_loading_more = !1, is_no_more = !1;
  3. var api = require('../../utils/api.js');
  4. Page({
  5. data: {
  6. page: 1,
  7. video_list: [],
  8. url: "",
  9. hide: "hide",
  10. show: !1,
  11. animationData: {}
  12. },
  13. onLoad: function (a) {
  14. // app.pageOnLoad(this);
  15. this.loadMoreGoodsList();
  16. },
  17. onReady: function () { },
  18. onShow: function () {
  19. // app.pageOnShow(this);
  20. },
  21. onHide: function () { },
  22. onUnload: function () { },
  23. onPullDownRefresh: function () { },
  24. loadMoreGoodsList: function () {
  25. var o = this;
  26. // if (!is_loading_more) {
  27. // o.setData({
  28. // show_loading_bar: !0
  29. // }), is_loading_more = !0;
  30. var i = o.data.page;
  31. // var v = [{
  32. // "id":"234",
  33. // "title":"小程序项目整体介绍",
  34. // "url":"http://m1.beiyuesi.com/2.mp4",
  35. // "sort":"9",
  36. // "is_delete":"0",
  37. // "addtime":"1515120216",
  38. // "store_id":"20926",
  39. // "pic_url":"https://u5.9026.com/addons/swdz_mall/core/web/uploads/image/f0/f0734ad93d46497483344846864596a4.jpg",
  40. // "content":"想要自己开发APP,却备受组建开发团队的困扰更别说高昂的开发费用与漫长的开",
  41. // "type":"0",
  42. // "time":"01月05日",
  43. // "show":-1
  44. // },
  45. // {
  46. // "id": "235",
  47. // "title": "小程序模版介绍",
  48. // "url": "http://m1.beiyuesi.com/1.mp4",
  49. // "sort": "99",
  50. // "is_delete": "0",
  51. // "addtime": "1515120395",
  52. // "store_id": "20926",
  53. // "pic_url": "https://u5.9026.com/addons/swdz_mall/core/web/uploads/image/0e/0e739254177172e4b815d75f88da77b4.png",
  54. // "content": "小程序是腾讯旗下继朋友圈、公众号之后推出的又一款战略级的产品。是线下实体店实体零售转型升级、实现新突破的利器。小程序比公众号更容易传播和裂变,比传统电商更容易获客和成交,比朋友圈微商更专业和可信",
  55. // "type": "0",
  56. // "time": "01月05日",
  57. // "show": -1
  58. // },
  59. // ];
  60. wx.request({
  61. url: api.getMoreVideosAndArticlesUrl,
  62. method: 'GET',
  63. data: {
  64. 'offset': o.data.video_list.length
  65. },
  66. success: res => {
  67. if (res.data.list.length > 0) {
  68. var t = o.data.video_list.concat(res.data.list);
  69. o.setData({
  70. video_list: t,
  71. page: i + 1
  72. });
  73. } else {
  74. wx.showToast({
  75. title: '到底了',
  76. icon: 'none',
  77. duration: 800
  78. })
  79. }
  80. }
  81. })
  82. // app.request({
  83. // url: api.default.video_list,
  84. // data: {
  85. // page: i
  86. // },
  87. // success: function (a) {
  88. // 0 == a.data.list.length && (is_no_more = !0);
  89. // var t = o.data.video_list.concat(a.data.list);
  90. // o.setData({
  91. // video_list: t,
  92. // page: i + 1
  93. // });
  94. // },
  95. // complete: function () {
  96. // is_loading_more = !1, o.setData({
  97. // show_loading_bar: !1
  98. // });
  99. // }
  100. // });
  101. // }
  102. },
  103. play: function (a) {
  104. var t = a.currentTarget.dataset.index;
  105. wx.createVideoContext("video_" + this.data.show_video).pause(), this.setData({
  106. show_video: t,
  107. show: !0
  108. });
  109. },
  110. onReachBottom: function () {
  111. this.loadMoreGoodsList();
  112. // is_no_more || this.loadMoreGoodsList();
  113. },
  114. more: function (a) {
  115. var t = this, o = a.target.dataset.index, i = t.data.video_list, e = wx.createAnimation({
  116. duration: 1e3,
  117. timingFunction: "ease"
  118. });
  119. this.animation = e, -1 != i[o].show ? (e.rotate(0).step(), i[o].show = -1) : (e.rotate(0).step(),
  120. i[o].show = 0), t.setData({
  121. video_list: i,
  122. animationData: this.animation.export()
  123. });
  124. },
  125. redirectToArticle: function(e) {
  126. let id = e.currentTarget.dataset.id;
  127. wx.navigateTo({
  128. url: '/pages/article-detail/index?id=' + id
  129. })
  130. }
  131. });