初始为新媒体h5页

media_land_page2.html 17KB

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