login.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const utils_assets = require("../../utils/assets.js");
  4. const _sfc_main = {
  5. data() {
  6. return {
  7. assets: utils_assets.assets,
  8. isAgreed: false,
  9. activeModal: "",
  10. userAvatar: "",
  11. userName: "微信用户",
  12. currentProtocol: { title: "", content: "" },
  13. protocols: {
  14. user: { title: "用户服务协议", content: '<div style="line-height:1.8;"><h4 style="margin-bottom:10px;">服务内容</h4><p>欢迎使用ERP系统,我们将为您提供高效的下单管理服务。本协议旨在明确双方权利与义务...</p></div>' },
  15. privacy: { title: "隐私政策", content: '<div style="line-height:1.8;"><h4 style="margin-bottom:10px;">隐私保护</h4><p>我们非常重视您的个人信息保护。我们会按照法律法规要求,采取相应的安全保护措施...</p></div>' }
  16. }
  17. };
  18. },
  19. methods: {
  20. toggleAgreed() {
  21. this.isAgreed = !this.isAgreed;
  22. },
  23. startLoginFlow() {
  24. if (!this.isAgreed)
  25. this.activeModal = "confirm";
  26. else
  27. this.activeModal = "profile";
  28. },
  29. agreeAndClose() {
  30. this.isAgreed = true;
  31. this.activeModal = "";
  32. },
  33. completeLogin() {
  34. common_vendor.index.showLoading({ title: "登录中..." });
  35. common_vendor.index.setStorageSync("isLogin", true);
  36. setTimeout(() => {
  37. common_vendor.index.hideLoading();
  38. this.activeModal = "";
  39. common_vendor.index.reLaunch({ url: "/pages/order/order" });
  40. }, 1e3);
  41. },
  42. onChooseAvatar(e) {
  43. this.userAvatar = e.detail.avatarUrl;
  44. },
  45. onNicknameBlur(e) {
  46. this.userName = e.detail.value;
  47. },
  48. onNicknameChange(e) {
  49. this.userName = e.detail.value;
  50. },
  51. showProtocol(type) {
  52. this.currentProtocol = this.protocols[type];
  53. this.activeModal = "protocol";
  54. },
  55. closeAllModals() {
  56. this.activeModal = "";
  57. }
  58. }
  59. };
  60. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  61. return common_vendor.e({
  62. a: $data.assets.logo,
  63. b: $data.assets.wechat,
  64. c: common_vendor.o((...args) => $options.startLoginFlow && $options.startLoginFlow(...args), "ec"),
  65. d: $data.isAgreed,
  66. e: common_vendor.o(($event) => $options.showProtocol("user"), "40"),
  67. f: common_vendor.o(($event) => $options.showProtocol("privacy"), "32"),
  68. g: common_vendor.o((...args) => $options.toggleAgreed && $options.toggleAgreed(...args), "56"),
  69. h: $data.activeModal
  70. }, $data.activeModal ? {
  71. i: common_vendor.o((...args) => $options.closeAllModals && $options.closeAllModals(...args), "b1")
  72. } : {}, {
  73. j: $data.activeModal === "confirm"
  74. }, $data.activeModal === "confirm" ? {
  75. k: common_vendor.o(($event) => $data.activeModal = "", "2d"),
  76. l: common_vendor.o((...args) => $options.agreeAndClose && $options.agreeAndClose(...args), "60")
  77. } : {}, {
  78. m: $data.activeModal === "profile"
  79. }, $data.activeModal === "profile" ? {
  80. n: common_vendor.o(($event) => $data.activeModal = "", "c1"),
  81. o: common_vendor.o(($event) => $data.activeModal = "phone", "5f"),
  82. p: $data.userAvatar || "https://img.icons8.com/color/144/user.png",
  83. q: common_vendor.o((...args) => $options.onChooseAvatar && $options.onChooseAvatar(...args), "04"),
  84. r: $data.userName,
  85. s: common_vendor.o((...args) => $options.onNicknameBlur && $options.onNicknameBlur(...args), "b8"),
  86. t: common_vendor.o((...args) => $options.onNicknameChange && $options.onNicknameChange(...args), "e2"),
  87. v: common_vendor.o(($event) => $data.activeModal = "phone", "ee")
  88. } : {}, {
  89. w: $data.activeModal === "phone"
  90. }, $data.activeModal === "phone" ? {
  91. x: $data.assets.logo,
  92. y: common_vendor.o(($event) => $data.activeModal = "", "99"),
  93. z: common_vendor.o((...args) => $options.completeLogin && $options.completeLogin(...args), "21")
  94. } : {}, {
  95. A: $data.activeModal === "protocol"
  96. }, $data.activeModal === "protocol" ? {
  97. B: common_vendor.t($data.currentProtocol.title),
  98. C: common_vendor.o(($event) => $data.activeModal = "", "3b"),
  99. D: $data.currentProtocol.content,
  100. E: common_vendor.o(($event) => $data.activeModal = "", "06")
  101. } : {});
  102. }
  103. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-e4e4508d"]]);
  104. wx.createPage(MiniProgramPage);
  105. //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/login/login.js.map