123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631 |
- <template>
- <div>
- <Panel v-show="player.showWidgets" :class="{ disabled: !showdaogou }" :isOpen="isOpen">
- <div @click="toggleOpen" class="menu color">
- <div class="logo">
- <img :src="require('@/assets/images/icon/logo.png')" alt="" />
- <p v-if="player.lang != 'en'">{{$t('common.title') }}</p>
- </div>
- <div class="vline"></div>
- <ul :class="player.lang" @touchmove.stop>
- <li v-if="tours.length > 0">
- <ui-icon type="preview" @click.stop="playTour"></ui-icon>
- <div>{{$t('common.tour')}}</div>
- </li>
- <li @click.stop="onClickMenu(item)" v-for="(item, i) in menulist" :key="i">
- <ui-icon :type="item.icon"></ui-icon>
- <div>{{ item.name }}</div>
- </li>
- <li v-if="showdaogou">
- <ui-icon
- type="guided_shopping"
- @click.stop="
- onClickMenu({
- icon: 'guided_shopping',
- id: 'guided_shopping',
- name: $t('common.mode'),
- })
- "
- ></ui-icon>
- <div>{{ $t('common.mode') }}</div>
- </li>
- <li>
- <ui-icon
- type="shopping"
- @click.stop="
- onClickMenu({
- icon: 'shopping',
- id: 'shopping',
- name: $t('common.shopping'),
- })
- "
- ></ui-icon>
- <div>{{ $t('common.shopping') }}</div>
- </li>
- </ul>
- </div>
- <div class="toolbar color">
- <div class="navigation">
- <div class="h3">
- <span>{{ $t('common.guide') }}</span>
- <div @click="showShopList = true">
- <img :src="require(`@/assets/images/icon/search.svg`)" alt="" />
- {{ $t('common.searchguide') }}
- </div>
- </div>
- <div class="swiper-container" id="sw-navigation">
- <ul class="swiper-wrapper">
- <li
- class="swiper-slide"
- :class="{ liactive: item.sceneUrl === currentM && item.inPosition.indexOf(currentPose) > -1 }"
- @click.stop="onClickShop(item)"
- v-for="(item, i) in brandlist"
- :key="i"
- >
- <div v-if="item.shopLogo" class="img" :style="{ 'background-image': `url(${item.shopLogo})` }"></div>
- <div class="name" v-if="item.shopName">
- <span :class="{ active: item.shopName.length > 6 }">
- {{ item.shopName }}
- </span>
- </div>
- </li>
- </ul>
- </div>
- </div>
- <div class="category">
- <div class="swiper-container" id="sw-category">
- <ul class="swiper-wrapper">
- <li
- class="swiper-slide"
- :class="{ categoryactive: '' == currentCategory.id }"
- @click.stop="
- onClickCategory({
- id: '',
- categoryName: $t('common.all'),
- })
- "
- >
- <div>{{ $t('common.all') }}</div>
- </li>
- <li @click.stop="onClickCategory(item)" :class="{ categoryactive: item.id == currentCategory.id }" class="swiper-slide" v-for="(item, i) in categorylist" :key="i">
- <div>{{ item.categoryName }}</div>
- </li>
- </ul>
- </div>
- </div>
- </div>
- </Panel>
- <teleport :to="`#app`">
- <div v-show="showShopList" class="shoplist">
- <div class="l-title">
- {{ $t('common.guidelist') }} ({{ searchList.length }})
- <ui-icon type="close" @click="showShopList = false" />
- </div>
- <div class="search">
- <img :src="require(`@/assets/images/icon/search.svg`)" alt="" />
- <input v-model="searchKey" type="text" :placeholder="$t('common.guideSearch')" />
- <ui-icon class="close" v-if="searchKey.length > 0" @click.stop="searchKey = ''" type="state_f"></ui-icon>
- </div>
- <ul v-if="searchList.length > 0">
- <li @click.stop="onClickShop(item)" v-for="(item, idx) in searchList" :key="idx">
- <div class="img" :style="{ 'background-image': `url(${item.shopLogo})` }"></div>
- <div class="name" v-if="item.shopName">
- <span>
- {{ item.shopName }}
- </span>
- </div>
- <ui-icon class="right" type="right"></ui-icon>
- </li>
- </ul>
- <div class="noresult" v-else>{{ $t('common.noResult') }}</div>
- </div>
- </teleport>
- </div>
- </template>
- <script setup>
- import { useStore } from 'vuex';
- import { onMounted, watch, computed, ref, nextTick } from 'vue';
- import Panel from '@/views/Panel.vue';
- import { useApp, getApp } from '@/app';
- import * as apis from '@/apis/index.js';
- import browser from '@/utils/browser';
- import { useI18n, getLocale } from '@/i18n';
- const { t } = useI18n({ useScope: 'global' });
- const store = useStore();
- const isOpen = ref(false);
- const searchKey = ref('');
- const showShopList = ref(false);
- const toggleOpen = () => {
- isOpen.value = !isOpen.value;
- };
- const currentCategory = ref({
- id: '',
- categoryName: '全部',
- });
- const currentM = computed(() => browser.getURLParam('m'));
- const currentPose = computed(() => browser.getURLParam('pose'));
- const showdaogou = computed(() => store.getters['rtc/showdaogou']);
- const isPlay = computed(() => {
- let status = store.getters['tour/isPlay'];
- let map = document.querySelector('.kankan-app div[xui_min_map]');
- if (map) {
- if (status) {
- map.classList.add('disabled');
- } else {
- map.classList.remove('disabled');
- }
- }
- return status;
- });
- const partId = computed(() => store.getters['tour/partId']);
- const playTour = async () => {
- let player = await getApp().TourManager.player;
- if (isPlay.value) {
- store.commit('tour/setData', { isHome: true });
- player.pause();
- } else {
- store.commit('tour/setData', { isHome: false });
- player.play(partId.value);
- }
- };
- const metadata = computed(() => store.getters['scene/metadata']);
- const player = computed(() => store.getters['player']);
- const tours = computed(() => store.getters['tour/tours']);
- const menulist = computed(() => {
- let fff = [
- {
- icon: 'help',
- id: 'help',
- name: t('common.help'),
- },
- {
- icon: 'customer_service',
- id: 'kefu',
- name: t('common.kefu'),
- },
- ];
- if (!browser.isMobile()) {
- fff.shift();
- }
- return fff;
- });
- const categorylist = ref([]);
- const brandlist = ref([]);
- const searchList = ref([]);
- const brandScroll = () => {
- nextTick(() => {
- let t = setTimeout(() => {
- clearTimeout(t);
- new Swiper('#sw-navigation', {
- freeMode: true,
- slidesPerView: 'auto',
- centeredSlides: false,
- spaceBetween: 10,
- grid: {
- rows: 2,
- },
- on: {
- touchMove(swiper, e) {
- e.stopPropagation();
- e.preventDefault();
- },
- },
- });
- new Swiper('#sw-category', {
- freeMode: true,
- slidesPerView: 'auto',
- spaceBetween: 10,
- on: {
- touchMove(swiper, e) {
- e.stopPropagation();
- e.preventDefault();
- },
- },
- });
- }, 100);
- });
- };
- const onClickMenu = (item) => {
- if (item.id == 'kefu') {
- let mglink =
- 'https://webpage.qidian.qq.com/2/chat/h5/index.html?linkType=1&env=ol&kfuin=3009110132&fid=3655&key=9b4334768c39150ead3f23e11e5dc2e4&cate=7&source=0&isLBS=0&isCustomEntry=0&type=10&ftype=1&_type=wpa&qidian=true&_pid=kvrmvu.74cg11.l43qvbcu&translateSwitch=0&isSsc=0&roleValue=4&roleData=922223821';
- window.open(mglink, '_blank');
- } else if (item.id == 'shopping') {
- browser.openLink('/subPackage/pages/shoppingcart/shoppingcart', 'https://m.cdfmembers.com/shop/600667208/shoppingcart', '/subPackage/pages/shoppingcart/shoppingcart');
- } else if (item.id == 'help') {
- store.commit('showUserGuide', true);
- } else if (item.id == 'guided_shopping') {
- store.commit('showShoppingguide', true);
- }
- };
- const getCategorylist = async () => {
- let res = await apis.get_category_list({});
- categorylist.value = res.data;
- brandScroll();
- };
- const onClickCategory = (item) => {
- currentCategory.value.id = item.id;
- currentCategory.value.categoryName = item.categoryName;
- };
- const onClickShop = (item) => {
- let url = window.location.href;
- if (!browser.hasURLParam('pose')) {
- url += `&${item.inPosition}`;
- } else {
- url = browser.replaceQueryString(url, 'pose', item.inPosition.replace('pose=', ''));
- }
- url = browser.replaceQueryString(url, 'm', item.sceneUrl);
- window.location.href = url;
- };
- watch(
- () => currentCategory,
- (val, old) => {
- getShoplist();
- },
- {
- deep: true,
- }
- );
- watch(
- () => searchKey.value,
- (val, old) => {
- console.log(searchKey.value);
- getSearchList();
- }
- );
- const getShoplist = async () => {
- let res = await apis.get_shop_list({
- categoryId: currentCategory.value.id,
- });
- brandlist.value = res.data;
- brandScroll();
- };
- const getSearchList = async () => {
- let res = await apis.get_shop_list({
- shopName: searchKey.value,
- });
- searchList.value = res.data;
- };
- onMounted(() => {
- useApp().then((app) => {
- getCategorylist();
- getShoplist();
- });
- });
- </script>
- <style lang="scss" scoped>
- .menu {
- width: 100%;
- border-radius: 6px;
- border: 1px solid rgba(255, 255, 255, 0.2);
- background: rgba(0, 0, 0, 0.2);
- display: flex;
- justify-content: space-between;
- box-sizing: border-box;
- position: relative;
- align-items: center;
- height: 48px;
- padding: 0 12px;
- text-align: center;
- .logo {
- width: 90px;
- transform: translateY(-24%);
- min-width: 90px;
- flex-shrink: 0;
- > img {
- width: 100%;
- border-radius: 4px;
- }
- > p {
- margin: 2px 0;
- font-size: 10px;
- }
- }
- .vline {
- width: 1px;
- height: 14px;
- background: #fff;
- }
- > ul {
- display: flex;
- align-items: center;
- font-size: 0;
- justify-content: flex-end;
- overflow-x: auto;
- > li {
- margin-left: 0.4rem;
- &:first-of-type {
- margin-left: 0;
- }
- > div {
- margin-top: 4px;
- font-size: 10px;
- }
- }
- }
- .en{
- justify-content: flex-start;
- width: calc(100% - 100px);
- }
- }
- .toolbar {
- width: 100%;
- border-radius: 6px;
- border: 1px solid rgba(255, 255, 255, 0.2);
- margin-top: 8px;
- margin-bottom: 30px;
- background: rgba(0, 0, 0, 0.2);
- .navigation {
- padding: 8px 0;
- .h3 {
- font-size: 14px;
- padding: 0 14px;
- display: flex;
- justify-content: space-between;
- align-items: center;
- > div {
- width: 96px;
- height: 24px;
- background: rgba(0, 0, 0, 0.5);
- border-radius: 24px;
- display: flex;
- font-size: 12px;
- justify-content: center;
- align-items: center;
- }
- img {
- width: 12px;
- margin-right: 6px;
- }
- }
- .swiper-container {
- width: 100%;
- height: 130px;
- overflow: hidden;
- margin-top: 8px;
- padding-right: 2px;
- padding-left: 14px;
- position: relative;
- &::after {
- position: absolute;
- right: 0;
- bottom: 0;
- content: '';
- display: inline-block;
- height: 100%;
- z-index: 99;
- width: 17px;
- background: linear-gradient(90deg, rgba(0, 0, 0, 0) 0%, #000000 100%);
- opacity: 0.4;
- pointer-events: none;
- }
- > ul {
- margin: 0 !important;
- > li {
- width: 60px;
- height: 60px;
- border-radius: 4px;
- position: relative;
- font-size: 0;
- overflow: hidden;
- border: 1px transparent solid;
- box-sizing: border-box;
- &.liactive {
- color: var(--editor-main-color);
- border: 1px var(--editor-main-color) solid;
- }
- .img {
- width: 100%;
- height: 100%;
- background-size: contain;
- }
- .name {
- width: 100%;
- position: absolute;
- bottom: -1px;
- font-size: 12px;
- left: 0;
- background: rgba(0, 0, 0, 0.5);
- // text-overflow: ellipsis;
- // white-space: nowrap;
- // overflow: hidden;
- text-align: center;
- padding: 2px 4px;
- box-sizing: border-box;
- word-break: break-all;
- > span {
- display: inline-block;
- white-space: nowrap;
- }
- .active {
- animation: 5s wordsLoop linear infinite normal;
- }
- }
- }
- }
- }
- }
- .category {
- padding: 8px 14px;
- border-top: 1px solid rgba(255, 255, 255, 0.2);
- .swiper-container {
- width: 100%;
- overflow: hidden;
- > ul {
- > li {
- width: auto;
- color: rgba(255, 255, 255, 0.5);
- > div {
- width: 100%;
- font-size: 14px;
- padding: 2px 4px;
- }
- }
- .categoryactive {
- color: #fff;
- }
- }
- }
- }
- }
- .shoplist {
- position: fixed;
- z-index: 999;
- width: 100%;
- height: 30px;
- left: 0;
- right: 0;
- bottom: 0;
- height: 80vh;
- background: rgba(0, 0, 0, 0.8);
- border-radius: 10px 10px 0px 0px;
- padding: 12px 15px;
- .l-title {
- font-size: 16px;
- font-weight: bold;
- color: #ffffff;
- text-align: center;
- position: relative;
- width: 100%;
- i {
- position: absolute;
- right: 0;
- top: 2px;
- }
- }
- .search {
- width: 100%;
- height: 34px;
- background: rgba(46, 46, 46, 0.9);
- border-radius: 20px;
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 0 8px;
- margin-top: 20px;
- > img {
- width: 16px;
- opacity: 0.8;
- }
- > input {
- text-align: left;
- font-size: 16px;
- width: 100%;
- color: #fff;
- margin-left: 10px;
- }
- .close {
- color: #7d7e80;
- }
- }
- > ul {
- width: 100%;
- height: calc(100% - 80px);
- overflow-y: auto;
- > li {
- width: 100%;
- height: 60px;
- position: relative;
- font-size: 0;
- overflow: hidden;
- box-sizing: border-box;
- display: flex;
- justify-content: center;
- align-items: center;
- margin: 18px 0;
- .img {
- width: 60px;
- height: 60px;
- background-size: contain;
- flex-shrink: 0;
- border-radius: 4px;
- margin-right: 10px;
- }
- .name {
- width: 100%;
- font-size: 12px;
- left: 0;
- text-overflow: ellipsis;
- white-space: nowrap;
- overflow: hidden;
- text-align: left;
- padding: 2px 4px;
- box-sizing: border-box;
- word-break: break-all;
- > span {
- display: inline-block;
- white-space: nowrap;
- }
- }
- .right {
- font-size: 14px;
- }
- }
- }
- }
- .noresult {
- text-align: center;
- margin-top: 20vh;
- }
- @keyframes wordsLoop {
- 0% {
- transform: translateX(100%);
- -webkit-transform: translateX(100%);
- }
- 100% {
- transform: translateX(-100%);
- -webkit-transform: translateX(-100%);
- }
- }
- </style>
|