index.ts 1.3 KB

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