"use strict";
const common_vendor = require("../../common/vendor.js");
const utils_assets = require("../../utils/assets.js");
const _sfc_main = {
  data() {
    return {
      assets: utils_assets.assets,
      isAgreed: false,
      activeModal: "",
      userAvatar: "",
      userName: "微信用户",
      currentProtocol: { title: "", content: "" },
      protocols: {
        user: { title: "用户服务协议", content: '<div style="line-height:1.8;"><h4 style="margin-bottom:10px;">服务内容</h4><p>欢迎使用ERP系统，我们将为您提供高效的下单管理服务。本协议旨在明确双方权利与义务...</p></div>' },
        privacy: { title: "隐私政策", content: '<div style="line-height:1.8;"><h4 style="margin-bottom:10px;">隐私保护</h4><p>我们非常重视您的个人信息保护。我们会按照法律法规要求，采取相应的安全保护措施...</p></div>' }
      }
    };
  },
  methods: {
    toggleAgreed() {
      this.isAgreed = !this.isAgreed;
    },
    startLoginFlow() {
      if (!this.isAgreed)
        this.activeModal = "confirm";
      else
        this.activeModal = "profile";
    },
    agreeAndClose() {
      this.isAgreed = true;
      this.activeModal = "";
    },
    completeLogin() {
      common_vendor.index.showLoading({ title: "登录中..." });
      common_vendor.index.setStorageSync("isLogin", true);
      setTimeout(() => {
        common_vendor.index.hideLoading();
        this.activeModal = "";
        common_vendor.index.reLaunch({ url: "/pages/order/order" });
      }, 1e3);
    },
    onChooseAvatar(e) {
      this.userAvatar = e.detail.avatarUrl;
    },
    onNicknameBlur(e) {
      this.userName = e.detail.value;
    },
    onNicknameChange(e) {
      this.userName = e.detail.value;
    },
    showProtocol(type) {
      this.currentProtocol = this.protocols[type];
      this.activeModal = "protocol";
    },
    closeAllModals() {
      this.activeModal = "";
    }
  }
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  return common_vendor.e({
    a: $data.assets.logo,
    b: $data.assets.wechat,
    c: common_vendor.o((...args) => $options.startLoginFlow && $options.startLoginFlow(...args), "ec"),
    d: $data.isAgreed,
    e: common_vendor.o(($event) => $options.showProtocol("user"), "40"),
    f: common_vendor.o(($event) => $options.showProtocol("privacy"), "32"),
    g: common_vendor.o((...args) => $options.toggleAgreed && $options.toggleAgreed(...args), "56"),
    h: $data.activeModal
  }, $data.activeModal ? {
    i: common_vendor.o((...args) => $options.closeAllModals && $options.closeAllModals(...args), "b1")
  } : {}, {
    j: $data.activeModal === "confirm"
  }, $data.activeModal === "confirm" ? {
    k: common_vendor.o(($event) => $data.activeModal = "", "2d"),
    l: common_vendor.o((...args) => $options.agreeAndClose && $options.agreeAndClose(...args), "60")
  } : {}, {
    m: $data.activeModal === "profile"
  }, $data.activeModal === "profile" ? {
    n: common_vendor.o(($event) => $data.activeModal = "", "c1"),
    o: common_vendor.o(($event) => $data.activeModal = "phone", "5f"),
    p: $data.userAvatar || "https://img.icons8.com/color/144/user.png",
    q: common_vendor.o((...args) => $options.onChooseAvatar && $options.onChooseAvatar(...args), "04"),
    r: $data.userName,
    s: common_vendor.o((...args) => $options.onNicknameBlur && $options.onNicknameBlur(...args), "b8"),
    t: common_vendor.o((...args) => $options.onNicknameChange && $options.onNicknameChange(...args), "e2"),
    v: common_vendor.o(($event) => $data.activeModal = "phone", "ee")
  } : {}, {
    w: $data.activeModal === "phone"
  }, $data.activeModal === "phone" ? {
    x: $data.assets.logo,
    y: common_vendor.o(($event) => $data.activeModal = "", "99"),
    z: common_vendor.o((...args) => $options.completeLogin && $options.completeLogin(...args), "21")
  } : {}, {
    A: $data.activeModal === "protocol"
  }, $data.activeModal === "protocol" ? {
    B: common_vendor.t($data.currentProtocol.title),
    C: common_vendor.o(($event) => $data.activeModal = "", "3b"),
    D: $data.currentProtocol.content,
    E: common_vendor.o(($event) => $data.activeModal = "", "06")
  } : {});
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-e4e4508d"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/login/login.js.map
