123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278 |
- <template>
- <div class="metaverse-root">
- <article v-if="isShowDesc">
- <button
- class="close"
- @click="onClickCloseDesc"
- />
- <h2>{{ desc.name }}</h2>
- <img
- class="splitter"
- src="@/assets/images/splitter.png"
- alt=""
- draggable="false"
- >
- <!-- <img
- class="banner"
- src="@/assets/images/for-dev.jpg"
- alt=""
- draggable="false"
- > -->
- <div
- class="txt"
- v-html="desc.detail || ''"
- />
- </article>
- <!-- element-ui的loading效果从调用到出现有延时,这期间要遮盖住组件 -->
- <div
- v-show="isShowLoadingMask"
- class="loading-mask"
- />
- </div>
- </template>
- <script>
- import {
- reactive,
- toRefs,
- ref,
- onMounted,
- } from 'vue'
- export default {
- name: 'MetaverseView',
- beforeRouteLeave() {
- gUnityInst.SendMessage('Page4', 'ResetCamera')
- },
- setup () {
- const rawData = reactive({ value: null })
- onMounted(async () => {
- rawData.value = await api.getMetaverseList()
- })
- const isShowDesc = ref(false)
- const desc = reactive({})
- function onClickCloseDesc() {
- isShowDesc.value = false
- gUnityInst.SendMessage('Page4', 'ResetCamera')
- }
- function onClickStar(idx) {
- desc.name = rawData.value[idx].name
- desc.detail = rawData.value[idx].description
- isShowDesc.value = true
- }
- window.handleClickPlanet = function(id) {
- console.log('click planet', id)
- onClickStar(id - 1)
- }
- onMounted(async () => {
- const url = window.location.href
- if (url.includes('id=')) {
- const id = url.split('id=')[1]
- // console.log('ppppppppppppppppp', id)
- setTimeout(() => {
- onClickStar(Number(id))
- }, 400)
- }
- })
- window.handleMovedPlanet = function(id) {
- console.log('moved planet', id)
- }
- const isShowLoadingMask = ref(true)
- onMounted(() => {
- setTimeout(() => {
- isShowLoadingMask.value = false
- }, 200)
- })
- return {
- rawData,
- isShowDesc,
- desc,
- onClickCloseDesc,
- onClickStar,
- isShowLoadingMask,
- }
- }
- }
- </script>
- <style lang="less" scoped>
- .metaverse-root {
- height: 100%;
- position: relative;
- pointer-events: none;
- >article {
- pointer-events: initial;
- position: absolute;
- top: calc(100% / 2);
- transform: translateY(-50%);
- right: 102px;
- width: 653px;
- height: calc(100% - 74px - 50px);
- max-height: 740px;
- backdrop-filter: blur(10px);
- background-image: url(@/assets/images/general-article-bg.png);
- background-size: 100% auto;
- background-repeat: no-repeat;
- background-position: left top;
- padding: 32px 50px 50px 50px;
- display: flex;
- flex-direction: column;
- @media only screen and (max-width: 1700px) {
- right: 0;
- }
- >button.close {
- position: absolute;
- top: 30px;
- right: 50px;
- width: 32px;
- height: 32px;
- background-image: url(@/assets/images/icon-close.png);
- background-size: cover;
- background-repeat: no-repeat;
- background-position: center center;
- }
- >h2 {
- flex: 0 0 auto;
- font-size: 24px;
- font-family: Source Han Sans CN-Bold, Source Han Sans CN;
- font-weight: bold;
- color: #FFFFFF;
- margin-bottom: 21px;
- }
- >img.splitter {
- flex: 0 0 auto;
- width: 100%;
- margin-bottom: 37px;
- }
- >img.banner {
- flex: 0 0 auto;
- width: 100%;
- height: 34.8%;
- object-fit: contain;
- margin-bottom: 20px;
- }
- >.txt {
- flex: 1 0 1px;
- font-size: 20px;
- font-family: Source Han Sans CN-Light, Source Han Sans CN;
- font-weight: 400;
- color: rgba(255, 255, 255, 0.8);
- line-height: 1.7;
- overflow: auto;
- padding-right: 10px;
- margin-right: -10px;
- &::-webkit-scrollbar { background: transparent; width: 4px; } /*宽度是对垂直滚动条而言,高度是对水平滚动条而言*/
- &::-webkit-scrollbar-thumb {
- background: rgba(220, 231, 240, 0.2);
- border-radius: 2px;
- }
- }
- }
- .loading-mask {
- position: absolute;
- left: 0;
- top: 0;
- width: 100%;
- height: 100%;
- background: black;
- }
- }
- .mobile {
- .metaverse-root {
- height: 100%;
- position: relative;
- pointer-events: none;
- >article {
- pointer-events: initial;
- position: absolute;
- top: calc(100% / 2);
- transform: translateY(-50%);
- right: calc(102 / 1080 * 83vh);
- width: calc(653 / 1080 * 83vh);
- height: calc(100% - 74px - 50px);
- max-height: calc(740 / 1080 * 83vh);
- backdrop-filter: blur(10px);
- background-image: url(@/assets/images/general-article-bg.png);
- background-size: 100% auto;
- background-repeat: no-repeat;
- background-position: left top;
- padding: calc(32 / 1080 * 83vh) calc(50 / 1080 * 83vh) calc(50 / 1080 * 83vh) calc(50 / 1080 * 83vh);
- display: flex;
- flex-direction: column;
- @media only screen and (max-width: 1700px) {
- right: 0;
- }
- >button.close {
- position: absolute;
- top: calc(30 / 1080 * 83vh);
- right: calc(50 / 1080 * 83vh);
- width: calc(32 / 1080 * 83vh);
- height: calc(32 / 1080 * 83vh);
- background-image: url(@/assets/images/icon-close.png);
- background-size: cover;
- background-repeat: no-repeat;
- background-position: center center;
- }
- >h2 {
- flex: 0 0 auto;
- font-size: calc(24 / 1080 * 83vh);
- font-family: Source Han Sans CN-Bold, Source Han Sans CN;
- font-weight: bold;
- color: #FFFFFF;
- margin-bottom: calc(21 / 1080 * 83vh);
- }
- >img.splitter {
- flex: 0 0 auto;
- width: 100%;
- margin-bottom: calc(37 / 1080 * 83vh);
- }
- >img.banner {
- flex: 0 0 auto;
- width: 100%;
- height: 34.8%;
- object-fit: contain;
- margin-bottom: calc(20 / 1080 * 83vh);
- }
- >.txt {
- flex: 1 0 1px;
- font-size: calc(20 / 1080 * 83vh);
- font-family: Source Han Sans CN-Light, Source Han Sans CN;
- font-weight: 400;
- color: rgba(255, 255, 255, 0.8);
- line-height: 1.7;
- overflow: auto;
- padding-right: calc(10 / 1080 * 83vh);
- margin-right: calc(-10 / 1080 * 83vh);
- &::-webkit-scrollbar { background: transparent; width: calc(4 / 1080 * 83vh); } /*宽度是对垂直滚动条而言,高度是对水平滚动条而言*/
- &::-webkit-scrollbar-thumb {
- background: rgba(220, 231, 240, 0.2);
- border-radius: 2px;
- }
- }
- }
- .loading-mask {
- position: absolute;
- left: 0;
- top: 0;
- width: 100%;
- height: 100%;
- background: black;
- }
- }
- }
- </style>
|