| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- "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: "微信用户",
- redirectUrl: "",
- 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>' }
- }
- };
- },
- onLoad(options) {
- if (options.redirect) {
- this.redirectUrl = decodeURIComponent(options.redirect);
- }
- },
- 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 = "";
- const targetUrl = this.redirectUrl || "/pages/index/index";
- common_vendor.index.reLaunch({ url: targetUrl });
- }, 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)),
- d: $data.isAgreed,
- e: common_vendor.o(($event) => $options.showProtocol("user")),
- f: common_vendor.o(($event) => $options.showProtocol("privacy")),
- g: common_vendor.o((...args) => $options.toggleAgreed && $options.toggleAgreed(...args)),
- h: $data.activeModal
- }, $data.activeModal ? {
- i: common_vendor.o((...args) => $options.closeAllModals && $options.closeAllModals(...args))
- } : {}, {
- j: $data.activeModal === "confirm"
- }, $data.activeModal === "confirm" ? {
- k: common_vendor.o(($event) => $data.activeModal = ""),
- l: common_vendor.o((...args) => $options.agreeAndClose && $options.agreeAndClose(...args))
- } : {}, {
- m: $data.activeModal === "profile"
- }, $data.activeModal === "profile" ? {
- n: common_vendor.o(($event) => $data.activeModal = ""),
- o: common_vendor.o(($event) => $data.activeModal = "phone"),
- p: $data.userAvatar || "https://img.icons8.com/color/144/user.png",
- q: common_vendor.o((...args) => $options.onChooseAvatar && $options.onChooseAvatar(...args)),
- r: $data.userName,
- s: common_vendor.o((...args) => $options.onNicknameBlur && $options.onNicknameBlur(...args)),
- t: common_vendor.o((...args) => $options.onNicknameChange && $options.onNicknameChange(...args)),
- v: common_vendor.o(($event) => $data.activeModal = "phone")
- } : {}, {
- w: $data.activeModal === "phone"
- }, $data.activeModal === "phone" ? {
- x: $data.assets.logo,
- y: common_vendor.o(($event) => $data.activeModal = ""),
- z: common_vendor.o((...args) => $options.completeLogin && $options.completeLogin(...args))
- } : {}, {
- A: $data.activeModal === "protocol"
- }, $data.activeModal === "protocol" ? {
- B: common_vendor.t($data.currentProtocol.title),
- C: common_vendor.o(($event) => $data.activeModal = ""),
- D: $data.currentProtocol.content,
- E: common_vendor.o(($event) => $data.activeModal = "")
- } : {});
- }
- 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
|