合同小程序前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

162 lines
5.4 KiB

10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const api = require("../../api.js");
  4. const common_assets = require("../../common/assets.js");
  5. const _sfc_main = common_vendor.defineComponent({
  6. data() {
  7. return {
  8. username: "",
  9. password: "",
  10. isModalVisible: false,
  11. modalTitle: "",
  12. modalContent: "",
  13. popupNoCancelShow: false,
  14. popupNoCancelShow1: false,
  15. checked: false,
  16. agreement: "",
  17. privacy: ""
  18. };
  19. },
  20. mounted() {
  21. api.getInfoList().then((res = null) => {
  22. getApp().aboutUs = res.result[0].aboutUs;
  23. this.privacy = res.result[0].privacy;
  24. this.agreement = res.result[0].agreement;
  25. });
  26. },
  27. methods: {
  28. // 处理登录逻辑
  29. handleLogin() {
  30. if (!this.username || !this.password) {
  31. common_vendor.index.showToast({ title: "请输入账号和密码", icon: "none" });
  32. return null;
  33. } else {
  34. if (this.checked) {
  35. let usr = new UTSJSONObject({
  36. "username": this.username,
  37. "password": this.password
  38. });
  39. api.login(usr).then((res = null) => {
  40. common_vendor.index.setStorageSync("token", res.result.token);
  41. getApp().usrInfo = res.result.userInfo;
  42. if (res.success) {
  43. common_vendor.index.showToast({
  44. title: "登录成功",
  45. icon: "success",
  46. success: (res2) => {
  47. common_vendor.index.switchTab({ url: "/pages/home/home" });
  48. }
  49. });
  50. }
  51. }).catch((err = null) => {
  52. common_vendor.index.showToast({ title: "账号或密码错误,请重新输入!", icon: "none" });
  53. });
  54. } else {
  55. common_vendor.index.showToast({ title: "请勾选服务协议", icon: "none" });
  56. }
  57. }
  58. },
  59. // 显示弹窗
  60. showModal() {
  61. this.popupNoCancelShow = true;
  62. },
  63. showModals() {
  64. this.popupNoCancelShow1 = true;
  65. },
  66. // 关闭弹窗
  67. closeModal() {
  68. this.popupNoCancelShow = false;
  69. },
  70. closeModals() {
  71. this.popupNoCancelShow1 = false;
  72. },
  73. change(e = null) {
  74. },
  75. changeCK() {
  76. if (this.checked) {
  77. this.checked = false;
  78. } else {
  79. this.checked = true;
  80. }
  81. },
  82. // 处理选中事件
  83. getConfirm() {
  84. if (this.checked) {
  85. this.checked = this.checked;
  86. } else {
  87. this.checked = true;
  88. }
  89. this.popupNoCancelShow = false;
  90. },
  91. getConfirms() {
  92. if (this.checked) {
  93. this.checked = this.checked;
  94. } else {
  95. this.checked = true;
  96. }
  97. this.popupNoCancelShow1 = false;
  98. }
  99. }
  100. });
  101. if (!Array) {
  102. const _easycom_uni_easyinput2 = common_vendor.resolveComponent("uni-easyinput");
  103. const _easycom_mosowe_confirm_popup2 = common_vendor.resolveComponent("mosowe-confirm-popup");
  104. (_easycom_uni_easyinput2 + _easycom_mosowe_confirm_popup2)();
  105. }
  106. const _easycom_uni_easyinput = () => "../../uni_modules/uni-easyinput/components/uni-easyinput/uni-easyinput.js";
  107. const _easycom_mosowe_confirm_popup = () => "../../uni_modules/mosowe-confirm-popup/components/mosowe-confirm-popup/mosowe-confirm-popup.js";
  108. if (!Math) {
  109. (_easycom_uni_easyinput + _easycom_mosowe_confirm_popup)();
  110. }
  111. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  112. return {
  113. a: common_assets._imports_0,
  114. b: common_vendor.o(($event) => $data.username = $event),
  115. c: common_vendor.p({
  116. prefixIcon: "person",
  117. placeholder: "请输入您的账号",
  118. inputBorder: false,
  119. clearable: false,
  120. modelValue: $data.username
  121. }),
  122. d: common_vendor.o(($event) => $data.password = $event),
  123. e: common_vendor.p({
  124. prefixIcon: "locked",
  125. type: "password",
  126. placeholder: "请输入您的密码",
  127. inputBorder: false,
  128. passwordIcon: false,
  129. clearable: false,
  130. modelValue: $data.password
  131. }),
  132. f: $data.checked,
  133. g: common_vendor.o((...args) => $options.changeCK && $options.changeCK(...args)),
  134. h: common_vendor.o((...args) => $options.showModals && $options.showModals(...args)),
  135. i: common_vendor.o((...args) => $options.showModal && $options.showModal(...args)),
  136. j: common_vendor.o((...args) => $options.handleLogin && $options.handleLogin(...args)),
  137. k: $data.privacy,
  138. l: common_vendor.o((...args) => $options.closeModal && $options.closeModal(...args)),
  139. m: common_vendor.o((...args) => $options.getConfirm && $options.getConfirm(...args)),
  140. n: common_vendor.o(($event) => $data.popupNoCancelShow = $event),
  141. o: common_vendor.p({
  142. title: "服务协议和隐私政策",
  143. confirmText: true,
  144. cancelText: true,
  145. modelValue: $data.popupNoCancelShow
  146. }),
  147. p: $data.agreement,
  148. q: common_vendor.o((...args) => $options.closeModals && $options.closeModals(...args)),
  149. r: common_vendor.o((...args) => $options.getConfirms && $options.getConfirms(...args)),
  150. s: common_vendor.o(($event) => $data.popupNoCancelShow1 = $event),
  151. t: common_vendor.p({
  152. title: "用户协议",
  153. confirmText: true,
  154. cancelText: true,
  155. modelValue: $data.popupNoCancelShow1
  156. }),
  157. v: common_vendor.sei(_ctx.virtualHostId, "view")
  158. };
  159. }
  160. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
  161. wx.createPage(MiniProgramPage);
  162. //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/index/login.js.map