login.ts 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. // index.ts
  2. import { loginType } from "../../utils/loginType"
  3. // 获取应用实例
  4. const app = getApp<IAppOption>()
  5. Page({
  6. data: {
  7. login_check_tab: 0,
  8. loginType: 0,
  9. showAccPwd: true,
  10. showUpdatePassWordLayout: false
  11. },
  12. onLoad(opention: any) {
  13. this.setData({
  14. login_check_tab: 0,
  15. loginType: opention.loginType
  16. })
  17. },
  18. // 点击短信验证码登录
  19. clickPhoneNumLogin: function (event: any) {
  20. console.log("短信验证码登录")
  21. console.log(event)
  22. this.setData({
  23. login_check_tab: 0
  24. })
  25. },
  26. // 点击账号密码登录
  27. clicAccountPasswordLogin: function (event: any) {
  28. console.log("账号密码登录")
  29. console.log(event)
  30. this.setData({
  31. login_check_tab: 1
  32. })
  33. },
  34. // 获取验证码
  35. clickGetVCode: function (event: any) {
  36. console.log("账号密码登录")
  37. },
  38. //账号密码登录——---------------------------
  39. showAccountPwd: function (event: any) {
  40. if (this.data.showAccPwd) {
  41. this.setData({
  42. showAccPwd: false
  43. })
  44. } else {
  45. this.setData({
  46. showAccPwd: true
  47. })
  48. }
  49. console.log("this.data.showAccPwd:" + this.data.showAccPwd)
  50. },
  51. //显示修改密码的框
  52. showUpdatePwdLayout: function (event: any) {
  53. if (this.data.showUpdatePassWordLayout) {
  54. this.setData({
  55. showUpdatePassWordLayout: false
  56. })
  57. } else {
  58. this.setData({
  59. showUpdatePassWordLayout: true
  60. })
  61. }
  62. },
  63. //跳转注册界面
  64. toRegisterPage: function () {
  65. wx.navigateTo({
  66. url: '../register/register',
  67. })
  68. },
  69. toTabIndex: function () {
  70. let toUrl = null
  71. switch (this.data.loginType) {
  72. case loginType.Teacher:
  73. //教师(去教师的index页面)
  74. toUrl = "../teacher/index/index"
  75. break;
  76. case loginType.Installer:
  77. //安装员(去安装员的index页面)
  78. toUrl = "../installer/index/index"
  79. break;
  80. case loginType.Repairman:
  81. //维修员(去维修员的index页面)
  82. toUrl = "../repairman/index/index"
  83. break;
  84. case loginType.IT:
  85. //IT管理员(去IT管理员的index页面)
  86. toUrl = "../itadministrator/index/index"
  87. break;
  88. }
  89. }
  90. })