scoreDetail.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import Api from "../../model/api";
  2. import {getEventParam} from "../../utils/utils";
  3. import {scoreLogics} from "../../model/enum";
  4. const app = getApp();
  5. app.Base({
  6. educationStuId: '',
  7. data: {
  8. typeArr: [],
  9. typeData: [],
  10. typeIndex: 0,
  11. educationStuId: '',
  12. scoreLogicsEnum: scoreLogics,
  13. },
  14. async onLoad(options) {
  15. const data = await Api.getScoreInfo(true);
  16. let typeArr = data.data.map(item => {
  17. return `${item.itemName}(${item.teamName})`;
  18. })
  19. typeArr.unshift("全部")
  20. this.setData({
  21. typeArr, typeData: data.data,
  22. })
  23. },
  24. async bindTypeChange(e) {
  25. this.setData({
  26. typeIndex: getEventParam(e, "value"),
  27. educationStuId: this.data.typeData[getEventParam(e, "value") - 1] ?
  28. this.data.typeData[getEventParam(e, "value") - 1].stuId : ''
  29. })
  30. this.educationStuId = this.data.typeData[getEventParam(e, "value") - 1] ?
  31. this.data.typeData[getEventParam(e, "value") - 1].stuId : '';
  32. await this.resetData(this);
  33. },
  34. async requestData() {
  35. const res = await Api.getScoreDetail({
  36. educationStuId: this.educationStuId,
  37. pageNum: this.pageNum,
  38. pageSize: this.pageSize
  39. });
  40. return res;
  41. },
  42. })