zhongduxiub.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429
  1. <template>
  2. <view class="container">
  3. <view class="loading" v-if="loadingState" :class="[loadingOutAnime?'loadingOut':'']">
  4. <view class="loadingBox">
  5. <image :src="loadingAImg" mode="aspectFit"></image>
  6. <image class="loadingRotate" :src="loadingBImg" mode="aspectFit"></image>
  7. </view>
  8. <image class="loadingText" :src="loadingText" mode="aspectFit"></image>
  9. </view>
  10. <view class="changeAudio" :class="[audioState?'changeAudioPlay':'']" @click="changeAudio">
  11. <image :src="audioImgA" v-show="audioState" mode="aspectFit"></image>
  12. <image :src="audioImgB" v-show="!audioState" mode="aspectFit"></image>
  13. </view>
  14. <view class="videoContent">
  15. <video id="myVideoBg" :src="videoBgPath" :loop="true" :controls="false" :muted="true"
  16. objectFit='cover' :show-progress='false' :enable-progress-gesture='false' :show-play-btn='false'
  17. :show-fullscreen-btn='false' @loadedmetadata="videoLoadingEnd"></video>
  18. </view>
  19. <view class="imgLayer">
  20. <view class="imgMask" v-if="imgShowIndex!='close'">
  21. </view>
  22. <view class="imgItem" v-for="(item,index) in personList" :key="item.name"
  23. :style="{width:item.width,height:item.height,left:item.x,top:item.y}" v-show="imgShowIndex==item.name">
  24. <image :src="item.url" mode="aspectFill"></image>
  25. </view>
  26. </view>
  27. <view class="clickLayer">
  28. <view class="clickItem clickItem1" @click="openImg('person1')">
  29. </view>
  30. <view class="clickItem clickItem2" @click="openImg('person2')">
  31. </view>
  32. <view class="clickItem clickItem3" @click="openImg('person3')">
  33. </view>
  34. <view class="clickItem clickItem4" @click="openImg('person4')">
  35. </view>
  36. <view class="clickItem clickItem5" @click="openImg('person5')">
  37. </view>
  38. </view>
  39. <view class="textLayer">
  40. <view class="textItem" v-for="(item,index) in textList" :key="item.name" v-show="imgShowIndex==item.name">
  41. <image :src="item.url" mode="aspectFill"></image>
  42. </view>
  43. </view>
  44. <view class="closeBtn" v-show="imgShowIndex!='close'" @click="closeContent">
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. export default {
  50. data() {
  51. return {
  52. loadingState: true,
  53. loadingOutAnime: false, //加载退场动画
  54. videoCtx:"",
  55. audioImgA: "https://dadu.ispush.com/static/zhongduxiu/img/audioOn.png",
  56. audioImgB: "https://dadu.ispush.com/static/zhongduxiu/img/audioOff.png",
  57. loadingAImg: "https://dadu.ispush.com/static/shouyu/loadingA.png",
  58. loadingBImg: "https://dadu.ispush.com/static/shouyu/loadingB.png",
  59. loadingText: "https://dadu.ispush.com/static/shouyu/loadingText.png",
  60. audioUrl: "",
  61. webUrl: "https://dadu.ispush.com/api/getHtml",
  62. audioState: true,
  63. innerAudioContext: "",
  64. imgShowIndex: "close",
  65. videoBgPath: "https://dadu.ispush.com/static/zhongduxiu/video/bg.mp4",
  66. personList: [{
  67. "name": "person1",
  68. "width": "180rpx",
  69. "height": "461rpx",
  70. "x": "-10rpx",
  71. "y": "980rpx",
  72. "url": "https://dadu.ispush.com/static/zhongduxiu/person/1.png"
  73. },
  74. {
  75. "name": "person2",
  76. "width": "192rpx",
  77. "height": "466rpx",
  78. "x": "130rpx",
  79. "y": "980rpx",
  80. "url": "https://dadu.ispush.com/static/zhongduxiu/person/2.png"
  81. },
  82. {
  83. "name": "person3",
  84. "width": "246rpx",
  85. "height": "474rpx",
  86. "x": "278rpx",
  87. "y": "950rpx",
  88. "url": "https://dadu.ispush.com/static/zhongduxiu/person/3.png"
  89. },
  90. {
  91. "name": "person4",
  92. "width": "179rpx",
  93. "height": "466rpx",
  94. "x": "485rpx",
  95. "y": "972rpx",
  96. "url": "https://dadu.ispush.com/static/zhongduxiu/person/4.png"
  97. },
  98. {
  99. "name": "person5",
  100. "width": "148rpx",
  101. "height": "458rpx",
  102. "x": "610rpx",
  103. "y": "980rpx",
  104. "url": "https://dadu.ispush.com/static/zhongduxiu/person/5.png"
  105. }
  106. ],
  107. textList: [{
  108. "name": "person1",
  109. "url": "https://dadu.ispush.com/static/zhongduxiu/img/text1.png"
  110. },
  111. {
  112. "name": "person2",
  113. "url": "https://dadu.ispush.com/static/zhongduxiu/img/text2.png"
  114. },
  115. {
  116. "name": "person3",
  117. "url": "https://dadu.ispush.com/static/zhongduxiu/img/text3.png"
  118. },
  119. {
  120. "name": "person4",
  121. "url": "https://dadu.ispush.com/static/zhongduxiu/img/text4.png"
  122. },
  123. {
  124. "name": "person5",
  125. "url": "https://dadu.ispush.com/static/zhongduxiu/img/text5.png"
  126. }
  127. ]
  128. }
  129. },
  130. methods: {
  131. createAudio() {
  132. this.innerAudioContext = uni.createInnerAudioContext()
  133. this.innerAudioContext.autoplay = true
  134. this.innerAudioContext.loop = true
  135. this.innerAudioContext.src = `${this.$g.baseUrl}/static/zhongduxiu/audio/audio.mp3`
  136. },
  137. changeAudio() {
  138. if (this.audioState) {
  139. this.innerAudioContext.pause()
  140. } else {
  141. this.innerAudioContext.play()
  142. }
  143. this.audioState = !this.audioState
  144. },
  145. videoLoadingEnd() {
  146. this.loadingOutAnime = true
  147. this.videoCtx.play()
  148. let t = setTimeout(() => {
  149. this.loadingState = false
  150. clearTimeout(t)
  151. }, 600)
  152. },
  153. openImg(index) {
  154. this.imgShowIndex = index
  155. },
  156. closeContent() {
  157. this.imgShowIndex = 'close'
  158. }
  159. },
  160. onReady() {
  161. this.videoCtx = uni.createVideoContext('myVideoBg')
  162. this.createAudio()
  163. }
  164. }
  165. </script>
  166. <style scoped>
  167. .conatiner {
  168. position: relative;
  169. width: 100vw;
  170. height: 100vh;
  171. }
  172. .container .loading {
  173. position: absolute;
  174. top: 0;
  175. left: 0;
  176. width: 100vw;
  177. height: 100vh;
  178. z-index: 9999999;
  179. background: #4c4c4c;
  180. display: flex;
  181. justify-content: center;
  182. align-items: center;
  183. }
  184. .container .loading .loadingBox {
  185. position: relative;
  186. width: 73rpx;
  187. height: 72rpx;
  188. }
  189. .container .loading .loadingBox image {
  190. position: absolute;
  191. left: 0;
  192. top: 0;
  193. width: 100%;
  194. height: 100%;
  195. }
  196. .container .loading .loadingBox .loadingRotate {
  197. animation: 1s loadingRotateAnime linear infinite;
  198. }
  199. .container .loading .loadingText {
  200. position: absolute;
  201. top: 43%;
  202. left: 50%;
  203. transform: translate(-50%, -50%);
  204. width: 169rpx;
  205. height: 40rpx;
  206. }
  207. @keyframes loadingRotateAnime {
  208. from {
  209. transform: rotate(0deg);
  210. }
  211. to {
  212. transform: rotate(360deg);
  213. }
  214. }
  215. .container .loadingOut {
  216. animation: 1s loadingOutAnime linear forwards;
  217. }
  218. @keyframes loadingOutAnime {
  219. from {
  220. opacity: 1;
  221. }
  222. to {
  223. opacity: 0;
  224. }
  225. }
  226. .container .changeAudio {
  227. position: absolute;
  228. right: 45rpx;
  229. top: 105rpx;
  230. width: 47rpx;
  231. height: 47rpx;
  232. z-index: 999999;
  233. }
  234. .container .changeAudio image {
  235. width: 100%;
  236. height: 100%;
  237. }
  238. .container .changeAudioPlay {
  239. animation: 1s changeAudioAnime linear infinite;
  240. }
  241. @keyframes changeAudioAnime {
  242. from {
  243. transform: rotate(0deg);
  244. }
  245. to {
  246. transform: rotate(360deg);
  247. }
  248. }
  249. .videoContent {
  250. width: 750rpx;
  251. height: 1624rpx;
  252. position: absolute;
  253. top: 0;
  254. left: 0;
  255. }
  256. .videoContent video {
  257. width: 100%;
  258. height: 100%;
  259. }
  260. .imgLayer {
  261. width: 100vw;
  262. height: 100vh;
  263. position: absolute;
  264. top: 0;
  265. left: 0;
  266. z-index: 99;
  267. }
  268. .imgLayer .imgMask {
  269. width: 750rpx;
  270. height: 1624rpx;
  271. background: rgba(0, 0, 0, 0.6);
  272. opacity: 0;
  273. animation: 1s imgMaskAnime linear forwards;
  274. }
  275. @keyframes imgMaskAnime {
  276. from {
  277. opacity: 0;
  278. }
  279. to {
  280. opacity: 1;
  281. }
  282. }
  283. .imgLayer .imgItem {
  284. position: absolute;
  285. animation: 0.5s imgItemAnime linear forwards;
  286. }
  287. @keyframes imgItemAnime {
  288. from {
  289. transform: scale(1);
  290. }
  291. to {
  292. transform: scale(1.05);
  293. }
  294. }
  295. .imgLayer .imgItem image {
  296. width: 100%;
  297. height: 100%;
  298. }
  299. .clickLayer {
  300. width: 100vw;
  301. height: 100vh;
  302. position: absolute;
  303. top: 0;
  304. left: 0;
  305. z-index: 99999;
  306. }
  307. .clickLayer .clickItem {
  308. width: 200rpx;
  309. height: 150rpx;
  310. position: absolute;
  311. /* background: pink; */
  312. z-index: 9999;
  313. }
  314. .clickLayer .clickItem1 {
  315. width: 150rpx;
  316. height: 460rpx;
  317. left: 0rpx;
  318. top: 970rpx;
  319. }
  320. .clickLayer .clickItem2 {
  321. width: 160rpx;
  322. height: 460rpx;
  323. left: 152rpx;
  324. top: 970rpx;
  325. }
  326. .clickLayer .clickItem3 {
  327. width: 170rpx;
  328. height: 460rpx;
  329. left: 315rpx;
  330. top: 970rpx;
  331. }
  332. .clickLayer .clickItem4 {
  333. width: 140rpx;
  334. height: 460rpx;
  335. left: 486rpx;
  336. top: 970rpx;
  337. }
  338. .clickLayer .clickItem5 {
  339. width: 123rpx;
  340. height: 460rpx;
  341. left: 628rpx;
  342. top: 970rpx;
  343. }
  344. .textLayer {
  345. position: absolute;
  346. top: 0;
  347. left: 0;
  348. width: 750rpx;
  349. height: 1624rpx;
  350. z-index: 999;
  351. }
  352. .textLayer .textItem {
  353. position: absolute;
  354. width: 643rpx;
  355. height: 280rpx;
  356. top: 657rpx;
  357. left: 50%;
  358. opacity: 0;
  359. transform: translateX(-50%);
  360. animation: 0.5s textItemAnime 1s linear forwards;
  361. }
  362. @keyframes textItemAnime {
  363. from {
  364. opacity: 0;
  365. }
  366. to {
  367. opacity: 1;
  368. }
  369. }
  370. .textLayer .textItem image {
  371. width: 100%;
  372. height: 100%;
  373. }
  374. .closeBtn {
  375. position: absolute;
  376. z-index: 99999;
  377. top: 665rpx;
  378. left: 625rpx;
  379. width: 60rpx;
  380. height: 60rpx;
  381. opacity: 0;
  382. animation: 0.5s textItemAnime linear 1s forwards;
  383. }
  384. </style>