466 lines
18 KiB
JavaScript
466 lines
18 KiB
JavaScript
import { defineComponent, unref, withCtx, createVNode, createBlock, openBlock, mergeProps, ref, computed, withAsyncContext, watch, useSSRContext } from 'vue';
|
|
import { ssrRenderComponent, ssrRenderAttrs, ssrRenderAttr, ssrInterpolate, ssrRenderList, ssrRenderStyle } from 'vue/server-renderer';
|
|
import { a as useConfigStore, u as useRouter$1, b as useUserStore, p as useCartStore, q as APP_TYPE, t as reactiveProjectName, c as appName, _ as __nuxt_component_0$1, n as useIntersectionObserver, w as getProducts, o as getToken, e as api$1 } from './server.mjs';
|
|
import { _ as _export_sfc } from './_plugin-vue_export-helper-1tPrXgE0.mjs';
|
|
import { _ as _imports_0$1, a as _imports_1$1 } from './cart-DMkYna66.mjs';
|
|
import { p as publicAssetsURL } from '../_/nitro.mjs';
|
|
import { e as _sfc_main$3$1, _ as _sfc_main$2$1, a as _sfc_main$1$1, b as _sfc_main$7, d as deletePostLike, c as createPostLike } from './CommentAddEdit-BK-JfAsk.mjs';
|
|
import { _ as _sfc_main$8 } from './moreOptionProduct-D14RzOF_.mjs';
|
|
import { d as deleteSave, c as createSave } from './save-kY8A0w-Z.mjs';
|
|
import { u as useProductStore } from './product-Crkl8I0V.mjs';
|
|
import { u as useAsyncData } from './asyncData-B6TRojJ5.mjs';
|
|
import { _ as _sfc_main$6 } from './FullScreenStories-DcEzAgjZ.mjs';
|
|
import { u as useMediaStore } from './media-kxpEX2xr.mjs';
|
|
import { U as UserProfilePic } from './UserProfilePic-DXA233hi.mjs';
|
|
import { B as Badge } from './index-CjBj1lyG.mjs';
|
|
import { _ as __nuxt_component_2 } from './index-zdsu3rBC.mjs';
|
|
import 'pinia';
|
|
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 '../routes/renderer.mjs';
|
|
import 'vue-bundle-renderer/runtime';
|
|
import 'unhead/server';
|
|
import 'devalue';
|
|
import 'unhead/utils';
|
|
import 'unhead/plugins';
|
|
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 './empty_user-BaUNCdgf.mjs';
|
|
import './useDateTime-D8RCoGwW.mjs';
|
|
import 'moment';
|
|
import 'moment-timezone';
|
|
import 'moment-jalaali';
|
|
import 'date-fns';
|
|
import 'date-fns/locale';
|
|
import 'swiper/vue';
|
|
import 'swiper/modules';
|
|
import './post_loading-BiySI7bp.mjs';
|
|
import './BasicIconOld-I4c2ShMu.mjs';
|
|
import './like-BhIOg3YL.mjs';
|
|
import 'vue-content-loader';
|
|
import './index-CJwAwTiP.mjs';
|
|
import '@vueuse/gesture';
|
|
import '@headlessui/vue';
|
|
import 'framesync';
|
|
import 'popmotion';
|
|
import 'style-value-types';
|
|
import './BasicButton-BAlnoE_w.mjs';
|
|
import './index-DqCYDGJX.mjs';
|
|
import 'throttle-debounce';
|
|
import './index-Dxyzjwb5.mjs';
|
|
import './raf-ruCY1ktO.mjs';
|
|
import 'dom-align';
|
|
import './index-BlNIpVst.mjs';
|
|
import './shallowequal-DbdDzF9p.mjs';
|
|
import 'lodash-es/uniq.js';
|
|
import './Overflow-Blz4Z5FW.mjs';
|
|
import './BaseInput-_gwhwanN.mjs';
|
|
import 'resize-observer-polyfill';
|
|
import './collapseMotion-cQ2SGjCA.mjs';
|
|
import './slide-Bfj4jnqX.mjs';
|
|
import './FormItemContext-CDDW52IT.mjs';
|
|
import './statusUtils-C3ZNzkeD.mjs';
|
|
import './index-C1mihc8c.mjs';
|
|
import './handle-DWGYMl2T.mjs';
|
|
import './BasicInput-BEP6ZgUl.mjs';
|
|
import './usePrice-B-5-jXKQ.mjs';
|
|
import './index--Q-kfs0Q.mjs';
|
|
import '../_/SearchOutlined.mjs';
|
|
import 'lodash-es/isPlainObject.js';
|
|
import './media-BbtM6xvT.mjs';
|
|
import '../_/CheckOutlined.mjs';
|
|
import './useRefs-BHKrVg4I.mjs';
|
|
|
|
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
__name: "InstallButton",
|
|
__ssrInlineRender: true,
|
|
setup(__props) {
|
|
ref(false);
|
|
return (_ctx, _push, _parent, _attrs) => {
|
|
const _component_ClientOnly = __nuxt_component_0$1;
|
|
_push(ssrRenderComponent(_component_ClientOnly, _attrs, {}, _parent));
|
|
};
|
|
}
|
|
});
|
|
const _sfc_setup$5 = _sfc_main$5.setup;
|
|
_sfc_main$5.setup = (props, ctx) => {
|
|
const ssrContext = useSSRContext();
|
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/InstallButton.vue");
|
|
return _sfc_setup$5 ? _sfc_setup$5(props, ctx) : void 0;
|
|
};
|
|
const __nuxt_component_0 = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-c11cee2c"]]);
|
|
const _imports_0 = publicAssetsURL("/logo_white.png");
|
|
const _imports_1 = publicAssetsURL("/logo.png");
|
|
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
__name: "Logo",
|
|
__ssrInlineRender: true,
|
|
setup(__props) {
|
|
const config = useConfigStore();
|
|
return (_ctx, _push, _parent, _attrs) => {
|
|
if (unref(config).isNightStore) {
|
|
_push(`<img${ssrRenderAttrs(mergeProps({
|
|
src: _imports_0,
|
|
alt: unref(appName).fa,
|
|
class: "inline"
|
|
}, _attrs))}>`);
|
|
} else {
|
|
_push(`<img${ssrRenderAttrs(mergeProps({
|
|
src: _imports_1,
|
|
alt: unref(appName).fa,
|
|
class: "inline"
|
|
}, _attrs))}>`);
|
|
}
|
|
};
|
|
}
|
|
});
|
|
const _sfc_setup$4 = _sfc_main$4.setup;
|
|
_sfc_main$4.setup = (props, ctx) => {
|
|
const ssrContext = useSSRContext();
|
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/Logo.vue");
|
|
return _sfc_setup$4 ? _sfc_setup$4(props, ctx) : void 0;
|
|
};
|
|
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
__name: "Posts",
|
|
__ssrInlineRender: true,
|
|
props: {
|
|
userPostScroll: {},
|
|
scrollSave: {}
|
|
},
|
|
async setup(__props) {
|
|
let __temp, __restore;
|
|
const router = useRouter$1();
|
|
const config = useConfigStore();
|
|
const posts = ref([]);
|
|
const total = ref(100);
|
|
const currentPage = ref(0);
|
|
const limit = ref(10);
|
|
const endPage = ref(false);
|
|
const loading = ref(false);
|
|
const addLikeLoading = ref(false);
|
|
const commentPostId = ref();
|
|
const commentVisible = ref(false);
|
|
const optionVisible = ref(false);
|
|
const optionPostId = ref();
|
|
const props = __props;
|
|
const user = useUserStore();
|
|
computed(() => props.userPostScroll === "userPostScroll");
|
|
const percent = useProductStore();
|
|
ref(null);
|
|
const reset = () => {
|
|
endPage.value = false;
|
|
posts.value = [];
|
|
total.value = 0;
|
|
};
|
|
function handleLike(isLiked, id) {
|
|
var _a, _b;
|
|
try {
|
|
addLikeLoading.value = true;
|
|
if (getToken()) {
|
|
if (isLiked) {
|
|
deletePostLike(id);
|
|
const index = posts.value.findIndex((x) => x.id === id);
|
|
(_b = posts.value[index]) == null ? void 0 : _b.likes.splice((_a = posts.value[index].likes) == null ? void 0 : _a.findIndex((y) => y.user_id === user.user.id));
|
|
} else {
|
|
createPostLike(id);
|
|
const index = posts.value.findIndex((x) => x.id === id);
|
|
posts.value[index].likes.push({
|
|
product_id: id,
|
|
user_id: user.user.id
|
|
});
|
|
}
|
|
} else {
|
|
router.push({ name: "auth-login" });
|
|
api$1.warn(config.useString("pleaseLoginOrRegister"));
|
|
}
|
|
} catch (e) {
|
|
console.log(e);
|
|
} finally {
|
|
addLikeLoading.value = false;
|
|
}
|
|
}
|
|
function addCommentId(id) {
|
|
posts.value[posts.value.findIndex((x) => x.id === commentPostId.value)].comments.push({ id });
|
|
}
|
|
function handleSave(isSaved, id) {
|
|
var _a, _b;
|
|
if (getToken()) {
|
|
if (isSaved) {
|
|
deleteSave(id);
|
|
const index = posts.value.findIndex((x) => x.id === id);
|
|
(_b = posts.value[index]) == null ? void 0 : _b.saved.splice((_a = posts.value[index].saved) == null ? void 0 : _a.findIndex((y) => y.user_id === user.user.id));
|
|
} else {
|
|
createSave(id);
|
|
const index = posts.value.findIndex((x) => x.id === id);
|
|
posts.value[index].saved.push({
|
|
product_id: id,
|
|
user_id: user.user.id
|
|
});
|
|
}
|
|
} else {
|
|
router.push({ name: "auth-login" });
|
|
api$1.warn(config.useString("pleaseLoginOrRegister"));
|
|
}
|
|
}
|
|
function openOption(id) {
|
|
optionPostId.value = id;
|
|
optionVisible.value = true;
|
|
}
|
|
function openComment(id) {
|
|
commentPostId.value = id;
|
|
commentVisible.value = true;
|
|
}
|
|
const request = async (page = 1) => {
|
|
try {
|
|
loading.value = true;
|
|
const res = await getProducts(page, limit.value);
|
|
return res;
|
|
} catch (e) {
|
|
console.error(e);
|
|
return { data: [], count: 0 };
|
|
} finally {
|
|
loading.value = false;
|
|
}
|
|
};
|
|
const { data } = ([__temp, __restore] = withAsyncContext(() => useAsyncData("posts", async () => {
|
|
return request(1);
|
|
})), __temp = await __temp, __restore(), __temp);
|
|
const observer = ref();
|
|
useIntersectionObserver(observer, async ([{ isIntersecting }]) => {
|
|
var _a, _b;
|
|
if (isIntersecting && !loading.value && !endPage.value) {
|
|
const nextPage = currentPage.value + 1;
|
|
const res = await request(nextPage);
|
|
if ((_a = res.data) == null ? void 0 : _a.length) {
|
|
posts.value.push(...res.data);
|
|
currentPage.value = nextPage;
|
|
}
|
|
if (((_b = res.data) == null ? void 0 : _b.length) < limit.value) {
|
|
endPage.value = true;
|
|
}
|
|
}
|
|
});
|
|
computed(() => router.currentRoute.value.query.target || null);
|
|
const present = computed(() => percent.percentUpload);
|
|
watch(present, () => {
|
|
if (present.value == 100) {
|
|
currentPage.value = 0;
|
|
reset();
|
|
request();
|
|
}
|
|
});
|
|
return (_ctx, _push, _parent, _attrs) => {
|
|
_push(`<!--[--><div class="mt-5 pb-5vh" data-v-6e8ab7d4><!--[-->`);
|
|
ssrRenderList(posts.value, (post, index) => {
|
|
_push(ssrRenderComponent(_sfc_main$2$1, {
|
|
onOpenOption: openOption,
|
|
onOpenComment: openComment,
|
|
onHandleLike: handleLike,
|
|
onHandleSave: handleSave,
|
|
index,
|
|
post,
|
|
key: index,
|
|
scrollSave: _ctx.scrollSave,
|
|
"add-like-loading": addLikeLoading.value
|
|
}, null, _parent));
|
|
});
|
|
_push(`<!--]-->`);
|
|
if (loading.value) {
|
|
_push(ssrRenderComponent(_sfc_main$1$1, null, null, _parent));
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
_push(`<div style="${ssrRenderStyle(!loading.value ? null : { display: "none" })}" class="w-full opacity-0 relative" data-v-6e8ab7d4> load </div></div>`);
|
|
_push(ssrRenderComponent(_sfc_main$7, {
|
|
id: commentPostId.value,
|
|
open: commentVisible.value,
|
|
"onUpdate:open": ($event) => commentVisible.value = $event,
|
|
onAddCommentId: addCommentId
|
|
}, null, _parent));
|
|
_push(ssrRenderComponent(_sfc_main$8, {
|
|
id: optionPostId.value,
|
|
open: optionVisible.value,
|
|
"onUpdate:open": ($event) => optionVisible.value = $event
|
|
}, null, _parent));
|
|
_push(`<!--]-->`);
|
|
};
|
|
}
|
|
});
|
|
const _sfc_setup$3 = _sfc_main$3.setup;
|
|
_sfc_main$3.setup = (props, ctx) => {
|
|
const ssrContext = useSSRContext();
|
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/home/components/Posts.vue");
|
|
return _sfc_setup$3 ? _sfc_setup$3(props, ctx) : void 0;
|
|
};
|
|
const Posts = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-6e8ab7d4"]]);
|
|
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
__name: "CustomStories",
|
|
__ssrInlineRender: true,
|
|
setup(__props) {
|
|
const selectedStoryId = ref(null);
|
|
ref(null);
|
|
ref(false);
|
|
useConfigStore();
|
|
useUserStore();
|
|
const mediaStore = useMediaStore();
|
|
const userStore = useUserStore();
|
|
return (_ctx, _push, _parent, _attrs) => {
|
|
_push(`<div${ssrRenderAttrs(mergeProps({ class: "stories-container -ms4" }, _attrs))} data-v-2c589676><div class="scroll-wrapper ps-4" data-v-2c589676><!--[-->`);
|
|
ssrRenderList(unref(mediaStore).users, (user2) => {
|
|
var _a, _b;
|
|
_push(`<div class="story" data-v-2c589676>`);
|
|
_push(ssrRenderComponent(UserProfilePic, {
|
|
src: user2.avatar,
|
|
seenStory: !((_a = user2 == null ? void 0 : user2.stories) == null ? void 0 : _a.length) || user2.stories.every((item) => item.storyviews.find((_item) => {
|
|
var _a2;
|
|
return _item.user_id === ((_a2 = unref(userStore).user) == null ? void 0 : _a2.id) || _item.user_id === "me";
|
|
})),
|
|
showAdd: user2.id === ((_b = unref(userStore).user) == null ? void 0 : _b.id)
|
|
}, null, _parent));
|
|
_push(`<div class="w-full text-center mt1 text-xs truncate font-azar" data-v-2c589676>${ssrInterpolate(user2.name)}</div></div>`);
|
|
});
|
|
_push(`<!--]--></div>`);
|
|
if (selectedStoryId.value) {
|
|
_push(ssrRenderComponent(_sfc_main$6, {
|
|
id: selectedStoryId.value,
|
|
"onUpdate:id": ($event) => selectedStoryId.value = $event
|
|
}, null, _parent));
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
_push(`</div>`);
|
|
};
|
|
}
|
|
});
|
|
const _sfc_setup$2 = _sfc_main$2.setup;
|
|
_sfc_main$2.setup = (props, ctx) => {
|
|
const ssrContext = useSSRContext();
|
|
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("views/base/pages/home/components/CustomStories.vue");
|
|
return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : void 0;
|
|
};
|
|
const CustomStories = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-2c589676"]]);
|
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
__name: "index",
|
|
__ssrInlineRender: true,
|
|
setup(__props) {
|
|
const config = useConfigStore();
|
|
const percent = useProductStore();
|
|
const router = useRouter$1();
|
|
const userStore = useUserStore();
|
|
const cartStore = useCartStore();
|
|
return (_ctx, _push, _parent, _attrs) => {
|
|
var _a, _b;
|
|
const _component_InstallButton = __nuxt_component_0;
|
|
const _component_a_badge = Badge;
|
|
const _component_AProgress = __nuxt_component_2;
|
|
_push(`<div${ssrRenderAttrs(_attrs)}><div class="absolute top-0 w-inherit right-0 left-0"><div class="flex justify-between w-full p-4">`);
|
|
_push(ssrRenderComponent(_sfc_main$4, { class: "h-2rem" }, null, _parent));
|
|
_push(`<div class="flex items-center gap-3">`);
|
|
_push(ssrRenderComponent(_component_InstallButton, { class: "w-10" }, null, _parent));
|
|
if (unref(config).isSeller && unref(APP_TYPE) === "multi") {
|
|
_push(ssrRenderComponent(_component_a_badge, {
|
|
count: unref(cartStore).count,
|
|
dir: "ltr"
|
|
}, {
|
|
default: withCtx((_, _push2, _parent2, _scopeId) => {
|
|
if (_push2) {
|
|
_push2(`<div${_scopeId}>`);
|
|
if (unref(config).isNightStore) {
|
|
_push2(`<img${ssrRenderAttr("src", _imports_0$1)} class="w-1.8rem -mt1" alt=""${_scopeId}>`);
|
|
} else {
|
|
_push2(`<img${ssrRenderAttr("src", _imports_1$1)}${ssrRenderAttr("alt", unref(reactiveProjectName))} class="w-1.8rem -mt1"${_scopeId}>`);
|
|
}
|
|
_push2(`</div>`);
|
|
} else {
|
|
return [
|
|
createVNode("div", {
|
|
onClick: ($event) => unref(router).push({ name: "cart" })
|
|
}, [
|
|
unref(config).isNightStore ? (openBlock(), createBlock("img", {
|
|
key: 0,
|
|
src: _imports_0$1,
|
|
class: "w-1.8rem -mt1",
|
|
alt: ""
|
|
})) : (openBlock(), createBlock("img", {
|
|
key: 1,
|
|
src: _imports_1$1,
|
|
alt: unref(reactiveProjectName),
|
|
class: "w-1.8rem -mt1"
|
|
}, null, 8, ["alt"]))
|
|
], 8, ["onClick"])
|
|
];
|
|
}
|
|
}),
|
|
_: 1
|
|
}, _parent));
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
_push(`<div class="relative">`);
|
|
_push(ssrRenderComponent(_sfc_main$3$1, null, null, _parent));
|
|
if ((_a = unref(userStore).unReadMessage) == null ? void 0 : _a.length) {
|
|
_push(`<div class="absolute -top-2 -right-2 bg-red-6 text-xs min-w-4 p-1 h-4 flex flex-col justify-center items-center text-white rounded-full">${ssrInterpolate((_b = unref(userStore).unReadMessage) == null ? void 0 : _b.length)}</div>`);
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
_push(`</div></div></div><div class="h-90vh overflow-y-auto pb-10vh scrollHome">`);
|
|
_push(ssrRenderComponent(CustomStories, { class: "" }, null, _parent));
|
|
if (unref(percent).percentUpload != 100 && unref(percent).loading) {
|
|
_push(ssrRenderComponent(_component_AProgress, {
|
|
percent: unref(percent).percentUpload,
|
|
"show-info": false,
|
|
status: "active",
|
|
size: "small"
|
|
}, null, _parent));
|
|
} else {
|
|
_push(`<!---->`);
|
|
}
|
|
_push(ssrRenderComponent(Posts, {
|
|
"user-post-scroll": "scrollHome",
|
|
"scroll-save": "scrollPosition"
|
|
}, null, _parent));
|
|
_push(`</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/base/pages/home/index.vue");
|
|
return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
|
|
};
|
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
__name: "index",
|
|
__ssrInlineRender: true,
|
|
setup(__props) {
|
|
useConfigStore();
|
|
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/home/index.vue");
|
|
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
|
|
};
|
|
|
|
export { _sfc_main as default };
|
|
//# sourceMappingURL=index-DkJr9Epd.mjs.map
|