Main.vue 10 KB

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