合同小程序前端代码仓库
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.

163 lines
5.5 KiB

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