index.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // pages/index/index.ts
  2. import { httpUtil } from "../../utils/restful";
  3. import { loginType } from '../../utils/loginType';
  4. import { ConstsData } from "../../utils/const"
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. },
  11. /**
  12. * 生命周期函数--监听页面加载
  13. */
  14. onLoad() {
  15. httpUtil.wxGet(httpUtil.interfaces.getOrganizeAll, null).then((res: any) => {
  16. ConstsData.AppData.organizeInfo = res.data
  17. }).catch((res) => {
  18. console.log(res)
  19. })
  20. },
  21. clickItem: function (event: any) {
  22. console.log(event.target.id)
  23. let type = null;
  24. switch (Number(event.target.id)) {
  25. case 0:
  26. console.log("click teacher")
  27. type = loginType.Teacher
  28. break;
  29. case 1:
  30. console.log("click installer")
  31. type = loginType.Installer
  32. break;
  33. case 2:
  34. console.log("click repairman")
  35. type = loginType.Repairman
  36. break;
  37. case 3:
  38. console.log("click it")
  39. type = loginType.IT
  40. break;
  41. }
  42. this.toLoginPage(type)
  43. },
  44. toLoginPage: function (type: any) {
  45. wx.navigateTo({
  46. url: '../login/login?loginType=' + type,
  47. })
  48. },
  49. })