index.html 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472
  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. }
  519. .show_box .show_item.add_animation_item .avatar_box{
  520. animation: showAvatarItem 0.3s ease-out 2s forwards;
  521. }
  522. .show_box .show_item .avatar_box .avatar{
  523. width: 20rem;
  524. height: 20rem;
  525. object-fit: cover;
  526. }
  527. .show_box .show_item .info_box{
  528. position: absolute;
  529. top: -15rem;
  530. left: -15rem;
  531. z-index: 1;
  532. background: rgba(255,255,255,0.8);
  533. border-radius: 15rem;
  534. border: 1rem solid #FFFFFF;
  535. width: 240rem;
  536. padding: 15rem;
  537. box-sizing: border-box;
  538. }
  539. .show_box .show_item.add_animation_item .info_box{
  540. animation: hiddenItem 0.3s ease-out 2s forwards;
  541. }
  542. .show_box .show_item.show_img_item .info_box{
  543. top: -175rem;
  544. left: -15rem;
  545. }
  546. .show_box .show_item.show_img_item.add_animation_item .info_box{
  547. animation: hiddenImgItem 0.3s ease-out 2s forwards;
  548. }
  549. @keyframes showItem {
  550. 0% {
  551. opacity: 0;
  552. }
  553. 100% {
  554. opacity: 1;
  555. }
  556. }
  557. @keyframes showAvatarItem {
  558. 0% {
  559. transform: scale(1);
  560. }
  561. 100% {
  562. transform: scale(1.5);
  563. }
  564. }
  565. @keyframes hiddenAvatarItem {
  566. 0% {
  567. transform: scale(1.5);
  568. opacity: 1;
  569. }
  570. 100% {
  571. transform: scale(1.5);
  572. opacity: 0;
  573. top: 135rem;
  574. left: 172rem;
  575. }
  576. }
  577. @keyframes hiddenItem {
  578. 0% {
  579. transform: scale(1);
  580. top: -15rem;
  581. left: -15rem;
  582. }
  583. 100% {
  584. transform: scale(0);
  585. left:-110rem;
  586. top: -30rem;
  587. }
  588. }
  589. @keyframes hiddenImgItem {
  590. 0% {
  591. transform: scale(1);
  592. top: -175rem;
  593. left: -15rem;
  594. }
  595. 100% {
  596. transform: scale(0);
  597. left:-110rem;
  598. top: -115rem;
  599. }
  600. }
  601. .show_box .show_item .info_box .img_box{
  602. width: 210rem;
  603. height: 150rem;
  604. border-radius: 15rem;
  605. overflow: hidden;
  606. margin-bottom: 10rem;
  607. display: none;
  608. }
  609. .show_box .show_item.show_img_item .info_box .img_box{
  610. display: block;
  611. }
  612. .show_box .show_item .info_box .img_box .info_img{
  613. width: 210rem;
  614. height: 150rem;
  615. object-fit: cover;
  616. }
  617. .show_box .show_item .info_box .info_text{
  618. }
  619. .show_box .show_item .info_box .info_text .info_name{
  620. font-weight: 500;
  621. font-size: 14rem;
  622. color: #222222;
  623. line-height: 20rem;
  624. padding-left: 25rem;
  625. margin-bottom: 5rem;
  626. }
  627. .show_box .show_item .info_box .info_text .info_dsc{
  628. font-weight: 400;
  629. font-size: 12rem;
  630. color: #222222;
  631. line-height: 17rem;
  632. }
  633. .send_btn {
  634. width: 100%;
  635. position: fixed;
  636. bottom: 0rem;
  637. left: 50%;
  638. transform: translateX(-50%);
  639. }
  640. .dialog_text {
  641. position: fixed;
  642. top: 0;
  643. left: 0;
  644. width: 100%;
  645. height: 100%;
  646. background-color: rgba(0, 0, 0, 0.5); /* 半透明黑色 */
  647. z-index: 1000; /* 确保遮罩层在顶部 */
  648. transition: opacity 0.5s ease; /* 可选:添加透明度过渡效果 */
  649. display: none;
  650. }
  651. .dialog-body {
  652. width: 100%;
  653. height: 100vh;
  654. z-index: 1001; /* 确保遮罩层在顶部 */
  655. display: flex;
  656. flex-direction: column;
  657. align-items: center;
  658. justify-content: center;
  659. }
  660. .text_bg {
  661. background: url('./img/dialog-text.png');
  662. background-size: cover;
  663. width: 100vw;
  664. height: 368rem;
  665. }
  666. .close-text {
  667. width: 24rem;
  668. height: 24rem;
  669. float: right;
  670. margin-right: 25rem;
  671. margin-top: 25rem;
  672. }
  673. .textarea_style {
  674. background-color: rgba(255, 255, 255, 0);
  675. border: unset;
  676. height: 180rem;
  677. padding: 0 35rem;
  678. width: 100%;
  679. margin: 0;
  680. }
  681. .photo-btn {
  682. width: 80rem;
  683. height: 80rem;
  684. margin-top: 18rem;
  685. margin-left: 35rem;
  686. }
  687. .send_text {
  688. width: 225rem;
  689. height: 52rem;
  690. background: linear-gradient( 134deg, #FAFF77 0%, #8EFF3B 100%);
  691. border-radius: 30rem;
  692. border: 2rem solid #FFFFFF;
  693. font-weight: 800;
  694. font-size: 16px;
  695. color: #222222;
  696. margin-top: 15rem;
  697. }
  698. .imageGallery {
  699. width: 100%;
  700. display: flex;
  701. overflow-x: auto;
  702. }
  703. .imageGallery img{
  704. width: 80rem;
  705. height: 80rem;
  706. margin-top: 18rem;
  707. margin-left: 35rem;
  708. }
  709. </style>
  710. <body>
  711. <div id="collectPage">
  712. <div class="bg_content">
  713. <div class="show_box">
  714. <div id="showItem" class="show_item">
  715. <div class="avatar_box">
  716. <img id="avatar" class="avatar" src="./img/prize-bg.png"/>
  717. </div>
  718. <div class="info_box">
  719. <div class="img_box">
  720. <img id="infoImg" class="info_img" src="./img/lottery-bg.png"/>
  721. </div>
  722. <div class="info_text">
  723. <div id="infoName" class="info_name">不爱吃甜:</div>
  724. <div id="infoDsc" class="info_dsc">不爱吃甜不爱吃甜不爱吃甜不爱吃甜不爱吃甜不爱吃甜</div>
  725. </div>
  726. </div>
  727. </div>
  728. </div>
  729. <img class="send_btn" id="sendBtn" src="./img/send-btn.png" mode="widthFix" />
  730. </div>
  731. <div id="dialogText" class="dialog_text">
  732. <div class="dialog-body">
  733. <div class="text_bg">
  734. <img class="close-text" id="closeText" src="./img/close-text.png" mode="widthFix" />
  735. <textarea class="textarea_style" id="textarea"></textarea>
  736. <div id="imageGallery" class="imageGallery"></div>
  737. <img class="photo-btn" id="photoBtn" src="./img/photo-btn.png" mode="widthFix" onclick="uploadImage()" />
  738. <input type="file" id="uploadfile" style="display: none;" multiple accept='image/*'>
  739. </div>
  740. <button class="send_text" onclick="handleSendText()">发送</button>
  741. </div>
  742. </div>
  743. </div>
  744. <div id="lotteryPage">
  745. <img class="bg-img" id="bgImg" src="./img/lottery-bg.png" mode="widthFix" />
  746. <div class="event-notice" id="eventNotice">
  747. <span>活动须知</span>
  748. </div>
  749. <div class="prize-content">
  750. <div id="grid-container">
  751. </div>
  752. </div>
  753. <div class="btn">
  754. <img class="btn-img" id="lottery-button" src="./img/btn.png" mode="widthFix" />
  755. </div>
  756. <div class="lottery-tip" id="lotteryId"></div>
  757. <div class="rule">
  758. <div class="rule-body">
  759. <div class="tabs">
  760. <button class="tab-link active" onclick="changeTab(event, 'tab1')">活动信息</button>
  761. <button class="tab-link" onclick="changeTab(event, 'tab2')">抽奖记录</button>
  762. </div>
  763. <div id="tab1" class="tab-content">
  764. </div>
  765. <div id="tab2" class="tab-content" style="display:none;">
  766. <div class="record-list" id="recordList">
  767. </div>
  768. </div>
  769. </div>
  770. </div>
  771. <div id="dialog" class="dialog">
  772. <div id="dialog-body" class="dialog-body">
  773. <img class="dialog-tip" src="./img/dialog-tip.png" />
  774. <img class="dialog-bg" src="./img/dialog-bg.png" />
  775. <div class="prize-msg" id="prize-msg-money">
  776. <div class="money-title">微信红包</div>
  777. <div class="money-content">
  778. <span class="prize-money" id="prize-money"></span>
  779. <span class="prize-unit">元</span>
  780. </div>
  781. <img class="dialog-btn" id="dialog-btn-money" src="./img/dialog-btn.png" />
  782. <div class="money-tip">红包到账会有延迟情况,请以实际为准</div>
  783. </div>
  784. <div class="prize-msg" id="prize-msg-goods">
  785. <img class="goods-img" id="goods-img" src="" />
  786. <div class="goods-name" id="goods-name"></div>
  787. <img class="dialog-btn" id="dialog-btn-goods" src="./img/dialog-btn.png" />
  788. </div>
  789. <img class="dialog-close" id="dialog-close" src="./img/dialog-close.png" />
  790. </div>
  791. </div>
  792. <div id="notice" class="dialog">
  793. <div class="notice-body" id="notice-body">
  794. <div>以下隐私协议是本产品对用户隐私保护的许诺,请您务必仔细阅读本协议,以了解我们关于管理您个人信息的情况。本隐私协议的全部条款属于本产品用户服务协议的重要部份之一。<br />
  795. 为了给您提供更准确、更有针对性的服务,本产品可能会以如下方式,使用您授权的个人信息。但本产品会以高度的勤勉义务对待这些信息,在未征得您许可的情况下,不会将这些信息对外公开或向第三方提供。<br />
  796. 请务必遵守《微信开放平台协议》、《微信公众平台协议》、《企业微信服务协议》、《企业微信隐私保护协议》、《微信商户号服务协议》、《微信外部链接内容管理规范》等微信相关管理规范,我们不承担因违反上述管理规范所导致的任何责任。<br />
  797. 一、您已经认真阅读参与的活动信息,自愿参加相关活动。您自愿并乐意将活动链接、海报、文案等信息转发分享到微信朋友圈、微信群、微信聊天等渠道,并不是因为诱导的情况下参与相关活动、分享相关活动。<br />
  798. 二、您自愿选择服务或提供信息的情况下收集您的个人信息(包括但不限于,微信昵称,微信头像,微信地址,微信关联手机号等),并将这些信息进行整合,以便向您提供更好的用户服务。<br />
  799. 三、保有您的使用记录在如下情况下,本产品会遵照您的意愿或法律的规定披露您的个人信息(包括但不限于,微信昵称,微信头像,微信地址,微信关联手机号等),由此引发的问题将由您个人承担: <br />
  800. 1)事先获得您的授权<br />
  801. 2)只有获取您的个人资料,才能提供您所要求的服务 <br />
  802. 3)根据有关的法律法规要求<br />
  803. 4)按照相关政府主管部门的要求 <br />
  804. 5)为维护本产品的合法权益<br />
  805. 6)您同意让第三方共享资料<br />
  806. 7)我们发现您违反了本产品的服务条款或使用规定 <br />
  807. 8)我们需要向代表我们提供产品或服务的公司提供资料 (除非我们另行通知您,否则这些公司无权使用您的身份识别资料)<br />
  808. 四、本《隐私协议》不适用于以下情况: <br />
  809. 1)通过我们的服务而接入的第三方服务(包括任何第三方网站)收集的信息。本政策仅适用于我们所收集的信息,并不适用于任何第三方提供的服务或第三方的信息使用规则,我们对任何第三方使用由您提供的信息不承担任何责任。<br />
  810. 2)通过在我们服务中进行广告服务的其他公司或机构所收集的信息。<br />
  811. </div>
  812. </div>
  813. </div>
  814. <div id="overlay" class="overlay">
  815. <div id="popForm" class="pop-form">
  816. <div class="pop-title">
  817. <img class="close-Icon" id="closeIcon" src="./img/close.png" mode="widthFix" />
  818. <span>填写收货地址</span>
  819. </div>
  820. <form class="mui-input-group">
  821. <div class="mui-input-row">
  822. <label>姓名:</label>
  823. <input type="text" id="name" class="mui-input-clear" placeholder="请填写您的姓名">
  824. </div>
  825. <div class="mui-input-row">
  826. <label>微信号:</label>
  827. <input type="text" id="wxAccount" class="mui-input-clear" placeholder="请填写您的微信号">
  828. </div><div class="mui-input-row">
  829. <label>手机号:</label>
  830. <input type="text" id="phone" class="mui-input-clear" placeholder="请填写您的手机号">
  831. </div>
  832. <div class="mui-input-row">
  833. <label>地区:</label>
  834. <div class="city-data" id="showCityPicker">
  835. <div class="no-data" id="placeholderCity">
  836. <span>请选择地区</span>
  837. <img class="right-Icon" id="city-rightIcon" src="" mode="widthFix" />
  838. </div>
  839. <div id="province"></div>
  840. <div id="city"></div>
  841. </div>
  842. </div>
  843. <div class="mui-input-row">
  844. <label>详细地址:</label>
  845. <input type="text" id="address" class="mui-input-clear" placeholder="请填写详细地址">
  846. </div>
  847. <div class="mui-input-row">
  848. <label>备注:</label>
  849. <input type="text" id="remark" class="mui-input-clear" placeholder="请填写详细地址">
  850. </div>
  851. <div class="mui-button-row">
  852. <button type="button" id="salesMan" class="mui-btn mui-btn-primary save-btn" id="submit" onclick="handleSave()">提交</button>
  853. </div>
  854. </form>
  855. </div>
  856. </div>
  857. </div>
  858. <script>
  859. function uploadImage() {
  860. let uploaInput = document.getElementById('uploadfile');
  861. document.getElementById('uploadfile').click();
  862. // 当用户上传时触发事件
  863. uploaInput.onchange=function(){
  864. readFile(this);
  865. }
  866. //处理图片并添加都dom中的函数
  867. let readFile=function(obj){
  868. // 获取input里面的文件组
  869. let fileList=obj.files;
  870. //对文件组进行遍历,可以到控制台打印出fileList去看看
  871. for(let i=0;i<fileList.length;i++){
  872. var formData = new FormData();
  873. formData.append('path', fileList[i].name)
  874. formData.append('file', fileList[i])
  875. let url = credentials.serverDomain+ '/open/v1/file/upload'
  876. mui.ajax(url, {
  877. data: formData,
  878. processData: false,
  879. contentType: false,
  880. type:'post',
  881. headers: {
  882. 'bucket': credentials.bucket,
  883. 'Authorization': credentials.authorization,
  884. 'secretId': credentials.secretId,
  885. },
  886. success:function(res){
  887. imgList.push(res.data.url)
  888. const gallery = document.getElementById('imageGallery');
  889. imgList.forEach( item=> { // 假设data是一个包含图片URL的数组
  890. const img = document.createElement('img');
  891. img.src = item; // 假设每个图片对象都有一个url属性
  892. gallery.appendChild(img); // 将图片添加到div中
  893. });
  894. },
  895. error:function(error){
  896. //异常处理;
  897. console.log(error);
  898. }
  899. });
  900. }
  901. }
  902. }
  903. let h5Type = 20
  904. let mpClientId = ''
  905. let credentials = {
  906. bucket: '',
  907. Authorization: '',
  908. secretId: '',
  909. serverDomain: ''
  910. }
  911. let imgList = []
  912. window.onload = function() {
  913. if (getQueryParam('openId')) {
  914. if(!getQueryParam('externalUserid')) {
  915. mui.alert('无权限访问', '提示', '确定');
  916. } else {
  917. if (h5Type == 19) {
  918. showCityLevel();
  919. raffleInfo();
  920. raffleRecord();
  921. } else if (h5Type == 20) {
  922. // 获取腾讯COS对象存储的实例对象
  923. getCosObj();
  924. }
  925. }
  926. } else {
  927. // 走授权操作
  928. getAuth();
  929. }
  930. document.getElementById("city-rightIcon").src = 'https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/1000/1720163006057/icon_jiantou2%402x.png';
  931. };
  932. // 公众号授权,获取code
  933. function getAuth() {
  934. // 获取url上的code
  935. let code = getQueryParam('code')
  936. if (code) {
  937. let bId = getQueryParam('bId')
  938. mui.ajax('http://test.wefanbot.com:18993/scrm/v1/mp-client/p/getInfoByh5Code',{
  939. data:{
  940. code: code,
  941. bId: bId,
  942. },
  943. dataType:'json',//服务器返回json格式数据
  944. type:'get',//HTTP请求类型
  945. success:function(res){
  946. h5Type = res.data.h5Type
  947. if (h5Type == 19) {
  948. document.getElementById('collectPage').style.display = "none"
  949. document.getElementById('lotteryPage').style.display = "block"
  950. if (res.data.externalUserid) {
  951. showCityLevel();
  952. } else {
  953. // 进行下一步企微授权
  954. gerQwAuth(bId, res.data.openId);
  955. }
  956. } else if (h5Type == 20){
  957. document.getElementById('collectPage').style.display = "block"
  958. document.getElementById('lotteryPage').style.display = "none"
  959. mpClientId = res.data.mpClientId
  960. // if (!res.data.externalUserid) {
  961. // // 进行下一步企微授权
  962. // gerQwAuth(bId, res.data.openId);
  963. // }
  964. }
  965. },
  966. error:function(error){
  967. //异常处理;
  968. console.log(error);
  969. }
  970. });
  971. } else {
  972. let redirect_uri = window.location.href
  973. // code 不存在,走微信网页授权逻辑
  974. let url = `https://open.weixin.qq.com/connect/oauth2/authorize?appId=wx99ec0d0828a4d2d3&redirect_uri=${redirect_uri}&scope=snsapi_userinfo&state=STATE#wechat_redirect`
  975. window.location.replace(url)
  976. }
  977. };
  978. // 企微授权
  979. function gerQwAuth (bId, openId) {
  980. let link = window.location.href
  981. mui.ajax('http://test.wefanbot.com:18993/p/insuite/p/getOAUrl',{
  982. data:{
  983. bId: bId,
  984. openId: openId,
  985. },
  986. dataType:'json',//服务器返回json格式数据
  987. type:'get',//HTTP请求类型
  988. success:function(res){
  989. if (res.data) {
  990. window.location.replace(res.data)
  991. }
  992. },
  993. error:function(error){
  994. //异常处理;
  995. console.log(error);
  996. }
  997. });
  998. };
  999. function getCosObj() {
  1000. mui.ajax('http://test.wefanbot.com:18998/scrm/v1/oss/p/getAuthorization',{
  1001. data:{
  1002. },
  1003. dataType:'json',//服务器返回json格式数据
  1004. type:'post',//HTTP请求类型
  1005. headers:{'Content-Type':'application/json'},
  1006. success:function(res){
  1007. credentials = res.data.info
  1008. // 用正则将this.credentials.serverDomain链接中的协议与当前域名的协议保持一致
  1009. credentials.serverDomain = credentials.serverDomain.replace(/https:|http:/g, document.location.protocol)
  1010. console.log('credentials2', credentials);
  1011. },
  1012. error:function(error){
  1013. //异常处理;
  1014. console.log(error);
  1015. }
  1016. });
  1017. };
  1018. // 发送祝福
  1019. function handleSendText() {
  1020. let openId = getQueryParam('openId')
  1021. let textareaResult = document.getElementById("textarea").value;
  1022. mui.ajax('http://test.wefanbot.com:18993/scrm/v1/mp-collect/p/add', {
  1023. data:{
  1024. mpClientId: mpClientId,
  1025. openId: openId,
  1026. content: textareaResult,
  1027. imgList: imgList,
  1028. },
  1029. dataType:'json',//服务器返回json格式数据
  1030. type:'post',//HTTP请求类型
  1031. headers:{'Content-Type':'application/json'},
  1032. success:function(res){
  1033. if (res.code == 1) {
  1034. mui.toast('发送成功');
  1035. document.getElementById('dialogText').style.display = 'none';
  1036. } else {
  1037. mui.toast(res.msg);
  1038. }
  1039. },
  1040. error:function(error){
  1041. //异常处理;
  1042. console.log(error);
  1043. }
  1044. });
  1045. };
  1046. // 获取用户故事收集列表
  1047. function findCollectList() {
  1048. let openId = getQueryParam('openId')
  1049. let textareaResult = document.getElementById("textarea").value;
  1050. mui.ajax('http://test.wefanbot.com:18993/scrm/v1/mp-collect/p/findCollectList', {
  1051. data:{
  1052. },
  1053. dataType:'json',//服务器返回json格式数据
  1054. type:'get',//HTTP请求类型
  1055. success:function(res){
  1056. },
  1057. error:function(error){
  1058. //异常处理;
  1059. console.log(error);
  1060. }
  1061. });
  1062. };
  1063. function getRandomArbitrary(min, max) {
  1064. return Math.floor(Math.random() * (max - min) + min);
  1065. }
  1066. function showItem(type){
  1067. var showItem = document.getElementById('showItem')
  1068. var infoName = document.getElementById('infoName')
  1069. var infoDsc = document.getElementById('infoDsc')
  1070. var avatar = document.getElementById('avatar')
  1071. avatar.src = ""
  1072. infoName.innerText = '455'
  1073. infoDsc.innerText = '455'
  1074. var X = getRandomArbitrary(15,125)
  1075. if(type===1){//无图片
  1076. showItem.classList.remove("show_img_item")
  1077. var Y = getRandomArbitrary(15,157)
  1078. }
  1079. if(type===2){//有图片
  1080. showItem.classList.add("show_img_item")
  1081. var infoImg = document.getElementById('infoImg')
  1082. infoImg.src = ""
  1083. var Y = getRandomArbitrary(175,208)
  1084. }
  1085. showItem.style.cssText = `top: ${Y}rem; left: ${X}rem;`
  1086. showItem.classList.add("add_animation_item")
  1087. setTimeout(()=>{
  1088. showItem.classList.remove("add_animation_item")
  1089. },3500)
  1090. }
  1091. document.getElementById('sendBtn').addEventListener('click', function() {
  1092. document.getElementById('dialogText').style.display = 'block';
  1093. });
  1094. document.getElementById('closeText').addEventListener('click', function() {
  1095. document.getElementById('dialogText').style.display = 'none';
  1096. });
  1097. // 截取url中的数据
  1098. function getQueryParam(paramName) {
  1099. // 获取当前URL的查询字符串部分
  1100. const queryString = window.location.search;
  1101. // 创建一个URLSearchParams对象
  1102. const urlParams = new URLSearchParams(queryString);
  1103. // 返回指定参数的值,如果不存在则返回null
  1104. return urlParams.get(paramName);
  1105. };
  1106. // 城市数据
  1107. function showCityLevel() {
  1108. var picker = new mui.PopPicker({
  1109. layer: 2,
  1110. });
  1111. mui.ajax('https://wl-1306604067.cos.ap-guangzhou.myqcloud.com/production/ct/1000/1720161853377/pc-code.json',{
  1112. data:{
  1113. },
  1114. dataType:'json',//服务器返回json格式数据
  1115. type:'get',//HTTP请求类型
  1116. success:function(res){
  1117. picker.setData(res)
  1118. },
  1119. error:function(error){
  1120. //异常处理;
  1121. console.log(error);
  1122. }
  1123. });
  1124. let provinceResult = document.getElementById('province');
  1125. let cityResult = document.getElementById('city');
  1126. document.getElementById("showCityPicker").addEventListener('click', function(event) {
  1127. event.stopPropagation();
  1128. // 默认第一层显示第1项;第二层显示第2项
  1129. picker.pickers[0].setSelectedIndex(0);
  1130. picker.pickers[1].setSelectedIndex(2);
  1131. picker.show(function(selectItems) {
  1132. document.getElementById('placeholderCity').style.display = "none"
  1133. var text1 = selectItems[0].text;
  1134. var text2 = selectItems[1].text;
  1135. provinceResult.innerText = text1
  1136. cityResult.innerText = text2
  1137. })
  1138. });
  1139. };
  1140. let lotteryStatus = '' // 抽奖活动状态
  1141. let gridList = []; // 用于存储所有格子数据
  1142. let gridItems = []; // 用于存储所有格子
  1143. let currentIndex = 0; // 当前活动的格子索引
  1144. let stopRotation = false; // 控制是否停止轮询的变量
  1145. let remainingTimes = 0
  1146. // 获取抽奖信息
  1147. function raffleInfo() {
  1148. let openId = getQueryParam('openId')
  1149. let raffleId = getQueryParam('bId')
  1150. mui.ajax('http://test.wefanbot.com:18993/scrm/v1/wxcp-raffle/p/raffleInfoByOpenId',{
  1151. data:{
  1152. openId: openId,
  1153. raffleId: raffleId,
  1154. },
  1155. dataType:'json',//服务器返回json格式数据
  1156. type:'get',//HTTP请求类型
  1157. success:function(res){
  1158. lotteryStatus = res.data.status
  1159. gridList = res.data.prizes
  1160. document.getElementById("tab1").innerHTML = res.data.activityInfo
  1161. remainingTimes = res.data.raffleNum-res.data.useNum
  1162. document.getElementById("lotteryId").innerHTML = `已抽奖${res.data.useNum}次,还剩${res.data.raffleNum-res.data.useNum}次机会`
  1163. const container = document.getElementById('grid-container');
  1164. const buttons = document.getElementById('lottery-button');
  1165. container.innerHTML = '';
  1166. for (let i = 0; i < 9; i++) {
  1167. // 创建一个新的div元素作为格子
  1168. const gridItem = document.createElement('div');
  1169. gridItem.classList.add('grid-item');
  1170. // 创建图片元素并添加到格子中
  1171. const img = document.createElement('img');
  1172. img.src = res.data.prizes[i].img; // 设置图片源
  1173. img.alt = `图片 ${i + 1}`; // 设置图片的替代文本
  1174. gridItem.appendChild(img);
  1175. // 创建标题元素并添加到格子中
  1176. const title = document.createElement('div');
  1177. title.classList.add('grid-item-title');
  1178. title.textContent = res.data.prizes[i].name; // 设置标题文本
  1179. gridItem.appendChild(title);
  1180. // 将格子添加到容器中
  1181. container.appendChild(gridItem);
  1182. }
  1183. gridItems = []
  1184. container.querySelectorAll('.grid-item').forEach(item => {
  1185. gridItems.push(item);
  1186. });
  1187. buttons.addEventListener('click', function() {
  1188. handleLottery();
  1189. })
  1190. },
  1191. error:function(error){
  1192. //异常处理;
  1193. console.log(error);
  1194. }
  1195. });
  1196. };
  1197. // 点击抽奖
  1198. function handleLottery() {
  1199. if (!remainingTimes) {
  1200. mui.toast('抽奖次数已用完');
  1201. return false;
  1202. }
  1203. const gridContainer = document.getElementById('grid-container');
  1204. if (lotteryStatus === -1) {
  1205. mui.toast('活动已结束');
  1206. } else if (lotteryStatus === 0) {
  1207. mui.toast('活动未开始');
  1208. } else if (lotteryStatus === 1) {
  1209. stopRotation = false
  1210. rotateActive();
  1211. let externalUserid = getQueryParam('externalUserid')
  1212. let openId = getQueryParam('openId')
  1213. let raffleId = getQueryParam('bId')
  1214. mui.ajax('http://test.wefanbot.com:18993/scrm/v1/wxcp-raffle/p/lottery',{
  1215. data:{
  1216. externalUserid: externalUserid,
  1217. openId: openId,
  1218. raffleId: raffleId,
  1219. },
  1220. dataType:'json',//服务器返回json格式数据
  1221. type:'get',//HTTP请求类型
  1222. success:function(res){
  1223. if (res.data) {
  1224. setTimeout(() => {
  1225. // 停止轮询
  1226. stopRotation = true;
  1227. // 立即将 active 类应用到目标格子上
  1228. gridItems.forEach(item => item.classList.remove('actives'));
  1229. gridList.forEach((item, index) => {
  1230. if (res.data.id === item.id) {
  1231. gridItems[index].classList.add('actives');
  1232. }
  1233. });
  1234. if (res.data.acceptType === 0 || res.data.acceptType === 1) {
  1235. document.getElementById('dialog').style.display = 'flex';
  1236. document.getElementById('prize-msg-goods').style.display = 'block';
  1237. document.getElementById('prize-msg-money').style.display = 'none';
  1238. document.getElementById("goods-img").src = res.data.img
  1239. document.getElementById("goods-name").innerHTML = res.data.name
  1240. } else if (res.data.acceptType === 2) {
  1241. document.getElementById('dialog').style.display = 'flex';
  1242. document.getElementById('prize-msg-goods').style.display = 'none';
  1243. document.getElementById('prize-msg-money').style.display = 'block';
  1244. document.getElementById("prize-money").innerHTML = res.data.money
  1245. }
  1246. raffleInfo()
  1247. raffleRecord()
  1248. currentIndex = 0
  1249. }, 2000); // 假设接口调用需要2秒
  1250. } else {
  1251. stopRotation = true;
  1252. gridItems.forEach(item => item.classList.remove('actives'));
  1253. currentIndex = 0
  1254. mui.toast(res.msg);
  1255. }
  1256. },
  1257. error:function(error){
  1258. //异常处理;
  1259. console.log(error);
  1260. }
  1261. });
  1262. }
  1263. };
  1264. // 轮询动画函数
  1265. function rotateActive() {
  1266. // 移除上一个格子的 active 类
  1267. if (gridItems[currentIndex]) {
  1268. gridItems[currentIndex].classList.remove('actives');
  1269. }
  1270. // 更新当前索引,循环到第一个格子如果超出范围
  1271. currentIndex = (currentIndex + 1) % gridItems.length;
  1272. // 应用 active 类到新的格子
  1273. gridItems[currentIndex].classList.add('actives');
  1274. // 递归调用以继续动画,直到接口调用完成
  1275. if (!stopRotation) {
  1276. setTimeout(rotateActive, 100); // 假设每个格子显示 500 毫秒
  1277. }
  1278. };
  1279. // 获取抽奖记录
  1280. function raffleRecord() {
  1281. let openId = getQueryParam('openId')
  1282. let raffleId = getQueryParam('bId')
  1283. mui.ajax('http://test.wefanbot.com:18993/scrm/v1/wxcp-raffle/p/raffleRecord',{
  1284. data:{
  1285. openId: openId,
  1286. raffleId: raffleId,
  1287. page: 1,
  1288. pageCount: 1000,
  1289. },
  1290. dataType:'json',//服务器返回json格式数据
  1291. type:'post',//HTTP请求类型
  1292. headers:{'Content-Type':'application/json'},
  1293. success:function(res){
  1294. const recordList = document.getElementById('recordList');
  1295. recordList.innerHTML = ''
  1296. res.data.records.forEach(record => {
  1297. recordList.innerHTML += `
  1298. <div class="record-item">
  1299. <img class="prize-img" src="${record.img}" mode="widthFix" />
  1300. <div>
  1301. <div class="prize-name">${record.name}</div>
  1302. <div class="prize-time">${timeFormat(record.raffleTime)}</div>
  1303. </div>
  1304. <button id="toggleButton" ${record.status ? 'disabled' : ''} class="get-btn" onclick="handleOpenForm(${record.id})">${record.status ? '已领取' : '领取'}</button>
  1305. </div>`
  1306. });
  1307. },
  1308. error:function(error){
  1309. //异常处理;
  1310. console.log(error);
  1311. }
  1312. });
  1313. };
  1314. let recordId = ''
  1315. function handleOpenForm(id) {
  1316. recordId = id
  1317. document.getElementById('overlay').style.display = 'flex';
  1318. var div = document.getElementById('popForm');
  1319. div.classList.add('show');
  1320. };
  1321. // 切换tab
  1322. function changeTab(evt, tabName) {
  1323. // 获取所有tab链接,并移除激活类
  1324. var i, tabcontent, tablinks;
  1325. tabcontent = document.getElementsByClassName("tab-content");
  1326. for (i = 0; i < tabcontent.length; i++) {
  1327. tabcontent[i].style.display = "none";
  1328. }
  1329. tablinks = document.getElementsByClassName("tab-link");
  1330. for (i = 0; i < tablinks.length; i++) {
  1331. tablinks[i].className = tablinks[i].className.replace(" active", "");
  1332. }
  1333. // 显示当前tab内容,并添加激活类到链接
  1334. document.getElementById(tabName).style.display = "block";
  1335. evt.currentTarget.className += " active";
  1336. };
  1337. function handleSave() {
  1338. let nameResult = document.getElementById('name').value;
  1339. let wxAccountResult = document.getElementById('wxAccount').value
  1340. let phone = document.getElementById("phone").value;
  1341. let provinceResult = document.getElementById('province');
  1342. let cityResult = document.getElementById('city');
  1343. let addressResult = document.getElementById("address").value;
  1344. let remarkResult = document.getElementById("remark").value;
  1345. if (!nameResult){
  1346. mui.toast("请填写姓名");
  1347. } else if (!phone){
  1348. mui.toast("请输入手机号");
  1349. } else if (!provinceResult.innerText){
  1350. mui.toast('请选择城市');
  1351. } else {
  1352. mui.ajax('http://test.wefanbot.com:18993/scrm/v1/wxcp-raffle/p/raffleForm',{
  1353. data:{
  1354. name: nameResult,
  1355. wxAccount: wxAccountResult,
  1356. phone: phone,
  1357. province: provinceResult.innerText || '',
  1358. city: cityResult.innerText || '',
  1359. address: addressResult,
  1360. remark: remarkResult,
  1361. recordId: recordId
  1362. },
  1363. dataType:'json',//服务器返回json格式数据
  1364. type:'post',//HTTP请求类型
  1365. timeout:10000,//超时时间设置为10秒;
  1366. headers:{'Content-Type':'application/json'},
  1367. success:function(res){
  1368. if (res.code === 1) {
  1369. mui.toast("提交成功!");
  1370. document.getElementById('overlay').style.display = 'none';
  1371. var div = document.getElementById('popForm');
  1372. div.classList.remove('show');
  1373. raffleRecord()
  1374. } else {
  1375. mui.toast(res.msg);
  1376. }
  1377. },
  1378. error:function(error){
  1379. //异常处理;
  1380. console.log(error);
  1381. mui.toast(error);
  1382. }
  1383. });
  1384. }
  1385. };
  1386. document.getElementById('closeIcon').addEventListener('click', function() {
  1387. document.getElementById('overlay').style.display = 'none';
  1388. var div = document.getElementById('popForm');
  1389. div.classList.remove('show');
  1390. });
  1391. if (document.getElementById('dialog-btn-money')) {
  1392. document.getElementById('dialog-btn-money').addEventListener('click', function() {
  1393. document.getElementById('dialog').style.display = 'none';
  1394. gridItems[currentIndex].classList.remove('actives');
  1395. });
  1396. }
  1397. if (document.getElementById('dialog-btn-goods')) {
  1398. document.getElementById('dialog-btn-goods').addEventListener('click', function() {
  1399. document.getElementById('dialog').style.display = 'none';
  1400. gridItems[currentIndex].classList.remove('actives');
  1401. });
  1402. }
  1403. document.getElementById('dialog-close').addEventListener('click', function() {
  1404. document.getElementById('dialog').style.display = 'none';
  1405. gridItems[currentIndex].classList.remove('actives');
  1406. });
  1407. document.getElementById('eventNotice').addEventListener('click', function() {
  1408. document.getElementById('notice').style.display = 'block';
  1409. });
  1410. document.getElementById('notice').addEventListener('click', function() {
  1411. var div = document.getElementById('notice-body');
  1412. // 检查点击事件的目标是否不是div本身或其子元素
  1413. if (!div.contains(event.target)) {
  1414. document.getElementById('notice').style.display = 'none';
  1415. }
  1416. });
  1417. function timeFormat (time, format = 'yyyy-MM-dd hh:mm:ss') {
  1418. if (time === undefined || time === '' || time === null) {
  1419. return '/'
  1420. } else {
  1421. const date = new Date(time)
  1422. const o = {
  1423. 'M+': date.getMonth() + 1,
  1424. 'd+': date.getDate(),
  1425. 'h+': date.getHours(),
  1426. 'm+': date.getMinutes(),
  1427. 's+': date.getSeconds(),
  1428. 'q+': Math.floor((date.getMonth() + 3) / 3),
  1429. 'S': date.getMilliseconds()
  1430. }
  1431. if (/(y+)/.test(format)) {
  1432. format = format.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
  1433. }
  1434. for (let k in o) {
  1435. if (new RegExp('(' + k + ')').test(format)) {
  1436. format = format.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
  1437. }
  1438. }
  1439. return format
  1440. }
  1441. }
  1442. </script>
  1443. </body>
  1444. </html>