123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <meta content="yes" name="apple-mobile-web-app-capable">
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0,minimum-scale=1.0,user-scalable=0" />
- <title>6.1狂欢节</title>
- <link rel="stylesheet" href="./public/reset.css">
- <script type="text/javascript" src="public/jquery-2.1.0.js"></script>
- <script type="text/javascript">
- document.documentElement.style.fontSize = 100 * (document.documentElement.clientWidth/375) + "px";
- window.onresize = function(){
- document.documentElement.style.fontSize = 100 * (document.documentElement.clientWidth/375) + "px";
- }
- </script>
- <style type="text/css">
- .alert-info {
- position: absolute;
- top: 1.74rem;
- right: 0;
- left: 0;
- bottom: 0;
- text-align: center;
- background: rgba(0,0,0,0.2);
- }
- .alert-info p {
- display: inline-block;
- height: 0.38rem;
- color: #fff;
- font-size: 0.14rem;
- line-height: 0.38rem;
- padding: 0 0.10rem;
- background-color: rgba(0, 0, 0, 0.7);
- border-radius: 5px;
- }
- .loading {
- position: fixed;
- top: 0;
- left: 0;
- display: none;
- width: 100%;
- height: 100vh;
- z-index: 99;
- }
- .loading img {
- position: absolute;
- top: 0;
- bottom: 0;
- left: 0;
- right: 0;
- margin: auto;
- width: 0.3rem;
- height: 0.3rem;
- }
- body{
- width: 100%;min-height: 100vh;background: #9c3bf9;padding-bottom: 0.2rem;box-sizing: border-box;
- }
- .banner{
- width: 100%;
- }
- .activity_list{
- width: 3.55rem;background: #fff;border-radius: 0.1rem;margin: auto;
- display: flex;flex-wrap: wrap;padding: 0.15rem 0.05rem;box-sizing: border-box;
- }
- .activity_list li{
- width: 50%;margin: 0.05rem 0;;
- }
- .activity_list li div{
- width: 1.63rem;height: 0.75rem;background: rgba(0,0,0,0.1);border-radius: 0.1rem;margin: auto;overflow: hidden;
- }
- .activity_list li div img{
- width: 100%;
- }
- </style>
- </head>
- <body>
- <img src="./img-618/Banner.png" class="banner"/>
- <ul class="activity_list">
-
- </ul>
- <div class="alert-info" style="display: none;">
- <!-- tip提示,3s后消失 -->
- <p></p>
- </div>
- <!-- loading -->
- <div class="loading">
- <img src="../common/loading.gif" />
- </div>
- </body>
- </html>
- <script type="text/javascript">
- var token=''
- $().ready(function () {
- getToken()
- })
-
- // 获取token
- function getToken() {
- var param = {
- "js_callback" : "callbackLogin"
- };
- param = JSON.stringify(param)
- try {
- if (navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)) {
- window.webkit.messageHandlers.app_h5_login.postMessage(param);
- }
- if (navigator.userAgent.match(/android/i)) {
- obj4H5.app_h5_login(param);
- }
- } catch (e) {
- // token='4f422467a11afa2cedaa593686f9b1d4257657'
- // act_pre_618_envent()
- }
- }
- function callbackLogin(data) {//app token 回调
- var data = JSON.parse(data); //上线时添加
- token=data.token; //上线时添加
- if(token) {
- act_pre_618_envent()
- }
- }
- //618预热活动
- function act_pre_618_envent() {
- if(token) {
- $(".loading").show()
- $.ajax({
- type: "get",
- url: "/api/v2/act_pre_618",
- typeData: 'json',
- headers:{
- token:token
- },
- success: function (res) {
- $(".loading").hide()
- if (res && res.errno == 0) {
- var con_html = res.rst.data.map(function (item,index) {
- return '<li><div data-url="' + item.m_url + '"><img src="' + item.img + '"/></div></li>'
- })
- $(".activity_list").html(con_html);
- $(".activity_list li div").click(function () {
- toTaobao($(this).attr('data-url'))
- })
- }else {
- showMsg(res.err)
- }
- },
- error: function () {
- $(".loading").hide()
- }
- });
- }else {
- getToken();
- }
-
- }
- // 打开淘宝
- function toTaobao(tbUrl) {
- if(token) {
- var param = {
- "taobaoUrl" : tbUrl,//淘宝链接
- }
- param = JSON.stringify(param)
- try {
- if(navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)){
- window.webkit.messageHandlers.app_h5_open_taobao_url.postMessage(param);
- }
- if(navigator.userAgent.match(/android/i)){
- obj4H5.app_h5_open_taobao_url(param);
- }
- } catch (error) {
- }
- }else {
- getToken()
- }
-
- }
- function showMsg(msg) {
- //弹框
- var msgBox = document.getElementsByClassName('alert-info')[0];
- msgBox.children[0].innerText = msg;
- msgBox.style.display="block";
- setTimeout(function() {
- msgBox.style.display="none";
- }, 1500);
- }
- </script>
|