login.ts 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. console.log("opention.loginType:", opention.loginType)
  14. this.setData({
  15. login_check_tab: 0,
  16. loginType: opention.loginType
  17. })
  18. },
  19. // 点击短信验证码登录
  20. clickPhoneNumLogin: function (event: any) {
  21. console.log("短信验证码登录")
  22. console.log(event)
  23. this.setData({
  24. login_check_tab: 0
  25. })
  26. },
  27. // 点击账号密码登录
  28. clicAccountPasswordLogin: function (event: any) {
  29. console.log("账号密码登录")
  30. console.log(event)
  31. this.setData({
  32. login_check_tab: 1
  33. })
  34. },
  35. // 获取验证码
  36. clickGetVCode: function (event: any) {
  37. console.log("账号密码登录")
  38. },
  39. //账号密码登录——---------------------------
  40. showAccountPwd: function (event: any) {
  41. if (this.data.showAccPwd) {
  42. this.setData({
  43. showAccPwd: false
  44. })
  45. } else {
  46. this.setData({
  47. showAccPwd: true
  48. })
  49. }
  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 = '';
  71. switch (Number(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. wx.navigateTo({
  90. url: toUrl,
  91. })
  92. }
  93. })