Loading.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. <template>
  2. <transition appear name="custom-classes-transition" leave-active-class="animated fadeOut faster">
  3. <div v-if="show" class="scene-loading" :class="{ small: small, default: thumbStyle }" @touchmove.prevent >
  4. <div class="content">
  5. <div :style="`transform:translateZ(0) scale(${small});`">
  6. <div v-for="item in 3" :key="item" :class="`brick brick-${item} ${enter ? 'enter' : ''}`">
  7. <div class="brick-top face"></div>
  8. <div class="brick-bottom face"></div>
  9. <div class="brick-left face"></div>
  10. <div class="brick-right face"></div>
  11. <div class="brick-front face"></div>
  12. <div class="brick-back face"></div>
  13. </div>
  14. </div>
  15. <div :class="`logo`" v-show="metadata.num">
  16. <div>
  17. <div v-if="loadingLogoFile" class="logo-main" :style="{ 'background-image': `url(${loadingLogoFile})` }"></div>
  18. <div v-else>
  19. <i class="iconfont icon-hengbiaoCN"></i>
  20. </div>
  21. </div>
  22. </div>
  23. <div class="copy-right" v-if="!loadingLogoFile">
  24. <span>四维时代提供技术支持</span>
  25. </div>
  26. </div>
  27. </div>
  28. </transition>
  29. </template>
  30. <script setup>
  31. import { ref, watch, computed, onMounted, defineProps } from 'vue'
  32. import { useStore } from 'vuex'
  33. import { useApp } from '@/app'
  34. const props = defineProps({
  35. small: {
  36. type: Boolean,
  37. default: false,
  38. },
  39. thumb: {
  40. type: Boolean,
  41. default: false,
  42. },
  43. })
  44. const store = useStore()
  45. const progres = ref(0)
  46. const enter = ref(false)
  47. const thumb = ref(null)
  48. const thumbStyle = ref(null)
  49. const show = ref(true)
  50. const metadata = computed(() => store.getters['scene/metadata'])
  51. const loadingLogoFile = computed(() => store.getters['scene/loadingLogoFile'])
  52. onMounted(() => {
  53. enter.value = true
  54. })
  55. if (props.thumb) {
  56. useApp().then(app => {
  57. app.Scene.on('ready', () => {
  58. show.value = false
  59. })
  60. app.store.on('metadata', metadata => {
  61. if (metadata.entry) {
  62. thumb.value = app.resource.getUserResourceURL('thumb-2k.jpg')
  63. } else {
  64. thumb.value = require('@/assets/images/loading.jpg')
  65. thumbStyle.value = 'default'
  66. }
  67. })
  68. })
  69. }
  70. </script>
  71. <style lang="scss" scoped>
  72. @use "sass:math";
  73. // $brick-width: 15px;
  74. // $brick-height: 5px;
  75. .scene-loading {
  76. $brick-width: 30px;
  77. $brick-height: 10px;
  78. display: table;
  79. table-layout: fixed;
  80. height: 100%;
  81. width: 100%;
  82. z-index: 100;
  83. &.thumb {
  84. position: fixed;
  85. left: 0;
  86. top: 0;
  87. background-repeat: no-repeat;
  88. background-position: center center;
  89. background-size: cover;
  90. z-index: 5000;
  91. &.default {
  92. background-position: right center;
  93. }
  94. }
  95. * {
  96. opacity: 1 !important;
  97. }
  98. .content {
  99. width: 100%;
  100. height: 100%;
  101. display: table-cell;
  102. text-align: center;
  103. vertical-align: middle;
  104. .all {
  105. perspective: 100px;
  106. text-align: center;
  107. display: inline-block;
  108. }
  109. .brick {
  110. text-align: center;
  111. position: relative;
  112. width: $brick-width;
  113. height: $brick-height;
  114. transform-style: preserve-3d;
  115. transform-origin: math.div($brick-width, 2) math.div($brick-height, 2);
  116. margin: 0 auto math.div($brick-width, 12);
  117. }
  118. .brick-1 {
  119. animation: rorate 2s 1s infinite linear;
  120. transform: rotateX(-30deg) rotateY(45deg) translateZ(30px);
  121. }
  122. .brick-2 {
  123. animation: rorate 2s 0.75s infinite linear;
  124. transform: rotateX(-30deg) rotateY(45deg) translateZ(20px);
  125. }
  126. .brick-3 {
  127. animation: rorate 2s 0.5s infinite linear;
  128. transform: rotateX(-30deg) rotateY(45deg) translateZ(10px);
  129. }
  130. .face {
  131. width: $brick-width;
  132. height: $brick-height;
  133. overflow: hidden;
  134. position: absolute;
  135. background: rgba(255, 255, 255, 0.4);
  136. opacity: 0;
  137. }
  138. .brick.enter {
  139. transition: 0.5s all;
  140. transform: rotateX(-30deg) rotateY(45deg);
  141. .face {
  142. transition: 0.5s all;
  143. opacity: 1;
  144. }
  145. }
  146. .brick-2 {
  147. .face {
  148. background: rgba(255, 255, 255, 0.3);
  149. }
  150. .brick-front,
  151. .brick-back {
  152. background: rgba(255, 255, 255, 0.4);
  153. }
  154. }
  155. .brick-3 {
  156. .face {
  157. background: rgba(255, 255, 255, 0.2);
  158. }
  159. .brick-front,
  160. .brick-back {
  161. background: rgba(255, 255, 255, 0.1);
  162. }
  163. }
  164. .brick-front {
  165. transform: translate3d(0, 0, math.div($brick-width, 2));
  166. background: rgba(255, 255, 255, 0.6);
  167. }
  168. .brick-top {
  169. width: $brick-width;
  170. height: $brick-width;
  171. transform: rotateX(90deg) translate3d(0, 0, math.div($brick-width, 2));
  172. background-color: rgba(255, 255, 255, 0.8);
  173. }
  174. .brick-bottom {
  175. width: $brick-width;
  176. height: $brick-width;
  177. transform: rotateX(-90deg) translate3d(0, 0, math.div(-$brick-height, 2));
  178. background-color: rgba(255, 255, 255, 0.8);
  179. }
  180. .brick-left {
  181. transform: rotateY(-90deg) translate3d(0, 0, math.div($brick-width, 2));
  182. background: rgba(255, 255, 255, 0.5);
  183. }
  184. .brick-right {
  185. transform: rotateY(90deg) translate3d(0, 0, math.div($brick-width, 2));
  186. background: rgba(255, 255, 255, 0.5);
  187. }
  188. .brick-back {
  189. transform: rotateY(180deg) translate3d(0, 0, math.div($brick-width, 2));
  190. background: rgba(255, 255, 255, 0.6);
  191. }
  192. }
  193. .logo {
  194. width: 100%;
  195. // height: 48px;
  196. color: #fff;
  197. font-size: 16px;
  198. text-align: center;
  199. // margin-top: 12px;
  200. opacity: 0;
  201. // visibility: hidden;
  202. &.enter {
  203. animation: logo-enter 0.5s forwards;
  204. visibility: initial;
  205. }
  206. .logo-main {
  207. // width: 100%;
  208. // height: 80px;
  209. width: 140px;
  210. height: 70px;
  211. position: absolute;
  212. left: 50%;
  213. top: 80%;
  214. transform: translateX(-50%) translateY(-50%);
  215. }
  216. div {
  217. margin: 0 auto;
  218. width: 100%;
  219. height: 100%;
  220. position: relative;
  221. background-size: contain;
  222. background-repeat: no-repeat;
  223. background-position: center center;
  224. min-height: 70px;
  225. }
  226. i {
  227. position: absolute;
  228. left: 50%;
  229. top: 65%;
  230. transform: translateX(-50%) translateY(-50%);
  231. font-size: 148px;
  232. }
  233. }
  234. .copy-right {
  235. color: rgba(255, 255, 255, 0.6);
  236. opacity: 0.5;
  237. position: absolute;
  238. left: 50%;
  239. bottom: 30px;
  240. transform: translateX(-50%);
  241. line-height: 30px;
  242. height: 48px;
  243. white-space: nowrap;
  244. span {
  245. white-space: nowrap;
  246. }
  247. }
  248. }
  249. .small {
  250. $brick-width: 12px;
  251. $brick-height: 4px;
  252. display: table;
  253. table-layout: fixed;
  254. // pointer-events: none;
  255. // position: absolute;
  256. // left: 50%;
  257. // top: 50%;
  258. // transform: translate(-50%, -50%);
  259. height: 100%;
  260. width: 100%;
  261. // background-color: rgba(0, 0, 0, 0.45);
  262. z-index: 100;
  263. * {
  264. opacity: 1 !important;
  265. }
  266. .content {
  267. width: 100%;
  268. height: 100%;
  269. display: table-cell;
  270. text-align: center;
  271. vertical-align: middle;
  272. .all {
  273. perspective: 100px;
  274. text-align: center;
  275. display: inline-block;
  276. }
  277. .brick {
  278. text-align: center;
  279. position: relative;
  280. width: $brick-width;
  281. height: $brick-height;
  282. transform-style: preserve-3d;
  283. transform-origin: math.div($brick-width, 2) math.div($brick-height, 2);
  284. margin: 0 auto math.div($brick-width, 12);
  285. }
  286. .brick-1 {
  287. animation: rorate 2s 1s infinite linear;
  288. transform: rotateX(-30deg) rotateY(45deg) translateZ(30px);
  289. }
  290. .brick-2 {
  291. animation: rorate 2s 0.75s infinite linear;
  292. transform: rotateX(-30deg) rotateY(45deg) translateZ(20px);
  293. }
  294. .brick-3 {
  295. animation: rorate 2s 0.5s infinite linear;
  296. transform: rotateX(-30deg) rotateY(45deg) translateZ(10px);
  297. }
  298. .face {
  299. width: $brick-width;
  300. height: $brick-height;
  301. overflow: hidden;
  302. position: absolute;
  303. background: rgba(255, 255, 255, 0.4);
  304. opacity: 0;
  305. }
  306. .brick.enter {
  307. transition: 0.5s all;
  308. transform: rotateX(-30deg) rotateY(45deg);
  309. .face {
  310. transition: 0.5s all;
  311. opacity: 1;
  312. }
  313. }
  314. .brick-2 {
  315. .face {
  316. background: rgba(255, 255, 255, 0.3);
  317. }
  318. .brick-front,
  319. .brick-back {
  320. background: rgba(255, 255, 255, 0.4);
  321. }
  322. }
  323. .brick-3 {
  324. .face {
  325. background: rgba(255, 255, 255, 0.2);
  326. }
  327. .brick-front,
  328. .brick-back {
  329. background: rgba(255, 255, 255, 0.1);
  330. }
  331. }
  332. .brick-front {
  333. transform: translate3d(0, 0, math.div($brick-width, 2));
  334. background: rgba(255, 255, 255, 0.6);
  335. }
  336. .brick-top {
  337. width: $brick-width;
  338. height: $brick-width;
  339. transform: rotateX(90deg) translate3d(0, 0, math.div($brick-width, 2));
  340. background-color: rgba(255, 255, 255, 0.8);
  341. }
  342. .brick-bottom {
  343. width: $brick-width;
  344. height: $brick-width;
  345. transform: rotateX(-90deg) translate3d(0, 0, math.div(-$brick-height, 2));
  346. background-color: rgba(255, 255, 255, 0.8);
  347. }
  348. .brick-left {
  349. transform: rotateY(-90deg) translate3d(0, 0, math.div($brick-width, 2));
  350. background: rgba(255, 255, 255, 0.5);
  351. }
  352. .brick-right {
  353. transform: rotateY(90deg) translate3d(0, 0, math.div($brick-width, 2));
  354. background: rgba(255, 255, 255, 0.5);
  355. }
  356. .brick-back {
  357. transform: rotateY(180deg) translate3d(0, 0, math.div($brick-width, 2));
  358. background: rgba(255, 255, 255, 0.6);
  359. }
  360. }
  361. .logo {
  362. width: 100%;
  363. // height: 48px;
  364. color: #fff;
  365. font-size: 16px;
  366. text-align: center;
  367. // margin-top: 12px;
  368. opacity: 0;
  369. // visibility: hidden;
  370. &.enter {
  371. animation: logo-enter 0.5s forwards;
  372. visibility: initial;
  373. }
  374. .logo-main {
  375. // width: 100%;
  376. // height: 80px;
  377. width: 70px;
  378. height: 35px;
  379. position: absolute;
  380. left: 50%;
  381. top: 80%;
  382. transform: translateX(-50%) translateY(-50%);
  383. }
  384. div {
  385. margin: 0 auto;
  386. width: 100%;
  387. height: 100%;
  388. position: relative;
  389. background-size: contain;
  390. background-repeat: no-repeat;
  391. background-position: center center;
  392. min-height: 35px;
  393. }
  394. i {
  395. position: absolute;
  396. left: 50%;
  397. top: 65%;
  398. transform: translateX(-50%) translateY(-50%);
  399. font-size: 74px;
  400. }
  401. }
  402. .logo-bottom {
  403. width: 100%;
  404. height: 48px;
  405. color: #fff;
  406. font-size: 16px;
  407. position: absolute;
  408. bottom: 42px;
  409. left: 0;
  410. div {
  411. margin: 0 auto;
  412. width: 100%;
  413. height: 100%;
  414. position: relative;
  415. background-size: contain;
  416. background-repeat: no-repeat;
  417. background-position: center center;
  418. }
  419. i {
  420. position: absolute;
  421. left: 50%;
  422. top: 50%;
  423. transform: translateX(-50%) translateY(-50%);
  424. font-size: 140px;
  425. }
  426. }
  427. }
  428. [show-mode='mobile'],
  429. [edit-mode='mobile'] {
  430. $brick-width: 24px;
  431. $brick-height: 8px;
  432. .content {
  433. .brick {
  434. width: $brick-width;
  435. height: $brick-height;
  436. transform-origin: math.div($brick-width, 2) math.div($brick-height, 2);
  437. margin: 0 auto math.div($brick-width, 12);
  438. &.enter {
  439. transition: 0.5s all;
  440. transform: rotateX(-30deg) rotateY(45deg);
  441. .face {
  442. transition: 0.5s all;
  443. opacity: 1;
  444. }
  445. }
  446. }
  447. .brick-1 {
  448. animation: rorate 2s 1s infinite linear;
  449. transform: rotateX(-30deg) rotateY(45deg) translateZ(30px);
  450. }
  451. .brick-2 {
  452. animation: rorate 2s 0.75s infinite linear;
  453. transform: rotateX(-30deg) rotateY(45deg) translateZ(20px);
  454. }
  455. .brick-3 {
  456. animation: rorate 2s 0.5s infinite linear;
  457. transform: rotateX(-30deg) rotateY(45deg) translateZ(10px);
  458. }
  459. .face {
  460. width: $brick-width;
  461. height: $brick-height;
  462. }
  463. .brick-front {
  464. transform: translate3d(0, 0, math.div($brick-width, 2));
  465. }
  466. .brick-top {
  467. width: $brick-width;
  468. height: $brick-width;
  469. transform: rotateX(90deg) translate3d(0, 0, math.div($brick-width, 2));
  470. }
  471. .brick-bottom {
  472. width: $brick-width;
  473. height: $brick-width;
  474. transform: rotateX(-90deg) translate3d(0, 0, math.div(-$brick-height, 2));
  475. }
  476. .brick-left {
  477. transform: rotateY(-90deg) translate3d(0, 0, math.div($brick-width, 2));
  478. }
  479. .brick-right {
  480. transform: rotateY(90deg) translate3d(0, 0, math.div($brick-width, 2));
  481. }
  482. .brick-back {
  483. transform: rotateY(180deg) translate3d(0, 0, math.div($brick-width, 2));
  484. }
  485. }
  486. .logo {
  487. margin-top: 5px;
  488. .logo-main {
  489. margin-top: 15px;
  490. }
  491. i {
  492. font-size: 100px;
  493. }
  494. }
  495. // .bottom-intro {
  496. // div {
  497. // height: 36px;
  498. // }
  499. // }
  500. .logo-bottom {
  501. bottom: 0.7rem;
  502. i {
  503. font-size: 75px;
  504. }
  505. div {
  506. height: 36px;
  507. }
  508. }
  509. }
  510. @keyframes logo-enter {
  511. from {
  512. opacity: 0;
  513. }
  514. to {
  515. opacity: 1;
  516. }
  517. }
  518. @keyframes rorate {
  519. 0% {
  520. transform: rotateX(-30deg) rotateY(-45deg);
  521. }
  522. 50% {
  523. transform: rotateX(-30deg) rotateY(-315deg);
  524. }
  525. 100% {
  526. transform: rotateX(-30deg) rotateY(-315deg);
  527. }
  528. }
  529. </style>