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

131 lines
4.2 KiB

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