index.js 972 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. //index.js
  2. //获取应用实例
  3. const getReq = require('./../../config.js').getReq;
  4. const app = getApp();
  5. Page({
  6. data: {
  7. tabs: [],
  8. special_datas:{},
  9. summery:[]
  10. },
  11. onLoad: function () {
  12. var self = this
  13. getReq({
  14. act: 'index',
  15. op: 'tabs'
  16. }, function (res) {
  17. if (res.code == 200) {
  18. self.getDatas(res.datas.tabs[0].special_id);
  19. self.setData({
  20. tabs: res.datas.tabs
  21. });
  22. }
  23. })
  24. },
  25. onMyEvent: function (e) {
  26. this.getDatas(e.detail.special_id)
  27. },
  28. getDatas(special_id) {
  29. var self = this;
  30. getReq({
  31. act: 'special',
  32. op: 'index',
  33. special_id,
  34. page: 10,
  35. curpage: 1
  36. }, function (res) {
  37. if (res.code == 200) {
  38. console.log(res)
  39. self.setData({
  40. special_datas: res.datas,
  41. summery:res.datas.summary
  42. });
  43. }
  44. setTimeout(function () {
  45. wx.hideLoading()
  46. }, 2000)
  47. })
  48. }
  49. })