初始为新媒体h5页

media_land_page3.html 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540
  1. <!DOCTYPE html>
  2. <html lang="zh" style="font-size: 365.867px;">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5. <meta content="yes" name="apple-mobile-web-app-capable">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0,minimum-scale=1.0,user-scalable=0">
  7. <meta http-equiv="X-UA-Compatible" content="IE=8">
  8. <meta http-equiv="Expires" content="0">
  9. <meta http-equiv="Pragma" content="no-cache">
  10. <meta http-equiv="Cache-control" content="no-cache">
  11. <meta http-equiv="Cache" content="no-cache">
  12. <link rel="stylesheet" type="text/css" href="./static/public_css.css">
  13. <link rel="stylesheet" type="text/css" href="./static/common.css">
  14. <script type="text/javascript" src="./static/public.js"></script>
  15. <script type="text/javascript" src="./static/nanoid.js"></script>
  16. <script type="text/javascript" src="./static/vue.js"></script>
  17. <script type="text/javascript" src="./static/jquery-2.1.0.js"></script>
  18. <!-- <script src="https://cdn.jsdelivr.net/npm/vue@2"></script> -->
  19. <title>999感冒灵-暖心补给大吉大灵</title>
  20. <style>
  21. .container {
  22. background-color: #9ccb71;
  23. min-height: 100vh;
  24. box-sizing: border-box;
  25. position: relative;
  26. padding-bottom: 20px;
  27. }
  28. .container .bg-img {
  29. width: 100%;
  30. }
  31. .container .bg-write{
  32. position: absolute;
  33. top: 0.86rem;
  34. width: 78vw;
  35. left: 50%;
  36. transform: translateX(-50%);
  37. }
  38. .title-btn {
  39. position: absolute;
  40. width: 2.5rem;
  41. top: 5.2rem;
  42. left: 50%;
  43. transform: translateX(-50%);
  44. }
  45. .container .prize-wrap {
  46. position: absolute;
  47. width: 100%;
  48. top: 7.45rem;
  49. left: 0;
  50. display: flex;
  51. flex-wrap: wrap;
  52. justify-content: space-around;
  53. align-items: center;
  54. padding: 0 0.25rem;
  55. }
  56. .container .prize-wrap .prize-item {
  57. width: 0.95rem;
  58. margin-bottom: 0.07rem;
  59. }
  60. .container .prize-wrap .prize-item:nth-child(7),
  61. .container .prize-wrap .prize-item:nth-child(8),
  62. .container .prize-wrap .prize-item:nth-child(9) {
  63. margin-bottom: 0;
  64. }
  65. .container .prize-wrap .prize-item img {
  66. width: 100%;
  67. }
  68. .container .prize-wrap .prize-item.active img {
  69. transform: scale(1.1);
  70. }
  71. .container .context {
  72. position: fixed;
  73. bottom: 50vh;
  74. width: 100%;
  75. z-index: 100;
  76. display: flex;
  77. justify-content: center;
  78. align-items: center;
  79. }
  80. .container .context .tip {
  81. background-color: rgba(40, 40, 40, 0.8);
  82. color: aliceblue;
  83. font-size: 0.13rem;
  84. padding: 0.1rem;
  85. border-radius: 0.08rem;
  86. }
  87. .win-dialog {
  88. position: fixed;
  89. top: 20vh;
  90. left: 50%;
  91. transform: translateX(-50%);
  92. z-index: 99;
  93. }
  94. .win-dialog .win-wrap {
  95. position: relative;
  96. width: 75vw;
  97. }
  98. .win-dialog .win-wrap .win-bg {
  99. width: 100%;
  100. }
  101. .win-dialog .win-wrap .win-prizeName {
  102. position: absolute;
  103. top: 1.8rem;
  104. color: #444;
  105. text-align: center;
  106. display: flex;
  107. flex-direction: column;
  108. align-items: center;
  109. justify-content: center;
  110. width: 100%;
  111. }
  112. .win-dialog .win-wrap .win-prizeName .win-prizeName-name{
  113. font-size: 0.15rem;
  114. font-weight: 500;
  115. line-height: 0.18rem;
  116. }
  117. .win-dialog .win-wrap .win-prizeName-note {
  118. font-size: 0.1rem;
  119. transform: scale(0.88);
  120. margin-top: -0.03rem;
  121. }
  122. .win-dialog .win-wrap .win-prizeImg {
  123. position: absolute;
  124. top: 0.912rem;
  125. left: 50%;
  126. transform: translateX(-50%);
  127. width: 0.8rem;
  128. height: 0.8rem;
  129. }
  130. .win-dialog .win-wrap .win-name {
  131. position: absolute;
  132. bottom: 1.54rem;
  133. left: 0.65rem;
  134. width: 1.9rem;
  135. height: 0.22rem;
  136. font-size: 0.11rem;
  137. font-weight: 500;
  138. background-color: transparent;
  139. border: none;
  140. outline: none;
  141. color: #fff;
  142. }
  143. .win-dialog .win-wrap .win-phone {
  144. position: absolute;
  145. bottom: 1.16rem;
  146. left: 0.65rem;
  147. width: 1.9rem;
  148. height: 0.22rem;
  149. font-size: 0.11rem;
  150. font-weight: 500;
  151. background-color: transparent;
  152. border: none;
  153. outline: none;
  154. color: #fff;
  155. }
  156. .win-dialog .win-wrap .win-adress {
  157. position: absolute;
  158. bottom: 0.79rem;
  159. left: 0.65rem;
  160. width: 1.9rem;
  161. height: 0.22rem;
  162. font-size: 0.11rem;
  163. font-weight: 500;
  164. background-color: transparent;
  165. border: none;
  166. outline: none;
  167. color: #fff;
  168. }
  169. .win-dialog .win-wrap .win-submit {
  170. position: absolute;
  171. bottom: 0.14rem;
  172. width: 1.4rem;
  173. left: 50%;
  174. transform: translateX(-50%);
  175. }
  176. .lose-dialog {
  177. position: fixed;
  178. top: 25vh;
  179. left: 50%;
  180. transform: translateX(-50%);
  181. z-index: 99;
  182. }
  183. .lose-dialog .lose-wrap {
  184. position: relative;
  185. width: 75vw;
  186. }
  187. .lose-dialog .lose-wrap .lose-bg {
  188. width: 100%;
  189. }
  190. .lose-dialog .lose-wrap .lose-btn{
  191. position: absolute;
  192. bottom: 0.5rem;
  193. width: 1.4rem;
  194. left: 50%;
  195. transform: translateX(-50%);
  196. }
  197. .close-btn {
  198. position: absolute;
  199. right: 0;
  200. top: -0.4rem;
  201. width: 0.25rem;
  202. height: 0.25rem;
  203. }
  204. .mask {
  205. position: fixed;
  206. top: 0;
  207. left: 0;
  208. right: 0;
  209. bottom: 0;
  210. background-color: rgba(0, 0, 0, 0.7);
  211. z-index: 9;
  212. }
  213. .yszc{
  214. bottom: 17px;
  215. left: 0;
  216. right: 0;
  217. margin: auto;
  218. text-align: center;
  219. }
  220. </style>
  221. <script type="text/javascript">
  222. var url_params = getQueryUrl();
  223. var mz_ca = url_params.mz_ca || ''
  224. var mz_sp = url_params.mz_sp
  225. // 获取地址栏信息
  226. function getQueryUrl () {
  227. let url = window.location.href;
  228. let result = {};
  229. if (url.indexOf('?') > -1) {
  230. let str = url.split('?')[1];
  231. let temp = str.split('&');
  232. for (let i = 0; i < temp.length; i++) {
  233. let temp2 = temp[i].split('=');
  234. result[temp2[0]] = temp2[1]
  235. }
  236. }
  237. return result
  238. }
  239. </script>
  240. <script>
  241. (function(a, e, f, g, b, c, d) {
  242. a.ClickiTrackerName = b;
  243. a[b] = a[b] || function() {(a[b].queue = a[b].queue || []).push(arguments)};
  244. a[b].start = +new Date; c = e.createElement(f); d = e.getElementsByTagName(f)[0];
  245. c.async = 1; c.src = g; d.parentNode.insertBefore(c, d)
  246. })(window, document, 'script', '//stm-cdn.cn.miaozhen.com/clicki.min.js?v='+Math.round(new Date().getTime()/1000/300), 'stm_clicki');
  247. // console.log('mz_ca => ', mz_ca)
  248. // console.log('mz_sp => ', mz_sp)
  249. // var dcParam = 'dc-' + mz_ca
  250. // stm_clicki('create', dcParam, 'auto');
  251. stm_clicki('create', 'dc-2000593', 'auto');
  252. stm_clicki('send', 'pageview');
  253. </script>
  254. </head>
  255. <body>
  256. <div id="app" class="container">
  257. <div v-if="isShowWinDialog || isShowLoseDialog" class="mask"></div>
  258. <div class="context" v-show="isShowMsg">
  259. <span class="tip">{{ msg }}</span>
  260. </div>
  261. <img class="bg-write" src="./img2/jq-write.png" alt="">
  262. <img src="./img2/bg-img.png" class="bg-img" />
  263. <div class="prize-wrap">
  264. <div
  265. v-for="(item, idx) in prizeList"
  266. :key="idx"
  267. :class="['prize-item', currentIdx === idx ? 'active' : '']"
  268. @click="onClickPrizeItem(idx)"
  269. >
  270. <img :src="item.img" />
  271. </div>
  272. </div>
  273. <div class="yszc" @click="showPrivacy = true">《隐私政策》</div>
  274. <div v-if="isShowWinDialog" class="win-dialog">
  275. <div class="win-wrap">
  276. <img class="close-btn" src="./img2/close-btn.png" @click="onClickClose" />
  277. <img class="win-bg" src="./img2/win-bg.png" />
  278. <img v-show="winPrizeImg" class="win-prizeImg" :src="winPrizeImg" />
  279. <div class="win-prizeName">
  280. <span class="win-prizeName-name">{{ winPrizeName }}</span>
  281. <p class="win-prizeName-note" v-if="winPrizeNote && winPrizeNote != ''">{{ winPrizeNote }}</p>
  282. </div>
  283. <input class="win-name" v-model="name" placeholder="请输入您的姓名" />
  284. <input class="win-phone" v-model="phone" placeholder="请输入您的电话" />
  285. <input class="win-adress" v-model="adress" placeholder="请输入您的地址" />
  286. <img class="win-submit" src="./img2/submit-btn.png" @click="onClickSubmit" />
  287. </div>
  288. </div>
  289. <div v-if="isShowLoseDialog" class="lose-dialog">
  290. <div class="lose-wrap">
  291. <img class="close-btn" src="./img2/close-btn.png" @click="onClickClose" />
  292. <img class="lose-bg" src="./img2/lose-bg.png" />
  293. <img class="lose-btn" src="./img2/lose_btn.png" @click="onClickClose" alt="">
  294. </div>
  295. </div>
  296. <!-- S 秒针隐私政策 -->
  297. <div class="mask" v-show="showPrivacy">
  298. <div class="mask_container">
  299. <div class="mask_title">隐私保护指引概要</div>
  300. <div class="mask_con">
  301. 为了数据统计和分析的目的,我们的平台集成合作方秒针的 SDK,将收集您的如下信息,收集信息的目的、方式和范围具体见下表所示。 若您想进一步了解秒针的个人信息保护政策,您可以前往 <a
  302. href="https://miaozhen.com/cn/privacy" style="color:#3173FF;">https://miaozhen.com/cn/privacy</a> 进行查看。
  303. </div>
  304. <div class="mask_btn" @click="showPrivacy = false">我知道了</div>
  305. </div>
  306. </div>
  307. <!-- E 秒针隐私政策 -->
  308. </div>
  309. <script>
  310. // stm_clicki('send', 'event', '返回首页按钮', '点击', '导航按钮');
  311. console.log('url_params => ', url_params)
  312. var app = new Vue({
  313. el: '#app',
  314. data() {
  315. return {
  316. web_type: 'media_land_page3',
  317. prizeList: [
  318. { name: '', img: './img2/prize-default.png' },
  319. { name: '', img: './img2/prize-default.png' },
  320. { name: '', img: './img2/prize-default.png' },
  321. { name: '', img: './img2/prize-default.png' },
  322. { name: '', img: './img2/start-btn.png' },
  323. { name: '', img: './img2/prize-default.png' },
  324. { name: '', img: './img2/prize-default.png' },
  325. { name: '', img: './img2/prize-default.png' },
  326. { name: '', img: './img2/prize-default.png' }
  327. ],
  328. prizeIdxList: [0, 1, 2, 5, 8, 7, 6, 3],
  329. currentIdx: '',
  330. intervalTimer: null,
  331. timeoutTimer: null,
  332. uid: '',
  333. name: '',
  334. phone: '',
  335. adress: '',
  336. isShowMsg: false,
  337. msg: '',
  338. winPrizeName: '',
  339. winPrizeImg: '',
  340. winPrizeNote: '',
  341. isShowWinDialog: false,
  342. isShowLoseDialog: false,
  343. showPrivacy: false,
  344. }
  345. },
  346. watch: {
  347. isShowMsg(isShow) {
  348. if (isShow) {
  349. setTimeout(() => {
  350. this.isShowMsg = false;
  351. }, 2000);
  352. }
  353. },
  354. },
  355. mounted() {
  356. this.handleGetUserInfo()
  357. },
  358. methods: {
  359. handleGetUserInfo() {
  360. this.uid = localStorage.getItem(`${this.web_type}_uid`) || ''
  361. if (!this.uid) {
  362. this.uid = nanoid && nanoid(10)
  363. localStorage.setItem(`${this.web_type}_uid`, `${this.web_type}_${this.uid}`)
  364. }
  365. console.log('this.uid => ', this.uid)
  366. },
  367. handleSetCurrentDay() {
  368. let date = new Date();
  369. let currentDay = date.getDate();
  370. localStorage.setItem('currentDay', currentDay)
  371. },
  372. handleGetIsJoined() { // 每天1次抽奖
  373. this.handleSetCurrentDay()
  374. const preDay = localStorage.getItem(`${this.web_type}_preDay`) || 0
  375. const currentDay = localStorage.getItem('currentDay')
  376. if (preDay && (Number(preDay) === Number(currentDay))) {
  377. return true
  378. } else {
  379. localStorage.setItem(`${this.web_type}_preDay`, currentDay)
  380. return false
  381. }
  382. },
  383. // handleGetIsJoined() { // 每个设备(uid)1次抽奖
  384. // const isJoined = localStorage.getItem('isJoined') || false
  385. // return isJoined
  386. // },
  387. // handleGetIsJoined() { // 不限制次数
  388. // return false
  389. // },
  390. handleSetIsJoined(isJoined) {
  391. localStorage.setItem('isJoined', isJoined)
  392. },
  393. onClickPrizeItem(idx) {
  394. if (idx !== 4) return
  395. this.handleStart()
  396. },
  397. handleStart() {
  398. try {
  399. stm_clicki('send', 'event', '按钮', '点击', '抽奖按钮');
  400. } catch (error) {
  401. console.log(error)
  402. }
  403. if (this.handleGetIsJoined()) {
  404. this.msg = '您今日已参与过抽奖'
  405. this.isShowMsg = true
  406. return
  407. }
  408. this.handleSetIsJoined(true)
  409. this.handleGo()
  410. this.handleGetLucky()
  411. },
  412. handleGo() {
  413. let step = 0
  414. this.intervalTimer = setInterval(() => {
  415. if (step <= 7) {
  416. this.currentIdx = this.prizeIdxList[step]
  417. step++
  418. } else {
  419. this.currentIdx = 0
  420. step = 0
  421. }
  422. }, 60);
  423. },
  424. handleStop() {
  425. this.intervalTimer && clearInterval(this.intervalTimer)
  426. this.intervalTimer = null
  427. this.timeoutTimer && clearTimeout(this.timeoutTimer)
  428. this.timeoutTimer = null
  429. this.currentIdx = ''
  430. },
  431. handleGetLucky() {
  432. $.ajax({
  433. type: "post",
  434. url: "/api/kx/luckyDraw",
  435. dataType: 'json',
  436. data: {
  437. uid: this.uid,
  438. web_type: this.web_type
  439. },
  440. success: (res) => {
  441. if (this.intervalTimer) {
  442. setTimeout(() => {
  443. this.handleStop()
  444. if (res.code == 0) {
  445. if (res.data.lucky == 1) {
  446. this.winPrizeName = res.data.prize.name
  447. this.winPrizeImg = res.data.prize.img
  448. this.winPrizeNote = res.data.prize.note
  449. this.isShowWinDialog = true
  450. } else {
  451. this.isShowLoseDialog = true
  452. }
  453. } else {
  454. this.msg = res.msg
  455. this.isShowMsg = true
  456. }
  457. }, 2000);
  458. } else {
  459. if (res.code == 0) {
  460. if (res.data.lucky == 1) {
  461. this.winPrizeName = res.data.prize.name
  462. this.winPrizeImg = res.data.prize.img
  463. this.winPrizeNote = res.data.prize.note
  464. this.isShowWinDialog = true
  465. } else {
  466. this.isShowLoseDialog = true
  467. }
  468. } else {
  469. this.msg = res.msg
  470. this.isShowMsg = true
  471. }
  472. }
  473. },
  474. error: () => {
  475. this.handleStop()
  476. }
  477. });
  478. },
  479. onClickSubmit() {
  480. if (!this.name) {
  481. this.msg = '请输入您的姓名'
  482. this.isShowMsg = true
  483. return
  484. }
  485. if (!this.phone) {
  486. this.msg = '请输入您的电话'
  487. this.isShowMsg = true
  488. return
  489. }
  490. if (!this.adress) {
  491. this.msg = '请输入您的地址'
  492. this.isShowMsg = true
  493. return
  494. }
  495. $.ajax({
  496. type: "post",
  497. url: "/api/kx/addLuckyInfo",
  498. dataType: 'json',
  499. data: {
  500. uid: this.uid,
  501. phone: this.phone,
  502. name: this.name,
  503. adress: this.adress,
  504. },
  505. success: (res) => {
  506. if (res.code == 0) {
  507. this.isShowWinDialog = false
  508. this.msg = '提交成功,感谢参与'
  509. this.isShowMsg = true
  510. } else {
  511. this.msg = res.msg
  512. this.isShowMsg = true
  513. }
  514. }
  515. });
  516. },
  517. onClickClose() {
  518. this.isShowWinDialog = false
  519. this.isShowLoseDialog = false
  520. },
  521. },
  522. })
  523. </script>
  524. </body>
  525. </html>