Main.vue 9.8 KB

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