index.vue 41 KB

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