recommand.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import Api from "../../model/api";
  2. import {getDataSet, getEventParam} from "../../utils/utils";
  3. import {logicStatus} from "../../model/enum";
  4. import Route from "../../model/route";
  5. const app = getApp();
  6. app.Base({
  7. data: {
  8. tabsList: [
  9. "推荐项目",
  10. "已报名"
  11. ],
  12. rows: [],
  13. isComplete: false,
  14. active: 0,
  15. },
  16. onChange(e) {
  17. this.setData({
  18. active: getEventParam(e, "index"),
  19. isComplete: "已报名" == getEventParam(e, "title")
  20. }, () => {
  21. this.changeResetData(this);
  22. })
  23. },
  24. toNewsDetail(e) {
  25. let id = getDataSet(e, "id");
  26. let isComplete = this.data.isComplete ? logicStatus.YES : logicStatus.NO;
  27. Route.toRocommandDetail(id, isComplete, {
  28. sign: () => {
  29. this.resetData(this);
  30. }
  31. })
  32. },
  33. async requestData() {
  34. let type = this.data.isComplete ? logicStatus.YES : logicStatus.NO
  35. let res = await Api.getRecommend({
  36. type,
  37. pageNum: this.pageNum,
  38. pageSize: this.pageSize
  39. });
  40. return res;
  41. }
  42. })