index.html 47 KB

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