1
0

start.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499
  1. <template>
  2. <view class="app-page bg-gradient-blue-lighten-b" :class="calcPageClass" :style="calcPageStyle">
  3. <view v-if="calcBackgroundType!=='video'" class="tn-satr">
  4. <view class="sky"></view>
  5. <view class="stars">
  6. <view class="falling-stars">
  7. <view class="star-fall"></view>
  8. <view class="star-fall"></view>
  9. <view class="star-fall"></view>
  10. <view class="star-fall"></view>
  11. </view>
  12. <view class="small-stars">
  13. <view class="star"></view>
  14. <view class="star"></view>
  15. <view class="star"></view>
  16. <view class="star"></view>
  17. <view class="star"></view>
  18. <view class="star"></view>
  19. <view class="star"></view>
  20. <view class="star"></view>
  21. <view class="star"></view>
  22. <view class="star"></view>
  23. <view class="star"></view>
  24. <view class="star"></view>
  25. </view>
  26. <view class="medium-stars">
  27. <view class="star"></view>
  28. <view class="star"></view>
  29. <view class="star"></view>
  30. <view class="star"></view>
  31. <view class="star"></view>
  32. <view class="star"></view>
  33. <view class="star"></view>
  34. <view class="star"></view>
  35. <view class="star"></view>
  36. <view class="star"></view>
  37. <view class="star"></view>
  38. <view class="star"></view>
  39. </view>
  40. </view>
  41. </view>
  42. <video v-else class="video-bg" :object-fit="startConfig.bgVideoFit" :src="startConfig.bgVideo" :loop="true" :autoplay="true"
  43. :muted="true" :controls="false" :show-fullscreen-btn="false" :show-play-btn="false"
  44. :show-center-play-btn="false" :show-loading="false" :enable-progress-gesture="false"
  45. :show-progress="false"></video>
  46. <cover-view v-if="startConfig.title || startConfig.logo" class="title-container">
  47. <cover-view v-if="startConfig.logo" class="app-logo">
  48. <cover-image class="app-logo-image" :src="$utils.checkImageUrl(startConfig.logo)"
  49. mode="aspectFill"></cover-image>
  50. </cover-view>
  51. <cover-view v-if="startConfig.title" class="app-title" :style="startConfig.titleStyle">
  52. 「 {{ startConfig.title }} 」
  53. </cover-view>
  54. </cover-view>
  55. <cover-view v-if="startConfig.desc1 || startConfig.desc2" class="bottom-container">
  56. <cover-view class="text-align-center" :style="startConfig.descStyle"
  57. style="color:white;padding: 60vh 0 0 0;">
  58. <cover-view class="" style="font-size: 44rpx;" v-if="startConfig.desc1">{{ startConfig.desc1 }}
  59. </cover-view>
  60. <cover-view class="mt-30 text-size-m" v-if="startConfig.desc2">{{ startConfig.desc2 }}</cover-view>
  61. </cover-view>
  62. <cover-view class="" style="padding: 120rpx 200rpx;z-index: 999;position: relative;">
  63. <cover-view class="start-btn" :class="[startConfig.btnClass]" @click="fnStart()"
  64. :style="startConfig.btnStyle">{{ startConfig.btnText || '开始体验' }}
  65. </cover-view>
  66. </cover-view>
  67. </cover-view>
  68. <!-- 波浪效果 -->
  69. <wave v-if="startConfig.useWave"></wave>
  70. </view>
  71. </template>
  72. <script>
  73. import wave from '@/components/wave/wave.vue';
  74. export default {
  75. components: {
  76. wave
  77. },
  78. computed: {
  79. startConfig() {
  80. return this.$tm.vx.getters().getConfigs.appConfig.startConfig;
  81. },
  82. calcBackgroundType() {
  83. return this.startConfig.backgroundType;
  84. },
  85. calcPageClass() {
  86. if (this.calcBackgroundType === 'color') {
  87. return [this.startConfig.bg]
  88. }
  89. return []
  90. },
  91. calcPageStyle() {
  92. if (this.calcBackgroundType === 'color') {
  93. return {}
  94. }
  95. if (this.calcBackgroundType === 'image') {
  96. return {
  97. backgroundImage: `url(${this.$utils.checkImageUrl(this.startConfig.bgImage)})!important`,
  98. backgroundSize: this.startConfig.bgImageFit
  99. }
  100. }
  101. if (this.calcBackgroundType === 'video') {
  102. return {
  103. background: '#ffffff'
  104. }
  105. }
  106. return {};
  107. }
  108. },
  109. methods: {
  110. fnStart() {
  111. uni.switchTab({
  112. url: '/pages/tabbar/home/home',
  113. success: () => {
  114. uni.setStorageSync('APP_HAS_STARTED', true);
  115. }
  116. });
  117. }
  118. }
  119. };
  120. </script>
  121. <style lang="scss" scoped>
  122. .app-page {
  123. position: relative;
  124. width: 100vw;
  125. height: 100vh;
  126. background-size: cover;
  127. background-repeat: no-repeat;
  128. }
  129. .start-btn {
  130. box-sizing: border-box;
  131. background-color: transparent;
  132. padding: 16rpx 50rpx;
  133. border-radius: 50rpx;
  134. border: 2rpx solid #ffffff;
  135. color: #ffffff;
  136. text-align: center;
  137. font-size: 28rpx;
  138. }
  139. .bottom-container {
  140. position: absolute;
  141. bottom: 50rpx;
  142. left: 50%;
  143. transform: translateX(-50%);
  144. z-index: 999;
  145. }
  146. .video-bg {
  147. position: absolute;
  148. left: 0;
  149. top: 0;
  150. width: 100vw;
  151. height: 100vh;
  152. z-index: 0;
  153. }
  154. .title-container {
  155. width: 100vw;
  156. position: absolute;
  157. top: 20vh;
  158. left: 0;
  159. z-index: 999;
  160. display: flex;
  161. flex-direction: column;
  162. align-items: center;
  163. justify-content: center;
  164. }
  165. .app-logo {
  166. width: 200rpx;
  167. height: 200rpx;
  168. border: 8rpx solid rgba(255, 255, 255, 0.35);
  169. border-radius: 50%;
  170. box-shadow: 0rpx 0rpx 80rpx 0rpx rgba(0, 0, 0, 0.15);
  171. overflow: hidden;
  172. &-image {
  173. width: 100%;
  174. height: 100%;
  175. }
  176. }
  177. .app-title {
  178. color: #ffffff;
  179. margin-top: 26rpx;
  180. font-size: 36rpx;
  181. font-weight: 600;
  182. text-align: center;
  183. }
  184. .tn-satr {
  185. position: fixed;
  186. width: 100%;
  187. height: 600px;
  188. overflow: hidden;
  189. flex-shrink: 0;
  190. z-index: 998;
  191. }
  192. .stars {
  193. position: absolute;
  194. z-index: 1;
  195. width: 100%;
  196. height: 400px;
  197. }
  198. .star {
  199. border-radius: 50%;
  200. background: #ffffff;
  201. box-shadow: 0 0 6px 0 rgba(255, 255, 255, 0.8);
  202. }
  203. .small-stars .star {
  204. position: absolute;
  205. width: 3px;
  206. height: 3px;
  207. }
  208. .small-stars .star:nth-child(2n) {
  209. opacity: 0;
  210. -webkit-animation: star-blink 1.2s linear infinite alternate;
  211. animation: star-blink 1.2s linear infinite alternate;
  212. }
  213. .small-stars .star:nth-child(1) {
  214. left: 40px;
  215. bottom: 50px;
  216. }
  217. .small-stars .star:nth-child(2) {
  218. left: 200px;
  219. bottom: 40px;
  220. }
  221. .small-stars .star:nth-child(3) {
  222. left: 60px;
  223. bottom: 120px;
  224. }
  225. .small-stars .star:nth-child(4) {
  226. left: 140px;
  227. bottom: 250px;
  228. }
  229. .small-stars .star:nth-child(5) {
  230. left: 400px;
  231. bottom: 300px;
  232. }
  233. .small-stars .star:nth-child(6) {
  234. left: 170px;
  235. bottom: 80px;
  236. }
  237. .small-stars .star:nth-child(7) {
  238. left: 200px;
  239. bottom: 360px;
  240. -webkit-animation-delay: 0.2s;
  241. animation-delay: 0.2s;
  242. }
  243. .small-stars .star:nth-child(8) {
  244. left: 250px;
  245. bottom: 320px;
  246. }
  247. .small-stars .star:nth-child(9) {
  248. left: 300px;
  249. bottom: 340px;
  250. }
  251. .small-stars .star:nth-child(10) {
  252. left: 130px;
  253. bottom: 320px;
  254. -webkit-animation-delay: 0.5s;
  255. animation-delay: 0.5s;
  256. }
  257. .small-stars .star:nth-child(11) {
  258. left: 230px;
  259. bottom: 330px;
  260. -webkit-animation-delay: 7s;
  261. animation-delay: 7s;
  262. }
  263. .small-stars .star:nth-child(12) {
  264. left: 300px;
  265. bottom: 360px;
  266. -webkit-animation-delay: 0.3s;
  267. animation-delay: 0.3s;
  268. }
  269. @-webkit-keyframes star-blink {
  270. 50% {
  271. width: 3px;
  272. height: 3px;
  273. opacity: 1;
  274. }
  275. }
  276. @keyframes star-blink {
  277. 50% {
  278. width: 3px;
  279. height: 3px;
  280. opacity: 1;
  281. }
  282. }
  283. .medium-stars .star {
  284. position: absolute;
  285. width: 3px;
  286. height: 3px;
  287. opacity: 0;
  288. -webkit-animation: star-blink 1.2s ease-in infinite alternate;
  289. animation: star-blink 1.2s ease-in infinite alternate;
  290. }
  291. .medium-stars .star:nth-child(1) {
  292. left: 300px;
  293. bottom: 50px;
  294. }
  295. .medium-stars .star:nth-child(2) {
  296. left: 400px;
  297. bottom: 40px;
  298. -webkit-animation-delay: 0.4s;
  299. animation-delay: 0.4s;
  300. }
  301. .medium-stars .star:nth-child(3) {
  302. left: 330px;
  303. bottom: 300px;
  304. -webkit-animation-delay: 0.2s;
  305. animation-delay: 0.2s;
  306. }
  307. .medium-stars .star:nth-child(4) {
  308. left: 460px;
  309. bottom: 300px;
  310. -webkit-animation-delay: 0.9s;
  311. animation-delay: 0.9s;
  312. }
  313. .medium-stars .star:nth-child(5) {
  314. left: 300px;
  315. bottom: 150px;
  316. -webkit-animation-delay: 1.2s;
  317. animation-delay: 1.2s;
  318. }
  319. .medium-stars .star:nth-child(6) {
  320. left: 440px;
  321. bottom: 120px;
  322. -webkit-animation-delay: 1s;
  323. animation-delay: 1s;
  324. }
  325. .medium-stars .star:nth-child(7) {
  326. left: 200px;
  327. bottom: 140px;
  328. -webkit-animation-delay: 0.8s;
  329. animation-delay: 0.8s;
  330. }
  331. .medium-stars .star:nth-child(8) {
  332. left: 30px;
  333. bottom: 480px;
  334. -webkit-animation-delay: 0.3s;
  335. animation-delay: 0.3s;
  336. }
  337. .medium-stars .star:nth-child(9) {
  338. left: 460px;
  339. bottom: 400px;
  340. -webkit-animation-delay: 1.2s;
  341. animation-delay: 1.2s;
  342. }
  343. .medium-stars .star:nth-child(10) {
  344. left: 150px;
  345. bottom: 10px;
  346. -webkit-animation-delay: 1s;
  347. animation-delay: 1s;
  348. }
  349. .medium-stars .star:nth-child(11) {
  350. left: 420px;
  351. bottom: 450px;
  352. -webkit-animation-delay: 1.2s;
  353. animation-delay: 1.2s;
  354. }
  355. .medium-stars .star:nth-child(12) {
  356. left: 340px;
  357. bottom: 180px;
  358. -webkit-animation-delay: 1.1s;
  359. animation-delay: 1.1s;
  360. }
  361. @keyframes star-blink {
  362. 50% {
  363. width: 4px;
  364. height: 4px;
  365. opacity: 1;
  366. }
  367. }
  368. .star-fall {
  369. position: relative;
  370. border-radius: 2px;
  371. width: 80px;
  372. height: 2px;
  373. overflow: hidden;
  374. -webkit-transform: rotate(-20deg);
  375. transform: rotate(-20deg);
  376. }
  377. .star-fall:after {
  378. content: '';
  379. position: absolute;
  380. width: 50px;
  381. height: 2px;
  382. background: -webkit-gradient(linear, right top, left top, from(rgba(0, 0, 0, 0)), to(rgba(255, 255, 255, 0.4)));
  383. background: linear-gradient(to left, rgba(0, 0, 0, 0) 0%, rgba(255, 255, 255, 0.4) 100%);
  384. left: 100%;
  385. -webkit-animation: star-fall 3.6s linear infinite;
  386. animation: star-fall 3.6s linear infinite;
  387. }
  388. .star-fall:nth-child(1) {
  389. left: 80px;
  390. bottom: -100px;
  391. }
  392. .star-fall:nth-child(1):after {
  393. -webkit-animation-delay: 2.4s;
  394. animation-delay: 2.4s;
  395. }
  396. .star-fall:nth-child(2) {
  397. left: 200px;
  398. bottom: -200px;
  399. }
  400. .star-fall:nth-child(2):after {
  401. -webkit-animation-delay: 2s;
  402. animation-delay: 2s;
  403. }
  404. .star-fall:nth-child(3) {
  405. left: 430px;
  406. bottom: -50px;
  407. }
  408. .star-fall:nth-child(3):after {
  409. -webkit-animation-delay: 3.6s;
  410. animation-delay: 3.6s;
  411. }
  412. .star-fall:nth-child(4) {
  413. left: 400px;
  414. bottom: 100px;
  415. }
  416. .star-fall:nth-child(4):after {
  417. -webkit-animation-delay: 0.2s;
  418. animation-delay: 0.2s;
  419. }
  420. @-webkit-keyframes star-fall {
  421. 20% {
  422. left: -100%;
  423. }
  424. 100% {
  425. left: -100%;
  426. }
  427. }
  428. @keyframes star-fall {
  429. 20% {
  430. left: -100%;
  431. }
  432. 100% {
  433. left: -100%;
  434. }
  435. }
  436. </style>