|
|
- "use strict";
- const common_vendor = require("../../common/vendor.js");
- const common_api = require("../../common/api.js");
- const common_assets = require("../../common/assets.js");
- const _sfc_main = {
- name: "Auth",
- data() {
- return {
- checked: [],
- show: false
- };
- },
- mounted() {
- common_api.getConfig({}).then((response) => {
- console.info(response);
- }).catch((error) => {
- });
- },
- methods: {
- open() {
- this.$refs.popup.open();
- },
- checkboxChange(n) {
- console.log("change", n);
- },
- onCancel() {
- this.$refs.popup.close();
- this.checked = [];
- },
- onAgree() {
- this.$refs.popup.close();
- this.checked = ["1"];
- },
- onLogin(event) {
- console.info(event);
- let that = this;
- if (that.checked.length == 0) {
- return common_vendor.index.showToast({
- icon: "none",
- title: "请勾选隐私协议"
- });
- }
- common_vendor.index.showLoading({
- title: "登录中..."
- });
- common_vendor.index.login({
- success(res) {
- console.info(res.code);
- if (res.errMsg != "login:ok") {
- return;
- }
- let params = {
- code: res.code,
- encryptedData: event.detail.encryptedData,
- headimgurl: event.detail.userInfo.avatarUrl,
- iv: event.detail.iv,
- nickName: event.detail.userInfo.nickName,
- session_key: "",
- shareId: "",
- vid: ""
- };
- common_api.appletLogin(params).then((response) => {
- common_vendor.index.hideLoading();
- common_vendor.index.setStorageSync("token", response.result.token);
- that.commit("setUserInfo", { userInfo: response.result.userInfo, token: response.result.token });
- }).catch(() => {
- });
- }
- });
- },
- handleOpenPrivacyContract() {
- common_vendor.wx$1.openPrivacyContract({
- success: () => {
- },
- // 打开成功
- fail: () => {
- },
- // 打开失败
- complete: () => {
- }
- });
- }
- }
- };
- if (!Array) {
- const _easycom_uv_checkbox2 = common_vendor.resolveComponent("uv-checkbox");
- const _easycom_uv_checkbox_group2 = common_vendor.resolveComponent("uv-checkbox-group");
- const _easycom_uv_popup2 = common_vendor.resolveComponent("uv-popup");
- (_easycom_uv_checkbox2 + _easycom_uv_checkbox_group2 + _easycom_uv_popup2)();
- }
- const _easycom_uv_checkbox = () => "../../uni_modules/uv-checkbox/components/uv-checkbox/uv-checkbox.js";
- const _easycom_uv_checkbox_group = () => "../../uni_modules/uv-checkbox/components/uv-checkbox-group/uv-checkbox-group.js";
- const _easycom_uv_popup = () => "../../uni_modules/uv-popup/components/uv-popup/uv-popup.js";
- if (!Math) {
- (_easycom_uv_checkbox + _easycom_uv_checkbox_group + _easycom_uv_popup)();
- }
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
- return {
- a: common_assets._imports_0$2,
- b: common_assets._imports_1$1,
- c: common_vendor.o((...args) => $options.onLogin && $options.onLogin(...args)),
- d: common_vendor.p({
- name: "1",
- activeColor: "#07C160",
- ["label-size"]: "12",
- shape: "circle",
- label: "阅读并同意"
- }),
- e: common_vendor.o(($event) => $options.open()),
- f: common_vendor.o(($event) => $options.open()),
- g: common_vendor.o($options.checkboxChange),
- h: common_vendor.o(($event) => $data.checked = $event),
- i: common_vendor.p({
- modelValue: $data.checked
- }),
- j: common_assets._imports_1$2,
- k: common_vendor.o(($event) => $options.handleOpenPrivacyContract()),
- l: common_vendor.o(($event) => $options.handleOpenPrivacyContract()),
- m: common_vendor.o((...args) => $options.onCancel && $options.onCancel(...args)),
- n: common_vendor.o((...args) => $options.onAgree && $options.onAgree(...args)),
- o: common_vendor.sr("popup", "d2d534e8-2"),
- p: common_vendor.p({
- round: 20,
- mode: "center",
- ["bg-color"]: "transparent",
- ["close-on-click-overlay"]: false
- })
- };
- }
- const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
- wx.createPage(MiniProgramPage);
|