index.html 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>幸运大抽奖</title>
  6. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  7. <link href="css/mui.css" rel="stylesheet" />
  8. <link href="css/mui.picker.css" rel="stylesheet" />
  9. <link href="css/mui.poppicker.css" rel="stylesheet" />
  10. <script src="js/mui.js"></script>
  11. <script src="js/mui.picker.js"></script>
  12. <script src="js/mui.poppicker.js"></script>
  13. <script type="text/javascript">
  14. mui.init()
  15. (function flexible (window, document) {
  16. let docEl = document.documentElement
  17. let dpr = window.devicePixelRatio || 1
  18. // adjust body font size
  19. function setBodyFontSize () {
  20. if (document.body) {
  21. document.body.style.fontSize = (12 * dpr) + 'px'
  22. } else {
  23. document.addEventListener('DOMContentLoaded', setBodyFontSize)
  24. }
  25. }
  26. setBodyFontSize()
  27. // set 1rem = viewWidth / 10
  28. function setRemUnit () {
  29. let rem = docEl.clientWidth / 375
  30. docEl.style.fontSize = rem + 'px'
  31. }
  32. setRemUnit()
  33. // reset rem unit on page resize
  34. window.addEventListener('resize', setRemUnit)
  35. window.addEventListener('pageshow', function(e) {
  36. if (e.persisted) {
  37. setRemUnit()
  38. }
  39. })
  40. // detect 0.5px supports
  41. if (dpr >= 2) {
  42. let fakeBody = document.createElement('body')
  43. let testElement = document.createElement('div')
  44. testElement.style.border = '.5px solid transparent'
  45. fakeBody.appendChild(testElement)
  46. docEl.appendChild(fakeBody)
  47. if (testElement.offsetHeight === 1) {
  48. docEl.classList.add('hairlines')
  49. }
  50. docEl.removeChild(fakeBody)
  51. }
  52. }(window, document));
  53. (function() {
  54. if (typeof WeixinJSBridge === 'object' && typeof WeixinJSBridge.invoke === 'function') {
  55. handleFontSize()
  56. } else {
  57. if (document.addEventListener) {
  58. document.addEventListener('WeixinJSBridgeReady', handleFontSize, false)
  59. } else if (document.attachEvent) {
  60. document.attachEvent('onWeixinJSBridgeReady', handleFontSize)
  61. }
  62. }
  63. function handleFontSize () {
  64. // 设置网页字体为默认大小
  65. WeixinJSBridge.invoke('setFontSizeCallback', { 'fontSize': 0 })
  66. // 重写设置网页字体大小的事件
  67. WeixinJSBridge.on('menu:setfont', function() {
  68. WeixinJSBridge.invoke('setFontSizeCallback', { 'fontSize': 0 })
  69. })
  70. }
  71. })()
  72. </script>
  73. </head>
  74. <style type="text/css">
  75. body {
  76. margin: 0;
  77. background: #FFFFFF;
  78. }
  79. .bg-img {
  80. width: 100%;
  81. height: 100%;
  82. }
  83. .btn {
  84. display: flex;
  85. justify-content: center;
  86. align-items: center;
  87. }
  88. .btn-img {
  89. width: 290px;
  90. }
  91. .rule {
  92. width: 100%;
  93. height: 509px;
  94. padding: 65px 15px 40px;
  95. background: linear-gradient( 180deg, #FF6C52 0%, #FFBA9B 100%);
  96. margin-top: -60px;
  97. }
  98. .rule-body {
  99. height: 404px;
  100. background: #FEE8D0;
  101. border-radius: 20px;
  102. padding: 20px;
  103. }
  104. .tabs {
  105. display: flex;
  106. justify-content: space-around;
  107. align-items: center;
  108. padding: 0 2px;
  109. margin: 0 auto;
  110. width: 255px;
  111. height: 34px;
  112. background: rgba(255, 125, 97, 0.2);
  113. border-radius: 17px 17px 17px 17px;
  114. }
  115. .tab-link {
  116. border: none;
  117. outline: none;
  118. cursor: pointer;
  119. transition: 0.3s;
  120. color: #FF765B;
  121. background: unset;
  122. width: 125px;
  123. height: 30px;
  124. border-radius: 17px
  125. }
  126. .tab-link:active {
  127. background: rgba(255, 125, 97, 0.2);
  128. }
  129. .tab-link.active {
  130. background: #FFFFFF;
  131. }
  132. .tab-content {
  133. p {
  134. font-weight: 400;
  135. font-size: 14px;
  136. color: #CB4E35;
  137. margin-top: 20px;
  138. }
  139. }
  140. .record-list {
  141. overflow-y: auto;
  142. height: 300px;
  143. margin-top: 18px;
  144. }
  145. .record-item {
  146. width: 315px;
  147. height: 72px;
  148. background: #FEDFC9;
  149. border-radius: 10px;
  150. padding: 9px 10px 8px;
  151. display: flex;
  152. align-items: center;
  153. margin: 0 auto 10px;
  154. }
  155. .prize-img {
  156. width: 55px;
  157. height: 55px;
  158. border-radius: 10px;
  159. margin-right: 8px;
  160. }
  161. .get-btn {
  162. width: 72px;
  163. height: 30px;
  164. background: #FF4646;
  165. border-radius: 17px;
  166. font-size: 14px;
  167. color: #FFFFFF;
  168. margin-left: 30px;
  169. }
  170. .prize-name {
  171. font-weight: 500;
  172. color: #FF4646;
  173. }
  174. .prize-time {
  175. font-size: 12px;
  176. color: #FF6767;
  177. }
  178. .mui-input-group {
  179. padding-top: 15px;
  180. }
  181. .mui-input-group:before {
  182. background: none;
  183. }
  184. .mui-input-group:after {
  185. background: none;
  186. }
  187. .mui-input-group .mui-input-row:after {
  188. background: none;
  189. }
  190. .mui-input-group .mui-input-row {
  191. height: 60px;
  192. }
  193. ::-webkit-input-placeholder { /* Chrome/Opera/Safari */
  194. font-weight: 400;
  195. font-size: 14px;
  196. color: #CCCCCC;
  197. float: right;
  198. }
  199. ::-moz-placeholder { /* Firefox 19+ */
  200. font-weight: 400;
  201. font-size: 14px;
  202. color: #CCCCCC;
  203. float: right;
  204. }
  205. :-ms-input-placeholder { /* IE 10+ */
  206. font-weight: 400;
  207. font-size: 14px;
  208. color: #CCCCCC;
  209. float: right;
  210. }
  211. :-moz-placeholder { /* Firefox 18- */
  212. font-weight: 400;
  213. font-size: 14px;
  214. color: #CCCCCC;
  215. float: right;
  216. }
  217. .mui-input-clear {
  218. font-weight: 500;
  219. font-size: 14px;
  220. color: #222222;
  221. text-align: right;
  222. padding: 10px 0;
  223. padding-right: 30px !important;
  224. }
  225. .mui-input-row label {
  226. font-weight: 500;
  227. font-size: 14px;
  228. color: #666666;
  229. }
  230. .save-btn {
  231. width: 305px;
  232. height: 52px;
  233. background: #FF4646;
  234. border-radius: 20px;
  235. border: none;
  236. font-weight: 500;
  237. font-size: 16px;
  238. color: #FFFFFF;
  239. }
  240. .pop-form {
  241. width: 100%;
  242. background-color: #FFFFFF;
  243. height: 524px; /* 根据需要调整高度 */
  244. position: fixed; /* 或 absolute,根据需要定位 */
  245. bottom: -524px; /* 初始位置在可视区域外 */
  246. transition: bottom 0.5s ease-in-out; /* 平滑过渡效果 */
  247. left: 0;
  248. z-index: 1001; /* 确保在遮罩层之上 */
  249. box-sizing: border-box;
  250. padding: 24px 25px 44px 15px;
  251. border-radius: 15px 15px 0px 0px;
  252. }
  253. .city-data {
  254. float: right;
  255. width: 65%;
  256. height: 40px;
  257. padding: 10px 30px 10px 10px;
  258. display: flex;
  259. font-weight: 500;
  260. font-size: 14px;
  261. color: #222222;
  262. justify-content: flex-end;
  263. }
  264. .no-data {
  265. width: 100%;
  266. font-weight: 400;
  267. font-size: 14px;
  268. color: #CCCCCC;
  269. display: flex;
  270. align-items: center;
  271. justify-content: flex-end;
  272. }
  273. .pop-form.show {
  274. bottom: 0; /* 显示时位置 */
  275. }
  276. .pop-title {
  277. display: flex;
  278. align-items: center;
  279. font-weight: bold;
  280. font-size: 16px;
  281. color: #222222;
  282. }
  283. .close-Icon {
  284. width: 24px;
  285. height: 24px;
  286. margin-right: 100px;
  287. }
  288. .right-Icon {
  289. width: 16px;
  290. height: 16px;
  291. margin-left: 5px;
  292. }
  293. .overlay {
  294. position: fixed;
  295. top: 0;
  296. left: 0;
  297. width: 100%;
  298. height: 100%;
  299. background-color: rgba(0, 0, 0, 0.5); /* 半透明黑色 */
  300. z-index: 1000; /* 确保遮罩层在顶部 */
  301. transition: opacity 0.5s ease; /* 可选:添加透明度过渡效果 */
  302. display: none;
  303. }
  304. .prize-content {
  305. width: fit-content;
  306. margin: -96% auto 0
  307. }
  308. #grid-container {
  309. display: grid;
  310. grid-template-columns: repeat(3, 1fr); /* 创建3列,每列等宽 */
  311. gap: 10px; /* 格子之间的间距 */
  312. padding: 10px;
  313. }
  314. .grid-item {
  315. width: 78px; /* 使图片宽度适应格子 */
  316. height: 78px; /* 保持图片原始宽高比 */
  317. position: relative; /* 为了让标题能够绝对定位 */
  318. overflow: hidden; /* 确保图片不会溢出格子 */
  319. background-image: url(./img/prize-bg.png);
  320. display: flex;
  321. justify-content: center;
  322. align-items: center;
  323. background-size: cover;
  324. flex-direction: column;
  325. padding-top: 8px;
  326. transition: transform 0.3s, opacity 0.3s; /* 平滑过渡效果 */
  327. }
  328. .grid-item img {
  329. width: 48px; /* 使图片宽度适应格子 */
  330. height: 48px; /* 保持图片原始宽高比 */
  331. display: block; /* 移除图片下方的默认空间 */
  332. }
  333. .grid-item-title {
  334. font-weight: 400;
  335. font-size: 10px;
  336. color: #CC745A;
  337. width: 70px;
  338. white-space: nowrap;
  339. overflow: hidden;
  340. text-overflow: ellipsis;
  341. text-align: center;
  342. }
  343. /* ... 其他样式保持不变 ... */
  344. .rotating {
  345. animation: rotateGrid 3s infinite linear;
  346. }
  347. @keyframes rotateGrid {
  348. from {
  349. transform: rotate(0deg);
  350. }
  351. to {
  352. transform: rotate(360deg);
  353. }
  354. }
  355. .actives {
  356. border: 2px solid #df2727;
  357. border-radius: 15px;
  358. }
  359. .lottery-tip {
  360. text-align: center;
  361. font-size: 14px;
  362. color: #FFFFFF;
  363. font-weight: 600;
  364. }
  365. .dialog {
  366. position: fixed;
  367. top: 0;
  368. left: 0;
  369. width: 100%;
  370. height: 100%;
  371. background-color: rgba(0, 0, 0, 0.5); /* 半透明黑色 */
  372. z-index: 1000; /* 确保遮罩层在顶部 */
  373. transition: opacity 0.5s ease; /* 可选:添加透明度过渡效果 */
  374. display: none;
  375. }
  376. .dialog-body {
  377. width: 100%;
  378. z-index: 1001; /* 确保遮罩层在顶部 */
  379. display: flex;
  380. flex-direction: column;
  381. align-items: center;
  382. justify-content: center;
  383. }
  384. .dialog-tip {
  385. width: 100%;
  386. height: 100px;
  387. }
  388. .dialog-bg {
  389. width: 295px;
  390. height: 251px;
  391. position: relative;
  392. }
  393. .prize-msg {
  394. position: absolute;
  395. text-align: center;
  396. }
  397. .money-title {
  398. font-weight: 500;
  399. font-size: 16px;
  400. color: #FF4E4E;
  401. padding-top: 90px;
  402. padding-bottom: 10px;
  403. }
  404. .money-content {
  405. margin-bottom: 30px;
  406. height: 60px;
  407. display: flex;
  408. justify-content: center;
  409. align-items: center;
  410. }
  411. .prize-money {
  412. font-weight: bold;
  413. font-size: 60px;
  414. color: #FF4E4E;
  415. }
  416. .prize-unit {
  417. font-weight: 500;
  418. font-size: 16px;
  419. color: #FF4E4E;
  420. padding-left: 10px;
  421. padding-top: 28px;
  422. }
  423. .dialog-btn {
  424. width: 235px;
  425. height: 52px;
  426. margin-bottom: 10px;
  427. }
  428. .money-tip {
  429. font-weight: 400;
  430. font-size: 12px;
  431. color: #999999;
  432. margin-bottom: 15px;
  433. }
  434. .goods-img {
  435. width: 100px;
  436. height: 100px;
  437. margin: 70px 0 10px;
  438. }
  439. .goods-name {
  440. font-weight: 500;
  441. font-size: 16px;
  442. color: #222222;
  443. margin-bottom: 20px;
  444. }
  445. .dialog-close {
  446. width: 30px;
  447. height: 30px;
  448. margin-top: 20px;
  449. }
  450. .mui-poppicker {
  451. z-index: 1002 !important;
  452. }
  453. .event-notice {
  454. width: 30px;
  455. height: 84px;
  456. background: rgba(255,255,255,0.5);
  457. border-radius: 15px 0px 0px 15px;
  458. border: 1px solid #FFFFFF;
  459. font-weight: 500;
  460. font-size: 14px;
  461. color: #FF4E4E;
  462. position: absolute;
  463. right: 0;
  464. top: 20%;
  465. writing-mode: vertical-rl;
  466. text-align: center;
  467. padding-right: 4px;
  468. }
  469. .notice-body {
  470. width: 80%;
  471. z-index: 1001;
  472. height: 500px;
  473. overflow-y: auto;
  474. background: #FFF;
  475. margin: 40px;
  476. border-radius: 20px;
  477. padding: 20px;
  478. font-size: 14px;
  479. border: 4px solid #eb845a;
  480. }
  481. .bg_content {
  482. height: calc(100vh + 44rem);
  483. width: 100vw;
  484. background: url('./img/blessing.png');
  485. background-size: cover;
  486. margin-top: -44rem;
  487. }
  488. .show_box{
  489. position: absolute;
  490. top: 198rem;
  491. //background: #FFFFFF;
  492. left: 15rem;
  493. right: 15rem;
  494. height: 290rem;
  495. }
  496. .show_box .show_item{
  497. width: 20rem;
  498. height: 20rem;
  499. position: relative;
  500. top: 15rem;
  501. left: 15rem;
  502. display: none;
  503. }
  504. .show_box .show_item.add_animation_item{
  505. display: block;
  506. animation: hiddenAvatarItem 0.8s ease-out 2.3s forwards
  507. }
  508. .show_box .show_item .avatar_box{
  509. width: 20rem;
  510. height: 20rem;
  511. border-radius: 15rem;
  512. overflow: hidden;
  513. position: absolute;
  514. top: 0;
  515. left: 0;
  516. z-index: 2;
  517. transform: scale(1);
  518. display: flex;
  519. align-items: center;
  520. }
  521. .show_box .show_item.add_animation_item .avatar_box{
  522. animation: showAvatarItem 0.3s ease-out 2s forwards;
  523. }
  524. .show_box .show_item .avatar_box .avatar{
  525. width: 20rem;
  526. height: 20rem;
  527. object-fit: cover;
  528. }
  529. .show_box .show_item .info_box{
  530. position: absolute;
  531. top: -15rem;
  532. left: -15rem;
  533. z-index: 1;
  534. background: rgba(255,255,255,0.8);
  535. border-radius: 15rem;
  536. border: 1rem solid #FFFFFF;
  537. width: 240rem;
  538. padding: 15rem;
  539. box-sizing: border-box;
  540. }
  541. .show_box .show_item.add_animation_item .info_box{
  542. animation: hiddenItem 0.3s ease-out 2s forwards;
  543. }
  544. .show_box .show_item.show_img_item .info_box{
  545. top: -175rem;
  546. left: -15rem;
  547. }
  548. .show_box .show_item.show_img_item.add_animation_item .info_box{
  549. animation: hiddenImgItem 0.3s ease-out 2s forwards;
  550. }
  551. @keyframes showItem {
  552. 0% {
  553. opacity: 0;
  554. }
  555. 100% {
  556. opacity: 1;
  557. }
  558. }
  559. @keyframes showAvatarItem {
  560. 0% {
  561. transform: scale(1);
  562. }
  563. 100% {
  564. transform: scale(1.5);
  565. }
  566. }
  567. @keyframes hiddenAvatarItem {
  568. 0% {
  569. transform: scale(1.5);
  570. opacity: 1;
  571. }
  572. 100% {
  573. transform: scale(1.5);
  574. opacity: 0;
  575. top: 135rem;
  576. left: 172rem;
  577. }
  578. }
  579. @keyframes hiddenItem {
  580. 0% {
  581. transform: scale(1);
  582. top: -15rem;
  583. left: -15rem;
  584. }
  585. 100% {
  586. transform: scale(0);
  587. left:-110rem;
  588. top: -30rem;
  589. }
  590. }
  591. @keyframes hiddenImgItem {
  592. 0% {
  593. transform: scale(1);
  594. top: -175rem;
  595. left: -15rem;
  596. }
  597. 100% {
  598. transform: scale(0);
  599. left:-110rem;
  600. top: -115rem;
  601. }
  602. }
  603. .show_box .show_item .info_box .img_box{
  604. width: 210rem;
  605. height: 150rem;
  606. border-radius: 15rem;
  607. overflow: hidden;
  608. margin-bottom: 10rem;
  609. display: none;
  610. }
  611. .show_box .show_item.show_img_item .info_box .img_box{
  612. display: block;
  613. }
  614. .show_box .show_item .info_box .img_box .info_img{
  615. width: 210rem;
  616. height: 150rem;
  617. object-fit: cover;
  618. }
  619. .show_box .show_item .info_box .info_text{
  620. }
  621. .show_box .show_item .info_box .info_text .info_name{
  622. font-weight: 500;
  623. font-size: 14rem;
  624. color: #222222;
  625. line-height: 20rem;
  626. padding-left: 25rem;
  627. margin-bottom: 5rem;
  628. height: 20rem;
  629. }
  630. .show_box .show_item .info_box .info_text .info_dsc{
  631. font-weight: 400;
  632. font-size: 12rem;
  633. color: #222222;
  634. line-height: 17rem;
  635. }
  636. .send_btn {
  637. width: 345rem;
  638. position: fixed;
  639. bottom: 50rem;
  640. left: 50%;
  641. transform: translateX(-50%);
  642. }
  643. .dialog_text {
  644. position: fixed;
  645. top: 0;
  646. left: 0;
  647. width: 100%;
  648. height: 100%;
  649. background-color: rgba(0, 0, 0, 0.5); /* 半透明黑色 */
  650. z-index: 1000; /* 确保遮罩层在顶部 */
  651. transition: opacity 0.5s ease; /* 可选:添加透明度过渡效果 */
  652. display: none;
  653. }
  654. .dialog-body {
  655. width: 100%;
  656. height: 100vh;
  657. z-index: 1001; /* 确保遮罩层在顶部 */
  658. display: flex;
  659. flex-direction: column;
  660. align-items: center;
  661. justify-content: center;
  662. }
  663. .text_bg {
  664. background: url('./img/dialog-text.png');
  665. background-size: cover;
  666. width: 100vw;
  667. height: 368rem;
  668. }
  669. .close-text {
  670. width: 24rem;
  671. height: 24rem;
  672. float: right;
  673. margin-right: 25rem;
  674. margin-top: 25rem;
  675. }
  676. .textarea_style {
  677. background-color: rgba(255, 255, 255, 0);
  678. border: unset;
  679. height: 180rem;
  680. padding: 0 35rem;
  681. width: 100%;
  682. margin: 0;
  683. }
  684. .photo-btn {
  685. width: 80rem;
  686. height: 80rem;
  687. margin-top: 18rem;
  688. margin-right: 35rem;
  689. }
  690. .send_text {
  691. width: 225rem;
  692. height: 52rem;
  693. background: linear-gradient( 134deg, #FAFF77 0%, #8EFF3B 100%);
  694. border-radius: 30rem;
  695. border: 2rem solid #FFFFFF;
  696. font-weight: 800;
  697. font-size: 16px;
  698. color: #222222;
  699. margin-top: 15rem;
  700. }
  701. .img_list {
  702. width: 100%;
  703. overflow-x: auto;
  704. padding: 0 35rem;
  705. }
  706. .imageGallery {
  707. display: flex;
  708. overflow-x: auto;
  709. }
  710. .imageGallery img{
  711. width: 80rem;
  712. height: 80rem;
  713. margin-top: 18rem;
  714. margin-right: 35rem;
  715. }
  716. </style>
  717. <body>
  718. <div id="collectPage">
  719. <div class="bg_content">
  720. <div class="show_box">
  721. <div id="showItem" class="show_item">
  722. <div class="avatar_box">
  723. <img id="avatar" class="avatar" src="./img/prize-bg.png"/>
  724. </div>
  725. <div class="info_box">
  726. <div class="img_box">
  727. <img id="infoImg" class="info_img" src="./img/lottery-bg.png"/>
  728. </div>
  729. <div class="info_text">
  730. <div id="infoName" class="info_name">不爱吃甜:</div>
  731. <div id="infoDsc" class="info_dsc">不爱吃甜不爱吃甜不爱吃甜不爱吃甜不爱吃甜不爱吃甜</div>
  732. </div>
  733. </div>
  734. </div>
  735. </div>
  736. <img class="send_btn" id="sendBtn" src="./img/send-btn.png" mode="widthFix" />
  737. </div>
  738. <div id="dialogText" class="dialog_text">
  739. <div class="dialog-body">
  740. <div class="text_bg">
  741. <img class="close-text" id="closeText" src="./img/close-text.png" mode="widthFix" />
  742. <textarea class="textarea_style" id="textarea"></textarea>
  743. <div class="img_list">
  744. <div id="imageGallery" class="imageGallery">
  745. <img class="photo-btn" id="photoBtn" src="./img/photo-btn.png" mode="widthFix" onclick="uploadImage()" />
  746. <input type="file" id="uploadfile" style="display: none;" multiple accept='image/*'>
  747. </div>
  748. </div>
  749. </div>
  750. <button class="send_text" onclick="handleSendText()">发送</button>
  751. </div>
  752. </div>
  753. </div>
  754. <div id="lotteryPage">
  755. <img class="bg-img" id="bgImg" src="./img/lottery-bg.png" mode="widthFix" />
  756. <div class="event-notice" id="eventNotice">
  757. <span>活动须知</span>
  758. </div>
  759. <div class="prize-content">
  760. <div id="grid-container">
  761. </div>
  762. </div>
  763. <div class="btn">
  764. <img class="btn-img" id="lottery-button" src="./img/btn.png" mode="widthFix" />
  765. </div>
  766. <div class="lottery-tip" id="lotteryId"></div>
  767. <div class="rule">
  768. <div class="rule-body">
  769. <div class="tabs">
  770. <button class="tab-link active" onclick="changeTab(event, 'tab1')">活动信息</button>
  771. <button class="tab-link" onclick="changeTab(event, 'tab2')">抽奖记录</button>
  772. </div>
  773. <div id="tab1" class="tab-content">
  774. </div>
  775. <div id="tab2" class="tab-content" style="display:none;">
  776. <div class="record-list" id="recordList">
  777. </div>
  778. </div>
  779. </div>
  780. </div>
  781. <div id="dialog" class="dialog">
  782. <div id="dialog-body" class="dialog-body">
  783. <img class="dialog-tip" src="./img/dialog-tip.png" />
  784. <img class="dialog-bg" src="./img/dialog-bg.png" />
  785. <div class="prize-msg" id="prize-msg-money">
  786. <div class="money-title">微信红包</div>
  787. <div class="money-content">
  788. <span class="prize-money" id="prize-money"></span>
  789. <span class="prize-unit">元</span>
  790. </div>
  791. <img class="dialog-btn" id="dialog-btn-money" src="./img/dialog-btn.png" />
  792. <div class="money-tip">红包到账会有延迟情况,请以实际为准</div>
  793. </div>
  794. <div class="prize-msg" id="prize-msg-goods">
  795. <img class="goods-img" id="goods-img" src="" />
  796. <div class="goods-name" id="goods-name"></div>
  797. <img class="dialog-btn" id="dialog-btn-goods" src="./img/dialog-btn.png" />
  798. </div>
  799. <img class="dialog-close" id="dialog-close" src="./img/dialog-close.png" />
  800. </div>
  801. </div>
  802. <div id="notice" class="dialog">
  803. <div class="notice-body" id="notice-body">
  804. <div>以下隐私协议是本产品对用户隐私保护的许诺,请您务必仔细阅读本协议,以了解我们关于管理您个人信息的情况。本隐私协议的全部条款属于本产品用户服务协议的重要部份之一。<br />
  805. 为了给您提供更准确、更有针对性的服务,本产品可能会以如下方式,使用您授权的个人信息。但本产品会以高度的勤勉义务对待这些信息,在未征得您许可的情况下,不会将这些信息对外公开或向第三方提供。<br />
  806. 请务必遵守《微信开放平台协议》、《微信公众平台协议》、《企业微信服务协议》、《企业微信隐私保护协议》、《微信商户号服务协议》、《微信外部链接内容管理规范》等微信相关管理规范,我们不承担因违反上述管理规范所导致的任何责任。<br />
  807. 一、您已经认真阅读参与的活动信息,自愿参加相关活动。您自愿并乐意将活动链接、海报、文案等信息转发分享到微信朋友圈、微信群、微信聊天等渠道,并不是因为诱导的情况下参与相关活动、分享相关活动。<br />
  808. 二、您自愿选择服务或提供信息的情况下收集您的个人信息(包括但不限于,微信昵称,微信头像,微信地址,微信关联手机号等),并将这些信息进行整合,以便向您提供更好的用户服务。<br />
  809. 三、保有您的使用记录在如下情况下,本产品会遵照您的意愿或法律的规定披露您的个人信息(包括但不限于,微信昵称,微信头像,微信地址,微信关联手机号等),由此引发的问题将由您个人承担: <br />
  810. 1)事先获得您的授权<br />
  811. 2)只有获取您的个人资料,才能提供您所要求的服务 <br />
  812. 3)根据有关的法律法规要求<br />
  813. 4)按照相关政府主管部门的要求 <br />
  814. 5)为维护本产品的合法权益<br />
  815. 6)您同意让第三方共享资料<br />
  816. 7)我们发现您违反了本产品的服务条款或使用规定 <br />
  817. 8)我们需要向代表我们提供产品或服务的公司提供资料 (除非我们另行通知您,否则这些公司无权使用您的身份识别资料)<br />
  818. 四、本《隐私协议》不适用于以下情况: <br />
  819. 1)通过我们的服务而接入的第三方服务(包括任何第三方网站)收集的信息。本政策仅适用于我们所收集的信息,并不适用于任何第三方提供的服务或第三方的信息使用规则,我们对任何第三方使用由您提供的信息不承担任何责任。<br />
  820. 2)通过在我们服务中进行广告服务的其他公司或机构所收集的信息。<br />
  821. </div>
  822. </div>
  823. </div>
  824. <div id="overlay" class="overlay">
  825. <div id="popForm" class="pop-form">
  826. <div class="pop-title">
  827. <img class="close-Icon" id="closeIcon" src="./img/close.png" mode="widthFix" />
  828. <span>填写收货地址</span>
  829. </div>
  830. <form class="mui-input-group">
  831. <div class="mui-input-row">
  832. <label>姓名:</label>
  833. <input type="text" id="name" class="mui-input-clear" placeholder="请填写您的姓名">
  834. </div>
  835. <div class="mui-input-row">
  836. <label>微信号:</label>
  837. <input type="text" id="wxAccount" class="mui-input-clear" placeholder="请填写您的微信号">
  838. </div><div class="mui-input-row">
  839. <label>手机号:</label>
  840. <input type="text" id="phone" class="mui-input-clear" placeholder="请填写您的手机号">
  841. </div>
  842. <div class="mui-input-row">
  843. <label>地区:</label>
  844. <div class="city-data" id="showCityPicker">
  845. <div class="no-data" id="placeholderCity">
  846. <span>请选择地区</span>
  847. <img class="right-Icon" id="city-rightIcon" src="" mode="widthFix" />
  848. </div>
  849. <div id="province"></div>
  850. <div id="city"></div>
  851. </div>
  852. </div>
  853. <div class="mui-input-row">
  854. <label>详细地址:</label>
  855. <input type="text" id="address" class="mui-input-clear" placeholder="请填写详细地址">
  856. </div>
  857. <div class="mui-input-row">
  858. <label>备注:</label>
  859. <input type="text" id="remark" class="mui-input-clear" placeholder="请填写详细地址">
  860. </div>
  861. <div class="mui-button-row">
  862. <button type="button" id="salesMan" class="mui-btn mui-btn-primary save-btn" id="submit" onclick="handleSave()">提交</button>
  863. </div>
  864. </form>
  865. </div>
  866. </div>
  867. </div>
  868. <script>
  869. let h5Type = null
  870. let credentials = {
  871. bucket: '',
  872. Authorization: '',
  873. secretId: '',
  874. serverDomain: ''
  875. }
  876. let imgList = []
  877. var itemList = []
  878. var itemIndex = 0
  879. function uploadImage() {
  880. let uploaInput = document.getElementById('uploadfile');
  881. document.getElementById('uploadfile').click();
  882. // 当用户上传时触发事件
  883. uploaInput.onchange=function(){
  884. readFile(this);
  885. }
  886. //处理图片并添加都dom中的函数
  887. let readFile=function(obj){
  888. // 获取input里面的文件组
  889. let fileList=obj.files;
  890. //对文件组进行遍历,可以到控制台打印出fileList去看看
  891. for(let i=0;i<fileList.length;i++){
  892. var formData = new FormData();
  893. formData.append('path', fileList[i].name)
  894. formData.append('file', fileList[i])
  895. let url = credentials.serverDomain+ '/open/v1/file/upload'
  896. mui.ajax(url, {
  897. data: formData,
  898. processData: false,
  899. contentType: false,
  900. type:'post',
  901. headers: {
  902. 'bucket': credentials.bucket,
  903. 'Authorization': credentials.authorization,
  904. 'secretId': credentials.secretId,
  905. },
  906. success:function(res){
  907. imgList.push(res.data.url)
  908. const gallery = document.getElementById('imageGallery');
  909. const photoBtn = document.getElementById('photoBtn');
  910. // imgList.forEach( item=> { // 假设data是一个包含图片URL的数组
  911. const img = document.createElement('img');
  912. img.src = res.data.url; // 假设每个图片对象都有一个url属性
  913. // gallery.appendChild(img); // 将图片添加到div中
  914. gallery.insertBefore(img,photoBtn);
  915. // });
  916. console.log('sdd', imgList);
  917. },
  918. error:function(error){
  919. //异常处理;
  920. console.log(error);
  921. }
  922. });
  923. }
  924. }
  925. }
  926. window.onload = function() {
  927. document.getElementById('collectPage').style.display = "none"
  928. document.getElementById('lotteryPage').style.display = "none"
  929. if (getQueryParam('openId')) {
  930. if(!getQueryParam('externalUserid')) {
  931. mui.alert('无权限访问', '提示', '确定');
  932. } else {
  933. h5Type = getQueryParam('h5Type')
  934. if (h5Type == 19) {
  935. showCityLevel();
  936. raffleInfo();
  937. raffleRecord();
  938. } else if (h5Type == 20) {
  939. findCollectList()
  940. }
  941. }
  942. } else {
  943. // 走授权操作
  944. getAuth();
  945. }
  946. document.getElementById("city-rightIcon").src = 'https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/1000/1720163006057/icon_jiantou2%402x.png';
  947. };
  948. // 公众号授权,获取code
  949. function getAuth() {
  950. // 获取url上的code
  951. let code = getQueryParam('code')
  952. if (code) {
  953. let bId = getQueryParam('bId')
  954. mui.ajax('http://test.wefanbot.com:18993/scrm/v1/mp-client/p/getInfoByh5Code',{
  955. data:{
  956. code: code,
  957. bId: bId,
  958. },
  959. dataType:'json',//服务器返回json格式数据
  960. type:'get',//HTTP请求类型
  961. success:function(res){
  962. h5Type = res.data.h5Type
  963. if (h5Type == 19) {
  964. document.getElementById('collectPage').style.display = "none"
  965. document.getElementById('lotteryPage').style.display = "block"
  966. // if (!res.data.externalUserid) {
  967. // 进行下一步企微授权
  968. gerQwAuth(bId, res.data.openId);
  969. // }
  970. } else if (h5Type == 20){
  971. document.getElementById('collectPage').style.display = "block"
  972. document.getElementById('lotteryPage').style.display = "none"
  973. // if (!res.data.externalUserid) {
  974. // 进行下一步企微授权
  975. gerQwAuth(bId, res.data.openId);
  976. // }
  977. }
  978. },
  979. error:function(error){
  980. //异常处理;
  981. console.log(error);
  982. }
  983. });
  984. } else {
  985. let redirect_uri = window.location.href
  986. // code 不存在,走微信网页授权逻辑
  987. let url = `https://open.weixin.qq.com/connect/oauth2/authorize?appId=wx99ec0d0828a4d2d3&redirect_uri=${redirect_uri}&scope=snsapi_userinfo&state=STATE#wechat_redirect`
  988. window.location.replace(url)
  989. }
  990. };
  991. // 企微授权
  992. function gerQwAuth (bId, openId) {
  993. let link = window.location.href
  994. mui.ajax('http://test.wefanbot.com:18993/p/insuite/p/getOAUrl',{
  995. data:{
  996. bId: bId,
  997. openId: openId,
  998. },
  999. dataType:'json',//服务器返回json格式数据
  1000. type:'get',//HTTP请求类型
  1001. success:function(res){
  1002. if (res.data) {
  1003. window.location.replace(res.data)
  1004. }
  1005. },
  1006. error:function(error){
  1007. //异常处理;
  1008. console.log(error);
  1009. }
  1010. });
  1011. };
  1012. function getCosObj() {
  1013. mui.ajax('http://test.wefanbot.com:18998/scrm/v1/oss/p/getAuthorization',{
  1014. data:{
  1015. },
  1016. dataType:'json',//服务器返回json格式数据
  1017. type:'post',//HTTP请求类型
  1018. headers:{'Content-Type':'application/json'},
  1019. success:function(res){
  1020. credentials = res.data.info
  1021. // 用正则将this.credentials.serverDomain链接中的协议与当前域名的协议保持一致
  1022. credentials.serverDomain = credentials.serverDomain.replace(/https:|http:/g, document.location.protocol)
  1023. console.log('credentials2', credentials);
  1024. },
  1025. error:function(error){
  1026. //异常处理;
  1027. console.log(error);
  1028. }
  1029. });
  1030. };
  1031. // 发送祝福
  1032. function handleSendText() {
  1033. let bId = getQueryParam('bId')
  1034. // let openId = getQueryParam('openId')
  1035. let textareaResult = document.getElementById("textarea").value;
  1036. mui.ajax('http://test.wefanbot.com:18993/scrm/v1/mp-collect/p/add', {
  1037. data:{
  1038. bId: bId,
  1039. openId: openId,
  1040. content: textareaResult,
  1041. imgList: imgList,
  1042. },
  1043. dataType:'json',//服务器返回json格式数据
  1044. type:'post',//HTTP请求类型
  1045. headers:{'Content-Type':'application/json'},
  1046. success:function(res){
  1047. if (res.code == 1) {
  1048. mui.toast('发送成功');
  1049. document.getElementById('dialogText').style.display = 'none';
  1050. imgList = []
  1051. } else {
  1052. mui.toast(res.msg);
  1053. }
  1054. },
  1055. error:function(error){
  1056. //异常处理;
  1057. console.log(error);
  1058. }
  1059. });
  1060. };
  1061. // 获取用户故事收集列表
  1062. function findCollectList() {
  1063. mui.ajax('http://test.wefanbot.com:18993/scrm/v1/mp-collect/p/findCollectList', {
  1064. data:{
  1065. },
  1066. dataType:'json',//服务器返回json格式数据
  1067. type:'get',//HTTP请求类型
  1068. success:function(res){
  1069. itemList = res.data||[]
  1070. console.log(itemList)
  1071. onShowItem()
  1072. },
  1073. error:function(error){
  1074. //异常处理;
  1075. console.log(error);
  1076. }
  1077. });
  1078. };
  1079. function getRandomArbitrary(min, max) {
  1080. return Math.floor(Math.random() * (max - min) + min);
  1081. }
  1082. function showItem(data){
  1083. var showItem = document.getElementById('showItem')
  1084. var infoName = document.getElementById('infoName')
  1085. var infoDsc = document.getElementById('infoDsc')
  1086. var avatar = document.getElementById('avatar')
  1087. avatar.src = data.avatar
  1088. infoName.innerText = data.clientName
  1089. infoDsc.innerText = data.content
  1090. var X = getRandomArbitrary(15,125)
  1091. if(data.imgList&&data.imgList.length){//有图片
  1092. showItem.classList.add("show_img_item")
  1093. var infoImg = document.getElementById('infoImg')
  1094. infoImg.src = data.imgList[0]
  1095. var Y = getRandomArbitrary(175,208)
  1096. }else{//无图片
  1097. showItem.classList.remove("show_img_item")
  1098. var Y = getRandomArbitrary(15,157)
  1099. }
  1100. showItem.style.cssText = `top: ${Y}rem; left: ${X}rem;`
  1101. showItem.classList.add("add_animation_item")
  1102. setTimeout(()=>{
  1103. showItem.classList.remove("add_animation_item")
  1104. },3500)
  1105. }
  1106. function onShowItem(){
  1107. console.log(itemIndex)
  1108. if(itemList.length){
  1109. var data = itemList[itemIndex]
  1110. showItem(data)
  1111. if(itemIndex<itemList.length-1){
  1112. itemIndex++
  1113. }else{
  1114. itemIndex = 0
  1115. }
  1116. setTimeout(()=>{
  1117. onShowItem()
  1118. },4000)
  1119. }
  1120. }
  1121. document.getElementById('sendBtn').addEventListener('click', function() {
  1122. document.getElementById('dialogText').style.display = 'block';
  1123. // 获取腾讯COS对象存储的实例对象
  1124. getCosObj();
  1125. });
  1126. document.getElementById('closeText').addEventListener('click', function() {
  1127. document.getElementById('dialogText').style.display = 'none';
  1128. imgList = []
  1129. });
  1130. // 截取url中的数据
  1131. function getQueryParam(paramName) {
  1132. // 获取当前URL的查询字符串部分
  1133. const queryString = window.location.search;
  1134. // 创建一个URLSearchParams对象
  1135. const urlParams = new URLSearchParams(queryString);
  1136. // 返回指定参数的值,如果不存在则返回null
  1137. return urlParams.get(paramName);
  1138. };
  1139. // 城市数据
  1140. function showCityLevel() {
  1141. var picker = new mui.PopPicker({
  1142. layer: 2,
  1143. });
  1144. mui.ajax('https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/1000/1720161853377/pc-code.json',{
  1145. data:{
  1146. },
  1147. dataType:'json',//服务器返回json格式数据
  1148. type:'get',//HTTP请求类型
  1149. success:function(res){
  1150. picker.setData(res)
  1151. },
  1152. error:function(error){
  1153. //异常处理;
  1154. console.log(error);
  1155. }
  1156. });
  1157. let provinceResult = document.getElementById('province');
  1158. let cityResult = document.getElementById('city');
  1159. document.getElementById("showCityPicker").addEventListener('click', function(event) {
  1160. event.stopPropagation();
  1161. // 默认第一层显示第1项;第二层显示第2项
  1162. picker.pickers[0].setSelectedIndex(0);
  1163. picker.pickers[1].setSelectedIndex(2);
  1164. picker.show(function(selectItems) {
  1165. document.getElementById('placeholderCity').style.display = "none"
  1166. var text1 = selectItems[0].text;
  1167. var text2 = selectItems[1].text;
  1168. provinceResult.innerText = text1
  1169. cityResult.innerText = text2
  1170. })
  1171. });
  1172. };
  1173. let lotteryStatus = '' // 抽奖活动状态
  1174. let gridList = []; // 用于存储所有格子数据
  1175. let gridItems = []; // 用于存储所有格子
  1176. let currentIndex = 0; // 当前活动的格子索引
  1177. let stopRotation = false; // 控制是否停止轮询的变量
  1178. let remainingTimes = 0
  1179. // 获取抽奖信息
  1180. function raffleInfo() {
  1181. let openId = getQueryParam('openId')
  1182. let raffleId = getQueryParam('bId')
  1183. mui.ajax('http://test.wefanbot.com:18993/scrm/v1/wxcp-raffle/p/raffleInfoByOpenId',{
  1184. data:{
  1185. openId: openId,
  1186. raffleId: raffleId,
  1187. },
  1188. dataType:'json',//服务器返回json格式数据
  1189. type:'get',//HTTP请求类型
  1190. success:function(res){
  1191. lotteryStatus = res.data.status
  1192. gridList = res.data.prizes
  1193. document.getElementById("tab1").innerHTML = res.data.activityInfo
  1194. remainingTimes = res.data.raffleNum-res.data.useNum
  1195. document.getElementById("lotteryId").innerHTML = `已抽奖${res.data.useNum}次,还剩${res.data.raffleNum-res.data.useNum}次机会`
  1196. const container = document.getElementById('grid-container');
  1197. const buttons = document.getElementById('lottery-button');
  1198. container.innerHTML = '';
  1199. for (let i = 0; i < 9; i++) {
  1200. // 创建一个新的div元素作为格子
  1201. const gridItem = document.createElement('div');
  1202. gridItem.classList.add('grid-item');
  1203. // 创建图片元素并添加到格子中
  1204. const img = document.createElement('img');
  1205. img.src = res.data.prizes[i].img; // 设置图片源
  1206. img.alt = `图片 ${i + 1}`; // 设置图片的替代文本
  1207. gridItem.appendChild(img);
  1208. // 创建标题元素并添加到格子中
  1209. const title = document.createElement('div');
  1210. title.classList.add('grid-item-title');
  1211. title.textContent = res.data.prizes[i].name; // 设置标题文本
  1212. gridItem.appendChild(title);
  1213. // 将格子添加到容器中
  1214. container.appendChild(gridItem);
  1215. }
  1216. gridItems = []
  1217. container.querySelectorAll('.grid-item').forEach(item => {
  1218. gridItems.push(item);
  1219. });
  1220. buttons.addEventListener('click', function() {
  1221. handleLottery();
  1222. })
  1223. },
  1224. error:function(error){
  1225. //异常处理;
  1226. console.log(error);
  1227. }
  1228. });
  1229. };
  1230. // 点击抽奖
  1231. function handleLottery() {
  1232. if (!remainingTimes) {
  1233. mui.toast('抽奖次数已用完');
  1234. return false;
  1235. }
  1236. const gridContainer = document.getElementById('grid-container');
  1237. if (lotteryStatus === -1) {
  1238. mui.toast('活动已结束');
  1239. } else if (lotteryStatus === 0) {
  1240. mui.toast('活动未开始');
  1241. } else if (lotteryStatus === 1) {
  1242. stopRotation = false
  1243. rotateActive();
  1244. let externalUserid = getQueryParam('externalUserid')
  1245. let openId = getQueryParam('openId')
  1246. let raffleId = getQueryParam('bId')
  1247. mui.ajax('http://test.wefanbot.com:18993/scrm/v1/wxcp-raffle/p/lottery',{
  1248. data:{
  1249. externalUserid: externalUserid,
  1250. openId: openId,
  1251. raffleId: raffleId,
  1252. },
  1253. dataType:'json',//服务器返回json格式数据
  1254. type:'get',//HTTP请求类型
  1255. success:function(res){
  1256. if (res.data) {
  1257. setTimeout(() => {
  1258. // 停止轮询
  1259. stopRotation = true;
  1260. // 立即将 active 类应用到目标格子上
  1261. gridItems.forEach(item => item.classList.remove('actives'));
  1262. gridList.forEach((item, index) => {
  1263. if (res.data.id === item.id) {
  1264. gridItems[index].classList.add('actives');
  1265. }
  1266. });
  1267. if (res.data.acceptType === 0 || res.data.acceptType === 1) {
  1268. document.getElementById('dialog').style.display = 'flex';
  1269. document.getElementById('prize-msg-goods').style.display = 'block';
  1270. document.getElementById('prize-msg-money').style.display = 'none';
  1271. document.getElementById("goods-img").src = res.data.img
  1272. document.getElementById("goods-name").innerHTML = res.data.name
  1273. } else if (res.data.acceptType === 2) {
  1274. document.getElementById('dialog').style.display = 'flex';
  1275. document.getElementById('prize-msg-goods').style.display = 'none';
  1276. document.getElementById('prize-msg-money').style.display = 'block';
  1277. document.getElementById("prize-money").innerHTML = res.data.money
  1278. }
  1279. raffleInfo()
  1280. raffleRecord()
  1281. currentIndex = 0
  1282. }, 2000); // 假设接口调用需要2秒
  1283. } else {
  1284. stopRotation = true;
  1285. gridItems.forEach(item => item.classList.remove('actives'));
  1286. currentIndex = 0
  1287. mui.toast(res.msg);
  1288. }
  1289. },
  1290. error:function(error){
  1291. //异常处理;
  1292. console.log(error);
  1293. }
  1294. });
  1295. }
  1296. };
  1297. // 轮询动画函数
  1298. function rotateActive() {
  1299. // 移除上一个格子的 active 类
  1300. if (gridItems[currentIndex]) {
  1301. gridItems[currentIndex].classList.remove('actives');
  1302. }
  1303. // 更新当前索引,循环到第一个格子如果超出范围
  1304. currentIndex = (currentIndex + 1) % gridItems.length;
  1305. // 应用 active 类到新的格子
  1306. gridItems[currentIndex].classList.add('actives');
  1307. // 递归调用以继续动画,直到接口调用完成
  1308. if (!stopRotation) {
  1309. setTimeout(rotateActive, 100); // 假设每个格子显示 500 毫秒
  1310. }
  1311. };
  1312. // 获取抽奖记录
  1313. function raffleRecord() {
  1314. let openId = getQueryParam('openId')
  1315. let raffleId = getQueryParam('bId')
  1316. mui.ajax('http://test.wefanbot.com:18993/scrm/v1/wxcp-raffle/p/raffleRecord',{
  1317. data:{
  1318. openId: openId,
  1319. raffleId: raffleId,
  1320. page: 1,
  1321. pageCount: 1000,
  1322. },
  1323. dataType:'json',//服务器返回json格式数据
  1324. type:'post',//HTTP请求类型
  1325. headers:{'Content-Type':'application/json'},
  1326. success:function(res){
  1327. const recordList = document.getElementById('recordList');
  1328. recordList.innerHTML = ''
  1329. res.data.records.forEach(record => {
  1330. recordList.innerHTML += `
  1331. <div class="record-item">
  1332. <img class="prize-img" src="${record.img}" mode="widthFix" />
  1333. <div>
  1334. <div class="prize-name">${record.name}</div>
  1335. <div class="prize-time">${timeFormat(record.raffleTime)}</div>
  1336. </div>
  1337. <button id="toggleButton" ${record.status ? 'disabled' : ''} class="get-btn" onclick="handleOpenForm(${record.id})">${record.status ? '已领取' : '领取'}</button>
  1338. </div>`
  1339. });
  1340. },
  1341. error:function(error){
  1342. //异常处理;
  1343. console.log(error);
  1344. }
  1345. });
  1346. };
  1347. let recordId = ''
  1348. function handleOpenForm(id) {
  1349. recordId = id
  1350. document.getElementById('overlay').style.display = 'flex';
  1351. var div = document.getElementById('popForm');
  1352. div.classList.add('show');
  1353. };
  1354. // 切换tab
  1355. function changeTab(evt, tabName) {
  1356. // 获取所有tab链接,并移除激活类
  1357. var i, tabcontent, tablinks;
  1358. tabcontent = document.getElementsByClassName("tab-content");
  1359. for (i = 0; i < tabcontent.length; i++) {
  1360. tabcontent[i].style.display = "none";
  1361. }
  1362. tablinks = document.getElementsByClassName("tab-link");
  1363. for (i = 0; i < tablinks.length; i++) {
  1364. tablinks[i].className = tablinks[i].className.replace(" active", "");
  1365. }
  1366. // 显示当前tab内容,并添加激活类到链接
  1367. document.getElementById(tabName).style.display = "block";
  1368. evt.currentTarget.className += " active";
  1369. };
  1370. function handleSave() {
  1371. let nameResult = document.getElementById('name').value;
  1372. let wxAccountResult = document.getElementById('wxAccount').value
  1373. let phone = document.getElementById("phone").value;
  1374. let provinceResult = document.getElementById('province');
  1375. let cityResult = document.getElementById('city');
  1376. let addressResult = document.getElementById("address").value;
  1377. let remarkResult = document.getElementById("remark").value;
  1378. if (!nameResult){
  1379. mui.toast("请填写姓名");
  1380. } else if (!phone){
  1381. mui.toast("请输入手机号");
  1382. } else if (!provinceResult.innerText){
  1383. mui.toast('请选择城市');
  1384. } else {
  1385. mui.ajax('http://test.wefanbot.com:18993/scrm/v1/wxcp-raffle/p/raffleForm',{
  1386. data:{
  1387. name: nameResult,
  1388. wxAccount: wxAccountResult,
  1389. phone: phone,
  1390. province: provinceResult.innerText || '',
  1391. city: cityResult.innerText || '',
  1392. address: addressResult,
  1393. remark: remarkResult,
  1394. recordId: recordId
  1395. },
  1396. dataType:'json',//服务器返回json格式数据
  1397. type:'post',//HTTP请求类型
  1398. timeout:10000,//超时时间设置为10秒;
  1399. headers:{'Content-Type':'application/json'},
  1400. success:function(res){
  1401. if (res.code === 1) {
  1402. mui.toast("提交成功!");
  1403. document.getElementById('overlay').style.display = 'none';
  1404. var div = document.getElementById('popForm');
  1405. div.classList.remove('show');
  1406. raffleRecord()
  1407. } else {
  1408. mui.toast(res.msg);
  1409. }
  1410. },
  1411. error:function(error){
  1412. //异常处理;
  1413. console.log(error);
  1414. mui.toast(error);
  1415. }
  1416. });
  1417. }
  1418. };
  1419. document.getElementById('closeIcon').addEventListener('click', function() {
  1420. document.getElementById('overlay').style.display = 'none';
  1421. var div = document.getElementById('popForm');
  1422. div.classList.remove('show');
  1423. });
  1424. if (document.getElementById('dialog-btn-money')) {
  1425. document.getElementById('dialog-btn-money').addEventListener('click', function() {
  1426. document.getElementById('dialog').style.display = 'none';
  1427. gridItems[currentIndex].classList.remove('actives');
  1428. });
  1429. }
  1430. if (document.getElementById('dialog-btn-goods')) {
  1431. document.getElementById('dialog-btn-goods').addEventListener('click', function() {
  1432. document.getElementById('dialog').style.display = 'none';
  1433. gridItems[currentIndex].classList.remove('actives');
  1434. });
  1435. }
  1436. document.getElementById('dialog-close').addEventListener('click', function() {
  1437. document.getElementById('dialog').style.display = 'none';
  1438. gridItems[currentIndex].classList.remove('actives');
  1439. });
  1440. document.getElementById('eventNotice').addEventListener('click', function() {
  1441. document.getElementById('notice').style.display = 'block';
  1442. });
  1443. document.getElementById('notice').addEventListener('click', function() {
  1444. var div = document.getElementById('notice-body');
  1445. // 检查点击事件的目标是否不是div本身或其子元素
  1446. if (!div.contains(event.target)) {
  1447. document.getElementById('notice').style.display = 'none';
  1448. }
  1449. });
  1450. function timeFormat (time, format = 'yyyy-MM-dd hh:mm:ss') {
  1451. if (time === undefined || time === '' || time === null) {
  1452. return '/'
  1453. } else {
  1454. const date = new Date(time)
  1455. const o = {
  1456. 'M+': date.getMonth() + 1,
  1457. 'd+': date.getDate(),
  1458. 'h+': date.getHours(),
  1459. 'm+': date.getMinutes(),
  1460. 's+': date.getSeconds(),
  1461. 'q+': Math.floor((date.getMonth() + 3) / 3),
  1462. 'S': date.getMilliseconds()
  1463. }
  1464. if (/(y+)/.test(format)) {
  1465. format = format.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
  1466. }
  1467. for (let k in o) {
  1468. if (new RegExp('(' + k + ')').test(format)) {
  1469. format = format.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
  1470. }
  1471. }
  1472. return format
  1473. }
  1474. }
  1475. </script>
  1476. </body>
  1477. </html>