index.vue 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403
  1. <template>
  2. <view class="luckyDraw">
  3. <image src="../../static/backImg.png" class="back" mode="widthFix"></image>
  4. <view class="luckyDrawContent">
  5. <!-- 个人信息模块 -->
  6. <view class="luckyDrawTop">
  7. <view class="left">
  8. <view class="avatarView" @click="startAni(3)">
  9. <open-data type="userAvatarUrl" class="avatar"></open-data>
  10. </view>
  11. <view class="userInfo">
  12. <view class="account" v-if="mpName">{{mpName}}</view>
  13. <view class="ID">ID:{{userId}}</view>
  14. </view>
  15. </view>
  16. <navigator :url="'../checkInRecord/checkInRecord' + getSerialize({...mpData, openId})" class="right" hover-class="none">
  17. <text>中奖记录</text>
  18. </navigator>
  19. </view>
  20. <!-- 滚动通知 -->
  21. <view class="notice">
  22. <image src="../../static/horn.png" class="horn" mode="widthFix"></image>
  23. <view class="txts">
  24. <u-notice-bar mode="vertical" :volume-icon="false" color="#FFFFFF" type="none" :list="list"></u-notice-bar>
  25. </view>
  26. </view>
  27. <!-- 去抽奖路口 -->
  28. <view class="qLuckDraw" @click="jumpSign">
  29. <image src="../../static/redEnv.png" mode="widthFix"></image>
  30. </view>
  31. <!-- 大转盘 -->
  32. <view class="turntable">
  33. <view class="decorate">
  34. <image src="../../static/decorate.png" class="decorateBack" mode="widthFix"></image>
  35. <image src="../../static/chassis.png" class="decorateChassis" mode="widthFix"></image>
  36. </view>
  37. <view class="turntableContent">
  38. <view class="al">
  39. <almost-lottery
  40. :canvasId="canvasConfig.canvasId"
  41. :canvasWidth="canvasConfig.width"
  42. :canvasHeight="canvasConfig.height"
  43. :outerWidth="canvasConfig.outerWidth"
  44. :outerHeight="canvasConfig.outerHeight"
  45. :colors="canvasConfig.colors"
  46. :ringCount="8"
  47. :duration="5"
  48. :prizeList="prizeList"
  49. :prizeIndex="prizeIndex"
  50. @reset-index="prizeIndex = -1"
  51. @draw-start="handleDrawStart"
  52. @draw-end="handleDrawEnd"
  53. @finish="handleDrawFinish"
  54. v-if="prizeList.length"
  55. />
  56. </view>
  57. <view class="bottom">
  58. <view class="cont">今日剩余抽奖次数:<text>{{freeNum}}</text></view>
  59. </view>
  60. </view>
  61. </view>
  62. <view style="margin: 0 30rpx;">
  63. <ad-view :unitId="adConfig.bannerAd" adIntervals="200"></ad-view>
  64. </view>
  65. <!-- 我的奖品 -->
  66. <view class="myPrize">
  67. <view class="title">我的奖品</view>
  68. <view class="chips">
  69. <view class="chip" v-for="(item, index) in prizeCountDtoList" :key="index">
  70. <image src="../../static/iPhone12Chip.png" mode="widthFix" v-if="item.prizeType === 3"></image>
  71. <image src="../../static/vipChip.png" mode="widthFix" v-else></image>
  72. <view class="text">{{item.prizeName}}</view>
  73. <view class="progress">
  74. <view class="value" :style="{width: item.prizeCount && item.prizeCount > 0 ? (item.prizeCount/item.maxCount*100) + '%' : '0'}"></view>
  75. <text>{{item.prizeCount}}/{{item.maxCount}}</text>
  76. </view>
  77. </view>
  78. </view>
  79. <view class="clearTime" v-if="clearTime">碎片有效期至:{{clearTime | getTimerFilter}} </view>
  80. </view>
  81. <!-- 活动规则模块 -->
  82. <view class="activityRules">
  83. <view class="top" @click="activityRulesHandle">
  84. <text>活动规则</text>
  85. <image :src="!activityRules ? '../../static/unfold.png' : '../../static/retract.png'" mode="widthFix"></image>
  86. </view>
  87. <view class="bottom" v-if="activityRules">
  88. <view>1、每个用户账户每天最多有10次抽奖机会,每天0点刷新。</view>
  89. <view>2、每天前2次可直接领取抽奖奖品,其他8次抽奖机会需要通过观看激励视频来获得。</view>
  90. <view>3、用户必须在对应公众号内登陆抽奖,否则书币将无法顺利领取。</view>
  91. <view>4、书币及7天书城VIP会员抽中后自动发放至书城账号,可在中奖记录中查看,或进入书城的“个人中心-充值记录-赠送”查看。</view>
  92. <view>5、用户可以通过完成本产品抽奖获得碎片,碎片种类由系统随机发放,兑换手机需集满50个碎片, 兑换书城VIP需集满30个碎片。碎片累计有效期为7天,在碎片超出有效期后或用户成功兑换奖品后,此前已获得的该奖品碎片都将清零。</view>
  93. <view>6、实物奖品请联系公众号内客服领取,实物奖品颜色随机寄送,以中奖用户收到的实物为准。</view>
  94. <view>7、若发现用户恶意违规行为,开发者有权取消其获奖资格。</view>
  95. <view>8、本活动解释权由开发者所有,有任何疑问请联系公众号内客服。</view>
  96. </view>
  97. </view>
  98. <!-- 弹窗 -->
  99. <view class="popup" v-if="popupShow">
  100. <view class="popupContent">
  101. <view class="content">
  102. <image src="../../static/popupBack.png"></image>
  103. <view class="textCon">
  104. <text class="ts">恭喜您获得</text> </br>
  105. <text class="reward ts">{{luckyDay.name}}</text> </br>
  106. <image src="../../static/doubleBt.png" class="doubleBt" mode="widthFix" :style="{transform: `scale(${scale})`}" @click="lookVideo"></image> </br>
  107. <text class="bt" @click="receiveGold(false)">不了,单倍领取</text>
  108. </view>
  109. </view>
  110. <image src="../../static/close.png" class="close" mode="widthFix" @click="closeHandle"></image>
  111. </view>
  112. </view>
  113. <!-- 弹窗VIP -->
  114. <view class="popupVIP popup" v-if="popupVIPShow">
  115. <view class="popupContent" style="width: 524rpx;">
  116. <view class="content">
  117. <image src="../../static/vipBack.png"></image>
  118. <view class="textCon" style="display: flex; align-items: flex-end;">
  119. <view class="againLuckDrawBt btVip" @click="againLuckDraw('vip');startAni(2)" :style="{transform: `scale(${scale})`}">再次抽奖</view>
  120. </view>
  121. </view>
  122. <image src="../../static/close.png" class="close" mode="widthFix" @click="popupVIPShow = false;startAni(2); showCpAd()"></image>
  123. </view>
  124. </view>
  125. <!-- 弹窗12 -->
  126. <view class="popup12 popup" v-if="popup12Show">
  127. <view class="popupContent" style="width: 702rpx;">
  128. <view class="content">
  129. <image src="../../static/12Back.png" style="height: 722rpx;"></image>
  130. <view class="textCon" style="display: flex; align-items: flex-end;">
  131. <view class="againLuckDrawBt" @click="againLuckDraw('12'); startAni(3)" :style="{transform: `scale(${scale})`, marginBottom: 0}">再次抽奖</view>
  132. </view>
  133. </view>
  134. <image src="../../static/close.png" class="close" mode="widthFix" @click="popup12Show = false; startAni(3); showCpAd()"></image>
  135. </view>
  136. </view>
  137. <!-- 弹窗金币 -->
  138. <view class="popup12 popup" v-if="popupGoldShow">
  139. <view class="popupContent" style="width: 636rpx;">
  140. <view class="content">
  141. <image src="../../static/goldBack.png" style="height: 790rpx;"></image>
  142. <view class="textCon" style="display: flex; align-items: center; flex-direction: column; justify-content: flex-end;">
  143. <text class="goldText">恭喜您获得</text> </br>
  144. <text class="goldText" style="margin-bottom: 48rpx;">{{luckyDay.name}}</text>
  145. <view class="againLuckDrawBt btGold" @click="againLuckDraw('gold'); startGold(false)" :style="{transform: `translateX(12rpx) scale(${scale})`}">再次抽奖</view>
  146. </view>
  147. </view>
  148. <image src="../../static/close.png" class="close" mode="widthFix" @click="popupGoldShow = false; startGold(false); showCpAd()"></image>
  149. </view>
  150. </view>
  151. <!-- 碎片飞行 -->
  152. <view class="fragmentAni" :animation="animationData">
  153. <image :src="prizeType === 3 ? '../../static/turntable_iPhone12.png' : '../../static/turntable_VIP.png'" mode="widthFix"></image>
  154. </view>
  155. <!-- 金币飞行组 -->
  156. <view class="fragmentGold" :animation="animationDatas[index]" v-for="(item, index) in goldData" :key="index" :style="{top: item.top, left: item.left}">
  157. <image src="../../static/turntable_gold.png" mode="widthFix"></image>
  158. </view>
  159. <!-- 弹窗提示 -->
  160. <view class="receiveTs" :animation="animationDataTs">
  161. {{tsTitle}}
  162. </view>
  163. <!-- 格子广告 -->
  164. <view class="singleLattice">
  165. <ad-custom-view :unit-id="adConfig.singleLatticeAd" adIntervals="200"></ad-custom-view>
  166. </view>
  167. </view>
  168. </view>
  169. </template>
  170. <script>
  171. let timer = null, powerOnTimer = null, adTimer = null, lqTimer = null;
  172. import AlmostLottery from '@/uni_modules/almost-lottery/components/almost-lottery/almost-lottery.vue'
  173. import { config, getHome, getOpenId, getBanner, setDrawGain, getPond, setReceive, getVersion } from '@/api/api.js'
  174. import { clearCacheFile } from '@/uni_modules/almost-lottery/utils/almost-utils.js'
  175. import { bannerAd, urgeVideoAd, insertScreenAd, singleLatticeAd } from '@/utils/ad_config.js'
  176. import adView from '@/components/ad-view/ad-view.vue'
  177. import adCustomView from '@/components/ad-custom-view/ad-custom-view.vue'
  178. const systemInfo = uni.getSystemInfoSync()
  179. export default {
  180. components: {
  181. AlmostLottery,
  182. adView,
  183. adCustomView
  184. },
  185. data() {
  186. return {
  187. title: 'Hello',
  188. adConfig: {
  189. bannerAd,
  190. singleLatticeAd
  191. },
  192. list: [
  193. '恭喜用户 “9016” 成功提现 2000书币',
  194. '恭喜用户 “9017” 成功提现 10书币',
  195. '恭喜用户 “9018” 成功提现 20书币',
  196. '恭喜用户 “9019” 成功提现 100书币'
  197. ],
  198. // canvas id、宽、高
  199. canvasConfig: {
  200. canvasId: 'almostLotteryCanvas',
  201. width: 280,
  202. height: 280,
  203. outerWidth: 305,
  204. outerHeight: 305,
  205. colors: [
  206. '#FEE3C6',
  207. '#FFFFFF'
  208. ]
  209. },
  210. // 以下是奖品配置数据
  211. // 奖品数据
  212. prizeList: [],
  213. // 中奖下标
  214. prizeIndex: -1,
  215. // 是否正在抽奖中,避免重复触发
  216. prizeing: false,
  217. // 以下为业务需求有关示例数据
  218. // 当日免费抽奖次数余额
  219. freeNum: 10,
  220. // 以下是
  221. // 活动规则开关控制
  222. activityRules: false,
  223. // 弹窗控制
  224. popupShow: false,
  225. // 抽到VIP碎片弹窗控制
  226. popupVIPShow: false,
  227. // 抽到12碎片弹窗控制
  228. popup12Show: false,
  229. // 抽到金币弹窗控制
  230. popupGoldShow: false,
  231. openId: '',
  232. mpData: {},
  233. prizeCountDtoList: [], // 碎片列表
  234. mpName: null, // 渠道号
  235. userId: 91874, //
  236. luckyDay: {}, // 中奖信息
  237. doubleKey: "", // 领取key
  238. clearTime: "", // 碎片有效期
  239. scale: 1,
  240. animation: null, // 动画实例
  241. animationData: null, // 动画
  242. animationDatas: [null, null, null, null, null, null, null, null], // 动画组
  243. animationDataTs: null,
  244. prizeType: 3, // 奖品类型
  245. durationMath: 20, // 防止动画每次都一样
  246. durationMath1: 20,
  247. durationMath2: 20,
  248. goldData: [
  249. {top: '404rpx', left: '300rpx'},
  250. {top: '434rpx', left: '240rpx'},
  251. {top: '430rpx', left: '398rpx'},
  252. {top: '448rpx', left: '424rpx'},
  253. {top: '380rpx', left: '412rpx'},
  254. {top: '332rpx', left: '332rpx'},
  255. {top: '356rpx', left: '240rpx'},
  256. {top: '474rpx', left: '294rpx'}
  257. ],
  258. tsTitle: '', //提示信息
  259. remoteVersion: null,
  260. loading: false,
  261. _isLoaded: false,
  262. powerOnCount: 0, // 记录开机秒数
  263. powerOnTimer: new Date().getTime(), // 保存当前进入页面的时间挫
  264. videoType: null, // 1 前面两次看视频翻倍 2 后面8次看视频抽奖
  265. // 本地
  266. weightTotal: 0,
  267. // 权重数组
  268. weightArr: [],
  269. }
  270. },
  271. computed: {
  272. isApple() {
  273. return uni.getSystemInfoSync().platform === 'ios'
  274. }
  275. },
  276. onLoad(options) {
  277. // 请求奖品数据
  278. this.mpData = options
  279. this.getData()
  280. this.animation = uni.createAnimation({ timingFunction: 'ease' })
  281. getVersion({appId: config.appid}).then(res => {
  282. this.remoteVersion = res.data
  283. })
  284. },
  285. onUnload() {
  286. uni.hideLoading()
  287. timer && clearInterval(timer)
  288. },
  289. onShareAppMessage() {},
  290. filters: {
  291. getTimerFilter(value) { // 获取年月日时分秒
  292. if(!value) return ""
  293. let timestamp = Date.parse(new Date(value))
  294. let date = new Date(timestamp)
  295. let Y = date.getFullYear()
  296. let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1)
  297. let D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
  298. let H = date.getHours() < 10 ? '0' + date.getHours() : date.getHours()
  299. let minute = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
  300. let S = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
  301. return `${Y}-${M}-${D} ${H}:${minute}:${S}`
  302. }
  303. },
  304. async onPullDownRefresh() {
  305. await this.handleInitCanvas()
  306. await this.getList()
  307. uni.stopPullDownRefresh();
  308. },
  309. onReady() {
  310. this.createInterstitialAd()
  311. this.powerOnShowAd()
  312. },
  313. watch: {
  314. // 监听获奖序号的变动
  315. popupShow(newVal, oldVal) {
  316. this.openAniBt(newVal)
  317. },
  318. popupVIPShow(newVal) {
  319. this.openAniBt(newVal)
  320. },
  321. popup12Show(newVal) {
  322. this.openAniBt(newVal)
  323. },
  324. popupGoldShow(newVal) {
  325. this.openAniBt(newVal)
  326. }
  327. },
  328. methods: {
  329. powerOnShowAd() {
  330. // 开机25秒调取弹窗广告 以后没5分钟调取
  331. powerOnTimer = setInterval(() => {
  332. this.powerOnCount += 1
  333. if(this.powerOnCount === 25 || this.powerOnCount % 325 === 0) {
  334. this.showInterstitialAd()
  335. }
  336. }, 1000)
  337. },
  338. // 创建插屏广告 激励视频广告
  339. createInterstitialAd() {
  340. // 创建插屏广告
  341. let interstitialAd = this.interstitialAd = uni.createInterstitialAd({adUnitId: insertScreenAd});
  342. interstitialAd.onLoad(() => {
  343. // 插屏 广告加载成功
  344. console.log("插屏 广告加载成功");
  345. this.loading = false;
  346. });
  347. interstitialAd.onClose(() => {
  348. // 用户点击了关闭或返回键(仅Android有返回键)
  349. console.log("插屏 广告关闭");
  350. });
  351. interstitialAd.onError((err) => {
  352. // 插屏 广告加载失败
  353. console.log("插屏 广告加载失败", err);
  354. this.loading = false;
  355. });
  356. // 广告实例创建成功后默认会执行一次 load,加载广告数据
  357. // 如果界面有 "显示广告" 按钮,需要先禁用掉,防止用户点击,等待广告数据加载成功后在放开
  358. this.loading = true;
  359. // 激励视频广告
  360. this._isLoaded = false
  361. let rewardedVideoAd = this._rewardedVideoAd = uni.createRewardedVideoAd({ adUnitId: urgeVideoAd })
  362. rewardedVideoAd.onLoad(() => {
  363. this._isLoaded = true
  364. console.log('onLoad event')
  365. // 加载激励视频成功
  366. // 当激励视频被关闭时,默认预载下一条数据,加载完成时仍然触发 `onLoad` 事件
  367. })
  368. rewardedVideoAd.onError((err) => {
  369. // 加载激励视频失败
  370. this._isLoaded = false
  371. console.log('onError event', err)
  372. })
  373. rewardedVideoAd.onClose((res) => {
  374. // 用户点击了【关闭广告】按钮
  375. console.log('==============>', res)
  376. if (res && res.isEnded) {
  377. // 正常播放结束
  378. if(this.videoType === 1){ // 看视频翻倍领取
  379. this.receiveGold(true)
  380. } else if (this.videoType === 2) { // 看视频抽奖
  381. if (!this.mpName) { // 首次没有重公众号进入
  382. this.localGetPrizeIndex()
  383. return
  384. }
  385. this.remoteGetPrizeIndex()
  386. }
  387. } else {
  388. // 播放中途退出
  389. this.prizeing = false
  390. this.freeNum++
  391. }
  392. })
  393. },
  394. // 抽完奖显示插屏广告
  395. showCpAd () {
  396. lqTimer && clearTimeout(lqTimer)
  397. setTimeout(() => {
  398. this.showInterstitialAd()
  399. }, 10000)
  400. },
  401. // 显示插屏广告广告
  402. showInterstitialAd() {
  403. // 调用 interstitialAd.show(),如果数据正在加载中不会显示广告,加载成功后才显示
  404. // 在数据没有加载成功时,需要防止用户频繁点击显示广告
  405. if(adTimer) {
  406. clearTimeout(adTimer)
  407. }
  408. let newT = new Date().getTime()
  409. if (((newT / 1000) - (this.powerOnTimer / 1000)) < 15) { // 判断是否开机15秒
  410. adTimer = setTimeout(() => {
  411. if (this.loading == true) {
  412. return
  413. }
  414. this.loading = true;
  415. this.interstitialAd.show().then((res) => {
  416. console.log('插屏广告成功---》', res)
  417. this.loading = false;
  418. }).catch(err => {
  419. console.log('插屏广告错误---》', err)
  420. });
  421. clearTimeout(adTimer)
  422. }, newT - this.powerOnTimer + 1000)
  423. return
  424. }
  425. if (this.loading == true) {
  426. return
  427. }
  428. console.log(11111)
  429. this.loading = true;
  430. this.interstitialAd.show().then((res) => {
  431. console.log('插屏广告成功---》', res)
  432. this.loading = false;
  433. }).catch(err => {
  434. console.log('插屏广告错误---》', err)
  435. });
  436. },
  437. // 显示激励视频广告
  438. showVideoAd(type) {
  439. console.log('显示激励视频广告')
  440. this.videoType = type
  441. if (this._isLoaded) {
  442. uni.showLoading({
  443. title: '正在拉取~~',
  444. })
  445. this._rewardedVideoAd.show().then(()=>{
  446. uni.hideLoading()
  447. console.log('拉取视频then')
  448. }).catch((err) => {
  449. console.log('拉取视频catch', err)
  450. uni.hideLoading()
  451. this._rewardedVideoAd && this._rewardedVideoAd.load().then(() => this._rewardedVideoAd && this._rewardedVideoAd.show()).catch(err => {
  452. uni.showToast({
  453. title: '当前无视频广告',
  454. icon: 'none'
  455. })
  456. })
  457. })
  458. } else {
  459. if(this.videoType === 1){ // 看视频翻倍领取
  460. this.receiveGold(true)
  461. } else if (this.videoType === 2) { // 看视频抽奖
  462. if (!this.mpName) { // 首次没有重公众号进入
  463. this.localGetPrizeIndex()
  464. return
  465. }
  466. this.remoteGetPrizeIndex()
  467. }
  468. }
  469. },
  470. // 是否开始呼吸开关动画
  471. openAniBt(val) {
  472. if(val) {
  473. timer = setInterval(() => {
  474. if(this.scale === 1) {
  475. this.scale = 0.92
  476. }else {
  477. this.scale = 1
  478. }
  479. }, 500)
  480. } else {
  481. timer && clearInterval(timer)
  482. }
  483. },
  484. // 开始动画 12 vip 碎片
  485. startAni(prizeType = 3) {
  486. if(prizeType === 3 || prizeType === 2) {
  487. this.prizeType = prizeType
  488. this.startTsAni(false)
  489. let index = this.prizeCountDtoList.findIndex(item => item.prizeType === prizeType)
  490. let left = index !== -1 ? index === 0 ? '150rpx' : '500rpx' : '500rpx'
  491. this.animation.opacity(1).step({ duration: this.durationMath })
  492. if( this.durationMath >= 50 ) {
  493. this.durationMath = 20
  494. } else {
  495. this.durationMath = this.durationMath + 1
  496. }
  497. // this.animation.top('1300rpx').left(left).step({ duration: 1200, delay: 100 })
  498. this.animation.top('76rpx').left('60rpx').step({ duration: 1000, delay: 100 })
  499. this.animation.opacity(0).top('453rpx').left('331rpx').step({ duration: 0 })
  500. this.animationData = this.animation.export()
  501. }
  502. },
  503. startGold(watchVideos) {
  504. this.prizeType = 1
  505. this.startTsAni(watchVideos)
  506. if( this.durationMath1 >= 50 ) {
  507. this.durationMath1 = 20
  508. } else {
  509. this.durationMath1 = this.durationMath1 + 1
  510. }
  511. this.animationDatas = this.goldData.map(item => {
  512. let animation = uni.createAnimation({ timingFunction: 'ease' })
  513. animation.opacity(1).step({ duration: this.durationMath1 })
  514. animation.top('76rpx').left('60rpx').step({ duration: Math.floor(Math.random() * 101) + 1000, delay: 100 }) //
  515. animation.opacity(0).top(item.top).left(item.left).step({ duration: 0 })
  516. return animation.export()
  517. })
  518. },
  519. startTsAni(watchVideos) {
  520. if(this.prizeType === 1) {
  521. if (watchVideos) {
  522. this.tsTitle = '+' + (this.luckyDay.prizeCount * 2) + this.luckyDay.prizeName
  523. } else {
  524. this.tsTitle = '+' + this.luckyDay.name
  525. }
  526. } else {
  527. this.tsTitle = this.luckyDay.prizeName + '+1'
  528. }
  529. if( this.durationMath2 >= 50 ) {
  530. this.durationMath2 = 20
  531. } else {
  532. this.durationMath2 = this.durationMath2 + 1
  533. }
  534. let animation = uni.createAnimation({ timingFunction: 'ease' })
  535. animation.opacity(1).step({ duration: this.durationMath2 })
  536. animation.top('250rpx').step({ duration: 1000, delay: 100 })
  537. animation.opacity(0).top('450rpx').step({ duration: 0 })
  538. this.animationDataTs = animation.export()
  539. },
  540. // 再次抽奖
  541. againLuckDraw(type) {
  542. if (type === 'vip') {
  543. this.popupVIPShow = false
  544. } else if (type === '12') {
  545. this.popup12Show = false
  546. } else {
  547. this.popupGoldShow = false
  548. }
  549. this.handleDrawStart()
  550. },
  551. // 看视频双倍
  552. lookVideo() {
  553. this.showVideoAd(1)
  554. },
  555. // 领取金币
  556. receiveGold(watchVideos = false) {
  557. if (!this.mpName) { // 首次没有重公众号进入
  558. this.startGold(watchVideos)
  559. this.popupShow = false
  560. return
  561. }
  562. if(this.doubleKey) {
  563. setReceive({appId: config.appid, doubleKey: this.doubleKey, openId: this.openId, watchVideos, ...this.mpData }).then(res => {
  564. this.startGold(watchVideos)
  565. this.popupShow = false
  566. this.doubleKey = ""
  567. this.getList()
  568. if(watchVideos) {
  569. } else {
  570. this.showInterstitialAd()
  571. }
  572. })
  573. }
  574. },
  575. //
  576. getData() {
  577. uni.login({
  578. success: async res => {
  579. if (res.code) {
  580. let openIDInfo = await getOpenId({appId: config.appid, code: res.code})
  581. this.openId = openIDInfo.data
  582. let response = await this.getList()
  583. if(response) {
  584. await this.getPrizeList()
  585. getBanner({appId: config.appid, openId: this.openId, mpAppId: this.mpData.mpAppId}).then(res => {
  586. this.list = res.data
  587. })
  588. } else {
  589. this.prizeList = [
  590. {"prizeId":1,"name":"100书币","stock":100,"prizeCount": 100,"prizeName": '书币',"weight":0.1,"prizeType": 1,"prizeImage":"/static/turntable_golds.png"},
  591. {"prizeId":2,"name":"书城VIP碎片","stock":100,"weight":5,"prizeType": 2,"prizeImage":"/static/turntable_VIP.png"},
  592. {"prizeId":3,"name":"30书币","stock":100,"prizeCount": 30,"prizeName": '书币',"weight":1,"prizeType": 1,"prizeImage":"/static/turntable_gold.png"},
  593. {"prizeId":4,"name":"书城VIP碎片","stock":100,"weight":5,"prizeType": 2,"prizeImage":"/static/turntable_VIP.png"},
  594. {"prizeId":5,"name":"10书币","stock":100,"prizeCount": 10,"prizeName": '书币',"weight":10000,"prizeType": 1,"prizeImage":"/static/turntable_gold.png"},
  595. {"prizeId":6,"name":"50书币","stock":100,"weight":1,"prizeCount": 50,"prizeName": '书币',"prizeType": 1,"prizeImage":"/static/turntable_golds.png"},
  596. {"prizeId":7,"name":"iPhone12碎片","stock":100,"weight":5,"prizeType": 3,"prizeImage":"/static/turntable_iPhone12.png"},
  597. {"prizeId":8,"name":"20书币","stock":100,"prizeCount": 20,"prizeName": '书币',"weight":10000,"prizeType": 1,"prizeImage":"/static/turntable_gold.png"}]
  598. this.prizeCountDtoList = [{"prizeType":2,"prizeCount":0,"prizeName":"书城VIP碎片","maxCount":30},{"prizeType":3,"prizeCount":0,"prizeName":"iPhone12碎片","maxCount":50}]
  599. this.prizeList.forEach((item) => this.weightTotal += item.weight)
  600. this.weightArr = this.prizeList.map((item) => item.weight)
  601. }
  602. }
  603. }
  604. })
  605. },
  606. // 跳转小程序
  607. jumpSign() {
  608. let path = 'pages/index/index'
  609. if(Object.keys(this.mpData).length > 0) {
  610. path = path + this.getSerialize(this.mpData)
  611. }
  612. uni.navigateToMiniProgram({
  613. appId: 'wxb21c3e030b8af425',
  614. path,
  615. success(res) {
  616. // 打开成功
  617. }
  618. })
  619. },
  620. // 对象序列化成 a=1&b=2
  621. getSerialize(value) {
  622. if(Object.prototype.toString.call(value) === "[object Object]") {
  623. let path = ""
  624. for (const key in value) {
  625. if (Object.prototype.hasOwnProperty.call(value, key)) {
  626. const element = value[key];
  627. if (path === "") {
  628. path = `?${key}=${element}`
  629. }else {
  630. path = path + `&${key}=${element}`
  631. }
  632. }
  633. }
  634. return path
  635. } else {
  636. return ""
  637. }
  638. },
  639. // 活动规则
  640. activityRulesHandle() {
  641. this.activityRules = !this.activityRules
  642. },
  643. // 关闭弹窗
  644. closeHandle() {
  645. this.receiveGold(false)
  646. this.popupShow = false
  647. },
  648. // 重新生成
  649. handleInitCanvas() {
  650. clearCacheFile()
  651. this.prizeList = []
  652. this.getPrizeList()
  653. },
  654. // 获取首页信息
  655. async getList() {
  656. let res = await getHome({appId: config.appid, openId: this.openId, userSource: 1, ...this.mpData})
  657. let data = res.data
  658. if(data) {
  659. this.userId = data.userId
  660. this.clearTime = data.clearTime
  661. this.prizeCountDtoList = data.prizeCountDtoList
  662. this.mpName = data.mpName
  663. this.freeNum = data.luckDraw
  664. this.mpData = {
  665. mpAppId: data.mpAppId,
  666. mpName: data.mpName,
  667. mpOpenId: data.mpOpenId
  668. }
  669. return Promise.resolve(true)
  670. } else {
  671. return Promise.resolve(false)
  672. }
  673. },
  674. // 获取奖品列表
  675. async getPrizeList() {
  676. uni.showLoading({
  677. title: '奖品准备中...'
  678. })
  679. let res = await getPond({appId: config.appid, openId: this.openId, mpAppId: this.mpData.mpAppId})
  680. if(res.data && res.data.length > 0) {
  681. this.prizeList = res.data.map(item => {
  682. let prizeImage = ""
  683. if (item.prizeType === 1) {
  684. prizeImage = '/static/turntable_gold.png'
  685. if(item.prizeCount > 30) {
  686. prizeImage = '/static/turntable_golds.png'
  687. }
  688. return {
  689. prizeId: item.id,
  690. name: item.prizeCount + item.prizeName,
  691. stock: 100,
  692. weight: 10,
  693. prizeImage,
  694. prizeType: item.prizeType,
  695. prizeCount: item.prizeCount,
  696. prizeName: item.prizeName,
  697. }
  698. } else {
  699. prizeImage = '/static/turntable_iPhone12.png'
  700. if(item.prizeType === 2){
  701. prizeImage = '/static/turntable_VIP.png'
  702. }
  703. return {
  704. prizeId: item.id,
  705. name: item.prizeName,
  706. stock: 100,
  707. weight: 10,
  708. prizeImage,
  709. prizeType: item.prizeType,
  710. prizeCount: item.prizeCount,
  711. prizeName: item.prizeName,
  712. }
  713. }
  714. })
  715. }else {
  716. uni.hideLoading()
  717. uni.showToast({
  718. title: '获取奖品失败'
  719. })
  720. }
  721. },
  722. // 本次抽奖开始
  723. handleDrawStart() {
  724. console.log('触发抽奖按钮')
  725. if (systemInfo.system.includes('indows')) {
  726. uni.showToast({
  727. title: '请到手机端抽奖!',
  728. icon: 'error',
  729. duration: 4000
  730. })
  731. return
  732. }
  733. if (!this.mpName) { // 首次没有重公众号进入
  734. if(this.remoteVersion !== config.version) {
  735. uni.showToast({
  736. title: '请先关注公众号~~',
  737. icon: 'none'
  738. })
  739. }
  740. // uni.navigateTo({
  741. // url: '../officialAccount/officialAccount'
  742. // })
  743. // 没有公众号本地抽奖
  744. if (this.freeNum > 0) {
  745. // 更新免费次数或金币余额
  746. if (this.freeNum > 0) {
  747. this.freeNum--
  748. }
  749. if(this.freeNum < 8) {
  750. // 看视频
  751. this.showVideoAd(2)
  752. } else {
  753. // 发起抽奖
  754. this.localGetPrizeIndex()
  755. }
  756. }
  757. return
  758. }
  759. if (this.prizeing) return
  760. this.prizeing = true
  761. // 还有免费数次或者剩余金币足够抽一次
  762. if (this.freeNum > 0) {
  763. // 更新免费次数或金币余额
  764. if (this.freeNum > 0) {
  765. this.freeNum--
  766. }
  767. lqTimer && clearTimeout(lqTimer)
  768. if(this.freeNum < 8) {
  769. // 看视频
  770. this.showVideoAd(2)
  771. } else {
  772. // 发起抽奖
  773. this.remoteGetPrizeIndex()
  774. }
  775. } else {
  776. this.prizeing = false
  777. uni.showToast({
  778. title: '抽奖次数不足',
  779. icon:'none'
  780. })
  781. }
  782. },
  783. // 远程请求接口获取中奖下标
  784. remoteGetPrizeIndex() {
  785. console.warn('###当前处于模拟的请求接口,并返回了中奖信息###')
  786. let { mpName, ...mp } = this.mpData
  787. setDrawGain({appId: config.appid, openId: this.openId, ...mp}).then(res => {
  788. let data = res.data
  789. this.doubleKey = data.doubleKey
  790. let prizeIndex = this.prizeList.findIndex(item => item.prizeId === data.id)
  791. if(prizeIndex !== -1){
  792. this.prizeIndex = prizeIndex
  793. } else {
  794. uni.showToast({
  795. title: '抽奖异常,请稍后重试'
  796. })
  797. }
  798. })
  799. },
  800. // 没有公众号模拟抽奖
  801. // 本地获取中奖下标
  802. localGetPrizeIndex() {
  803. console.warn('###当前处于前端控制中奖概率,安全起见,强烈建议由后端控制###')
  804. // 前端控制概率的情况下,需要拿到最接近随机权重且大于随机权重的值
  805. // 后端控制概率的情况下,通常会直接返回 prizeId
  806. if (!this.weightTotal) {
  807. console.warn('###当前已开启前端控制中奖概率,但是奖品数据列表中的 weight 参数似乎配置不正确###')
  808. return
  809. }
  810. console.log('当前权重总和为 =>', this.weightTotal)
  811. // 注意这里使用了 Math.ceil,如果某个权重的值为 0,则始终无法中奖
  812. let weight = Math.ceil(Math.random() * this.weightTotal)
  813. console.log('本次权重随机数 =>', weight)
  814. let list = [...this.prizeList]
  815. // 生成大于等于随机权重的数组
  816. let tempMaxArrs = []
  817. list.forEach((item) => {
  818. if (item.weight >= weight) {
  819. tempMaxArrs.push(item.weight)
  820. }
  821. })
  822. // 如果大于随机权重的数组有值,先对这个数组排序然后取值
  823. // 反之新建一个临时的包含所有权重的已排序数组,然后取值
  824. let tempMaxArrsLen = tempMaxArrs.length
  825. if (tempMaxArrsLen) {
  826. tempMaxArrs.sort((a, b) => a - b)
  827. // 取值时,如果存在多个值,分两种情况
  828. if (tempMaxArrsLen > 1) {
  829. // 值不相等的情况下取最接近的值,也就是第1个值
  830. let sumWeight = tempMaxArrs.reduce((a, b) => a + b)
  831. if ((sumWeight / tempMaxArrsLen) !== tempMaxArrs[0]) {
  832. this.prizeIndex = this.weightArr.indexOf(tempMaxArrs[0])
  833. } else {
  834. // 值相等时,随机取值,当然这里你可以自己决定是否随机取值
  835. let sameWeight = tempMaxArrs[0]
  836. let sameWeightArr = []
  837. let sameWeightItem = {}
  838. this.weightArr.forEach((item, index) => {
  839. if (item === sameWeight) {
  840. sameWeightArr.push({
  841. weight: item,
  842. index
  843. })
  844. }
  845. })
  846. console.log('sameWeightArr', sameWeightArr)
  847. sameWeightItem = sameWeightArr[Math.floor(Math.random() * sameWeightArr.length)]
  848. console.log('sameWeightItem', sameWeightItem)
  849. this.prizeIndex = sameWeightItem.index
  850. }
  851. } else {
  852. this.prizeIndex = this.weightArr.indexOf(tempMaxArrs[0])
  853. }
  854. } else {
  855. let tempWeightArr = [...this.weightArr]
  856. tempWeightArr.sort((a, b) => a - b)
  857. this.prizeIndex = this.weightArr.indexOf(tempWeightArr[tempWeightArr.length - 1])
  858. }
  859. console.log('本次抽中奖品 =>', this.prizeList[this.prizeIndex].name)
  860. },
  861. // 本次抽奖结束
  862. handleDrawEnd() {
  863. console.log('旋转结束,执行拿到结果后到逻辑')
  864. // 旋转结束后,开始处理拿到结果后的逻辑
  865. this.prizeing = false
  866. let prizeName = this.prizeList[this.prizeIndex].name
  867. let { prizeType, prizeCount } = this.prizeList[this.prizeIndex]
  868. console.log('1111->', this.prizeList[this.prizeIndex])
  869. this.luckyDay = this.prizeList[this.prizeIndex]
  870. if (prizeName === '谢谢参与') {
  871. } else if (prizeName.indexOf('碎片') === -1 && this.freeNum >= 8) {
  872. this.popupShow = true
  873. return
  874. } else {
  875. if (prizeType === 1) {
  876. this.popupGoldShow = true
  877. } else if (prizeType === 2) {
  878. this.popupVIPShow = true
  879. } else if (prizeType === 3) {
  880. this.popup12Show = true
  881. }
  882. }
  883. if (!this.mpName) { // 首次没有重公众号进入
  884. console.log("首次没有重公众号进入")
  885. return
  886. }
  887. this.getList()
  888. },
  889. // 抽奖转盘绘制完成
  890. handleDrawFinish(res) {
  891. console.log('抽奖转盘绘制完成', res)
  892. uni.showToast({
  893. title: res.msg,
  894. duration: 800,
  895. mask: true,
  896. icon: 'none'
  897. })
  898. }
  899. }
  900. }
  901. </script>
  902. <style lang="scss">
  903. page{
  904. background-color: #F0524C;
  905. }
  906. .luckyDraw {
  907. position: relative;
  908. &>.back {
  909. width: 100%;
  910. }
  911. }
  912. .luckyDrawContent {
  913. overflow-x: hidden;
  914. position: absolute;
  915. top: 0;
  916. width: 100%;
  917. padding: 28rpx 0;
  918. margin-bottom: 20rpx;
  919. font-family: PingFangSC-Medium, PingFang SC;
  920. // 用户信息
  921. .luckyDrawTop {
  922. padding: 0 28rpx;
  923. height: 104rpx;
  924. display: flex;
  925. justify-content: space-between;
  926. align-items: center;
  927. .left{
  928. display: flex;
  929. justify-content: flex-start;
  930. align-items: center;
  931. &>.avatarView {
  932. overflow: hidden;
  933. width: 104rpx;
  934. height: 104rpx;
  935. background: #D8D8D8;
  936. border-radius: 10px;
  937. }
  938. .userInfo{
  939. margin-left: 28rpx;
  940. &>view{
  941. font-size: 32rpx;
  942. font-weight: 500;
  943. color: #FFFFFF;
  944. &.account {
  945. display: flex;
  946. justify-content: flex-start;
  947. align-items: center;
  948. &>image {
  949. width: 36rpx;
  950. height: 36rpx;
  951. margin-right: 10rpx;
  952. }
  953. }
  954. &.ID{
  955. margin-top: 4rpx;
  956. }
  957. }
  958. }
  959. }
  960. .right{
  961. width: 180rpx;
  962. height: 64rpx;
  963. background: #BA3A11;
  964. border-radius: 30rpx;
  965. display: flex;
  966. justify-content: center;
  967. align-items: center;
  968. &>text {
  969. font-size: 28rpx;
  970. font-weight: 400;
  971. color: #FFFFFF;
  972. }
  973. }
  974. }
  975. // 滚动通知
  976. .notice {
  977. width: 656rpx;
  978. height: 60rpx;
  979. background: #C7322C;
  980. box-shadow: 0px 4rpx 8rpx 0rpx rgba(49, 49, 49, 0.08);
  981. border-radius: 38rpx;
  982. opacity: 0.53;
  983. margin: 38rpx auto 0;
  984. padding: 0 30rpx;
  985. box-sizing: border-box;
  986. display: flex;
  987. justify-content: flex-start;
  988. align-items: center;
  989. .horn {
  990. width: 28rpx;
  991. height: 28rpx;
  992. }
  993. .txts {
  994. // flex: 1;
  995. height: 68rpx;
  996. width: 600rpx;
  997. }
  998. }
  999. // 去签到
  1000. .qLuckDraw {
  1001. position: absolute;
  1002. top: 180rpx;
  1003. right: 10rpx;
  1004. z-index: 200;
  1005. animation: lanimation 1.3s linear infinite;
  1006. &>image {
  1007. width: 120rpx;
  1008. height: 120rpx;
  1009. }
  1010. }
  1011. // 大转盘
  1012. .turntable {
  1013. position: relative;
  1014. margin-top: 20rpx;
  1015. .decorate{
  1016. position: relative;
  1017. width: 100%;
  1018. height: 880rpx;
  1019. &>image {
  1020. width: 100%;
  1021. position: absolute;
  1022. z-index: 10;
  1023. &.decorateBack {
  1024. top: 0;
  1025. }
  1026. &.decorateChassis{
  1027. position: absolute;
  1028. z-index: 1;
  1029. bottom: 0;
  1030. }
  1031. }
  1032. }
  1033. .turntableContent {
  1034. position: absolute;
  1035. top: 0;
  1036. left: 0;
  1037. right: 0;
  1038. bottom: 0;
  1039. width: 100%;
  1040. height: 100%;
  1041. z-index: 20;
  1042. .al {
  1043. width: 100%;
  1044. height: 804rpx;
  1045. display: flex;
  1046. justify-content: center;
  1047. align-items: center;
  1048. padding-bottom: 40rpx;
  1049. }
  1050. .bottom {
  1051. margin-top: 30rpx;
  1052. text-align: center;
  1053. position: absolute;
  1054. bottom: 25rpx;
  1055. left: 50%;
  1056. transform: translateX(-50%);
  1057. .cont{
  1058. font-size: 28rpx;
  1059. font-weight: 400;
  1060. color: #FFFFFF;
  1061. margin-bottom: 12rpx;
  1062. text {
  1063. font-size: 36rpx;
  1064. color: #FEED22;
  1065. font-weight: 500;
  1066. }
  1067. }
  1068. }
  1069. }
  1070. }
  1071. // 我的奖品
  1072. .myPrize {
  1073. margin: 30rpx 26rpx 0;
  1074. min-height: 352rpx;
  1075. background: #F4E2CA;
  1076. border-radius: 20rpx;
  1077. position: relative;
  1078. padding: 40rpx 0 20rpx;
  1079. .title {
  1080. position: absolute;
  1081. width: 232rpx;
  1082. height: 64rpx;
  1083. background: linear-gradient(180deg, #FFEDD1 0%, #FFC954 100%);
  1084. box-shadow: 0 4rpx 8rpx 0 rgba(0, 0, 0, 0.07);
  1085. border-radius: 0 0 24rpx 24rpx;
  1086. font-size: 32rpx;
  1087. font-weight: 500;
  1088. color: #F33938;
  1089. text-align: center;
  1090. line-height: 64rpx;
  1091. left: 50%;
  1092. transform: translateX(-50%);
  1093. top: -12rpx;
  1094. }
  1095. .chips {
  1096. display: flex;
  1097. justify-content: space-between;
  1098. }
  1099. .chip {
  1100. display: flex;
  1101. flex-direction: column;
  1102. align-items: center;
  1103. width: 50%;
  1104. &>image {
  1105. width: 180rpx;
  1106. height: 140rpx;
  1107. }
  1108. .text{
  1109. font-size: 32rpx;
  1110. font-weight: 500;
  1111. color: #F33938;
  1112. line-height: 44rpx;
  1113. margin-top: 12rpx;
  1114. }
  1115. .progress{
  1116. position: relative;
  1117. width: 200rpx;
  1118. height: 38rpx;
  1119. margin-top: 12rpx;
  1120. background: #FFFCF7;
  1121. border-radius: 26rpx;
  1122. overflow: hidden;
  1123. .value{
  1124. position: absolute;
  1125. width: 1%;
  1126. height: 100%;
  1127. top: 0;
  1128. left: 0;
  1129. z-index: 1;
  1130. background: #F37938;
  1131. }
  1132. &>text {
  1133. font-size: 28rpx;
  1134. font-weight: 500;
  1135. color: #333333;
  1136. position: absolute;
  1137. top: 50%;
  1138. left: 50%;
  1139. transform: translate(-50%, -50%);
  1140. z-index: 2;
  1141. }
  1142. }
  1143. }
  1144. .clearTime{
  1145. margin: 20rpx 0 0;
  1146. text-align: center;
  1147. font-size: 24rpx;
  1148. font-weight: 400;
  1149. color: #F33938;
  1150. }
  1151. }
  1152. // 活动规则
  1153. .activityRules {
  1154. margin: 28rpx 28rpx 0;
  1155. background: #F4E2CA;
  1156. border-radius: 20rpx;
  1157. color: #F33938;
  1158. font-size: 32rpx;
  1159. font-weight: 400;
  1160. &>.top {
  1161. height: 92rpx;
  1162. padding: 0 28rpx;
  1163. box-sizing: border-box;
  1164. display: flex;
  1165. justify-content: space-between;
  1166. align-items: center;
  1167. &>image {
  1168. width: 40rpx;
  1169. }
  1170. }
  1171. &>.bottom {
  1172. padding: 0 28rpx 30rpx;
  1173. box-sizing: border-box;
  1174. &> view {
  1175. margin-bottom: 12rpx;
  1176. font-size: 28rpx;
  1177. font-weight: 400;
  1178. color: #666666;
  1179. line-height: 46rpx;
  1180. }
  1181. }
  1182. }
  1183. // 弹窗
  1184. .popup {
  1185. position: fixed;
  1186. width: 100%;
  1187. height: 100vh;
  1188. background: rgba(0, 0, 0, 0.6);
  1189. top: 0;
  1190. left: 0;
  1191. right: 0;
  1192. bottom: 0;
  1193. z-index: 201;
  1194. .popupContent {
  1195. width: 632rpx;
  1196. position: absolute;
  1197. top: 50%;
  1198. left: 50%;
  1199. transform: translate(-50%, -50%);
  1200. text-align: center;
  1201. &>.content {
  1202. position: relative;
  1203. &>image {
  1204. width: 100%;
  1205. height: 652rpx;
  1206. }
  1207. &>.textCon {
  1208. position: absolute;
  1209. width: 100%;
  1210. top: 0;
  1211. left: 0;
  1212. right: 0;
  1213. bottom: 0;
  1214. padding-top: 192rpx;
  1215. .ts {
  1216. font-size: 60rpx;
  1217. font-weight: 500;
  1218. color: #F5631D;
  1219. }
  1220. .reward {
  1221. height: 60rpx;
  1222. // background: #FFD9A2;
  1223. // border-radius: 31rpx;
  1224. font-size: 50rpx;
  1225. font-weight: 400;
  1226. display: inline-block;
  1227. padding: 0 32rpx;
  1228. color: #F5631E;
  1229. line-height: 60rpx;
  1230. margin-top: 20rpx;
  1231. }
  1232. .goldText {
  1233. font-size: 64rpx;
  1234. font-family: FZZZHONGJW--GB1-0, FZZZHONGJW--GB1;
  1235. font-weight: normal;
  1236. color: #FFFFFF;
  1237. margin-bottom: 25rpx;
  1238. transform: translateX(12rpx);
  1239. }
  1240. .doubleBt {
  1241. width: 456rpx;
  1242. height: 104rpx;
  1243. margin-top: 90rpx;
  1244. transition: all linear .5s;
  1245. }
  1246. .bt {
  1247. margin-top: 14rpx;
  1248. font-size: 32rpx;
  1249. font-weight: 400;
  1250. color: #FCE8CD;
  1251. }
  1252. .againLuckDrawBt {
  1253. width: 424rpx;
  1254. height: 86rpx;
  1255. background: linear-gradient(180deg, #FDDEA5 0%, #FFC981 75%, #FFC983 100%);
  1256. border-radius: 43rpx;
  1257. font-size: 36rpx;
  1258. font-family: SourceHanSansCN-Medium, SourceHanSansCN;
  1259. font-weight: 500;
  1260. color: #854007;
  1261. text-align: center;
  1262. line-height: 86rpx;
  1263. margin: 0 auto 40rpx;
  1264. transition: all linear .5s;
  1265. }
  1266. .btGold {
  1267. width: 448rpx;
  1268. height: 104rpx;
  1269. border-radius: 52rpx;
  1270. line-height: 104rpx;
  1271. font-size: 40rpx;
  1272. box-shadow: 0px 2rpx 8rpx 4rpx rgba(183, 2, 2, 0.37);
  1273. background: linear-gradient(180deg, #FFFCBE 0%, #F87527 100%);
  1274. }
  1275. .btVip {
  1276. width: 426rpx;
  1277. height: 88rpx;
  1278. background: linear-gradient(180deg, #F6E5CA 0%, #EDC388 100%);
  1279. box-shadow: 0rpx 6rpx 16rpx 0rpx rgba(162, 58, 20, 0.77);
  1280. border-radius: 44rpx;
  1281. }
  1282. }
  1283. }
  1284. &>.close {
  1285. width: 54rpx;
  1286. height: 54rpx;
  1287. margin-top: 76rpx;
  1288. }
  1289. }
  1290. }
  1291. // 碎片飞行初始样式 // 金币飞行
  1292. .fragmentAni, .fragmentGold {
  1293. position: absolute;
  1294. z-index: 201;
  1295. top: 453rpx;
  1296. left: 330rpx;
  1297. opacity: 0;
  1298. &>image {
  1299. width: 100rpx;
  1300. height: 100rpx;
  1301. }
  1302. }
  1303. .fragmentGold {
  1304. // opacity: 1;
  1305. }
  1306. .receiveTs {
  1307. position: absolute;
  1308. border: 2rpx solid rgb(242, 69, 69);
  1309. top: 450rpx;
  1310. z-index: 201;
  1311. color: #FFFFFF;
  1312. left: 50%;
  1313. transform: translateX(-50%);
  1314. padding: 10rpx 20rpx;
  1315. background-color: rgba(131, 37, 37, 0.6);
  1316. border-radius: 5rpx;
  1317. opacity: 0;
  1318. }
  1319. .singleLattice {
  1320. position: absolute;
  1321. top: 900rpx;
  1322. right: 8rpx;
  1323. z-index: 201;
  1324. }
  1325. }
  1326. @-webkit-keyframes lanimation {
  1327. 0% {
  1328. transform: rotate(0deg);
  1329. }
  1330. 8% {
  1331. transform: rotate(12deg);
  1332. }
  1333. 16% {
  1334. transform: rotate(0deg);
  1335. }
  1336. 24% {
  1337. transform: rotate(-12deg);
  1338. }
  1339. 32% {
  1340. transform: rotate(0deg);
  1341. }
  1342. 100% {
  1343. transform: rotate(0deg);
  1344. }
  1345. }
  1346. </style>