loginIndex.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. require("../../api/login.js");
  4. const common_assets = require("../../common/assets.js");
  5. const _sfc_main = {
  6. data() {
  7. return {
  8. btnLoading: false,
  9. agree: false
  10. };
  11. },
  12. onLoad() {
  13. if (!this.$isLogin()) {
  14. let pages = getCurrentPages();
  15. let url = pages[pages.length - 3];
  16. if (pages.length > 2 && url && (url.route == "pages/auth/login" || url.route == "pages/auth/loginIndex" || url.route == "pages/common/launch")) {
  17. common_vendor.index.navigateBack({
  18. delta: 2
  19. });
  20. } else {
  21. if (String(navigator.userAgent.toLowerCase().match(/MicroMessenger/i)) === "micromessenger") {
  22. const pages2 = getCurrentPages();
  23. if (pages2.length > 1) {
  24. const url2 = pages2[pages2.length - 2];
  25. const options = url2.options;
  26. if (options && JSON.stringify(options) != "{}") {
  27. let allurl = "/" + url2.route + common_vendor.index.$u.queryParams(options);
  28. common_vendor.index.setStorageSync("beforLoginPage", allurl);
  29. } else {
  30. common_vendor.index.setStorageSync("beforLoginPage", "/" + url2.route);
  31. }
  32. common_vendor.index.redirectTo({
  33. url: "/pages/auth/h5WxLogin"
  34. });
  35. } else {
  36. this.submit();
  37. }
  38. } else {
  39. common_vendor.index.redirectTo({
  40. url: "/pages/auth/login"
  41. });
  42. }
  43. }
  44. }
  45. },
  46. onShow() {
  47. if (this.$isLogin()) {
  48. common_vendor.index.reLaunch({
  49. url: "../course/index",
  50. //url: '../course/video/living-app',
  51. animationType: "none",
  52. animationDuration: 2e3
  53. });
  54. }
  55. },
  56. methods: {
  57. goToWeb(index) {
  58. common_vendor.index.setStorageSync("url", index == 0 ? "https://userapp.his.cdwjyyh.com/web/userAgreement" : "https://userapp.his.cdwjyyh.com/web/privacyPolicy");
  59. common_vendor.index.navigateTo({
  60. url: "/pages/index/h5"
  61. });
  62. },
  63. // 同意
  64. handleAgree() {
  65. this.agree = !this.agree;
  66. },
  67. // login
  68. submit() {
  69. this.$showLoginPage();
  70. },
  71. handleOtherLogin() {
  72. common_vendor.index.redirectTo({
  73. url: "/pages/auth/login"
  74. });
  75. },
  76. // 关闭弹窗
  77. close(val) {
  78. this.$refs.popup.close();
  79. if (val == "agree") {
  80. this.agree = true;
  81. this.submit();
  82. }
  83. }
  84. }
  85. };
  86. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  87. return {
  88. a: $data.btnLoading,
  89. b: $data.btnLoading,
  90. c: common_vendor.o((...args) => $options.submit && $options.submit(...args)),
  91. d: $data.btnLoading,
  92. e: common_vendor.o((...args) => $options.handleOtherLogin && $options.handleOtherLogin(...args)),
  93. f: common_assets._imports_0$7,
  94. g: !$data.agree,
  95. h: common_assets._imports_1$4,
  96. i: $data.agree,
  97. j: common_vendor.o((...args) => $options.handleAgree && $options.handleAgree(...args)),
  98. k: common_vendor.o(($event) => $options.goToWeb(0)),
  99. l: common_vendor.o(($event) => $options.goToWeb(1))
  100. };
  101. }
  102. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-648b5fa7"]]);
  103. wx.createPage(MiniProgramPage);