Main.vue 8.2 KB

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