Main.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482
  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. // name: "導購",
  131. // },
  132. {
  133. icon: "shopping",
  134. id: "shopping",
  135. name: "購物",
  136. },
  137. ];
  138. if (!browser.isMobile()) {
  139. fff.shift();
  140. }
  141. return fff;
  142. });
  143. const categorylist = ref([]);
  144. const brandlist = ref([
  145. {
  146. img: "show_3d_normal",
  147. name: "GAP 蓋璞",
  148. },
  149. {
  150. img: "show_3d_normal",
  151. name: "MOOST·理MOOST·理MOOST·理MOOST·理MOOST·理",
  152. },
  153. {
  154. img: "show_3d_normal",
  155. name: "H&M",
  156. },
  157. {
  158. img: "show_3d_normal",
  159. name: "GAP 蓋璞",
  160. },
  161. {
  162. img: "show_3d_normal",
  163. name: "MOOST·理",
  164. },
  165. {
  166. img: "show_3d_normal",
  167. name: "H&M",
  168. },
  169. {
  170. img: "show_3d_normal",
  171. name: "GAP 蓋璞",
  172. },
  173. {
  174. img: "show_3d_normal",
  175. name: "MOOST·理",
  176. },
  177. {
  178. img: "show_3d_normal",
  179. name: "H&M",
  180. },
  181. {
  182. img: "show_3d_normal",
  183. name: "GAP 蓋璞",
  184. },
  185. {
  186. img: "show_3d_normal",
  187. name: "MOOST·理",
  188. },
  189. {
  190. img: "show_3d_normal",
  191. name: "H&M",
  192. },
  193. ]);
  194. const brandScroll = () => {
  195. nextTick(() => {
  196. let t = setTimeout(() => {
  197. clearTimeout(t);
  198. new Swiper("#sw-navigation", {
  199. freeMode: true,
  200. slidesPerView: "auto",
  201. centeredSlides: false,
  202. spaceBetween: 10,
  203. grid: {
  204. rows: 2,
  205. },
  206. on: {
  207. touchMove(swiper, e) {
  208. e.stopPropagation();
  209. e.preventDefault();
  210. },
  211. },
  212. });
  213. new Swiper("#sw-category", {
  214. freeMode: true,
  215. slidesPerView: "auto",
  216. spaceBetween: 10,
  217. on: {
  218. touchMove(swiper, e) {
  219. e.stopPropagation();
  220. e.preventDefault();
  221. },
  222. },
  223. });
  224. }, 100);
  225. });
  226. };
  227. const onClickMenu = (item) => {
  228. if (item.id == "kefu") {
  229. let mglink =
  230. "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";
  231. window.open(mglink, "_blank");
  232. } else if (item.id == "shopping") {
  233. browser.openLink("/subPackage/pages/shoppingcart/shoppingcart",
  234. "https://m.cdfmembers.com/shop/600667208/shoppingcart",
  235. "/subPackage/pages/shoppingcart/shoppingcart");
  236. } else if (item.id == "help") {
  237. store.commit("showUserGuide", true);
  238. }
  239. };
  240. const getCategorylist = async () => {
  241. let res = await apis.get_category_list({});
  242. categorylist.value = res.data;
  243. brandScroll();
  244. };
  245. const onClickCategory = (item) => {
  246. currentCategory.value.id = item.id;
  247. currentCategory.value.categoryName = item.categoryName;
  248. };
  249. const onClickShop = (item) => {
  250. let url = window.location.href;
  251. if (!browser.hasURLParam("novideo")) {
  252. url += `&novideo=1`;
  253. }
  254. if (!browser.hasURLParam("pose")) {
  255. url += `&${item.inPosition}`;
  256. } else {
  257. url = browser.replaceQueryString(url, "pose", item.inPosition.replace("pose=", ""));
  258. }
  259. url = browser.replaceQueryString(url, "m", item.sceneUrl);
  260. window.location.href = url;
  261. };
  262. watch(
  263. () => currentCategory,
  264. (val, old) => {
  265. getShoplist();
  266. },
  267. {
  268. deep: true,
  269. }
  270. );
  271. const getShoplist = async () => {
  272. let res = await apis.get_shop_list({
  273. categoryId: currentCategory.value.id,
  274. });
  275. brandlist.value = res.data;
  276. brandScroll();
  277. };
  278. onMounted(() => {
  279. useApp().then(async (sdk) => {
  280. getCategorylist();
  281. getShoplist();
  282. });
  283. });
  284. </script>
  285. <style lang="scss" scoped>
  286. .menu {
  287. width: 100%;
  288. border-radius: 6px;
  289. border: 1px solid rgba(255, 255, 255, 0.2);
  290. background: rgba(0, 0, 0, 0.2);
  291. display: flex;
  292. justify-content: space-between;
  293. box-sizing: border-box;
  294. position: relative;
  295. align-items: center;
  296. height: 48px;
  297. padding: 0 12px;
  298. text-align: center;
  299. .logo {
  300. width: 90px;
  301. transform: translateY(-24%);
  302. > img {
  303. width: 100%;
  304. border-radius: 4px;
  305. }
  306. > p {
  307. margin: 2px 0;
  308. font-size: 10px;
  309. }
  310. }
  311. .vline {
  312. width: 1px;
  313. height: 14px;
  314. background: #fff;
  315. }
  316. > ul {
  317. display: flex;
  318. align-items: center;
  319. font-size: 0;
  320. justify-content: flex-end;
  321. > li {
  322. margin-left: 0.5rem;
  323. &:first-of-type {
  324. margin-left: 0;
  325. }
  326. > div {
  327. margin-top: 4px;
  328. font-size: 10px;
  329. }
  330. }
  331. }
  332. }
  333. .toolbar {
  334. width: 100%;
  335. border-radius: 6px;
  336. border: 1px solid rgba(255, 255, 255, 0.2);
  337. margin-top: 8px;
  338. margin-bottom: 30px;
  339. background: rgba(0, 0, 0, 0.2);
  340. .navigation {
  341. padding: 8px 0;
  342. .h3 {
  343. font-size: 14px;
  344. padding: 0 14px;
  345. }
  346. .swiper-container {
  347. width: 100%;
  348. height: 130px;
  349. overflow: hidden;
  350. margin-top: 8px;
  351. padding-right: 2px;
  352. padding-left: 14px;
  353. position: relative;
  354. &::after {
  355. position: absolute;
  356. right: 0;
  357. bottom: 0;
  358. content: "";
  359. display: inline-block;
  360. height: 100%;
  361. z-index: 99;
  362. width: 17px;
  363. background: linear-gradient(90deg, rgba(0, 0, 0, 0) 0%, #000000 100%);
  364. opacity: 0.4;
  365. pointer-events: none;
  366. }
  367. > ul {
  368. margin: 0 !important;
  369. > li {
  370. width: 60px;
  371. height: 60px;
  372. border-radius: 4px;
  373. position: relative;
  374. font-size: 0;
  375. overflow: hidden;
  376. border: 1px transparent solid;
  377. box-sizing: border-box;
  378. &.liactive {
  379. color: var(--editor-main-color);
  380. border: 1px var(--editor-main-color) solid;
  381. }
  382. .img {
  383. width: 100%;
  384. height: 100%;
  385. background-size: contain;
  386. }
  387. .name {
  388. width: 100%;
  389. position: absolute;
  390. bottom: -1px;
  391. font-size: 12px;
  392. left: 0;
  393. background: rgba(0, 0, 0, 0.5);
  394. // text-overflow: ellipsis;
  395. // white-space: nowrap;
  396. // overflow: hidden;
  397. text-align: center;
  398. padding: 2px 4px;
  399. box-sizing: border-box;
  400. word-break: break-all;
  401. > span {
  402. display: inline-block;
  403. white-space: nowrap;
  404. }
  405. .active {
  406. animation: 5s wordsLoop linear infinite normal;
  407. }
  408. }
  409. }
  410. }
  411. }
  412. }
  413. .category {
  414. padding: 8px 14px;
  415. border-top: 1px solid rgba(255, 255, 255, 0.2);
  416. .swiper-container {
  417. width: 100%;
  418. overflow: hidden;
  419. > ul {
  420. > li {
  421. width: auto;
  422. color: rgba(255, 255, 255, 0.5);
  423. > div {
  424. width: 100%;
  425. font-size: 14px;
  426. padding: 2px 4px;
  427. }
  428. }
  429. .categoryactive {
  430. color: #fff;
  431. }
  432. }
  433. }
  434. }
  435. }
  436. @keyframes wordsLoop {
  437. 0% {
  438. transform: translateX(100%);
  439. -webkit-transform: translateX(100%);
  440. }
  441. 100% {
  442. transform: translateX(-100%);
  443. -webkit-transform: translateX(-100%);
  444. }
  445. }
  446. </style>