472 lines
18 KiB
JavaScript
472 lines
18 KiB
JavaScript
import { defineComponent, ref, reactive, mergeProps, unref, withCtx, createVNode, createBlock, openBlock, createTextVNode, toDisplayString, useSSRContext } from 'vue';
|
|
import { ssrRenderComponent, ssrRenderAttrs, ssrInterpolate } from 'vue/server-renderer';
|
|
import { u as useRouter, a as useConfigStore, b as useUserStore, A as APP_Milady_Date, h as generateOtp, e as api$1, v as verifyOtp, d as setToken, s as supabase, j as setPassword, k as setBirthday, m as setNames } from './server.mjs';
|
|
import OtpInput from 'vue3-otp-input';
|
|
import { _ as _sfc_main$2 } from './BasicInput-BEP6ZgUl.mjs';
|
|
import { _ as _sfc_main$1$1, a as _sfc_main$3 } from './BaseDatePicker-CBTFfZPt.mjs';
|
|
import { _ as _sfc_main$4 } from './BasicButton-B-4QDu9v.mjs';
|
|
import { B as BasicIconOld } from './BasicIconOld-I4c2ShMu.mjs';
|
|
import { _ as __nuxt_component_1 } from './FormItem-DY7uTw8_.mjs';
|
|
import '../_/nitro.mjs';
|
|
import 'node:http';
|
|
import 'node:https';
|
|
import 'node:events';
|
|
import 'node:buffer';
|
|
import 'node:fs';
|
|
import 'node:url';
|
|
import 'consola';
|
|
import 'ipx';
|
|
import 'node:path';
|
|
import 'node:crypto';
|
|
import 'pinia';
|
|
import 'vue-router';
|
|
import '@supabase/supabase-js';
|
|
import '@babel/runtime/helpers/esm/extends';
|
|
import '@babel/runtime/helpers/esm/objectSpread2';
|
|
import '@ant-design/colors';
|
|
import '@ctrl/tinycolor';
|
|
import 'stylis';
|
|
import 'vue-types';
|
|
import 'lodash-es';
|
|
import 'axios';
|
|
import '@ant-design/icons-vue';
|
|
import 'vue3-lazyload';
|
|
import '../routes/renderer.mjs';
|
|
import 'vue-bundle-renderer/runtime';
|
|
import 'unhead/server';
|
|
import 'devalue';
|
|
import 'unhead/utils';
|
|
import 'unhead/plugins';
|
|
import './usePrice-B-5-jXKQ.mjs';
|
|
import './index--Q-kfs0Q.mjs';
|
|
import './FormItemContext-CDDW52IT.mjs';
|
|
import './statusUtils-C3ZNzkeD.mjs';
|
|
import './BaseInput-_gwhwanN.mjs';
|
|
import 'resize-observer-polyfill';
|
|
import './index-C1mihc8c.mjs';
|
|
import '../_/SearchOutlined.mjs';
|
|
import 'lodash-es/isPlainObject.js';
|
|
import './raf-ruCY1ktO.mjs';
|
|
import 'moment-jalaali';
|
|
import 'dayjalali';
|
|
import './index-BLBX3jXD.mjs';
|
|
import './index-Dxyzjwb5.mjs';
|
|
import 'dom-align';
|
|
import './useMergedState-BZEfJ8Fl.mjs';
|
|
import './move-BSi4LOZX.mjs';
|
|
import './shallowequal-DbdDzF9p.mjs';
|
|
import './slide-Bfj4jnqX.mjs';
|
|
import './_plugin-vue_export-helper-1tPrXgE0.mjs';
|
|
import './index-DqCYDGJX.mjs';
|
|
import 'throttle-debounce';
|
|
import 'lodash-es/cloneDeep.js';
|
|
import 'async-validator';
|
|
import 'lodash-es/find.js';
|
|
import './collapseMotion-cQ2SGjCA.mjs';
|
|
|
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
__name: "index",
|
|
__ssrInlineRender: true,
|
|
setup(__props) {
|
|
const router = useRouter();
|
|
const step = ref("mobile");
|
|
const config = useConfigStore();
|
|
const isBack = ref(false);
|
|
const loading = ref(false);
|
|
const user = useUserStore();
|
|
const form = reactive({
|
|
mobile: void 0,
|
|
otp: void 0,
|
|
password: void 0,
|
|
first_name: void 0,
|
|
last_name: void 0,
|
|
birthday: void 0,
|
|
agree: void 0
|
|
});
|
|
function handleOnChange(value) {
|
|
}
|
|
async function handleOnComplete(value) {
|
|
form.otp = value;
|
|
}
|
|
const goNext = async () => {
|
|
var _a;
|
|
try {
|
|
loading.value = true;
|
|
if (step.value === "mobile") {
|
|
const res = await generateOtp(form.mobile, "signup");
|
|
if ((_a = res == null ? void 0 : res.user) == null ? void 0 : _a.id) {
|
|
api$1.error(config.useString("userHaveAccount"));
|
|
router.push({
|
|
name: "auth-login"
|
|
});
|
|
return;
|
|
}
|
|
isBack.value = false;
|
|
step.value = "otp";
|
|
} else if (step.value === "otp") {
|
|
const res = await verifyOtp(form.mobile, form.otp);
|
|
console.log("res ===>", res);
|
|
setToken(res.session.access_token);
|
|
await supabase.auth.setSession(res.session);
|
|
user.getUserInfo();
|
|
isBack.value = false;
|
|
step.value = "password";
|
|
} else if (step.value === "password") {
|
|
if (form.password.length < 6) {
|
|
api$1.error(config.useString("minPassIs6"));
|
|
return;
|
|
}
|
|
const res = await setPassword(form.password);
|
|
isBack.value = false;
|
|
step.value = "birthday";
|
|
} else if (step.value === "birthday") {
|
|
const res = await setBirthday(form.birthday);
|
|
isBack.value = false;
|
|
step.value = "name";
|
|
} else if (step.value === "name") {
|
|
const res = await setNames(form.first_name, form.last_name);
|
|
isBack.value = false;
|
|
step.value = "agree";
|
|
} else if (step.value === "agree") {
|
|
await router.push({
|
|
name: "home"
|
|
});
|
|
}
|
|
} catch (e) {
|
|
console.log("e ===>", e);
|
|
} finally {
|
|
loading.value = false;
|
|
}
|
|
};
|
|
return (_ctx, _push, _parent, _attrs) => {
|
|
const _component_a_form_item = __nuxt_component_1;
|
|
_push(`<div${ssrRenderAttrs(mergeProps({
|
|
class: "p-4 bgRegister w-full h-screen"
|
|
}, _attrs))}><div class="font-semibold text-2xl"><div class="absolute bottom-0 right-0 left-0 w-full text-center text-sm">`);
|
|
if (step.value === "mobile") {
|
|
_push(`<div class="pb-5 text-primary cursor-pointer">${ssrInterpolate(unref(config).useString("iHaveAccount"))}</div>`);
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
_push(`</div>`);
|
|
if (step.value === "mobile") {
|
|
_push(`<div class="mt-5">${ssrInterpolate(unref(config).useString("registerMobile"))}</div>`);
|
|
} else if (step.value === "otp") {
|
|
_push(`<div><div class="flex items-center justify-left">`);
|
|
_push(ssrRenderComponent(BasicIconOld, {
|
|
icon: "vuesax-linear:arrow-left-1",
|
|
class: "mb-5 font-semibold cursor-pointer",
|
|
size: "26",
|
|
onClick: ($event) => {
|
|
isBack.value = true;
|
|
step.value = "mobile";
|
|
}
|
|
}, null, _parent));
|
|
_push(`</div> ${ssrInterpolate(unref(config).useString("registerOtp"))}</div>`);
|
|
} else if (step.value === "password") {
|
|
_push(`<div><div class="flex items-center justify-left">`);
|
|
_push(ssrRenderComponent(BasicIconOld, {
|
|
icon: "vuesax-linear:arrow-left-1",
|
|
class: "mb-5 font-semibold cursor-pointer",
|
|
size: "26",
|
|
onClick: ($event) => {
|
|
isBack.value = true;
|
|
step.value = "mobile";
|
|
}
|
|
}, null, _parent));
|
|
_push(`</div> ${ssrInterpolate(unref(config).useString("registerPassword"))}</div>`);
|
|
} else if (step.value === "birthday") {
|
|
_push(`<div><div class="flex items-center justify-left">`);
|
|
_push(ssrRenderComponent(BasicIconOld, {
|
|
icon: "vuesax-linear:arrow-left-1",
|
|
class: "mb-5 font-semibold cursor-pointer",
|
|
size: "26",
|
|
onClick: ($event) => {
|
|
isBack.value = true;
|
|
step.value = "password";
|
|
}
|
|
}, null, _parent));
|
|
_push(`</div> ${ssrInterpolate(unref(config).useString("registerBirthday"))}</div>`);
|
|
} else if (step.value === "name") {
|
|
_push(`<div><div class="flex items-center justify-left">`);
|
|
_push(ssrRenderComponent(BasicIconOld, {
|
|
icon: "vuesax-linear:arrow-left-1",
|
|
class: "mb-5 font-semibold cursor-pointer",
|
|
size: "26",
|
|
onClick: ($event) => {
|
|
isBack.value = true;
|
|
step.value = "birthday";
|
|
}
|
|
}, null, _parent));
|
|
_push(`</div> ${ssrInterpolate(unref(config).useString("registerName"))}</div>`);
|
|
} else if (step.value === "agree") {
|
|
_push(`<div><div class="flex items-center justify-left">`);
|
|
_push(ssrRenderComponent(BasicIconOld, {
|
|
icon: "vuesax-linear:arrow-left-1",
|
|
class: "mb-5 font-semibold cursor-pointer",
|
|
size: "26",
|
|
onClick: ($event) => {
|
|
isBack.value = true;
|
|
step.value = "name";
|
|
}
|
|
}, null, _parent));
|
|
_push(`</div> ${ssrInterpolate(unref(config).useString("registerAgree"))}</div>`);
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
_push(`</div><div class="mt-2">`);
|
|
if (step.value === "mobile") {
|
|
_push(`<div>${ssrInterpolate(unref(config).useString("registerMobileDescription1"))}</div>`);
|
|
} else if (step.value === "otp") {
|
|
_push(`<div>${ssrInterpolate(unref(config).useString("registerOtpDescription", form.mobile))}</div>`);
|
|
} else if (step.value === "password") {
|
|
_push(`<div>${ssrInterpolate(unref(config).useString("registerPasswordDescription"))}</div>`);
|
|
} else if (step.value === "birthday") {
|
|
_push(`<div>${ssrInterpolate(unref(config).useString("registerBirthdayDescription"))}</div>`);
|
|
} else if (step.value === "name") {
|
|
_push(`<div>${ssrInterpolate(unref(config).useString("registerNameDescription"))}</div>`);
|
|
} else if (step.value === "agree") {
|
|
_push(`<div class="text-justify">${ssrInterpolate(unref(config).useString("registerAgreeDescription"))}</div>`);
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
_push(`</div><div class="mt-2">`);
|
|
if (step.value === "mobile") {
|
|
_push(`<div>`);
|
|
_push(ssrRenderComponent(_component_a_form_item, {
|
|
name: "mobile"
|
|
}, {
|
|
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
if (_push2) {
|
|
_push2(ssrRenderComponent(_sfc_main$2, {
|
|
value: form.mobile,
|
|
"onUpdate:value": ($event) => form.mobile = $event,
|
|
size: "large",
|
|
"place-holder": unref(config).useString("phone")
|
|
}, null, _parent2, _scopeId));
|
|
} else {
|
|
return [createVNode(_sfc_main$2, {
|
|
value: form.mobile,
|
|
"onUpdate:value": ($event) => form.mobile = $event,
|
|
size: "large",
|
|
"place-holder": unref(config).useString("phone")
|
|
}, null, 8, ["value", "onUpdate:value", "place-holder"])];
|
|
}
|
|
}),
|
|
_: 1
|
|
}, _parent));
|
|
_push(`<div>${ssrInterpolate(unref(config).useString("registerMobileDescription2"))}</div></div>`);
|
|
} else if (step.value === "otp") {
|
|
_push(`<div>`);
|
|
_push(ssrRenderComponent(_component_a_form_item, {
|
|
name: "otp"
|
|
}, {
|
|
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
if (_push2) {
|
|
_push2(ssrRenderComponent(unref(OtpInput), {
|
|
style: {
|
|
"direction": "ltr"
|
|
},
|
|
class: "mt-10 justify-center",
|
|
ref: "otpInput",
|
|
autocomplete: "one-time-code",
|
|
"input-classes": "otp-input",
|
|
separator: "",
|
|
"num-inputs": 5,
|
|
"should-auto-focus": true,
|
|
"is-input-num": true,
|
|
onOnChange: handleOnChange,
|
|
onOnComplete: handleOnComplete
|
|
}, null, _parent2, _scopeId));
|
|
} else {
|
|
return [createVNode(unref(OtpInput), {
|
|
style: {
|
|
"direction": "ltr"
|
|
},
|
|
class: "mt-10 justify-center",
|
|
ref: "otpInput",
|
|
autocomplete: "one-time-code",
|
|
"input-classes": "otp-input",
|
|
separator: "",
|
|
"num-inputs": 5,
|
|
"should-auto-focus": true,
|
|
"is-input-num": true,
|
|
onOnChange: handleOnChange,
|
|
onOnComplete: handleOnComplete
|
|
}, null, 512)];
|
|
}
|
|
}),
|
|
_: 1
|
|
}, _parent));
|
|
_push(`</div>`);
|
|
} else if (step.value === "password") {
|
|
_push(`<div>`);
|
|
_push(ssrRenderComponent(_component_a_form_item, {
|
|
name: "password"
|
|
}, {
|
|
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
if (_push2) {
|
|
_push2(ssrRenderComponent(_sfc_main$2, {
|
|
value: form.password,
|
|
"onUpdate:value": ($event) => form.password = $event,
|
|
"is-password": "",
|
|
size: "large",
|
|
"place-holder": unref(config).useString("password")
|
|
}, null, _parent2, _scopeId));
|
|
} else {
|
|
return [createVNode(_sfc_main$2, {
|
|
value: form.password,
|
|
"onUpdate:value": ($event) => form.password = $event,
|
|
"is-password": "",
|
|
size: "large",
|
|
"place-holder": unref(config).useString("password")
|
|
}, null, 8, ["value", "onUpdate:value", "place-holder"])];
|
|
}
|
|
}),
|
|
_: 1
|
|
}, _parent));
|
|
_push(`</div>`);
|
|
} else if (step.value === "birthday") {
|
|
_push(`<div>`);
|
|
_push(ssrRenderComponent(_component_a_form_item, {
|
|
name: "birthday"
|
|
}, {
|
|
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
if (_push2) {
|
|
if (unref(config).lang === "en" && ("APP_Milady_Date" in _ctx ? _ctx.APP_Milady_Date : unref(APP_Milady_Date))) {
|
|
_push2(ssrRenderComponent(unref(_sfc_main$1$1), {
|
|
value: form.birthday,
|
|
"onUpdate:value": ($event) => form.birthday = $event,
|
|
inputReadOnly: "",
|
|
placeHolder: unref(config).useString("birthdate"),
|
|
size: "large"
|
|
}, null, _parent2, _scopeId));
|
|
} else {
|
|
_push2(ssrRenderComponent(unref(_sfc_main$3), {
|
|
value: form.birthday,
|
|
"onUpdate:value": ($event) => form.birthday = $event,
|
|
inputReadOnly: "",
|
|
placeHolder: unref(config).useString("birthdate"),
|
|
size: "large"
|
|
}, null, _parent2, _scopeId));
|
|
}
|
|
} else {
|
|
return [unref(config).lang === "en" && ("APP_Milady_Date" in _ctx ? _ctx.APP_Milady_Date : unref(APP_Milady_Date)) ? (openBlock(), createBlock(unref(_sfc_main$1$1), {
|
|
key: 0,
|
|
value: form.birthday,
|
|
"onUpdate:value": ($event) => form.birthday = $event,
|
|
inputReadOnly: "",
|
|
placeHolder: unref(config).useString("birthdate"),
|
|
size: "large"
|
|
}, null, 8, ["value", "onUpdate:value", "placeHolder"])) : (openBlock(), createBlock(unref(_sfc_main$3), {
|
|
key: 1,
|
|
value: form.birthday,
|
|
"onUpdate:value": ($event) => form.birthday = $event,
|
|
inputReadOnly: "",
|
|
placeHolder: unref(config).useString("birthdate"),
|
|
size: "large"
|
|
}, null, 8, ["value", "onUpdate:value", "placeHolder"]))];
|
|
}
|
|
}),
|
|
_: 1
|
|
}, _parent));
|
|
_push(`</div>`);
|
|
} else if (step.value === "name") {
|
|
_push(`<div>`);
|
|
_push(ssrRenderComponent(_component_a_form_item, {
|
|
name: "first_name"
|
|
}, {
|
|
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
if (_push2) {
|
|
_push2(ssrRenderComponent(_sfc_main$2, {
|
|
placeHolder: unref(config).useString("firstNamePlaceholder"),
|
|
value: form.first_name,
|
|
"onUpdate:value": ($event) => form.first_name = $event,
|
|
size: "large"
|
|
}, null, _parent2, _scopeId));
|
|
} else {
|
|
return [createVNode(_sfc_main$2, {
|
|
placeHolder: unref(config).useString("firstNamePlaceholder"),
|
|
value: form.first_name,
|
|
"onUpdate:value": ($event) => form.first_name = $event,
|
|
size: "large"
|
|
}, null, 8, ["placeHolder", "value", "onUpdate:value"])];
|
|
}
|
|
}),
|
|
_: 1
|
|
}, _parent));
|
|
_push(ssrRenderComponent(_component_a_form_item, {
|
|
name: "last_name"
|
|
}, {
|
|
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
if (_push2) {
|
|
_push2(ssrRenderComponent(_sfc_main$2, {
|
|
placeHolder: unref(config).useString("lastNamePlaceholder"),
|
|
value: form.last_name,
|
|
"onUpdate:value": ($event) => form.last_name = $event,
|
|
size: "large"
|
|
}, null, _parent2, _scopeId));
|
|
} else {
|
|
return [createVNode(_sfc_main$2, {
|
|
placeHolder: unref(config).useString("lastNamePlaceholder"),
|
|
value: form.last_name,
|
|
"onUpdate:value": ($event) => form.last_name = $event,
|
|
size: "large"
|
|
}, null, 8, ["placeHolder", "value", "onUpdate:value"])];
|
|
}
|
|
}),
|
|
_: 1
|
|
}, _parent));
|
|
_push(`</div>`);
|
|
} else if (step.value === "agree") {
|
|
_push(`<div></div>`);
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
_push(ssrRenderComponent(_sfc_main$4, {
|
|
block: "",
|
|
class: "mt-5",
|
|
type: "primary",
|
|
onClick: goNext,
|
|
loading: loading.value,
|
|
curve: "",
|
|
size: "large"
|
|
}, {
|
|
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
if (_push2) {
|
|
_push2(`${ssrInterpolate(unref(config).useString("next"))}`);
|
|
} else {
|
|
return [createTextVNode(toDisplayString(unref(config).useString("next")), 1)];
|
|
}
|
|
}),
|
|
_: 1
|
|
}, _parent));
|
|
_push(`</div><div></div></div>`);
|
|
};
|
|
}
|
|
});
|
|
const _sfc_setup$1 = _sfc_main$1.setup;
|
|
_sfc_main$1.setup = (props, ctx) => {
|
|
const ssrContext = useSSRContext();
|
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/register/index.vue");
|
|
return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
|
|
};
|
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
__name: "index",
|
|
__ssrInlineRender: true,
|
|
setup(__props) {
|
|
return (_ctx, _push, _parent, _attrs) => {
|
|
_push(ssrRenderComponent(_sfc_main$1, _attrs, null, _parent));
|
|
};
|
|
}
|
|
});
|
|
const _sfc_setup = _sfc_main.setup;
|
|
_sfc_main.setup = (props, ctx) => {
|
|
const ssrContext = useSSRContext();
|
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("pages/auth/register/index.vue");
|
|
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
|
|
};
|
|
|
|
export { _sfc_main as default };
|
|
//# sourceMappingURL=index-OXeb4LNR.mjs.map
|