Main.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  1. <template>
  2. <Panel v-show="player.showWidgets" :isOpen="isOpen">
  3. <div @click="toggleOpen" class="menu color">
  4. <div class="logo">
  5. <img :src="require('@/assets/images/icon/logo.png')" alt="" />
  6. <p>cdf澳門上葡京店</p>
  7. </div>
  8. <div class="vline"></div>
  9. <ul>
  10. <li v-if="tours.length > 0">
  11. <ui-icon type="preview" @click.stop="playTour"></ui-icon>
  12. <div>導覽</div>
  13. </li>
  14. <li @click.stop="onClickMenu(item)" v-for="(item, i) in menulist" :key="i">
  15. <ui-icon :type="item.icon"></ui-icon>
  16. <div>{{ item.name }}</div>
  17. </li>
  18. </ul>
  19. </div>
  20. <div class="toolbar color">
  21. <div class="navigation">
  22. <div class="h3">專櫃導航</div>
  23. <div class="swiper-container" id="sw-navigation">
  24. <ul class="swiper-wrapper">
  25. <li
  26. class="swiper-slide"
  27. :class="{ liactive: item.sceneUrl === currentM && item.inPosition.indexOf(currentPose) > -1 }"
  28. @click.stop="onClickShop(item)"
  29. v-for="(item, i) in brandlist"
  30. :key="i"
  31. >
  32. <div v-if="item.shopLogo" class="img" :style="{ 'background-image': `url(${item.shopLogo})` }"></div>
  33. <div class="name" v-if="item.shopName">
  34. <span :class="{ active: item.shopName.length > 6 }">
  35. {{ item.shopName }}
  36. </span>
  37. </div>
  38. </li>
  39. </ul>
  40. </div>
  41. </div>
  42. <div class="category">
  43. <div class="swiper-container" id="sw-category">
  44. <ul class="swiper-wrapper">
  45. <li
  46. class="swiper-slide"
  47. :class="{ categoryactive: '' == currentCategory.id }"
  48. @click.stop="
  49. onClickCategory({
  50. id: '',
  51. categoryName: '全部',
  52. })
  53. "
  54. >
  55. <div>全部</div>
  56. </li>
  57. <li
  58. @click.stop="onClickCategory(item)"
  59. :class="{ categoryactive: item.id == currentCategory.id }"
  60. class="swiper-slide"
  61. v-for="(item, i) in categorylist"
  62. :key="i"
  63. >
  64. <div>{{ item.categoryName }}</div>
  65. </li>
  66. </ul>
  67. </div>
  68. </div>
  69. </div>
  70. </Panel>
  71. </template>
  72. <script setup>
  73. import { useStore } from "vuex";
  74. import { onMounted, watch, computed, ref, nextTick } from "vue";
  75. import Panel from "@/views/Panel.vue";
  76. import { useApp, getApp } from "@/app";
  77. import * as apis from "@/apis/index.js";
  78. import browser from "@/utils/browser";
  79. const store = useStore();
  80. const isOpen = ref(false);
  81. const toggleOpen = () => {
  82. isOpen.value = !isOpen.value;
  83. };
  84. const currentCategory = ref({
  85. id: "",
  86. categoryName: "全部",
  87. });
  88. const currentM = computed(() => browser.getURLParam("m"));
  89. const currentPose = computed(() => browser.getURLParam("pose"));
  90. const isPlay = computed(() => {
  91. let status = store.getters["tour/isPlay"];
  92. let map = document.querySelector(".kankan-app div[xui_min_map]");
  93. if (map) {
  94. if (status) {
  95. map.classList.add("disabled");
  96. } else {
  97. map.classList.remove("disabled");
  98. }
  99. }
  100. return status;
  101. });
  102. const partId = computed(() => store.getters["tour/partId"]);
  103. const playTour = async () => {
  104. let player = await getApp().TourManager.player;
  105. if (isPlay.value) {
  106. store.commit("tour/setData", { isPlay: true });
  107. player.pause();
  108. } else {
  109. store.commit("tour/setData", { isPlay: true });
  110. player.play(partId.value);
  111. }
  112. };
  113. const metadata = computed(() => store.getters["scene/metadata"]);
  114. const player = computed(() => store.getters["player"]);
  115. const tours = computed(() => store.getters["tour/tours"]);
  116. const menulist = computed(() => {
  117. let fff = [
  118. {
  119. icon: "help",
  120. id: "help",
  121. name: "幫助",
  122. },
  123. {
  124. icon: "customer_service",
  125. id: "kefu",
  126. name: "客服",
  127. },
  128. {
  129. icon: "guided_shopping",
  130. id: "guided_shopping",
  131. name: "導購",
  132. },
  133. {
  134. icon: "shopping",
  135. id: "shopping",
  136. name: "購物",
  137. },
  138. ];
  139. if (!browser.isMobile()) {
  140. fff.shift();
  141. }
  142. return fff;
  143. });
  144. const categorylist = ref([]);
  145. const brandlist = ref([
  146. {
  147. img: "show_3d_normal",
  148. name: "GAP 蓋璞",
  149. },
  150. {
  151. img: "show_3d_normal",
  152. name: "MOOST·理MOOST·理MOOST·理MOOST·理MOOST·理",
  153. },
  154. {
  155. img: "show_3d_normal",
  156. name: "H&M",
  157. },
  158. {
  159. img: "show_3d_normal",
  160. name: "GAP 蓋璞",
  161. },
  162. {
  163. img: "show_3d_normal",
  164. name: "MOOST·理",
  165. },
  166. {
  167. img: "show_3d_normal",
  168. name: "H&M",
  169. },
  170. {
  171. img: "show_3d_normal",
  172. name: "GAP 蓋璞",
  173. },
  174. {
  175. img: "show_3d_normal",
  176. name: "MOOST·理",
  177. },
  178. {
  179. img: "show_3d_normal",
  180. name: "H&M",
  181. },
  182. {
  183. img: "show_3d_normal",
  184. name: "GAP 蓋璞",
  185. },
  186. {
  187. img: "show_3d_normal",
  188. name: "MOOST·理",
  189. },
  190. {
  191. img: "show_3d_normal",
  192. name: "H&M",
  193. },
  194. ]);
  195. const brandScroll = () => {
  196. nextTick(() => {
  197. let t = setTimeout(() => {
  198. clearTimeout(t);
  199. new Swiper("#sw-navigation", {
  200. freeMode: true,
  201. slidesPerView: "auto",
  202. centeredSlides: false,
  203. spaceBetween: 10,
  204. grid: {
  205. rows: 2,
  206. },
  207. on: {
  208. touchMove(swiper, e) {
  209. e.stopPropagation();
  210. e.preventDefault();
  211. },
  212. },
  213. });
  214. new Swiper("#sw-category", {
  215. freeMode: true,
  216. slidesPerView: "auto",
  217. spaceBetween: 10,
  218. on: {
  219. touchMove(swiper, e) {
  220. e.stopPropagation();
  221. e.preventDefault();
  222. },
  223. },
  224. });
  225. }, 100);
  226. });
  227. };
  228. const onClickMenu = (item) => {
  229. if (item.id == "kefu") {
  230. let mglink =
  231. "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";
  232. window.open(mglink, "_blank");
  233. } else if (item.id == "shopping") {
  234. browser.openLink(
  235. "/subPackage/pages/shoppingcart/shoppingcart",
  236. "https://m.cdfmembers.com/shop/600667208/shoppingcart",
  237. "/subPackage/pages/shoppingcart/shoppingcart"
  238. );
  239. } else if (item.id == "help") {
  240. store.commit("showUserGuide", true);
  241. } else if (item.id == "guided_shopping") {
  242. store.commit("showShoppingguide", true);
  243. }
  244. };
  245. const getCategorylist = async () => {
  246. let res = await apis.get_category_list({});
  247. categorylist.value = res.data;
  248. brandScroll();
  249. };
  250. const onClickCategory = (item) => {
  251. currentCategory.value.id = item.id;
  252. currentCategory.value.categoryName = item.categoryName;
  253. };
  254. const onClickShop = (item) => {
  255. let url = window.location.href;
  256. if (!browser.hasURLParam("pose")) {
  257. url += `&${item.inPosition}`;
  258. } else {
  259. url = browser.replaceQueryString(url, "pose", item.inPosition.replace("pose=", ""));
  260. }
  261. url = browser.replaceQueryString(url, "m", item.sceneUrl);
  262. window.location.href = url;
  263. };
  264. watch(
  265. () => currentCategory,
  266. (val, old) => {
  267. getShoplist();
  268. },
  269. {
  270. deep: true,
  271. }
  272. );
  273. const getShoplist = async () => {
  274. let res = await apis.get_shop_list({
  275. categoryId: currentCategory.value.id,
  276. });
  277. brandlist.value = res.data;
  278. brandScroll();
  279. };
  280. onMounted(() => {
  281. useApp().then(async (app) => {
  282. getCategorylist();
  283. getShoplist();
  284. app.Scene.on("loaded", () => {
  285. if (browser.getURLParam("roomId")) {
  286. store.commit("showShoppingguide", true);
  287. }
  288. });
  289. });
  290. });
  291. </script>
  292. <style lang="scss" scoped>
  293. .menu {
  294. width: 100%;
  295. border-radius: 6px;
  296. border: 1px solid rgba(255, 255, 255, 0.2);
  297. background: rgba(0, 0, 0, 0.2);
  298. display: flex;
  299. justify-content: space-between;
  300. box-sizing: border-box;
  301. position: relative;
  302. align-items: center;
  303. height: 48px;
  304. padding: 0 12px;
  305. text-align: center;
  306. .logo {
  307. width: 90px;
  308. transform: translateY(-24%);
  309. > img {
  310. width: 100%;
  311. border-radius: 4px;
  312. }
  313. > p {
  314. margin: 2px 0;
  315. font-size: 10px;
  316. }
  317. }
  318. .vline {
  319. width: 1px;
  320. height: 14px;
  321. background: #fff;
  322. }
  323. > ul {
  324. display: flex;
  325. align-items: center;
  326. font-size: 0;
  327. justify-content: flex-end;
  328. > li {
  329. margin-left: 0.5rem;
  330. &:first-of-type {
  331. margin-left: 0;
  332. }
  333. > div {
  334. margin-top: 4px;
  335. font-size: 10px;
  336. }
  337. }
  338. }
  339. }
  340. .toolbar {
  341. width: 100%;
  342. border-radius: 6px;
  343. border: 1px solid rgba(255, 255, 255, 0.2);
  344. margin-top: 8px;
  345. margin-bottom: 30px;
  346. background: rgba(0, 0, 0, 0.2);
  347. .navigation {
  348. padding: 8px 0;
  349. .h3 {
  350. font-size: 14px;
  351. padding: 0 14px;
  352. }
  353. .swiper-container {
  354. width: 100%;
  355. height: 130px;
  356. overflow: hidden;
  357. margin-top: 8px;
  358. padding-right: 2px;
  359. padding-left: 14px;
  360. position: relative;
  361. &::after {
  362. position: absolute;
  363. right: 0;
  364. bottom: 0;
  365. content: "";
  366. display: inline-block;
  367. height: 100%;
  368. z-index: 99;
  369. width: 17px;
  370. background: linear-gradient(90deg, rgba(0, 0, 0, 0) 0%, #000000 100%);
  371. opacity: 0.4;
  372. pointer-events: none;
  373. }
  374. > ul {
  375. margin: 0 !important;
  376. > li {
  377. width: 60px;
  378. height: 60px;
  379. border-radius: 4px;
  380. position: relative;
  381. font-size: 0;
  382. overflow: hidden;
  383. border: 1px transparent solid;
  384. box-sizing: border-box;
  385. &.liactive {
  386. color: var(--editor-main-color);
  387. border: 1px var(--editor-main-color) solid;
  388. }
  389. .img {
  390. width: 100%;
  391. height: 100%;
  392. background-size: contain;
  393. }
  394. .name {
  395. width: 100%;
  396. position: absolute;
  397. bottom: -1px;
  398. font-size: 12px;
  399. left: 0;
  400. background: rgba(0, 0, 0, 0.5);
  401. // text-overflow: ellipsis;
  402. // white-space: nowrap;
  403. // overflow: hidden;
  404. text-align: center;
  405. padding: 2px 4px;
  406. box-sizing: border-box;
  407. word-break: break-all;
  408. > span {
  409. display: inline-block;
  410. white-space: nowrap;
  411. }
  412. .active {
  413. animation: 5s wordsLoop linear infinite normal;
  414. }
  415. }
  416. }
  417. }
  418. }
  419. }
  420. .category {
  421. padding: 8px 14px;
  422. border-top: 1px solid rgba(255, 255, 255, 0.2);
  423. .swiper-container {
  424. width: 100%;
  425. overflow: hidden;
  426. > ul {
  427. > li {
  428. width: auto;
  429. color: rgba(255, 255, 255, 0.5);
  430. > div {
  431. width: 100%;
  432. font-size: 14px;
  433. padding: 2px 4px;
  434. }
  435. }
  436. .categoryactive {
  437. color: #fff;
  438. }
  439. }
  440. }
  441. }
  442. }
  443. @keyframes wordsLoop {
  444. 0% {
  445. transform: translateX(100%);
  446. -webkit-transform: translateX(100%);
  447. }
  448. 100% {
  449. transform: translateX(-100%);
  450. -webkit-transform: translateX(-100%);
  451. }
  452. }
  453. </style>