1
0

start.vue 10 KB

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