student.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import Api from "../../model/api";
  2. import {getDataSet, getEventParam, toast} from "../../utils/utils";
  3. import Route from "../../model/route";
  4. import {sexTexts} from "../../model/enum";
  5. const app = getApp();
  6. app.Base({
  7. data: {
  8. className: '',
  9. teamId: '',
  10. myStuId: '',
  11. sexs: sexTexts,
  12. key: '',
  13. },
  14. async onLoad(options) {
  15. let teamId = options.teamId;
  16. let myStuId = options.myStuId;
  17. this.data.teamId = teamId;
  18. this.setData({
  19. className: options.className,
  20. teamId, myStuId
  21. })
  22. },
  23. sleep(e) {
  24. let item = getDataSet(e, "item");
  25. let className = getDataSet(e, "classname");
  26. Route.toSLeep(item.id, item.picUrl, item.name, item.teamJobName, item.phone,
  27. item.sex, item.nationName, className, item.groupName, this.data.myStuId)
  28. },
  29. async requestData() {
  30. let res = await Api.getStudentList({
  31. teamId: this.data.teamId,
  32. pageNum: this.pageNum,
  33. pageSize: this.pageSize,
  34. name: this.data.key ? this.data.key : ''
  35. });
  36. return res;
  37. },
  38. async onSearch(e) {
  39. await this.resetData(this);
  40. },
  41. onChange(e) {
  42. let key = getEventParam(e);
  43. this.setData({key})
  44. },
  45. async callPhone(e) {
  46. try {
  47. await wx.makePhoneCall({
  48. phoneNumber: getDataSet(e, "phone")
  49. })
  50. } catch (e) {
  51. console.log(e)
  52. toast("拨打电话失败")
  53. }
  54. }
  55. })