Metaverse.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. <template>
  2. <div class="metaverse-root">
  3. <article v-if="isShowDesc">
  4. <button
  5. class="close"
  6. @click="onClickCloseDesc"
  7. />
  8. <h2>{{ desc.name }}</h2>
  9. <img
  10. class="splitter"
  11. src="@/assets/images/splitter.png"
  12. alt=""
  13. draggable="false"
  14. >
  15. <!-- <img
  16. class="banner"
  17. src="@/assets/images/for-dev.jpg"
  18. alt=""
  19. draggable="false"
  20. > -->
  21. <div
  22. class="txt"
  23. v-html="desc.detail || ''"
  24. />
  25. </article>
  26. <!-- element-ui的loading效果从调用到出现有延时,这期间要遮盖住组件 -->
  27. <div
  28. v-show="isShowLoadingMask"
  29. class="loading-mask"
  30. />
  31. </div>
  32. </template>
  33. <script>
  34. import {
  35. reactive,
  36. toRefs,
  37. ref,
  38. onMounted,
  39. } from 'vue'
  40. export default {
  41. name: 'MetaverseView',
  42. beforeRouteLeave() {
  43. gUnityInst.SendMessage('MainPanel', 'ResetCamera')
  44. },
  45. setup () {
  46. const rawData = reactive({ value: null })
  47. onMounted(async () => {
  48. rawData.value = await api.getMetaverseList()
  49. })
  50. const isShowDesc = ref(false)
  51. const desc = reactive({})
  52. function onClickCloseDesc() {
  53. isShowDesc.value = false
  54. gUnityInst.SendMessage('MainPanel', 'ResetCamera')
  55. }
  56. function onClickStar(idx) {
  57. desc.name = rawData.value[idx].name
  58. desc.detail = rawData.value[idx].description
  59. isShowDesc.value = true
  60. }
  61. window.handleClickPlanet = function(id) {
  62. console.log('click planet', id)
  63. onClickStar(id - 1)
  64. }
  65. window.handleMovedPlanet = function(id) {
  66. console.log('moved planet', id)
  67. }
  68. const isShowLoadingMask = ref(true)
  69. onMounted(() => {
  70. setTimeout(() => {
  71. isShowLoadingMask.value = false
  72. }, 200)
  73. })
  74. return {
  75. rawData,
  76. isShowDesc,
  77. desc,
  78. onClickCloseDesc,
  79. onClickStar,
  80. isShowLoadingMask,
  81. }
  82. }
  83. }
  84. </script>
  85. <style lang="less" scoped>
  86. .metaverse-root {
  87. height: 100%;
  88. position: relative;
  89. pointer-events: none;
  90. >article {
  91. pointer-events: initial;
  92. position: absolute;
  93. top: calc(100% / 2);
  94. transform: translateY(-50%);
  95. right: 102px;
  96. width: 653px;
  97. height: calc(100% - 74px - 50px);
  98. max-height: 740px;
  99. backdrop-filter: blur(10px);
  100. background-image: url(@/assets/images/general-article-bg.png);
  101. background-size: 100% auto;
  102. background-repeat: no-repeat;
  103. background-position: left top;
  104. padding: 32px 50px 50px 50px;
  105. display: flex;
  106. flex-direction: column;
  107. @media only screen and (max-width: 1700px) {
  108. right: 0;
  109. }
  110. >button.close {
  111. position: absolute;
  112. top: 30px;
  113. right: 50px;
  114. width: 32px;
  115. height: 32px;
  116. background-image: url(@/assets/images/icon-close.png);
  117. background-size: cover;
  118. background-repeat: no-repeat;
  119. background-position: center center;
  120. }
  121. >h2 {
  122. flex: 0 0 auto;
  123. font-size: 24px;
  124. font-family: Source Han Sans CN-Bold, Source Han Sans CN;
  125. font-weight: bold;
  126. color: #FFFFFF;
  127. margin-bottom: 21px;
  128. }
  129. >img.splitter {
  130. flex: 0 0 auto;
  131. width: 100%;
  132. margin-bottom: 37px;
  133. }
  134. >img.banner {
  135. flex: 0 0 auto;
  136. width: 100%;
  137. height: 34.8%;
  138. object-fit: contain;
  139. margin-bottom: 20px;
  140. }
  141. >.txt {
  142. flex: 1 0 1px;
  143. font-size: 20px;
  144. font-family: Source Han Sans CN-Light, Source Han Sans CN;
  145. font-weight: 400;
  146. color: rgba(255, 255, 255, 0.8);
  147. line-height: 1.7;
  148. overflow: auto;
  149. padding-right: 10px;
  150. margin-right: -10px;
  151. &::-webkit-scrollbar { background: transparent; width: 4px; } /*宽度是对垂直滚动条而言,高度是对水平滚动条而言*/
  152. &::-webkit-scrollbar-thumb {
  153. background: rgba(220, 231, 240, 0.2);
  154. border-radius: 2px;
  155. }
  156. }
  157. }
  158. .loading-mask {
  159. position: absolute;
  160. left: 0;
  161. top: 0;
  162. width: 100%;
  163. height: 100%;
  164. background: black;
  165. }
  166. }
  167. .mobile {
  168. .metaverse-root {
  169. height: 100%;
  170. position: relative;
  171. pointer-events: none;
  172. >article {
  173. pointer-events: initial;
  174. position: absolute;
  175. top: calc(100% / 2);
  176. transform: translateY(-50%);
  177. right: calc(102 / 1080 * 100vh);
  178. width: calc(653 / 1080 * 100vh);
  179. height: calc(100% - 74px - 50px);
  180. max-height: calc(740 / 1080 * 100vh);
  181. backdrop-filter: blur(10px);
  182. background-image: url(@/assets/images/general-article-bg.png);
  183. background-size: 100% auto;
  184. background-repeat: no-repeat;
  185. background-position: left top;
  186. padding: calc(32 / 1080 * 100vh) calc(50 / 1080 * 100vh) calc(50 / 1080 * 100vh) calc(50 / 1080 * 100vh);
  187. display: flex;
  188. flex-direction: column;
  189. @media only screen and (max-width: 1700px) {
  190. right: 0;
  191. }
  192. >button.close {
  193. position: absolute;
  194. top: calc(30 / 1080 * 100vh);
  195. right: calc(50 / 1080 * 100vh);
  196. width: calc(32 / 1080 * 100vh);
  197. height: calc(32 / 1080 * 100vh);
  198. background-image: url(@/assets/images/icon-close.png);
  199. background-size: cover;
  200. background-repeat: no-repeat;
  201. background-position: center center;
  202. }
  203. >h2 {
  204. flex: 0 0 auto;
  205. font-size: calc(24 / 1080 * 100vh);
  206. font-family: Source Han Sans CN-Bold, Source Han Sans CN;
  207. font-weight: bold;
  208. color: #FFFFFF;
  209. margin-bottom: calc(21 / 1080 * 100vh);
  210. }
  211. >img.splitter {
  212. flex: 0 0 auto;
  213. width: 100%;
  214. margin-bottom: calc(37 / 1080 * 100vh);
  215. }
  216. >img.banner {
  217. flex: 0 0 auto;
  218. width: 100%;
  219. height: 34.8%;
  220. object-fit: contain;
  221. margin-bottom: calc(20 / 1080 * 100vh);
  222. }
  223. >.txt {
  224. flex: 1 0 1px;
  225. font-size: calc(20 / 1080 * 100vh);
  226. font-family: Source Han Sans CN-Light, Source Han Sans CN;
  227. font-weight: 400;
  228. color: rgba(255, 255, 255, 0.8);
  229. line-height: 1.7;
  230. overflow: auto;
  231. padding-right: calc(10 / 1080 * 100vh);
  232. margin-right: calc(-10 / 1080 * 100vh);
  233. &::-webkit-scrollbar { background: transparent; width: calc(4 / 1080 * 100vh); } /*宽度是对垂直滚动条而言,高度是对水平滚动条而言*/
  234. &::-webkit-scrollbar-thumb {
  235. background: rgba(220, 231, 240, 0.2);
  236. border-radius: 2px;
  237. }
  238. }
  239. }
  240. .loading-mask {
  241. position: absolute;
  242. left: 0;
  243. top: 0;
  244. width: 100%;
  245. height: 100%;
  246. background: black;
  247. }
  248. }
  249. }
  250. </style>