index.ts 1.1 KB

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