Main.vue 10 KB

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