index.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  1. <template>
  2. <view class="uni-main" @click="isclose()">
  3. <view class="header">
  4. <u-icon class="back" name="arrow-left" color="#fff" size="48" @click="backHome()"></u-icon>
  5. <text @click="backHome()">返回</text>
  6. <image class="menu" @click.stop="isopen()" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEUAAABFCAYAAAAcjSspAAAAAXNSR0IArs4c6QAAAdtJREFUeAHtmb1KxFAQhTf+NYKF+AB2umBhIdhaCIKNjS9jYaGloM/gC2i9jdoKaqGVhawi6EP4QzwjvkDOZOMVv4Fh05w5N1+SmWRvr0dAAAIQgAAEIAABCEAAAhCAAAQgAAEIQAACEIDAbxGoMsZ1XS9Lv6tcVI5larWkrVVnqDysqurCrWlDEZA5mT4pp13zEeo+VXtJYO4dj8zVXZVhiUCCw7hyIw6cyEDJaJ21NtUEGCsyJ3YtxzfLtRvRuWtj95QwVF9Z08+esqRG+6j1HKifnOiXgAAEIACBEgmkpk+ckCZQTJ4FZWa8R6m2YqjJc9tWscZ1BORYWWIMtKjJxif0I7DvFJmuqMaVa9yBbtt9V8nc8vMdnFjGIh5pKzJQXi3H7kTPrlUGyqVMz1zjEevuVP/U9bB7ShiqrwTUdWVp3z4D9ZOSP1YDHwEBCEDg/xLITp++0O0oS5k+cSVji+NI0ydeGaywoWgcz8ox/vqbsZxHK/pQ+b7APDg2mZe32OIoEUhwmFBuxoETGSj2V6izUEMzZWi+JRkoN6rw7hp3oLO3TeM2s0LP64v6ypbE+8rSGm1sccRFIyAAAQhAAAIQgAAEIAABCEAAAhCAAAQgAAEIQOCPEfgCRWjhRTN8lMcAAAAASUVORK5CYII=" mode=""></image>
  7. <cover-view class="menuBox" v-show="header.isopen">
  8. <view class="menuInner">
  9. <navigator url="./rule" hover-class="navigator-hover">
  10. <view class="menuI1">
  11. <image src="../../../static/index/peifu/agreement.png" mode="" style="width: 50rpx;height: 50rpx;"></image>
  12. <view>规则说明</view>
  13. </view>
  14. </navigator>
  15. <navigator url="./record">
  16. <view class="menuI2">
  17. <image src="../../../static/index/peifu/menu_history_icon.png" mode="" style="width: 50rpx;height: 50rpx;"></image>
  18. <view>培福记录</view>
  19. </view>
  20. </navigator>
  21. </view>
  22. </cover-view>
  23. <view class="shelter" v-if="isrank">
  24. <view class="rank" >
  25. <view class="rankHeader">
  26. <text class="rankText">排行榜</text>
  27. <text class="rankClose" @click="rankClose()">×</text>
  28. </view>
  29. <view class="rankContent">
  30. <!-- 排行 -->
  31. <view class="rankInner">
  32. <view-item v-for="(rankPeople,index) in rankPeoples" class="rankOrder">
  33. <view class="rankI" v-if="index<=2">
  34. <image :src="rankImage[index]" mode=""></image>
  35. </view>
  36. <view class="rankA" v-else>
  37. {{index+1}}
  38. </view>
  39. <view class="rankName">
  40. {{rankPeople.name}}
  41. </view>
  42. <view class="rankNum">
  43. {{rankPeople.num+'颗'}}
  44. </view>
  45. </view-item>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. <view class="zhe" v-if="cord">
  52. <image src="../../../static/index/peifu/luck_bag_bg.png" mode="" class="cord"></image>
  53. <image src="../../../static/index/peifu/peifu_btn.png" mode="" class="know"></image>
  54. <view class="knowText" @click="diss()">我知道了</view>
  55. <view class="knowTime">{{knowTime}}</view>
  56. </view>
  57. <view class="wate" v-if="ishappen">
  58. <image src="../../../static/index/peifu/kettle.png" mode="" :animation="animationData" :class="waters[num]">
  59. </image>
  60. <image src="../../../static/index/peifu/water.gif" mode="" class="watering" v-if="waterhappen"></image>
  61. </view>
  62. <view class="Bottom">
  63. <view class="imgBtn" @click="waterB()">
  64. <image src="../../../static/index/peifu/peifu_btn.png" mode=""></image>
  65. <view class="btnText">浇灌福气</view>
  66. </view>
  67. <view class="rankBtn">
  68. <image @click="openRank()" src="../../../static/index/peifu/order.png" mode=""></image>
  69. </view>
  70. </view>
  71. </view>
  72. </template>
  73. <script>
  74. export default {
  75. data(){
  76. return{
  77. num : 0,
  78. waters:['water1','water2','water3'],
  79. header:{
  80. isopen:false
  81. },
  82. timer:'',
  83. knowTime :3,
  84. ishappen:true,
  85. cord:false,
  86. waterhappen:false,
  87. isrun:true,
  88. isrank:false, //false
  89. rankPeoples:[
  90. {name:'张三',num:20},
  91. {name:'李四',num:20},
  92. {name:'王五',num:20},
  93. {name:'老六',num:20},
  94. {name:'老七',num:20},
  95. {name:'老八',num:20}
  96. ],
  97. rankImage:[
  98. '../../../static/index/peifu/one_rank.png',
  99. '../../../static/index/peifu/two_rank.png',
  100. '../../../static/index/peifu/three_rank.png'
  101. ],
  102. animationData:{},
  103. };
  104. },
  105. methods:{
  106. backHome() {
  107. uni.navigateBack({
  108. delta: 1
  109. });
  110. },
  111. isopen(event){
  112. this.header.isopen = true
  113. },
  114. isclose(){
  115. this.header.isopen = false
  116. },
  117. openRank(){
  118. this.isrank = true
  119. },
  120. rankClose(){
  121. this.isrank = false
  122. },
  123. waterB(){
  124. this.num++
  125. var that = this
  126. setTimeout(function(){
  127. that.num++
  128. },1500)
  129. setTimeout(function(){
  130. that.waterhappen = true
  131. that.num = 2
  132. },3000)
  133. setTimeout(function(){
  134. that.num = 0
  135. that.waterhappen = false
  136. },6000)
  137. setTimeout(function(){
  138. that.cord = true
  139. setTimeout(function(){
  140. that.cord = false
  141. clearInterval(that.timer)
  142. },3000)
  143. that.timer = setInterval(function(){
  144. that.knowTime--
  145. },1000)
  146. },6000)
  147. },
  148. diss(){
  149. this.cord = false
  150. }
  151. },
  152. onUnload:{
  153. },
  154. onload:{
  155. }
  156. }
  157. </script>
  158. <style >
  159. page {
  160. height: 100%;
  161. padding: 0;
  162. margin: 0;
  163. overflow-x: hidden;
  164. }
  165. .uni-main{
  166. width: 100%;
  167. height: 100%;
  168. min-height: 800rpx;
  169. display: block;
  170. background:url('../../../static/index/peifu/peifu_bg.png') no-repeat center 100%/100% #f5c163;
  171. min-height: 800rpx;
  172. font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  173. /* background: cover; */
  174. overflow-x:hidden ;
  175. }
  176. .header{
  177. padding-top: 10rpx;
  178. }
  179. .header text{
  180. margin: 30rpx;
  181. color: #FFFFFF;
  182. font-size: 40rpx;
  183. }
  184. .header .menu{
  185. margin-top: -100rpx;
  186. width: 100rpx;
  187. height: 100rpx;
  188. margin-left: 85%;
  189. }
  190. .menuBox{
  191. width: 300rpx;
  192. height: 230rpx;
  193. margin-left:100%;
  194. transform: translateX(-100%);
  195. background-color: #FFFFFF;
  196. border-radius: 10rpx;
  197. overflow: hidden;
  198. }
  199. .menuI1,.menuI2{
  200. width: 300rpx;
  201. height: 115rpx;
  202. padding-top: 40rpx;
  203. padding-left: 20rpx;
  204. }
  205. .menuI1 view,.menuI2 view{
  206. float: right;
  207. font-size: 40rpx;
  208. margin-right: 30rpx;
  209. }
  210. .Bottom{
  211. }
  212. .imgBtn image{
  213. width: 400rpx;
  214. height: 120rpx;
  215. }
  216. .imgBtn{
  217. position: absolute;
  218. width: 400rpx;
  219. height: 120rpx;
  220. top: 88%;
  221. left: 50%;
  222. transform: translateX(-50%);
  223. }
  224. .btnText{
  225. position: absolute;
  226. color: #c5836b;
  227. font-size: 60rpx;
  228. font-weight: 700;
  229. transform: translateY(-140%);
  230. left: 80rpx;
  231. }
  232. .rankBtn image{
  233. width: 100rpx;
  234. height: 120rpx;
  235. position: absolute;
  236. top: 88%;
  237. left: 100%;
  238. transform: translateX(-120%);
  239. }
  240. .shelter{
  241. top: 0;
  242. position: absolute;
  243. z-index: 9;
  244. width: 100%;
  245. height: 100%;
  246. background-color: rgba(0,0,0,0.5);
  247. }
  248. .rank{
  249. position: absolute;
  250. top: 20%;
  251. width: 580rpx;
  252. height: 900rpx;
  253. background-color: #fed396;
  254. border-radius: 20rpx;
  255. left: 50%;
  256. transform: translateX(-50%);
  257. }
  258. .rankHeader{
  259. width: 580rpx;
  260. height: 100rpx;
  261. }
  262. .rank .rankText,.rank .rankClose{
  263. display: block;
  264. font-weight: 800;
  265. margin-top: 0rpx;
  266. position: absolute;
  267. line-height: 100rpx;
  268. margin-left: 0;
  269. left:50%;
  270. transform: translateX(-50%);
  271. }
  272. .rank .rankClose{
  273. font-size: 100rpx;
  274. left: 90%;
  275. margin-top: -10rpx;
  276. }
  277. .rank .rankText{
  278. color: #c38466;
  279. }
  280. .rank .rankContent{
  281. width: 500rpx;
  282. height: 780rpx;
  283. border-radius: 20rpx;
  284. background-color:#e4c495;
  285. margin-left: 40rpx;
  286. overflow: scroll;
  287. }
  288. .rankInner{
  289. margin-top: 20rpx;
  290. }
  291. .rankContent .rankInner {
  292. margin-left: 10rpx;
  293. position: relative;
  294. }
  295. .rankOrder{
  296. border-radius: 10rpx;
  297. margin-bottom: 20rpx;
  298. background-color: #f7ebdd;
  299. width: 480rpx;
  300. height: 80rpx;
  301. display: flex;
  302. flex-direction: row;
  303. align-items: center;
  304. }
  305. .rankName,.rankNum,.rankA{
  306. font-weight: 500;
  307. position: absolute;
  308. font-size: 35rpx;
  309. color:#c8907a;
  310. line-height: 80rpx;
  311. }
  312. .rankName{
  313. left: 40%;
  314. }
  315. .rankNum{
  316. left: 75%
  317. }
  318. .rankI image{
  319. width: 50rpx;
  320. height: 60rpx;
  321. transform: translateX(15rpx);
  322. }
  323. .rankA{
  324. left: 6%;
  325. }
  326. .wate image{
  327. margin: 0;
  328. position: absolute;
  329. width: 220rpx;
  330. height: 150rpx;
  331. top: 55%;
  332. left: 70%;
  333. }
  334. .water1{
  335. transform: rotateZ(0deg);
  336. transform: translateX(200rpx);
  337. }
  338. .water2{
  339. transition:all 1.5s;
  340. transform: translateX(-20rpx);
  341. }
  342. .water3{
  343. transition:all 1.5s;
  344. transform: rotateZ(-40deg);
  345. },
  346. .watering{
  347. transform: rotateZ(40deg);
  348. transform: translateX(-150rpx) translateY(50%);
  349. }
  350. .cord{
  351. width: 400rpx;
  352. height: 600rpx;
  353. position: absolute;
  354. left: 50%;
  355. transform: translateX(-50%) translateY(80%);
  356. }
  357. .zhe{
  358. width: 100%;
  359. height: 100%;
  360. background-color: rgb(0,0,0,0.4);
  361. position: absolute;
  362. top: 0;
  363. z-index: 999;
  364. }
  365. .know,.knowText{
  366. position: absolute;
  367. width: 300rpx;
  368. height:80rpx;
  369. left: 50%;
  370. transform: translateX(-50%);
  371. top: 70%;
  372. }
  373. .knowText{
  374. color: #c5836b;
  375. font-size: 50rpx;
  376. font-weight: 700;
  377. position: absolute;
  378. text-align: center;
  379. }
  380. .knowTime{
  381. width: 70rpx;
  382. height: 70rpx;
  383. border: #ff0000 5rpx solid;
  384. border-radius: 50%;
  385. font-size: 50rpx;
  386. text-align: center;
  387. position: absolute;
  388. top: 38%;
  389. left: 65%;
  390. }
  391. </style>