index.html 44 KB

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