active-raffle.html 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>活动-每日领取红包-创业帮</title>
  6. <meta name="keywords" content="活动-每日领取红包-创业帮">
  7. <meta name="description" content="活动-每日领取红包-创业帮">
  8. <meta content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,shrink-to-fit=no,user-scalable=no" name="viewport" viewport="cover">
  9. <meta name="apple-mobile-web-app-capable" content="yes">
  10. <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
  11. <meta content="telephone=no" name="format-detection">
  12. <meta content="email=no" name="format-detection">
  13. <meta name="apple-mobile-web-app-title" content="活动-每日领取红包-创业帮">
  14. <meta http-equiv="Cache-Control" content="no-siteapp">
  15. <link rel="stylesheet" href="./static/css/main.css">
  16. <style>
  17. .raffle .task-btn .receive,
  18. .raffle .task-btn .unreceive{
  19. width:1.56rem;
  20. }
  21. @keyframes popMove {0%{left:100%}100%{left:-80%}}
  22. .popMove{animation:popMove 6s linear}
  23. .popups .warp{left:100%;}
  24. .van-sticky--fixed .mt1{ margin-top:.1067rem;background-color:transparent !important;}
  25. .noup{top:-100%!important;}
  26. .raffle {background-image:linear-gradient(to bottom, #89275d 10%, #f63d45 20%) !important;}
  27. .raffle .iphonetitle {
  28. background-image: radial-gradient(center bottom, ellipse cover, #b94468, #89275d) !important;
  29. background-image: -o-radial-gradient(center bottom, ellipse cover, #b94468, #89275d) !important;
  30. background-image: -ms-radial-gradient(center bottom, ellipse cover, #b94468, #89275d) !important;
  31. background-image: -moz-radial-gradient(center bottom, ellipse cover, #b94468, #89275d) !important;
  32. background-image: -webkit-radial-gradient(center bottom, ellipse cover, #b94468, #89275d) !important;
  33. }
  34. .raffle .task-container{margin-top:.4267rem}
  35. .rank-container .van-sticky--fixed{width:94%;margin:0 auto;padding:0 .32rem;box-sizing: border-box;}
  36. .raffle .rank-container .rankmain{ height:.9rem !important;}
  37. .raffle .rank-container .rank1,
  38. .raffle .rank-container .rank2,
  39. .raffle .rank-container .rank3 {margin-top:.213333rem;height:1.04rem !important;}
  40. .raffle .rank-container .rank3 {margin-bottom:.213333rem;}
  41. </style>
  42. </head>
  43. <body class="pb0 ovh raffle">
  44. <div class="iphonetitle"></div>
  45. <div class="ovh-x" id="app" v-cloak ref="wrapper1">
  46. <div class="top-image df rel"><img class="abs icon-logo" src="./static/images/active/raffle/raffle-active-logo.png" alt="">
  47. <van-sticky class="top-panel abs" :offset-top="topheight">
  48. <div>
  49. <div class="abs top-icon icon-right mt1" @click="refresh"><img src="./static/images/active/raffle/raffle-active-refresh.png" alt=""></div>
  50. <div class="abs top-icon icon-left mt1" @click="backbtn"><img src="./static/images/active/raffle/raffle-active-back.png" alt=""></div><img class="abs top-font mt12" src="./static/images/active/raffle/raffle-title.png" alt="">
  51. </div>
  52. </van-sticky>
  53. <div class="abs top-icon icon-left icon-sec" @click="rules"><img src="./static/images/active/raffle/raffle-active-rules.png" alt=""></div>
  54. <div class="abs top-icon icon-right icon-sec" @click="record"><img src="./static/images/active/raffle/raffle-active-record.png" alt=""></div>
  55. <div class="popups abs" ref="contaner">
  56. <div class="df abs warp" v-for="pop,index in scrollQuene" :key="pop.id" :ref="'pop' + pop.id" :class="'class' + pop.id">
  57. <div class="linnerBox-right"> <img src="./static/images/active/raffle/redpokect.png" alt="alt" width="80%"></div>
  58. <div class="popItem cfff f10">{{pop.text}}</div>
  59. <div class="linnerBox-left"> </div>
  60. </div>
  61. </div><img class="bg raffle-bg" src="./static/images/active/raffle/raffle-top-background-image.png" alt="">
  62. <div class="cfff f14 abs datetitle">第{{nowactive}}期 | 每晚22:00开奖</div>
  63. <div class="couponcode abs"><img class="outleft1" src="./static/images/active/raffle/raffle-code.png" alt=""><img class="outleft2" src="./static/images/active/raffle/raffle-code.png" alt=""><img class="outright1" src="./static/images/active/raffle/raffle-code.png" alt=""><img class="outright2" src="./static/images/active/raffle/raffle-code.png" alt=""><img class="outcenter1" src="./static/images/active/raffle/raffle-code.png" alt=""><img class="outcenter2" src="./static/images/active/raffle/raffle-code.png" alt=""></div><img class="hand abs rotatehand" src="./static/images/active/raffle/raffle-hand-code.png" alt="">
  64. <div class="raffle-container abs"><img class="bg" src="./static/images/active/raffle/raffle-Jackpot.png" alt="">
  65. <div class="abs rafflecount opcm aic">
  66. <div class="cfff df">
  67. <div class="f24 b">888.88</div>
  68. <div class="f14 df aife mb2 ml4">元</div>
  69. </div>
  70. <div class="f10 cfff tc rules">300个红包限量抢</div>
  71. </div>
  72. </div><img class="cloud-left abs cloud1" src="./static/images/active/raffle/raffle-cloud-left.png" alt=""><img class="cloud-right abs cloud2" src="./static/images/active/raffle/raffle-cloud-right.png" alt="">
  73. <div class="award-container abs df">
  74. <div class="award award-code rel" @click="showFilter = true"><img class="bg" src="./static/images/active/raffle/raffle-award-code.png" alt="">
  75. <div class="abs opcm aic tc">
  76. <div class="df">
  77. <div class="f14 df aife mb2 ml4" v-if="creatorinfo.StaStatus">已达标</div>
  78. <div class="f14 df aife mb2 ml4" v-else>未达标</div>
  79. </div>
  80. <div class="f10">本期任务</div>
  81. </div>
  82. </div>
  83. <div class="award award-code-notin rel" @click="record"><img class="bg" src="./static/images/active/raffle/raffle-award-code-notin.png" alt="">
  84. <div class="abs opcm aic">
  85. <div class="df">
  86. <div class="f14 df aife mb2">{{creatorinfo.PreStatus ? '上期已参与':'上期未参与'}}</div>
  87. </div>
  88. <div class="f10">参与记录</div>
  89. </div>
  90. </div>
  91. </div>
  92. </div>
  93. <div class="radial-gradient"></div>
  94. <div class="task-container df bbox jcsb">
  95. <div class="df mr8"><img class="task-icon mr8" src="./static/images/active/raffle/raffle-task-icon.png" alt="">
  96. <div class="task-main">
  97. <div class="c333 b f14">做任务 抢红包</div>
  98. <div class="c333 mb f12 mt12 mb6 spc">激活抢红包</div>
  99. <div class="c999 mb f10">当日00:00-21:59 激活机具即可达标,300个红包抢完即止,每期限领1次</div>
  100. </div>
  101. </div>
  102. <div class="task-btn df aic">
  103. <div class="tc">
  104. <div class="c999 f8"> <span class="spcolor">{{time}}</span></div>
  105. <button class="f10 receive" v-if="creatorinfo.GetStatus === 1" @click="receivefn">领取</button>
  106. <button class="f10 unreceive" v-if="creatorinfo.GetStatus === 2">已领取</button>
  107. <button class="f10 unreceive" v-if="creatorinfo.GetStatus === 3">未开始</button>
  108. <button class="f10 unreceive" v-if="creatorinfo.GetStatus === 4">抢光啦</button>
  109. <button class="f10 unreceive" v-if="creatorinfo.GetStatus === 0">未达标</button>
  110. </div>
  111. </div>
  112. </div>
  113. <div class="rank-container bgcfff bbox">
  114. <van-sticky :offset-top="topheight + 50" style="left:0;right:0;">
  115. <div class="bgcfff pt8 pb8">
  116. <div class="f18 c333 tc b">奖金排行榜</div>
  117. <div class="title f14 df mt20">
  118. <div @click="rank = 1" :class="rank === 1? 'chosebtn':''">累计奖金榜</div>
  119. <div class="c999">|</div>
  120. <div @click="rank = 2" :class="rank === 2? 'chosebtn':''">中奖次数榜</div>
  121. </div>
  122. <div class="ranktitle f12 c999 df mt16">
  123. <div class="tc" style="flex:1">排名</div>
  124. <div class="tc" style="flex:1">创客</div>
  125. <div class="tc" style="flex:1.3">创客推荐码</div>
  126. <div class="tc" style="flex:1.3" v-if="rank === 2">累计中奖次数</div>
  127. <div class="tc" style="flex:1.3" v-else>累计中奖金额</div>
  128. </div>
  129. </div>
  130. </van-sticky>
  131. <div class="ranktitle rankmain f12 c999 df mt8 aic" v-if="rank === 1">
  132. <div class="tc f12 c333" style="flex:1">{{Number(creatorinfo.MyTopInfo1.Num) < 101 && Number(creatorinfo.MyTopInfo1.Num) > 0 ? creatorinfo.MyTopInfo1.Num : '未上榜'}}</div>
  133. <div class="tc f12 c333" style="flex:1">{{creatorinfo.MyTopInfo1.RealName}}</div>
  134. <div class="tc f12 c333" style="flex:1.5">{{creatorinfo.MyTopInfo1.MakerCode}}<span class="ml6 f10" style="width:18px; height:100%;background-color:#FFC4C1;border-radius:3px;color:#DD4941;display:inline-block;">我</span></div>
  135. <div class="tc f12 c333" style="flex:1.3"><span class="f16 c333 b">{{creatorinfo.MyTopInfo1.Data}}</span><span>元</span></div>
  136. </div>
  137. <div class="ranktitle rankmain f12 c999 df mt8 aic" v-if="rank === 2">
  138. <div class="tc f12 c333" style="flex:1">{{Number(creatorinfo.MyTopInfo2.Num) < 101 && Number(creatorinfo.MyTopInfo2.Num) > 0 ? creatorinfo.MyTopInfo2.Num : '未上榜'}}</div>
  139. <div class="tc f12 c333" style="flex:1">{{creatorinfo.MyTopInfo2.RealName}}</div>
  140. <div class="tc f12 c333" style="flex:1.5">{{creatorinfo.MyTopInfo2.MakerCode}}<span class="ml6 f10" style="width:18px; height:100%;background-color:#FFC4C1;border-radius:3px;color:#DD4941;display:inline-block;">我</span></div>
  141. <div class="tc f12 c333" style="flex:1.3"><span class="f16 c333 b">{{creatorinfo.MyTopInfo2.Data}}</span><span>次</span></div>
  142. </div>
  143. <div class="ranktitle rankmain f12 c999 df aic" v-for="item,index in ranklist" :key="index" :class="rankfn(index)">
  144. <div class="tc f12 c999 b" style="flex:1" :class="rankontfn(index)">{{item.Num}}</div>
  145. <div class="tc f12 c333" style="flex:1">{{item.UserInfo.RealName}}</div>
  146. <div class="tc f12 c333" style="flex:1.3">{{item.UserInfo.MakerCode}}</div>
  147. <div class="tc f12 c333" style="flex:1.3"><span class="f16 c333 b">{{item.Data}}</span><span v-if="rank === 2">次</span><span v-else>元</span></div>
  148. </div>
  149. </div>
  150. <van-popup class="receivedialog tc" v-model="receivedialog" :close-on-click-overlay="false">
  151. <canvas class="canvas abs pagcanvas" id="pag" style="z-index:99;" :class="!PreInfo.MakerCode ? 'noup' : ''"></canvas>
  152. <van-icon class="abs closebtn" name="./static/images/close-level.png" color="#666" @click="receivedialog = false"> </van-icon><img class="scalc100 title" src="./static/images/active/raffle/raffle-receive-untitle.png" alt="" v-if="!this.count"><img class="scalc100 title" src="./static/images/active/raffle/raffle-receive-title.png" alt="" v-if="this.count">
  153. <div class="f18 cfff mt16" v-if="this.count">- 抽中奖金 -</div>
  154. <div class="comtainer rel mt8 width0-100 ovh" v-if="this.count"><img class="w100 vouch" src="./static/images/active/raffle/raffle-card-voucher1.png" alt="">
  155. <div class="abs opcm c333 f14 w100 opac0-1" style="white-space:nowrap;">恭喜您抽中<span class="f16 spc">{{count}}元</span><span>奖金,已发放至您的创客余额</span></div>
  156. </div>
  157. <div class="f18 cfff mt16" v-if="!this.count">- 抢完啦 -</div>
  158. <div class="comtainer rel mt8 width0-100 ovh" v-if="!this.count"><img class="w100 vouch" src="./static/images/active/raffle/raffle-card-voucher3.png" alt="">
  159. <div class="abs opcm c333 f14 w100 opac0-1" style="white-space:nowrap;">很抱歉,本期红包已抢完</div>
  160. </div>
  161. <div class="f18 cfff mt32" v-if="PreInfo.MakerCode">- 上期最高奖 -</div>
  162. <div class="comtainer rel mt8 width0-100 ovh" v-if="PreInfo.MakerCode"><img class="w100 vouch" src="./static/images/active/raffle/raffle-card-voucher2.png" alt="">
  163. <div class="abs c333 f14 w100 opcm opac0-1"><span class="c333 mr12">{{PreInfo.MakerCode}} </span><span class="c333 mr12">{{PreInfo.RealName}}</span><span class="c333 mr12">中得</span><span class="f18 spc">{{PreInfo.PrizeAmt}}</span><span class="spc">元</span></div>
  164. </div>
  165. </van-popup>
  166. </div>
  167. <script src="./static/js/klm-vv.min.js"></script>
  168. <script src="./static/js/appfunc.min.js"></script>
  169. <script src="./static/js/klm-axios-config.js"></script>
  170. <script src="./static/js/publicfn.js"></script>
  171. <script src="./static/js/libpag.js"></script>
  172. <script>
  173. class Danmaku {
  174. constructor(option){
  175. this.id = option.id
  176. this.text = `创客 ${option.name} 抽中红包 ¥${option.packte}` //内容
  177. //- this.top = this.getStrack(option.position) //轨道 弹幕吸顶,居中,触底
  178. this.time = option.time || 5 //运行时间 默认5s
  179. this.color = option.color //文字颜色
  180. this.class = '.class' + option.id //文字颜色
  181. this.struck = { //轨道,轨道位置。是否可加入
  182. isOK:true,
  183. top:this.getStrack(option.position)
  184. }
  185. }
  186. getStrack(position = '',poa){
  187. let struck = null
  188. if(position == ''){
  189. let top = Math.floor(Math.random() * 10)
  190. if(poa === 0 && top>=0 && top<2){ top = 3 };
  191. if(poa === 20 && top>=2 && top<4){ top = 5 };
  192. if(poa === 40 && top>=4 && top<6){ top = 7 };
  193. if(poa === 60 && top>=6 && top<8){ top = 9 };
  194. if(poa === 80 && top>=8 && top<10){ top = 0 };
  195. if(top>=0 && top<2) return struck = 0;
  196. if(top>=2 && top<4) return struck = 20;
  197. if(top>=4 && top<6) return struck = 40;
  198. if(top>=6 && top<8) return struck = 60;
  199. if(top>=8 && top<10) return struck = 80;
  200. }
  201. if(position == 'top'){
  202. return struck = 0;
  203. }
  204. if(position == 'center'){
  205. return struck = 50;
  206. }
  207. if(position == 'bottom'){
  208. return struck = 100;
  209. }
  210. }
  211. //- getPosition(weizhi){
  212. //- if(weizhi == 'top'){
  213. //- this.top = 0
  214. //- }
  215. //- if(weizhi == 'center'){
  216. //- this.top = 50
  217. //- }
  218. //- if(weizhi == 'bottom'){
  219. //- this.top = 100
  220. //- }
  221. //- }
  222. }
  223. </script>
  224. <script>
  225. // 在 #app 标签下渲染一个按钮组件
  226. let app = new Vue({
  227. el: '#app',
  228. data() {
  229. return {
  230. showFilter:false,
  231. show:false,
  232. //- 状态栏高度
  233. topheight:0,
  234. nowactive:'',
  235. creatorinfo:{
  236. GetStatus:3,
  237. StaStatus:0,
  238. PreStatus:0,
  239. MyTopInfo1:{
  240. MakerCode:'',
  241. RealName:'',
  242. Num:11,
  243. Data:0,
  244. }
  245. },
  246. receive:0,
  247. count:'',
  248. rank:1,
  249. receivedialog:false,
  250. time:'',
  251. popList:[
  252. {
  253. name:'方**',
  254. packte:88.88,
  255. id:1,
  256. },
  257. {
  258. name:'向*',
  259. packte:55.55,
  260. id:2,
  261. },
  262. {
  263. name:'刘**',
  264. packte:28.88,
  265. id:3,
  266. },
  267. {
  268. name:'谢*',
  269. packte:8.88,
  270. id:4,
  271. },
  272. {
  273. name:'刘*',
  274. packte:4.32,
  275. id:5,
  276. },
  277. {
  278. name:'魏**',
  279. packte:4.28,
  280. id:6,
  281. },
  282. {
  283. name:'潘**',
  284. packte:62.46,
  285. id:7,
  286. },
  287. {
  288. name:'桂*',
  289. packte:23.55,
  290. id:8,
  291. },
  292. {
  293. name:'张**',
  294. packte:2.68,
  295. id:9,
  296. },
  297. {
  298. name:'张**',
  299. packte:78.66,
  300. id:10,
  301. },
  302. {
  303. name:'王*',
  304. packte:54.51,
  305. id:11,
  306. },
  307. {
  308. name:'吴*',
  309. packte:1.88,
  310. id:12,
  311. },
  312. {
  313. name:'胡*',
  314. packte:42.66,
  315. id:13,
  316. },
  317. {
  318. name:'向*',
  319. packte:25.55,
  320. id:14,
  321. },
  322. {
  323. name:'雷**',
  324. packte:34.68,
  325. id:15,
  326. },
  327. {
  328. name:'郭*',
  329. packte:16.26,
  330. id:16,
  331. },
  332. {
  333. name:'范**',
  334. packte:3.55,
  335. id:17,
  336. },
  337. {
  338. name:'贾*',
  339. packte:39.08,
  340. id:18,
  341. },
  342. {
  343. name:'陈*',
  344. packte:46.26,
  345. id:19,
  346. },
  347. {
  348. name:'李**',
  349. packte:65.55,
  350. id:20,
  351. },
  352. ],
  353. scrollQuene:[],
  354. ranklist:[
  355. ],
  356. PreInfo:{
  357. },
  358. isbegin:false,
  359. lastDanmu:0,
  360. list2:[],
  361. }
  362. },
  363. created() {
  364. this.topheightfn();
  365. this.nowactive = formatDate(new Date().getFullYear(),new Date().getMonth()+1,new Date().getDate());
  366. //- this.countdown();
  367. this.getcreatorinfo();
  368. this.getrank();
  369. //- this.initPop(this.popList)
  370. },
  371. beforeUpdate() {
  372. this.$refs.wrapper1.style.height = `${document.documentElement.clientHeight - this.topheight}px`;
  373. //- window.requestAnimationFrame(this.createPop())
  374. },
  375. computed:{
  376. },
  377. watch:{
  378. rank(){
  379. this.getrank();
  380. },
  381. },
  382. methods: {
  383. aaa(){
  384. this.popList.forEach(item=>{
  385. item.id++;
  386. });
  387. },
  388. //弹幕
  389. initPop(arr){
  390. let num = 0;
  391. arr.forEach((item,index)=>{
  392. let danmu = new Danmaku(item)
  393. let warp = this.$refs.contaner;
  394. setTimeout(()=>{
  395. num++;
  396. //- if(this.lastDanmu === danmu.struck.top ){
  397. //- danmu.struck.top = danmu.getStrack()
  398. //- console.log('重叠了!',this.lastDanmu,'上一个',danmu.struck.top,'现在');
  399. //- }
  400. //- do{
  401. //- danmu.struck.top = danmu.getStrack();
  402. //- console.log(this.lastDanmu,danmu.struck.top,60000)
  403. //- }while (this.lastDanmu === danmu.struck.top);
  404. if(this.lastDanmu === danmu.struck.top){
  405. console.log(this.lastDanmu,danmu.struck.top,1);
  406. danmu.struck.top = danmu.getStrack(danmu.struck.top);
  407. };
  408. if(this.lastDanmu === danmu.struck.top){
  409. console.log(this.lastDanmu,danmu.struck.top,2);
  410. };
  411. this.lastDanmu = danmu.struck.top;
  412. if(num === arr.length){
  413. this.testaa(danmu,index,true);
  414. }else{
  415. this.testaa(danmu,index);
  416. };
  417. },Math.random()* arr.length * 1000);
  418. })
  419. },
  420. testaa(danmu,index,islast = false){
  421. this.scrollQuene.push(danmu)
  422. setTimeout(()=>{
  423. this.setPopStyle(danmu)
  424. this.popMove(danmu,index,islast)
  425. },100);
  426. },
  427. popMove(danmu,index,islast){
  428. //- let warp = this.$refs.contaner;
  429. //- let node = document.querySelector(danmu.class);
  430. let node = this.$refs['pop' + `${danmu.id}`][0];
  431. node.classList.add('popMove')
  432. setTimeout(()=>{
  433. //- node.classList.remove('popMove')
  434. //- console.log(this.scrollQuene)
  435. //- this.scrollQuene = this.scrollQuene.splice(0,1);
  436. //- this.scrollQuene.shift();
  437. //- console.log(this.scrollQuene);
  438. //- node.remove();
  439. //- setTimeout(()=>{this.aaa();this.initPop(this.popList)},1000)
  440. //- setTimeout(()=>{node.classList.add('popMove')},100)
  441. },6000)
  442. if(islast){
  443. this.initPop(this.popList);
  444. this.scrollQuene.splice(0,this.scrollQuene.length - 5);
  445. };
  446. },
  447. setPopStyle(danmu){
  448. let node = this.$refs['pop' + `${danmu.id}`][0];
  449. node.style = {}
  450. //- node.style.opacity = '0'
  451. //- node.style.transition = `transform ${danmu.time}s linear` //运行时间
  452. //- node.style.transition = `transform 0s linear`
  453. node.style.color = `${danmu.color}` //内容颜色
  454. node.style.top = ` ${danmu.struck.top}%` //弹幕垂直方向位置
  455. //- node.style.transform = `0px`;
  456. },
  457. pageffect(url = '') {
  458. const that = this;
  459. window.libpag.PAGInit().then(async (PAG) => {
  460. axios({url,responseType: "blob"}).then(async (response) =>{return response.request.response}).then(async (blob) => {
  461. let file = new window.File([blob], url.replace(/(.*\/)*([^.]+)/i, '$2'));
  462. const pagFile = await PAG.PAGFile.load(file);
  463. document.getElementById('pag').width = document.documentElement.clientWidth;
  464. document.getElementById('pag').height = document.documentElement.clientWidth;
  465. const pagView = await PAG.PAGView.init(pagFile, '#pag',{ useCanvas2D: true,useScale: true,firstFrame:true });
  466. pagView.setRepeatCount(0);
  467. await pagView.play();
  468. this.pagView = pagView;
  469. });
  470. });
  471. },
  472. //- 高度适配函数
  473. topheightfn(){
  474. const type = browsertype.versions.ios ? 'ios' : 'android';
  475. if(type === 'ios'){
  476. if(isFringe()){
  477. this.topheight = 48;
  478. }else{
  479. this.topheight = 20;
  480. };
  481. }else{
  482. this.topheight = PublicLib.getStatusBarHeight();
  483. };
  484. },
  485. //- 倒计时函数
  486. countdown(){
  487. const target = new Date().getFullYear() + '/' + fillzero(new Date().getMonth()+1) + '/' + fillzero(new Date().getDate()) + ' 17:26:00';
  488. let istimeout = new Date().getTime() > new Date(target).getTime()
  489. if(istimeout){
  490. this.time = '';
  491. this.isbegin = true;
  492. this.getcreatorinfo();
  493. }else{
  494. this.time = this.getundate(target);
  495. this.isbegin = false;
  496. };
  497. const timer = setInterval(()=>{
  498. istimeout = new Date().getTime() > new Date(target).getTime()
  499. this.time = this.getundate(target);
  500. if(istimeout){
  501. this.time = '';
  502. clearInterval(timer);
  503. };
  504. },1000);
  505. },
  506. //- 倒计时处理函数
  507. getundate(time){
  508. var nowTime = +new Date(); // 返回的是当前时间总的毫秒数
  509. var inputTime = +new Date(time); // 返回的是用户输入时间总的毫秒数
  510. var times = (inputTime - nowTime) / 1000; // times是剩余时间总的秒数
  511. var h = parseInt(times / 60 / 60 % 24); //时
  512. h = h < 10 ? '0' + h : h;
  513. var m = parseInt(times / 60 % 60); //分
  514. m = m < 10 ? '0' + m : m;
  515. var s = parseInt(times % 60); // 秒
  516. s = s < 10 ? '0' + s : s;
  517. return h + ':' + m + ':' + s; //返回函数计算出的值
  518. },
  519. //- 获取创客获奖信息
  520. async getcreatorinfo(){
  521. const UserId = PublicLib.getCookieInfo('userId');
  522. const res = await getRequest('api/v1/activityredpackagejoins/detail?t='+Math.random(6),JSON.stringify({UserId}));
  523. if(res.status !== '1') return tips(res.info);
  524. this.creatorinfo = res.data;
  525. },
  526. //- 获取定时器最后一次创客获奖信息
  527. async getlastcreatorinfo(){
  528. const UserId = PublicLib.getCookieInfo('userId');
  529. const res = await getRequest('api/v1/activityredpackagejoins/detail?t='+Math.random(6),JSON.stringify({UserId}));
  530. if(res.status !== '1') return tips(res.info);
  531. this.creatorinfo = res.data;
  532. this.isbegin = true;
  533. },
  534. //- 获取排行榜
  535. async getrank(){
  536. const res = await getRequest('api/v1/activityredpackagetop10/list?t='+Math.random(6),JSON.stringify({Kind:this.rank,PageNum:1,PageSize:100}));
  537. if(res.status !== '1') return tips(res.info);
  538. this.ranklist = res.data;
  539. res.data.forEach(item=>{
  540. if(item.UserInfo.RealName && item.UserInfo.RealName.length === 3){
  541. item.UserInfo.RealName = item.UserInfo.RealName[0] + '**';
  542. }else if(item.UserInfo.RealName && item.UserInfo.RealName.length != 3){
  543. item.UserInfo.RealName = item.UserInfo.RealName[0] + '*';
  544. }
  545. })
  546. if(res.data.length === 0) {
  547. this.getrank();
  548. };
  549. },
  550. //- 刷新
  551. refresh:undebounce(async function(){
  552. await this.getrank();
  553. await this.getcreatorinfo();
  554. tips('刷新成功');
  555. },500),
  556. //- 领取
  557. receivefn:undebounce(async function(){
  558. const that = this;
  559. const UserId = PublicLib.getCookieInfo('userId');
  560. const res = await postRequest('api/v1/activityredpackagejoins/getprize?t='+Math.random(6),JSON.stringify({UserId}));
  561. if(res.status === '-1'){
  562. return tips(res.info);
  563. };
  564. that.receive = 1;
  565. that.receivedialog = true;
  566. if(res.status === '2'){
  567. that.count = null;
  568. that.PreInfo.PrizeAmt = null;
  569. }else{
  570. that.count = res.data.PrizeAmt;
  571. that.PreInfo = res.data.PreInfo ? res.data.PreInfo : '';
  572. setTimeout(()=>{
  573. that.pageffect('./static/pag/active-raffle.pag');
  574. },300);
  575. };
  576. that.getcreatorinfo();
  577. },500),
  578. record(){
  579. PublicLib.Goto({Url:'active-raffle-record'});
  580. },
  581. backbtn(){
  582. PublicLib.GoBack({Level:1});
  583. },
  584. //- 排名背景
  585. rankfn(index){
  586. if(index === 0) return 'rank1';
  587. if(index === 1) return 'rank2';
  588. if(index === 2) return 'rank3';
  589. },
  590. rankontfn(index){
  591. if(index === 0) return 'rankfont1';
  592. if(index === 1) return 'rankfont2';
  593. if(index === 2) return 'rankfont3';
  594. },
  595. rules(){
  596. PublicLib.Goto({Url:'active-raffle-rules'});
  597. },
  598. },
  599. });
  600. </script>
  601. </body>
  602. </html>