123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760 |
- <template>
- <div class="header">
- <div class="left" :class="{ show: player.showVR }">
- <div
- v-show="mode != 'panorama'"
- :class="{ disabled: flying }"
- class="back-pano"
- @click="onChangeMode"
- >
- <ui-icon type="show_back"></ui-icon>
- </div>
- <div v-show="mode == 'panorama'" class="back" @click="onBack">
- <ui-icon type="_back"></ui-icon>
- </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"></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>
- <div class="url-share" v-show="showCopy">
- <div>
- <div class="tips">
- <h4>分享链接给好友</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">取消</ui-button>
- <ui-button class="primary" :data-clipboard-text="copyLink" ref="copy$"
- >一键复制</ui-button
- >
- </div>
- </div>
- </div>
- </div>
- </template>
- <script setup>
- import ClipboardJS from "clipboard";
- import browser from "@/utils/browser";
- import { useStore } from "vuex";
- import { Dialog } from "@/global_components/";
- import { MessageToApp, NotchHeight } from "@/utils/platform";
- import { onMounted, watch, computed, ref, nextTick } from "vue";
- const store = useStore();
- 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 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 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(() => {
- 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();
- };
- });
- });
- 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(() => {
- if (name == "music") {
- onMusicClick();
- // if (isMusicPlaying.value) {
- // musicPlayer.pause()
- // } else {
- // musicPlayer.play()
- // }
- } else if (name == "share") {
- showCopy.value = true;
- } else if (name === "measure") {
- this.$bus.emit("measure/Handle", "start");
- } else if (name == "vr") {
- store.commit("showVR");
- }
- });
- };
- 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");
- };
- </script>
- <style lang="scss" scoped>
- .disable {
- opacity: 1;
- }
- .header {
- position: absolute;
- top: 10px;
- left: 0;
- height: 44px;
- width: 100%;
- z-index: 101;
- color: #fff;
- display: flex;
- align-items: center;
- text-shadow: 0px 0px 4px rgba(0, 0, 0, 0.4);
- pointer-events: auto;
- &.app {
- top: 1rem;
- }
- .left {
- width: 1rem;
- height: 100%;
- display: flex;
- align-items: center;
- justify-content: center;
- &.show {
- visibility: visible;
- pointer-events: auto;
- .back {
- visibility: visible;
- }
- }
- .back {
- width: 0.78rem;
- height: 0.78rem;
- border-radius: 50%;
- background-color: rgba(0, 0, 0, 0.3);
- display: flex;
- align-items: center;
- justify-content: center;
- visibility: hidden;
- position: relative;
- i {
- font-size: 0.3rem;
- width: auto;
- position: static;
- }
- }
- .back-pano {
- width: 100%;
- height: 100%;
- display: flex;
- align-items: center;
- justify-content: center;
- // padding-left: 15px;
- position: relative;
- i {
- font-size: 0.6rem;
- 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;
- > i {
- font-size: 0.6rem;
- }
- > 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;
- 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;
- pointer-events: auto;
- > 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: 10px;
- transform: translateX(-50%);
- }
- &.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: fixed;
- 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;
- max-height: 80vh;
- max-height: calc(var(--vh) * 80);
- overflow: scroll;
- -webkit-overflow-scrolling: touch;
- // z-index: 10000;
- pointer-events: auto;
- * {
- pointer-events: auto;
- -webkit-overflow-scrolling: touch;
- }
- &.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;
- :deep(p) {
- word-break: break-word;
- }
- :deep(a) {
- color: var(--editor-main-color);
- }
- }
- }
- .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>
|