findpass.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. require("../../api/login.js");
  4. const _sfc_main = {
  5. data() {
  6. return {
  7. userName: "",
  8. password: "",
  9. password1: "",
  10. registrationID: "",
  11. yzcode: ""
  12. };
  13. },
  14. onLoad(option) {
  15. let that = this;
  16. common_vendor.index.$on("getRegistrationID", function(data) {
  17. that.registrationID = data;
  18. });
  19. this.$getRegistrationID();
  20. },
  21. onShow() {
  22. },
  23. onUnload() {
  24. common_vendor.index.$off("getRegistrationID");
  25. },
  26. mounted() {
  27. },
  28. methods: {
  29. login() {
  30. if (this.$isEmpty(this.userName)) {
  31. common_vendor.index.showToast({
  32. title: "请输入帐号",
  33. icon: "none"
  34. });
  35. return;
  36. }
  37. if (this.$isEmpty(this.password)) {
  38. common_vendor.index.showToast({
  39. title: "请输入密码",
  40. icon: "none"
  41. });
  42. return;
  43. }
  44. var data = {
  45. userName: this.userName,
  46. password: this.password,
  47. jpushId: this.registrationID || common_vendor.index.getStorageSync("registrationID")
  48. };
  49. common_vendor.index.showLoading({
  50. title: "处理中..."
  51. });
  52. login(data).then(
  53. (res) => {
  54. common_vendor.index.hideLoading();
  55. if (res.code == 200) {
  56. common_vendor.index.setStorageSync("AppToken", res.data.token);
  57. this.$Router.pushTab({ name: "home" });
  58. } else {
  59. common_vendor.index.showToast({ title: res.msg, icon: "none" });
  60. }
  61. },
  62. (rej) => {
  63. }
  64. );
  65. },
  66. goToRegister() {
  67. this.$navTo("./register");
  68. },
  69. goToFindPass() {
  70. this.$navTo("./findPass");
  71. },
  72. getRegistrationID() {
  73. }
  74. }
  75. };
  76. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  77. return {
  78. a: $data.userName,
  79. b: common_vendor.o(($event) => $data.userName = $event.detail.value),
  80. c: $data.password,
  81. d: common_vendor.o(($event) => $data.password = $event.detail.value),
  82. e: $data.yzcode,
  83. f: common_vendor.o(($event) => $data.yzcode = $event.detail.value),
  84. g: common_vendor.o((...args) => $options.login && $options.login(...args))
  85. };
  86. }
  87. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
  88. wx.createPage(MiniProgramPage);