app.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817
  1. <template>
  2. <LoadingLogo v-if="hadVideo" :thumb="true" />
  3. <OpenVideo v-else @close="hadVideo = true" />
  4. <Guide />
  5. <div class="ui-view-layout" :class="{ show: show }" is-mobile="true">
  6. <div class="scene" ref="scene$"></div>
  7. <template v-if="dataLoaded">
  8. <Information v-if="!isshoppingguide" />
  9. <Control />
  10. <!-- <teleport v-if="refMiniMap && player.showWidgets" :to="refMiniMap">
  11. <span :class="{ gudieDisabled: isshoppingguide && role != 'leader' }" class="button-switch" @click.stop="toggleMap">
  12. <ui-icon type="show_map_collect"></ui-icon>
  13. </span>
  14. <p class="change" :class="{ gudieDisabled: isshoppingguide && role != 'leader' }" @click="changeMode('dollhouse', $event, 'focus3d')">
  15. <ui-icon type="show_3d_normal"></ui-icon>
  16. 3D模型
  17. </p>
  18. </teleport> -->
  19. <teleport v-if="refMiniMap && player.showWidgets" :to="refMiniMap">
  20. <span :class="{ gudieDisabled: isshoppingguide && role != 'leader' }" class="button-switch" @click.stop="toggleMap">
  21. <ui-icon type="show_map_collect"></ui-icon>
  22. </span>
  23. <div v-if="controls.showDollhouse" :class="{ gudieDisabled: isshoppingguide && role != 'leader' }" class="change" @click="changeMode('dollhouse')">
  24. <ui-icon type="show_3d_normal"></ui-icon>
  25. <span> 3D模型</span>
  26. </div>
  27. </teleport>
  28. <!-- <template v-if="refMiniMap && player.showWidgets">
  29. <div
  30. :class="{ disabled: flying, gudieDisabled: isshoppingguide && role != 'leader' }"
  31. v-show="mode != 'panorama'"
  32. v-if="controls.showFloorplan && controls.showDollhouse"
  33. class="tab-layer"
  34. >
  35. <div class="tabs" v-if="controls.showMap">
  36. <span :class="{ active: mode === 'floorplan' }" @click="changeMode('floorplan', $event)">
  37. <ui-icon :type="mode == 'floorplan' ? 'show_plane_selected' : 'show_plane_normal'"></ui-icon>
  38. 二維
  39. </span>
  40. <span :class="{ active: mode === 'dollhouse' }" @click="changeMode('dollhouse', $event)">
  41. <ui-icon :type="mode == 'dollhouse' ? 'show_3d_selected' : 'show_3d_normal'"></ui-icon>
  42. 三維
  43. </span>
  44. <div class="background" ref="background"></div>
  45. </div>
  46. </div>
  47. </template> -->
  48. <template v-if="refMiniMap && player.showWidgets">
  49. <div
  50. :class="{ disabled: flying, gudieDisabled: isshoppingguide && role != 'leader' }"
  51. v-show="mode != 'panorama'"
  52. v-if="controls.showFloorplan && controls.showDollhouse"
  53. class="tab-layer"
  54. >
  55. <div class="tabs" v-if="controls.showMap">
  56. <span :class="{ active: mode === 'floorplan' }" ref="floorplan_ref" @click="changeMode('floorplan', $event)">
  57. <ui-icon :type="mode == 'floorplan' ? 'show_plane_selected' : 'show_plane_normal'"></ui-icon>
  58. 二維
  59. </span>
  60. <span :class="{ active: mode === 'dollhouse' }" ref="dollhouse_ref" @click="changeMode('dollhouse', $event)">
  61. <ui-icon :type="mode == 'dollhouse' ? 'show_3d_selected' : 'show_3d_normal'"></ui-icon>
  62. 三維
  63. </span>
  64. <div class="background" ref="background"></div>
  65. </div>
  66. </div>
  67. </template>
  68. </template>
  69. <!-- <UiTags /> -->
  70. </div>
  71. <GoodsList @close="closetagtype" />
  72. <Treasure @close="closetagtype" />
  73. <Waterfall @close="closetagtype" />
  74. </template>
  75. <script setup>
  76. import { useMusicPlayer } from "@/utils/sound";
  77. // import UiTags from "@/components/Tags";
  78. import GoodsList from "@/components/Tags/goods-list.vue";
  79. import Treasure from "@/components/Tags/treasure.vue";
  80. import Waterfall from "@/components/Tags/waterfall.vue";
  81. import Information from "@/components/Information";
  82. import Control from "@/components/Controls/Control.Mobile.vue";
  83. import LoadingLogo from "@/components/shared/Loading.vue";
  84. import OpenVideo from "@/components/openVideo/";
  85. import Guide from "@/components/shared/Guide.vue";
  86. import { Dialog } from "@/global_components/";
  87. import { createApp } from "@/app";
  88. import { ref, onMounted, computed, nextTick, watch } from "vue";
  89. import { useStore } from "vuex";
  90. import browser from "@/utils/browser";
  91. import { useApp, getApp } from "@/app";
  92. import common from "@/utils/common";
  93. import { Cache } from "@/utils/index";
  94. import wxShare from "@/utils/wxshare";
  95. import * as apis from "@/apis/index.js";
  96. const store = useStore();
  97. let jumpNewScene = (sceneFirstView) => {
  98. let url = window.location.href;
  99. if (!browser.hasURLParam("pose")) {
  100. url += `&${sceneFirstView.sceneview}`;
  101. } else {
  102. url = browser.replaceQueryString(url, "pose", sceneFirstView.sceneview.replace("pose=", ""));
  103. }
  104. url = browser.replaceQueryString(url, "m", sceneFirstView.num);
  105. return url;
  106. };
  107. let visibilitychangeFn = () => {
  108. if (browser.isTabHidden()) {
  109. apis.burying_point({ type: 1 });
  110. }
  111. };
  112. let hashchangefn = () => {
  113. if (window.location.hash.indexOf("#showpage") >= 0) {
  114. window.history.go(-1);
  115. }
  116. };
  117. const musicPlayer = useMusicPlayer();
  118. let app = null;
  119. let tagid = browser.getURLParam("tagid");
  120. const role = computed(() => store.getters["rtc/role"]);
  121. const closetagtype = () => {
  122. store.commit("tag/setTagClickType", {
  123. type: "",
  124. data: {},
  125. });
  126. if (isshoppingguide.value) {
  127. if (role.value == "leader") {
  128. socket.value &&
  129. socket.value.emit("action", {
  130. type: "tagclose",
  131. });
  132. }
  133. }
  134. };
  135. const socket = computed(() => store.getters["rtc/socket"]);
  136. const tags = computed(() => {
  137. return store.getters["tag/tags"] || [];
  138. });
  139. const isshoppingguide = computed(() => store.getters["shoppingguide"]);
  140. const player = computed(() => store.getters["player"]);
  141. const flying = computed(() => store.getters["flying"]);
  142. const metadata = computed(() => store.getters["scene/metadata"]);
  143. const controls = computed(() => {
  144. return metadata.value.controls;
  145. });
  146. const mode = computed(() => store.getters["mode"]);
  147. const showNavigations = computed(() => store.getters["showNavigations"]);
  148. const scene$ = ref(null);
  149. const hadVideo = ref(true);
  150. if (!Cache.get("HIDENVIDEOEXPIRES")) {
  151. if (browser.getURLParam("m") == "eur-KJ-z5ZEV22AeU" && browser.getURLParam("pose") == "pano:408,qua:-0.006,0.6299,0.0049,0.7766") {
  152. Cache.set("HIDENVIDEOEXPIRES", "yes", 60 * 8 * 60);
  153. hadVideo.value = false;
  154. } else {
  155. hadVideo.value = true;
  156. }
  157. }
  158. if (browser.getURLParam("role")) {
  159. hadVideo.value = true;
  160. }
  161. const show = ref(false);
  162. const dataLoaded = ref(false);
  163. const refMiniMap = ref(null);
  164. const isCollapse = ref(false);
  165. const background = ref(null);
  166. const resize = () => {
  167. if (this.$refs.background && (this.mode == "floorplan" || this.mode == "dollhouse")) {
  168. this.$nextTick(() => {
  169. let $active = $(this.$el).find(".tabs .active");
  170. background.value.style.width = $active[0].getBoundingClientRect().width + "px";
  171. background.value.style.left = $active.position().left + "px";
  172. });
  173. }
  174. };
  175. watch(
  176. () => isshoppingguide.value,
  177. (val, old) => {
  178. let $minmap = document.querySelector("[xui_min_map]");
  179. if ($minmap) {
  180. setTimeout(async () => {
  181. if (role.value == "customer") {
  182. await nextTick();
  183. if (isshoppingguide.value) {
  184. $minmap.classList.add("gudieDisabled");
  185. } else {
  186. $minmap.classList.remove("gudieDisabled");
  187. // wxShare({
  188. // title: `cdf澳門上葡京店~`,
  189. // desc: "cdf澳門上葡京店~",
  190. // link: window.location.href.split("#")[0],
  191. // imgUrl: "https://glp-vr.cdfmembers.com/cdf/file/91dd5305525f463286f03a31abd1c154.jpg",
  192. // });
  193. }
  194. }
  195. });
  196. }
  197. },
  198. {
  199. deep: true,
  200. }
  201. );
  202. watch(
  203. () => player.value.showMap,
  204. (val, old) => {
  205. if (!isCollapse.value) {
  206. let $minmap = document.querySelector("[xui_min_map]");
  207. if ($minmap) {
  208. if (val) {
  209. $minmap.classList.remove("collapse");
  210. } else {
  211. $minmap.classList.add("collapse");
  212. }
  213. }
  214. }
  215. },
  216. {
  217. deep: true,
  218. }
  219. );
  220. watch(
  221. () => player.value.showWidgets,
  222. (val, old) => {
  223. let $minmap = document.querySelector("[xui_min_map]");
  224. if ($minmap) {
  225. if (val) {
  226. $minmap.classList.remove("collapse");
  227. } else {
  228. $minmap.classList.add("collapse");
  229. }
  230. }
  231. },
  232. {
  233. deep: true,
  234. }
  235. );
  236. watch(
  237. () => mode.value,
  238. (val, old) => {
  239. console.log(val);
  240. let timer = setTimeout(() => {
  241. clearTimeout(timer);
  242. if (val == "floorplan") {
  243. if (floorplan_ref.value && floorplan_ref.value) {
  244. background.value.style.width = floorplan_ref.value.getBoundingClientRect().width + "px";
  245. background.value.style.left = floorplan_ref.value.offsetLeft + "px";
  246. }
  247. } else if (val == "dollhouse") {
  248. if (dollhouse_ref.value && dollhouse_ref.value) {
  249. background.value.style.width = dollhouse_ref.value.getBoundingClientRect().width + "px";
  250. background.value.style.left = dollhouse_ref.value.offsetLeft + "px";
  251. }
  252. }
  253. }, 0);
  254. },
  255. {
  256. deep: true,
  257. }
  258. );
  259. const floorplan_ref = ref(null);
  260. const dollhouse_ref = ref(null);
  261. const changeMode = (name, e) => {
  262. if (e) {
  263. if (!flying.value) {
  264. store.commit("setMode", name);
  265. }
  266. } else {
  267. store.commit("setMode", name);
  268. }
  269. };
  270. const toggleMap = () => {
  271. isCollapse.value = !isCollapse.value;
  272. let $minmap = document.querySelector("[xui_min_map]");
  273. if ($minmap) {
  274. if (!isCollapse.value) {
  275. $minmap.classList.remove("collapse");
  276. } else {
  277. $minmap.classList.add("collapse");
  278. }
  279. }
  280. };
  281. const onClickTagInfo = (el) => {
  282. el.stopPropagation();
  283. let item = tags.value.find((item) => item.sid == el.target.dataset.id);
  284. if (item.type == "commodity") {
  285. guideclicktag(item);
  286. store.commit("tag/setTagClickType", {
  287. type: "goodlist",
  288. data: item,
  289. });
  290. } else if (item.type == "link_scene") {
  291. guideclicktag(item);
  292. let sceneFirstView = item.hotContent.sceneFirstView;
  293. window.location.href = jumpNewScene(sceneFirstView);
  294. }
  295. };
  296. const guideclicktag = (tag) => {
  297. if (isshoppingguide.value) {
  298. if (role.value == "leader") {
  299. socket.value &&
  300. socket.value.emit("action", {
  301. type: "tagclick",
  302. data: {
  303. sid: tag.sid,
  304. },
  305. });
  306. }
  307. }
  308. return;
  309. };
  310. onMounted(async () => {
  311. apis.burying_point({ type: 0 });
  312. app = createApp({
  313. num: browser.getURLParam("m"),
  314. dom: scene$.value,
  315. mobile: true,
  316. isLoadTags: false,
  317. sceneKind: "tiles",
  318. scene: {
  319. markerOpacity: 1,
  320. markerURL: "https://eurs3.4dkankan.com/cdf/file/43aa29799bfd472298a47cc6370b10cc.png",
  321. pathEndColor: "#FF4641",
  322. },
  323. });
  324. app.use("MinMap", { theme: { camera_fillStyle: "#ED5D18" } });
  325. app.use("Tag");
  326. app
  327. .use("TagView", {
  328. render(data) {
  329. if (data.type == "waterfall") {
  330. return `<span class="tag-icon waterfall animate" style="background-image:url({{icon}})"></span>`;
  331. } else if (data.type == "coupon") {
  332. return `<span class="tag-icon coupon animate" style="background-image:url({{icon}})"></span>`;
  333. } else if (data.type == "applet_link") {
  334. try {
  335. data.hotContent = JSON.parse(data.hotContent);
  336. } catch (error) {}
  337. return `<span class="tag-icon applet_link animate" style="background-image:url(${
  338. data.hotContent.liveIcon.src ? common.changeUrl(data.hotContent.liveIcon.src) : "{{icon}}"
  339. })"></span>`;
  340. } else if (data.type == "link_scene") {
  341. return `<span class="tag-icon animate" style="background-image:url({{icon}})"></span>
  342. <div class="tag-body">
  343. <div data-id="${data.sid}" class="tag-commodity tag-link_scene">
  344. <p class="tag-title">點擊前往下一個區域</p>
  345. </div>
  346. </div>
  347. `;
  348. } else if (data.type == "commodity") {
  349. let arr = data.products.map((item) => item.price);
  350. let priceMin = isFinite(Math.min.apply(null, arr)) ? Math.min.apply(null, arr) : 0;
  351. let priceMax = isFinite(Math.max.apply(null, arr)) ? Math.max.apply(null, arr) : 0;
  352. let price = priceMin == priceMax ? priceMax : `${priceMin}-${priceMax}`;
  353. let range = `${data.products[0] ? data.products[0].symbol : "MOP$"} ${price}`;
  354. return `<span class="tag-icon animate" style="background-image:url({{icon}})"></span>
  355. <div class="tag-body">
  356. <div data-id="${data.sid}" class="tag-commodity">
  357. <div style="background-image:url(${data.products[0] ? data.products[0].pic : ""})" class='tag-avatar'>
  358. </div>
  359. <p class="tag-title">${data.title}</p>
  360. <p class="tag-info">${range} | 查看 ></p>
  361. </div>
  362. </div>
  363. `;
  364. } else {
  365. return `<span class="tag-icon animate" style="background-image:url({{icon}})"></span>`;
  366. }
  367. },
  368. })
  369. .then((view) => {
  370. view.on("click", (e) => {
  371. var tag = e.data;
  372. // 聚焦當前點擊的熱點
  373. view.focus(tag.sid).then(() => {
  374. if (tag.type == "coupon") {
  375. try {
  376. if (isshoppingguide.value) {
  377. return;
  378. }
  379. document.querySelector(`[data-tag-id="${tag.sid}"] .tag-icon`).style.display = "none";
  380. let hotcontent = typeof tag.hotContent == "string" ? JSON.parse(tag.hotContent) : tag.hotContent;
  381. browser.openLink(
  382. "/subPackage/pages/activity/activity?pageId=" + hotcontent.couponLink,
  383. `https://m.cdfmembers.com/shop/600667208/showactivity?pageId=${hotcontent.couponLink}`,
  384. `/pages/showactivity/showactivity?pageId=${hotcontent.couponLink}`
  385. );
  386. apis.burying_point({ type: 2 });
  387. } catch (error) {}
  388. } else if (tag.type == "waterfall") {
  389. store.commit("tag/setTagClickType", {
  390. type: "waterfall",
  391. data: tag,
  392. });
  393. guideclicktag(tag);
  394. } else if (tag.type == "applet_link") {
  395. try {
  396. if (isshoppingguide.value) {
  397. return;
  398. }
  399. let hotcontent = typeof tag.hotContent == "string" ? JSON.parse(tag.hotContent) : tag.hotContent;
  400. browser.openLink(
  401. "/subPackage/pages/home/home?pageType=2&pageId=" + hotcontent.liveLink,
  402. `https://m.cdfmembers.com/shop/600667208/showactivity?pageId=${hotcontent.liveLink}`,
  403. `/pages/showactivity/showactivity?pageId=${hotcontent.liveLink}`
  404. );
  405. } catch (error) {}
  406. } else if (tag.type == "link_scene") {
  407. guideclicktag(tag);
  408. let sceneFirstView = tag.hotContent.sceneFirstView;
  409. window.location.href = jumpNewScene(sceneFirstView);
  410. }
  411. });
  412. });
  413. view.on("focus", (e) => {
  414. document.querySelectorAll("[xui_tags_view] >div").forEach((el) => {
  415. if (el.getAttribute("data-tag-type") == "link_scene" || el.getAttribute("data-tag-type") == "commodity") {
  416. el.querySelector(".tag-body").classList.remove("show");
  417. el.style.zIndex = "auto";
  418. }
  419. });
  420. if (e.data.type == "commodity" || e.data.type == "link_scene") {
  421. e.target.style.zIndex = "999";
  422. e.target.querySelector(".tag-body").classList.add("show");
  423. e.target.querySelector(".tag-commodity").removeEventListener("click", onClickTagInfo);
  424. e.target.querySelector(".tag-commodity").addEventListener("click", onClickTagInfo);
  425. if (tagid) {
  426. document.querySelector(`[data-id="${tagid}"]`) && document.querySelector(`[data-id="${tagid}"]`).click();
  427. tagid = null;
  428. }
  429. }
  430. });
  431. view.on("rendered", (e) => {
  432. tagid && view.focus(tagid);
  433. }); //dom渲染完成
  434. });
  435. app.use("TourPlayer");
  436. // if (!hadVideo.value) {
  437. // app.Scene.lock();
  438. // }
  439. app.Scene.on("ready", () => {
  440. show.value = true;
  441. // wxShare({
  442. // title: `cdf澳門上葡京店~`,
  443. // desc: "cdf澳門上葡京店~",
  444. // link: window.location.href.split("#")[0],
  445. // imgUrl: "https://glp-vr.cdfmembers.com/cdf/file/91dd5305525f463286f03a31abd1c154.jpg",
  446. // });
  447. });
  448. app.Scene.on("error", (data) => {
  449. switch (data.code) {
  450. case 5033:
  451. Dialog.alert("该场景正在计算中,请稍后再试");
  452. break;
  453. case 5034:
  454. Dialog.alert("服务端开小差,请稍后再试");
  455. break;
  456. case 5009:
  457. Dialog.alert("服务端开小差,请稍后再试");
  458. break;
  459. case 5005:
  460. Dialog.alert("服务端开小差,请稍后再试");
  461. break;
  462. }
  463. });
  464. app.Scene.on("loaded", (pano) => {
  465. refMiniMap.value = "[xui_min_map]";
  466. store.commit("setFloorId", pano.floorIndex);
  467. store.commit("rtc/setShowdaogou", true);
  468. if (browser.getURLParam("roomId")) {
  469. store.commit("showShoppingguide", true);
  470. } else {
  471. if (!localStorage.getItem("user_guide")) {
  472. Dialog.confirm({
  473. showCloseIcon: false,
  474. okText: "我知道了",
  475. content:
  476. "<span style='font-size: 16px; line-height: 1.5;'>開發者已遵守收集、使用最終用戶個人信息有關的所有可適用法律、政策和法規,保護用戶個人信息安全。<span/>",
  477. title: "隱私條款:",
  478. single: true,
  479. func: (state) => {
  480. if (state == "ok") {
  481. localStorage.setItem("user_guide", Date.now());
  482. }
  483. },
  484. });
  485. }
  486. }
  487. app.resource.tags(`${process.env.VUE_APP_RESOURCE_URL}cdf/hot/${browser.getURLParam("m")}/hot.json?rnd=${Math.random()}`);
  488. useMusicPlayer();
  489. });
  490. app.Scene.on("panorama.videorenderer.resumerender", () => {
  491. musicPlayer.pause(true);
  492. });
  493. app.Scene.on("panorama.videorenderer.suspendrender", async () => {
  494. let player = await getApp().TourManager.player;
  495. if (!player.isPlaying) {
  496. musicPlayer.resume();
  497. }
  498. });
  499. app.store.on("metadata", (metadata) => {
  500. store.commit("scene/load", metadata);
  501. if (!metadata.controls.showMap) {
  502. app.MinMap.hide(true);
  503. }
  504. dataLoaded.value = true;
  505. });
  506. app.store.on("tags", (tags) => {
  507. store.commit("tag/load", tags);
  508. });
  509. app.Camera.on("mode.beforeChange", ({ fromMode, toMode, floorIndex }) => {
  510. if (fromMode) {
  511. store.commit("setFlying", true);
  512. }
  513. });
  514. app.Camera.on("mode.afterChange", ({ toMode, floorIndex }) => {
  515. store.commit("setFlying", false);
  516. });
  517. app.Camera.on("flying.started", (pano) => {
  518. store.commit("setFlying", true);
  519. });
  520. app.Camera.on("flying.ended", ({ targetPano }) => {
  521. store.commit("setFlying", false);
  522. store.commit("setPanoId", targetPano.id);
  523. if (app.Scene.isCurrentPanoHasVideo) {
  524. apis.burying_point({ type: 5 });
  525. }
  526. });
  527. app.Camera.on("pano.chosen", (pano) => {
  528. apis.burying_point({ type: 4 });
  529. });
  530. app.store.on("tour", async (tour) => {
  531. app.TourManager.load(tour);
  532. store.commit("tour/setData", {
  533. tours: JSON.parse(
  534. JSON.stringify(app.TourManager.tours, (key, val) => {
  535. if (key === "audio") {
  536. return null;
  537. } else {
  538. return val;
  539. }
  540. })
  541. ),
  542. });
  543. store.commit("tour/setBackUp", {
  544. tours: JSON.parse(
  545. JSON.stringify(app.TourManager.tours, (key, val) => {
  546. if (key === "audio") {
  547. return null;
  548. } else {
  549. return val;
  550. }
  551. })
  552. ),
  553. });
  554. });
  555. app.store.on("floorcad", (floor) => store.commit("scene/loadFloorData", floor));
  556. app.render();
  557. document.removeEventListener("visibilitychange", visibilitychangeFn);
  558. document.addEventListener("visibilitychange", visibilitychangeFn);
  559. if (browser.detectWeixin()) {
  560. //ios的ua中无miniProgram,但都有MicroMessenger(表示是微信浏览器)
  561. wx.miniProgram.getEnv((res) => {
  562. if (res.miniprogram) {
  563. window.removeEventListener("hashchange", hashchangefn);
  564. window.addEventListener("hashchange", hashchangefn);
  565. }
  566. });
  567. }
  568. });
  569. </script>
  570. <style lang="scss">
  571. .tab-layer {
  572. width: 100%;
  573. text-align: center;
  574. display: flex;
  575. justify-content: center;
  576. align-items: center;
  577. z-index: 10;
  578. position: fixed;
  579. left: 50%;
  580. transform: translateX(-50%);
  581. top: 2.3rem;
  582. pointer-events: none;
  583. }
  584. .tabs {
  585. pointer-events: auto;
  586. position: relative;
  587. display: flex;
  588. background: #222222;
  589. border-radius: 6px;
  590. padding: 2px;
  591. justify-content: center;
  592. align-items: center;
  593. border: 1px solid rgba(255, 255, 255, 0.1);
  594. box-shadow: inset 0px 0px 6px 0px rgba(0, 0, 0, 0.5);
  595. .background {
  596. position: absolute;
  597. left: 2px;
  598. top: 2px;
  599. bottom: 2px;
  600. width: 50%;
  601. border-radius: 4px;
  602. background: #444444;
  603. box-shadow: 2px 0px 4px 0px rgba(0, 0, 0, 0.3);
  604. z-index: 0;
  605. transition: left 0.3s;
  606. }
  607. span {
  608. flex: 1;
  609. color: #fff;
  610. opacity: 0.5;
  611. border-radius: 6px;
  612. height: 0.94737rem;
  613. font-size: 0.36842rem;
  614. transition: all 0.3s ease;
  615. display: flex;
  616. align-items: center;
  617. justify-content: center;
  618. padding-left: 10px;
  619. padding-right: 10px;
  620. white-space: nowrap;
  621. z-index: 1;
  622. i {
  623. font-size: 0.47368rem;
  624. margin-right: 4px;
  625. pointer-events: none;
  626. }
  627. }
  628. span.active {
  629. opacity: 1;
  630. }
  631. }
  632. [xui_tags_view] {
  633. .tag-body {
  634. /* display: none; */
  635. position: absolute;
  636. left: 50%;
  637. bottom: 50px;
  638. transform: translateX(-50%) scale(0);
  639. transform-origin: bottom;
  640. transition: all 0.3s cubic-bezier(0.35, 0.32, 0.65, 0.63);
  641. // pointer-events: none;
  642. .tag-commodity,
  643. .tag-link_scene {
  644. min-width: 230px;
  645. height: 76px;
  646. background: rgba(255, 255, 255, 0.8);
  647. box-shadow: 0px 3px 6px 0px rgba(0, 0, 0, 0.16);
  648. border-radius: 2px;
  649. position: relative;
  650. margin-bottom: 30px;
  651. &::before {
  652. content: "";
  653. display: inline-block;
  654. left: 50%;
  655. transform: translateX(-50%);
  656. width: 2px;
  657. height: 28px;
  658. bottom: -30px;
  659. background: linear-gradient(145deg, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0));
  660. position: absolute;
  661. }
  662. .tag-avatar {
  663. position: absolute;
  664. z-index: 99;
  665. width: 80px;
  666. height: 80px;
  667. background: #ffffff;
  668. box-shadow: 0px 3px 6px 0px rgb(0 0 0 / 16%);
  669. border-radius: 2px;
  670. top: -14px;
  671. left: -12px;
  672. background-size: cover;
  673. pointer-events: none;
  674. }
  675. > p {
  676. color: #131d34;
  677. font-size: 16px;
  678. pointer-events: none;
  679. }
  680. .tag-title {
  681. padding: 10px 10px 10px 76px;
  682. overflow: hidden;
  683. text-overflow: ellipsis;
  684. white-space: nowrap;
  685. width: 240px;
  686. }
  687. .tag-info {
  688. padding: 0 20px 0 76px;
  689. font-size: 12px;
  690. overflow: hidden;
  691. text-overflow: ellipsis;
  692. white-space: nowrap;
  693. }
  694. }
  695. &.show {
  696. transform: translateX(-50%) scale(1);
  697. }
  698. .tag-link_scene {
  699. height: auto;
  700. min-width: unset;
  701. .tag-title {
  702. padding: 10px;
  703. width: auto;
  704. text-align: center;
  705. }
  706. }
  707. }
  708. .coupon {
  709. width: 84px !important;
  710. height: 84px !important;
  711. &::after {
  712. content: "發現好禮";
  713. width: 100%;
  714. color: #ed5d18;
  715. position: absolute;
  716. bottom: -24px;
  717. text-align: center;
  718. font-size: 14px;
  719. }
  720. }
  721. .waterfall {
  722. width: 90px !important;
  723. height: 90px !important;
  724. }
  725. .applet_link {
  726. width: 64px !important;
  727. height: 64px !important;
  728. border-radius: 50%;
  729. background-color: #fff;
  730. border: 1px solid #ed5d18;
  731. position: relative;
  732. overflow: hidden;
  733. &::after {
  734. content: "直播中";
  735. width: 100%;
  736. height: 20px;
  737. background: #ed5d18;
  738. position: absolute;
  739. bottom: 0;
  740. text-align: center;
  741. line-height: 1.2;
  742. font-size: 12px;
  743. border-radius: 26%;
  744. }
  745. }
  746. }
  747. .gudieDisabled {
  748. pointer-events: none !important;
  749. * {
  750. pointer-events: none !important;
  751. }
  752. }
  753. @media (orientation: landscape) {
  754. .tab-layer {
  755. top: 1.2rem;
  756. .tabs {
  757. height: 0.7rem;
  758. > span {
  759. height: 0.7rem;
  760. font-size: 0.25rem;
  761. }
  762. }
  763. }
  764. }
  765. </style>