租房小程序前端代码
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.

114 lines
3.7 KiB

6 months ago
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. const common_api = require("../../common/api.js");
  4. const common_assets = require("../../common/assets.js");
  5. const _sfc_main = {
  6. name: "Auth",
  7. data() {
  8. return {
  9. checked: [],
  10. show: false
  11. };
  12. },
  13. methods: {
  14. open() {
  15. this.$refs.popup.open();
  16. },
  17. checkboxChange(n) {
  18. console.log("change", n);
  19. },
  20. onCancel() {
  21. this.$refs.popup.close();
  22. this.checked = [];
  23. },
  24. onAgree() {
  25. this.$refs.popup.close();
  26. this.checked = ["1"];
  27. },
  28. onLogin() {
  29. let that = this;
  30. if (that.checked.length == 0) {
  31. return common_vendor.index.showToast({
  32. icon: "none",
  33. title: "请勾选隐私协议"
  34. });
  35. }
  36. common_vendor.index.showLoading({
  37. title: "登录中..."
  38. });
  39. common_vendor.index.login({
  40. success(res) {
  41. console.info(res.code);
  42. if (res.errMsg != "login:ok") {
  43. return;
  44. }
  45. common_api.wxLogin({ code: res.code }).then((response) => {
  46. common_vendor.index.hideLoading();
  47. common_vendor.index.setStorageSync("token", response.result.token);
  48. that.commit("setUserInfo", { userInfo: response.result.userInfo, token: response.result.token });
  49. }).catch(() => {
  50. });
  51. }
  52. });
  53. },
  54. handleOpenPrivacyContract() {
  55. common_vendor.wx$1.openPrivacyContract({
  56. success: () => {
  57. },
  58. // 打开成功
  59. fail: () => {
  60. },
  61. // 打开失败
  62. complete: () => {
  63. }
  64. });
  65. }
  66. }
  67. };
  68. if (!Array) {
  69. const _easycom_uv_checkbox2 = common_vendor.resolveComponent("uv-checkbox");
  70. const _easycom_uv_checkbox_group2 = common_vendor.resolveComponent("uv-checkbox-group");
  71. const _easycom_uv_popup2 = common_vendor.resolveComponent("uv-popup");
  72. (_easycom_uv_checkbox2 + _easycom_uv_checkbox_group2 + _easycom_uv_popup2)();
  73. }
  74. const _easycom_uv_checkbox = () => "../../uni_modules/uv-checkbox/components/uv-checkbox/uv-checkbox.js";
  75. const _easycom_uv_checkbox_group = () => "../../uni_modules/uv-checkbox/components/uv-checkbox-group/uv-checkbox-group.js";
  76. const _easycom_uv_popup = () => "../../uni_modules/uv-popup/components/uv-popup/uv-popup.js";
  77. if (!Math) {
  78. (_easycom_uv_checkbox + _easycom_uv_checkbox_group + _easycom_uv_popup)();
  79. }
  80. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  81. return {
  82. a: common_assets._imports_0$2,
  83. b: common_assets._imports_1$1,
  84. c: common_vendor.o(($event) => $options.onLogin()),
  85. d: common_vendor.p({
  86. name: "1",
  87. activeColor: "#07C160",
  88. ["label-size"]: "12",
  89. shape: "circle",
  90. label: "阅读并同意"
  91. }),
  92. e: common_vendor.o(($event) => $options.open()),
  93. f: common_vendor.o(($event) => $options.open()),
  94. g: common_vendor.o($options.checkboxChange),
  95. h: common_vendor.o(($event) => $data.checked = $event),
  96. i: common_vendor.p({
  97. modelValue: $data.checked
  98. }),
  99. j: common_assets._imports_1$2,
  100. k: common_vendor.o(($event) => $options.handleOpenPrivacyContract()),
  101. l: common_vendor.o(($event) => $options.handleOpenPrivacyContract()),
  102. m: common_vendor.o((...args) => $options.onCancel && $options.onCancel(...args)),
  103. n: common_vendor.o((...args) => $options.onAgree && $options.onAgree(...args)),
  104. o: common_vendor.sr("popup", "d2d534e8-2"),
  105. p: common_vendor.p({
  106. round: 20,
  107. mode: "center",
  108. ["bg-color"]: "transparent",
  109. ["close-on-click-overlay"]: false
  110. })
  111. };
  112. }
  113. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
  114. wx.createPage(MiniProgramPage);