| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946 |
- <template>
- <div class="header" @touchmove.prevent>
- <div class="left" v-show="player.showWidgets" :class="{ show: showMusic }">
- <div class="music" @click.stop="onMusicClick">
- <img :src="require(`@/assets/images/icon/${showMusicPlaying ? 'music_on@2x' : 'music_off@2x'}.png`)" alt="" />
- </div>
- </div>
- <div class="title" :class="{ up: player.showDescription, drak: mode != 'panorama', empty: !description }"
- @click="onShowDescription" v-show="player.showWidgets">
- <div>
- <span>
- {{ metadata.title }}
- </span>
- <i class="iconfont icon-pull-down"></i>
- </div>
- </div>
- <div class="right" :class="{ more: player.showMore }" v-show="player.showWidgets" @click="onShowMore">
- <img :src="require(`@/assets/images/icon/${player.lang}.png`)" alt="" />
- <keep-alive>
- <transition appear name="custom-classes-transition" enter-active-class="animated fadeInUp short faster"
- leave-active-class="animated fadeOutDown short faster">
- <div v-if="player.showMore">
- <ul>
- <li @click.stop="onMenuClick('zh_CN')">
- <img :src="require(`@/assets/images/icon/zh_CN.png`)" alt="" />
- <span>简体中文</span>
- </li>
- <li @click.stop="onMenuClick('zh_HK')">
- <img :src="require(`@/assets/images/icon/zh_HK.png`)" alt="" />
- <span>繁体中文</span>
- </li>
- <li @click.stop="onMenuClick('en')">
- <img :src="require(`@/assets/images/icon/en.png`)" alt="" />
- <span>English</span>
- </li>
- </ul>
- </div>
- </transition>
- </keep-alive>
- </div>
- <transition appear name="custom-classes-transition" enter-active-class="animated fadeInUp short faster"
- leave-active-class="animated fadeOutDown short faster">
- <div class="content" :class="{ drak: mode != 'panorama' }" v-if="player.showDescription"
- @click="onShowDescription">
- <div>
- <div v-html="description"></div>
- </div>
- </div>
- </transition>
- <teleport to="body">
- <template v-if="isApp">
- <transition appear name="custom-classes-transition" enter-active-class="animated fadeInUp short faster"
- leave-active-class="animated fadeOutDown short faster">
- <div class="app-share" v-if="showShare">
- <ul :class="{ flex: getLocale() == 'zh' }">
- <li @click="onShare('weixin')">
- <ui-icon type="_wechat"></ui-icon>
- <div>{{ $t("share.wechat") }}</div>
- </li>
- <li @click="onShare('weixinFriend')">
- <ui-icon type="_friend"></ui-icon>
- <div>{{ $t("share.friends") }}</div>
- </li>
- <li @click="onShare('qq')">
- <ui-icon type="_qq"></ui-icon>
- <div>{{ $t("share.qq") }}</div>
- </li>
- <li v-if="getLocale() != 'zh'" @click="onShare('faceBook')">
- <ui-icon type="icon_share_facebook"></ui-icon>
- <div>{{ $t("share.facebook") }}</div>
- </li>
- <li v-if="getLocale() != 'zh'" @click="onShare('whatsApp')">
- <ui-icon type="icon_share_whatsapp"></ui-icon>
- <div>{{ $t("share.whatsApp") }}</div>
- </li>
- <li @click="onShare('copy')">
- <ui-icon type="link1"></ui-icon>
- <div>{{ $t("share.copyLink") }}</div>
- </li>
- </ul>
- <div @click="showShare = false">{{ $t("common.cancel") }}</div>
- </div>
- </transition>
- </template>
- </teleport>
- <div class="url-share" v-show="showCopy">
- <div>
- <div class="tips">
- <h4>{{ $t("share.shareLinkTips") }}</h4>
- <i class="iconfont iconshow_cancel" @click="showCopy = false"></i>
- </div>
- <div class="url">{{ copyLink }}</div>
- <div class="btns">
- <ui-button class="cancel" @click="showCopy = false">{{ $t("common.cancel") }}</ui-button>
- <ui-button class="primary" :data-clipboard-text="copyLink" ref="copy$">{{ $t("share.fastCopy") }}</ui-button>
- </div>
- </div>
- </div>
- </div>
- <div class="rules-btn" v-if="showRules">
- <ui-button type="cancel" @click="cancelRules">取消</ui-button>
- <ui-button type="primary" :class="{ disabled: !next }" @click="confirmRules">确定起点({{ rulesIndex }}/2)</ui-button>
- </div>
- </template>
- <script setup>
- import ClipboardJS from "clipboard";
- import browser from "@/utils/browser";
- import { useStore } from "vuex";
- import { Dialog } from "@/global_components/";
- import { IsApp, MessageToApp, NotchHeight } from "@/utils/platform";
- import { useMusicPlayer } from "@/utils/sound";
- import { onMounted, watch, computed, ref, nextTick } from "vue";
- import { useApp, getApp } from "@/app";
- import i18n, { getLocale, setI18nLanguage, useI18n, loadLocaleMessages } from "@/i18n";
- const store = useStore();
- const { t } = useI18n({ useScope: "global" });
- let getUrl = (href, queryArr) => {
- queryArr.forEach((item) => {
- if (!browser.hasURLParam(item.key)) {
- let ttt = href.split("index.html?");
- href = `${ttt[0]}index.html?${item.key}=${item.val}&${ttt[1]}`;
- } else {
- href = browser.replaceQueryString(href, item.key, item.val);
- }
- });
- return href;
- };
- let share_url = browser.getURLParam("share_url");
- if (share_url) {
- share_url = decodeURIComponent(share_url);
- } else {
- share_url = location.href.split("#")[0];
- }
- const deploy = ref(process.env.VUE_APP_DEPLOY);
- const musicPlayer = useMusicPlayer();
- const loadingLogoFile = computed(() => store.getters["scene/loadingLogoFile"]);
- const metadata = computed(() => store.getters["scene/metadata"]);
- const controls = computed(() => {
- return metadata.value.controls;
- });
- const showMusicPlaying = ref(false);
- const showMusic = computed(() => store.getters["scene/metadata"].music);
- const player = computed(() => store.getters["player"]);
- const flying = computed(() => store.getters["flying"]);
- const copy$ = ref(null);
- const copyLink = computed(() => {
- return share_url.replace("&app", "");
- });
- const isApp = ref(IsApp);
- const showCopy = ref(false);
- const showShare = ref(false);
- const isMusicPlaying = ref(false);
- const mode = computed(() => store.getters["mode"]);
- const description = computed(() => metadata.value.description);
- watch(
- () => showCopy.value,
- (val, old) => {
- store.commit("SetPlayerOptions", {
- showMap: !showCopy.value,
- showToolbar: !showCopy.value,
- });
- },
- {
- deep: true,
- }
- );
- watch(
- () => showShare.value,
- (val, old) => {
- store.commit("SetPlayerOptions", {
- showMap: !showShare.value,
- showToolbar: !showShare.value,
- });
- },
- {
- deep: true,
- }
- );
- onMounted(() => {
- useApp().then((app) => {
- app.TagManager.on("tagManager.markTagPos", (res) => {
- next.value = true;
- });
- });
- new ClipboardJS(copy$.value.$el).on("success", function (e) {
- e.clearSelection();
- showCopy.value = false;
- Dialog.toast({ content: t("toast.copySuccess"), type: "success" });
- });
- nextTick(() => {
- document.querySelector(".player").addEventListener("touchstart", () => {
- if (player.value.showMore) {
- store.commit("SetPlayerOptions", {
- showMore: false,
- showMap: true,
- showToolbar: true,
- });
- } else if (player.value.showDescription) {
- store.commit("SetPlayerOptions", {
- showDescription: false,
- showMap: true,
- showToolbar: true,
- });
- }
- });
- window.Back = () => {
- onBack();
- };
- musicPlayer.on("play", () => (showMusicPlaying.value = true));
- musicPlayer.on("pause", () => (showMusicPlaying.value = false));
- });
- });
- const onListen = () => {
- // this.$bus.on('orientation', () => {
- if (NotchHeight) {
- this.$el.style.top = NotchHeight + "px";
- }
- // 发送返回按钮信息
- const rect = document.querySelector(".back").getBoundingClientRect();
- const data = {
- BackBtnInfo: {
- left: rect.left,
- top: rect.top,
- radius: rect.width / 2,
- },
- };
- if (browser.detectAndroid()) {
- MessageToApp(JSON.stringify(data));
- } else {
- MessageToApp(data);
- }
- // })
- };
- const onBack = () => {
- // player.value.showVR && store.commit('showVR')
- if (player.value.showVR) {
- MessageToApp("VRMode0");
- store.commit("showVR");
- }
- };
- const onShowMore = () => {
- let show = !player.value.showMore;
- store.commit("SetPlayerOptions", {
- showMore: show,
- showMap: show == false,
- showToolbar: show == false,
- showDescription: false,
- });
- };
- const onShowDescription = () => {
- let show = !player.value.showDescription;
- store.commit("SetPlayerOptions", {
- showMore: false,
- showMap: show == false,
- showToolbar: show == false,
- showDescription: show,
- });
- };
- const onMusicClick = () => {
- showMusicPlaying.value ? musicPlayer.pause() : musicPlayer.play();
- };
- const onMenuClick = (name) => {
- store.commit("SetPlayerOptions", {
- showMore: false,
- showDescription: false,
- showMap: true,
- showToolbar: true,
- });
- nextTick(() => {
- loadLocaleMessages(i18n, name).then(() => {
- setI18nLanguage(i18n, name);
- store.commit("SetPlayerOptions", {
- lang: name,
- });
- let tmp = getUrl(window.location.href, [
- {
- key: "lang",
- val: name,
- },
- ]);
- console.log(tmp);
- history.replaceState(null, null, tmp);
- setTimeout(() => {
- window.location.reload()
- }, 0);
- });
- });
- };
- const onShare = (name) => {
- if (name == "copy") {
- showShare.value = false;
- nextTick(() => {
- showCopy.value = true;
- });
- } else {
- MessageToApp(`Share-${name}`);
- showCopy.value = false;
- showShare.value = false;
- }
- };
- const onChangeMode = () => {
- store.commit("setMode", "panorama");
- };
- const rulesIndex = ref(1);
- // const emits = defineEmits(['close'])
- const confirmRules = () => {
- next.value = false;
- getApp().TagManager.confirmMeasure(rulesIndex.value);
- if (rulesIndex.value < 2) {
- Dialog.toast({
- content: "起点确定完毕,请定位终点",
- });
- rulesIndex.value++;
- } else {
- cancelRules();
- }
- };
- const showRules = ref(false);
- const cancelRules = () => {
- showRules.value = false;
- rulesIndex.value = 1;
- getApp().TagManager.cancelMeasure();
- store.commit("toggleUi");
- };
- const next = ref(false);
- </script>
- <style lang="scss" scoped>
- .disable {
- opacity: 1;
- }
- .rules-btn {
- background: rgba(0, 0, 0, 0.8);
- position: fixed;
- height: 1.3333rem;
- width: 100%;
- bottom: 0;
- left: 0;
- display: flex;
- align-items: center;
- justify-content: center;
- .ui-button {
- width: 40%;
- height: 1.0667rem;
- &.cancel {
- margin-right: 10px;
- }
- }
- }
- .header {
- position: absolute;
- top: 0.3rem;
- left: 0;
- height: 1.15789rem;
- width: 100%;
- z-index: 101;
- color: #fff;
- display: flex;
- align-items: center;
- text-shadow: 0px 0px 4px rgba(0, 0, 0, 0.4);
- &.app {
- top: 1rem;
- }
- .left {
- width: 1.28rem;
- height: 100%;
- display: flex;
- align-items: center;
- justify-content: flex-end;
- pointer-events: none;
- &.show {
- visibility: visible;
- pointer-events: auto;
- .music {
- visibility: visible;
- pointer-events: auto;
- }
- }
- .music {
- width: 0.50rem;
- height: 0.50rem;
- display: flex;
- align-items: center;
- justify-content: center;
- visibility: hidden;
- position: relative;
- >img {
- width: 100%;
- height: auto;
- position: static;
- }
- }
- }
- .right {
- position: relative;
- width: 1.28rem;
- height: 100%;
- padding-right: 15px;
- display: flex;
- align-items: center;
- justify-content: flex-end;
- z-index: 11;
- opacity: 0;
- pointer-events: none;
- >i {
- font-size: 0.6rem;
- }
- >img {
- width: 20px;
- }
- >div {
- position: absolute;
- display: flex;
- flex-direction: column;
- right: 10px;
- top: 1.3rem;
- padding: 4px 0.42105rem;
- background-color: rgba(0, 0, 0, 0.5);
- border-radius: 5px;
- &::after {
- content: "";
- position: absolute;
- top: -5px;
- right: 0.3rem;
- width: 0;
- height: 0;
- border-width: 0 5px 5px;
- border-style: solid;
- border-color: transparent transparent rgba(0, 0, 0, 0.5);
- }
- &.flex {
- li {
- span {
- flex: 1;
- width: auto;
- // min-width: 2.8rem;
- }
- }
- }
- li {
- position: relative;
- display: flex;
- align-items: center;
- justify-content: center;
- // margin-top: 0.3rem;
- font-size: 0;
- // height: .5333rem;
- padding: 0.1333rem 0 0.2667rem;
- >img {
- width: 22px;
- margin-right: 6px;
- }
- i {
- // position: absolute;
- // left: 0;
- // top: 0;
- // font-size: 0.45rem;
- font-size: 0.3733rem;
- margin-right: 0.4rem;
- }
- b {
- position: absolute;
- left: 0.32rem;
- top: 0.33rem;
- width: 7px;
- height: 7px;
- border-radius: 50%;
- background-color: #00c2c4;
- i {
- color: #fff;
- font-size: 12px;
- transform: scale(0.3, 0.3);
- top: -4px;
- left: -3px;
- position: absolute;
- }
- }
- span {
- width: 1.89474rem;
- white-space: nowrap;
- text-align: left;
- // padding-bottom: 0.3rem;
- // margin-left: 0.75rem;
- font-size: 0.3733rem;
- // text-indent: 0.2rem;
- // padding-right: 0.2rem;
- }
- }
- .home {
- border-top: solid 1px rgba(255, 255, 255, 0.4);
- a {
- width: 1.89474rem;
- margin-top: 0.3rem;
- margin-bottom: 0.1rem;
- margin-left: auto;
- margin-right: auto;
- display: block;
- text-decoration: none;
- overflow: hidden;
- img {
- width: 100%;
- outline: none;
- border: none;
- }
- }
- }
- }
- }
- .title {
- display: flex;
- flex: 1;
- width: 100%;
- height: 100%;
- font-size: 0.42105rem;
- letter-spacing: 1px;
- align-items: center;
- justify-content: center;
- >div {
- display: flex;
- transition: background 0.3s ease, min-width 0.3s ease, border-radius 0.3s ease;
- align-items: center;
- justify-content: center;
- padding-right: 12px;
- padding-left: 12px;
- white-space: nowrap;
- position: absolute;
- height: 100%;
- min-width: 100%;
- overflow: visible;
- pointer-events: none;
- background: linear-gradient(90deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.15) 50%, rgba(0, 0, 0, 0) 100%);
- }
- span {
- display: inline-block;
- position: relative;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- max-width: 7rem;
- }
- i {
- transition: all 0.3s;
- position: absolute;
- left: 50%;
- bottom: 0;
- font-size: 0.3rem;
- transform: translateX(-50%);
- margin-bottom: 0.07rem;
- }
- &.up {
- i {
- transform: translateX(-50%) rotate(180deg);
- }
- >div {
- min-width: 0;
- //position: static;
- flex-shrink: 0;
- background-color: rgba(0, 0, 0, 0.5);
- border-radius: 1.15789rem;
- }
- &.drak {
- >div {
- background-color: rgba(0, 0, 0, 0.8);
- }
- }
- }
- &.empty {
- i {
- display: none;
- }
- }
- }
- .content {
- position: absolute;
- top: 1.6rem;
- left: 0.92105rem;
- right: 0.92105rem;
- padding: 10px;
- background: rgba(0, 0, 0, 0.5);
- border-radius: 5px;
- font-size: 0.36842rem;
- text-align: center;
- &.drak {
- background: rgba(0, 0, 0, 0.8);
- }
- >div {
- display: inline-block;
- text-align: left;
- letter-spacing: 1px;
- word-break: break-all;
- white-space: normal;
- line-height: 1.5;
- // h4 {
- // margin: 0;
- // padding: 0;
- // margin-bottom: 0.28rem;
- // font-size: 0.43rem;
- // padding-left: 0.18789rem;
- // width: 100%;
- // position: relative;
- // &::before {
- // content: "";
- // position: absolute;
- // left: 0;
- // top: 50%;
- // height: 80%;
- // transform: translateY(-50%);
- // width: 2px;
- // background-color: var(--editor-main-color);
- // }
- // }
- :deep(p) {
- word-break: break-word;
- margin: 8px 0;
- font-size: 16px;
- }
- :deep(a) {
- // color: var(--editor-main-color);
- color: #fff;
- font-size: 16px;
- text-decoration: none;
- }
- }
- // &::after {
- // content: "";
- // position: absolute;
- // top: -6px;
- // left: 50%;
- // margin-left: -3px;
- // width: 0;
- // height: 0;
- // border-width: 0 7px 6px;
- // border-style: solid;
- // border-color: transparent transparent rgba(0, 0, 0, 0.5);
- // }
- }
- .url-share {
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background-color: rgba(0, 0, 0, 0.1);
- >div {
- position: absolute;
- left: 0.6rem;
- right: 0.6rem;
- top: 50vh;
- transform: translateY(-50%);
- border-radius: 4px;
- background-color: rgba(0, 0, 0, 0.5);
- padding: 0.31579rem;
- font-size: 0.36842rem;
- .tips {
- display: flex;
- align-items: center;
- justify-content: space-between;
- h4 {
- margin: 0;
- font-size: 0.42105rem;
- }
- i {
- font-size: 0.6rem;
- }
- }
- .url {
- display: -webkit-box;
- color: #fff;
- text-align: center;
- padding: 0.26316rem;
- width: 100%;
- height: 1.8rem;
- margin: 0.7rem 0rem;
- border-radius: 0.07rem;
- line-height: 1.99;
- font-size: 0.36842rem;
- background-color: rgba(0, 0, 0, 0.35);
- overflow: hidden;
- text-overflow: ellipsis;
- word-break: break-all;
- word-wrap: break-word;
- -webkit-line-clamp: 2; //在第几行加省略号
- -webkit-box-orient: vertical;
- }
- .btns {
- display: flex;
- justify-content: space-between;
- button {
- font-size: 0.36842rem;
- width: 47%;
- height: 1.05263rem;
- border-radius: 1.05263rem;
- &.submit {
- background: #00c2c4;
- }
- }
- }
- }
- }
- }
- @media (orientation: landscape) {
- .header {
- top: 0.2rem;
- height: 0.7rem;
- &.app {
- top: 0.2rem;
- }
- .left {
- .back-pano {
- i {
- font-size: 0.5rem;
- }
- }
- }
- .right {
- >i {
- font-size: 0.5rem;
- }
- >div {
- right: 10px;
- top: 0.75rem;
- padding: 4px 0.2rem;
- &::after {
- right: 0.23rem;
- }
- li {
- margin-top: 0.15rem;
- i {
- font-size: 0.3rem;
- }
- b {
- left: 0.2rem;
- top: 0.15rem;
- }
- span {
- padding-bottom: 0.15rem;
- margin-left: 0.5rem;
- font-size: 0.25rem;
- }
- }
- .home {
- a {
- margin-top: 0.15rem;
- margin-bottom: 0rem;
- width: 1.4rem;
- }
- }
- }
- }
- .title {
- font-size: 0.3rem;
- }
- .content {
- top: 1rem;
- left: 2rem;
- right: 2rem;
- padding: 10px;
- >div {
- max-height: 3rem;
- font-size: 0.25rem;
- line-height: 1.5;
- }
- }
- }
- }
- // ipad 横屏
- @media only screen and (min-device-width: 768px) and (orientation: landscape) {
- .header {
- height: 0.8rem;
- .title {
- i {
- margin-bottom: 0;
- }
- }
- }
- }
- .app-share {
- position: fixed;
- left: 0;
- bottom: 0;
- width: 100%;
- background-color: #fff;
- color: var(--editor-main-color);
- text-shadow: none;
- border-radius: 0.146667rem 0.146667rem 0px 0px;
- z-index: 1000;
- i {
- // font-size: 2rem;
- font-size: 1rem;
- margin: 0.666667rem 0 0.106667rem;
- display: inline-block;
- }
- ul {
- // display: flex;
- // justify-content: space-around;
- overflow: hidden;
- div {
- text-align: center;
- // margin-top: -0.3rem;
- font-size: 0.34rem;
- }
- li {
- width: 33.3%;
- float: left;
- // padding-bottom: 0.5rem;
- overflow: hidden;
- text-align: center;
- // i{
- // font-size: 2rem;
- // }
- }
- &.flex {
- display: flex;
- li {
- float: none;
- }
- }
- }
- >div {
- height: 1.293333rem;
- font-size: 16px;
- text-align: center;
- // padding: 0.5rem;
- border-top: solid 1px #eeeeee;
- margin-top: 0.466667rem;
- line-height: 1.293333rem;
- }
- }
- </style>
- <style lang="scss">
- .animated.short {
- &.faster {
- animation-duration: 0.3s;
- }
- @keyframes fadeInUp {
- 0% {
- opacity: 0;
- transform: translate3d(0, 1rem, 0);
- }
- to {
- opacity: 1;
- transform: translateZ(0);
- }
- }
- @keyframes fadeOutDown {
- 0% {
- opacity: 1;
- }
- to {
- opacity: 0;
- transform: translate3d(0, 1rem, 0);
- }
- }
- }
- </style>
|