Main.vue 8.9 KB

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