Main.vue 10 KB

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