index.js 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. define([
  2. 'api/activity',
  3. 'moment',
  4. 'text!./index.html',
  5. 'css!./index.css',
  6. 'css!../../../../wap/first/zsff/iconfont/iconfont.css',
  7. ], function(activityApi, moment, html) {
  8. return {
  9. props: {
  10. activeName: {
  11. type: String,
  12. default: 'activity'
  13. },
  14. isLogin: {
  15. type: Boolean,
  16. default: false
  17. }
  18. },
  19. filters: {
  20. timeFormat: function (value) {
  21. return moment(value * 1000).format('YYYY-MM-DD HH:mm');
  22. }
  23. },
  24. data: function () {
  25. return {
  26. active: '0',
  27. limit: 10,
  28. page0: 1,
  29. page1: 1,
  30. page2: 1,
  31. total0: 10,
  32. total1: 10,
  33. total2: 10,
  34. list0: [],
  35. list1: [],
  36. list2: []
  37. };
  38. },
  39. watch: {
  40. isLogin: function (val) {
  41. if (val) {
  42. this.activitySignInList0();
  43. this.activitySignInList1();
  44. this.activitySignInList2();
  45. }
  46. }
  47. },
  48. methods: {
  49. activitySignInList0: function () {
  50. var vm = this;
  51. activityApi.activitySignInList({
  52. page: this.page0,
  53. limit: this.limit,
  54. navActive: 0
  55. }).then(function (res) {
  56. var data = res.data;
  57. vm.list0 = data.list;
  58. vm.total0 = data.count;
  59. });
  60. },
  61. activitySignInList1: function () {
  62. var vm = this;
  63. activityApi.activitySignInList({
  64. page: this.page1,
  65. limit: this.limit,
  66. navActive: 1
  67. }).then(function (res) {
  68. var data = res.data;
  69. vm.list1 = data.list;
  70. vm.total1 = data.count;
  71. });
  72. },
  73. activitySignInList2: function () {
  74. var vm = this;
  75. activityApi.activitySignInList({
  76. page: this.page2,
  77. limit: this.limit,
  78. navActive: 2
  79. }).then(function (res) {
  80. var data = res.data;
  81. vm.list2 = data.list;
  82. vm.total2 = data.count;
  83. });
  84. },
  85. handleClick: function () {
  86. }
  87. },
  88. template: html
  89. };
  90. });