Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

libai / web.yazhai.co

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Members
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Switch branch/tag
  • web.yazhai.co
  • eleven
  • lib
  • default.js
Find file
Normal viewHistoryPermalink
default.js 5.83 KB
Newer Older
libai's avatar
测试
e0202eb0
 
libai committed 4 years ago
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
/**
 * Created by webshow on 2019/11/22.
 */
var bbb = location.href;
$ip = 'http://test.api.lvdou66.com:8036/';
$ws = 'ws://114.55.165.186:12308/ws?type=1';
$url ='http://test.ybact.ishuaji.cn/'
// if (bbb.indexOf("https://activity.ishuaji.cn/") > -1) {
//     $ip = "https://zhiboweb.ishuaji.cn/";
//     $ws='wss://zhiboweb.ishuaji.cn/yzsocket?type=1'
//     $url ='https://activity.ishuaji.cn/'
// }else if(bbb.indexOf("http://test.ybact.ishuaji.cn/") > -1){
//     $ip = 'http://test.api.lvdou66.com:8036/';
//     $ws = 'ws://114.55.165.186:12308/ws?type=1';
//     $url ='http://test.ybact.ishuaji.cn/'
// } else if(bbb.indexOf('http://192.168.0.124:9090') > -1){
// 	$ip = 'http://test.api.lvdou66.com:8036/';
//     $ws = 'ws://114.55.165.186:12308/ws?type=1';
//     $url ='http://test.ybact.ishuaji.cn/'
// }
// else{
//     $ip = 'http://test.api.lvdou66.com:8036/';
//     $ws = 'ws://114.55.165.186:12308/ws?type=-1';
//     $url ='http://test.ybact.ishuaji.cn/'
// }
var data = url_get_params(bbb)
if (sessionStorage.kkk == undefined) {
    sessionStorage.kkk = data.token; //t
    sessionStorage.bbb = data.uid; //u
    sessionStorage.version = data.appversion;
    sessionStorage.pkg=data.pkg
    if (data.roomID != undefined && data.roomID != 'undefined') {
        sessionStorage.roomId = data.roomID;
    } else {
        sessionStorage.roomId = data.roomId;
    }
    if(sessionStorage.roomId=='undefined')sessionStorage.roomId=0
}
sessionStorage.jump=data.jump
sessionStorage.isShowHalf=data.isShowHalf
function url_get_params(url_path) {
    var url = url_path;
    var theRequest = new Object();
    if (url.indexOf("?") != -1) {
        var str = url.substr(url.indexOf("?") + 1);
        strs = str.split("&");
        for (var i = 0; i < strs.length; i++) {
            theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
        }
    }
    return theRequest;
}
if (bbb.indexOf("file:///D") > -1) {
    sessionStorage.bbb = 23868834;
    sessionStorage.kkk = 'debug'
    sessionStorage.roomId=23870943
}

//ajax设置默认参数
$.ajaxSetup({
    global: false,
    type: 'get',
    data: {
        uid: sessionStorage.bbb,
        token: sessionStorage.kkk
    },
    dataType: "JSON"
})
//点击刷新
$(".ref").on("click", function () {
    sessionStorage.jump=undefined;
    window.location.reload()
})
function btnHref(e){
    var myJson = {
        "cid": 12,
        "reqCode": new Date().getTime(),
        "data": {
            "msg":'跳转页面',
            "jump": e,
        }
    }
    var obj=JSON.stringify(myJson);
    appCollaboration(obj)
}
//与客户端交互
function appCollaboration(msg) {
    var ua = window.navigator.userAgent.toLowerCase();
    try {
        if (/iphone|ipad|ipod/.test(ua)) {
            window.webkit.messageHandlers.appCollaboration.postMessage(msg);
        } else if (/android/.test(ua)) {
            window.yazhai.appCollaboration(msg);
        }
    } catch (e) {
    }
}
//处理时间倒计时的函数
function timeDeal(e){
    var endTime=e;
    var newTime=new Date().getTime();
    var Remain=Math.floor((endTime-newTime)/1000);
    // if(Remain<=0)window.location.reload();
    var day=Math.floor(Remain/86400);
    var hour=add0(Math.floor(Remain%86400/3600));
    if(hour>99)hour=99;
    var min=add0(Math.floor(Remain%3600/60));
    var sceond=add0(Math.floor(Remain%60));
    var timeArr=[day,hour,min,sceond];
    return timeArr;
}
function timeDeal2(e,time){
    var endTime=e;
    var newTime=time;
    var Remain=Math.floor((endTime-newTime)/1000);
    // if(Remain<=0)window.location.reload();
    var day=add0(Math.floor(Remain/86400));
    var hour=add0(Math.floor(Remain%86400/3600));
    if(hour>99)hour=99;
    var min=add0(Math.floor(Remain%3600/60));
    var sceond=add0(Math.floor(Remain%60));
    var timeArr=[day,hour,min,sceond];
    return timeArr;
}
//时间戳转具体 年月日时分秒
function timeGet(e){
    var time = new Date(Number(e));
    var y = time.getFullYear();
    var m = time.getMonth()+1;
    var d = time.getDate();
    var h = time.getHours();
    var mm = time.getMinutes();
    var s = time.getSeconds();
    var timeArr=[y,m,d,add0(h),add0(mm),s]
    return timeArr
}

//一位数前面加0
function add0(m) {
    return m < 10 ? '0' + m : m
}
//一万以上省略
function addw(e){
    if(e>=100000000){
        return Math.floor((e/100000000).toFixed(2)*10)/10+'亿';
    }
    else if(e>10000000){
        return Math.floor((e/10000))+'万'
    }
    else if(e>=10000){
        return Math.floor((e/10000)*10)/10+'万';
    }else{
        return Math.floor(e*100)/100;
    }
}
//跳转充值页面
function goReg(){
    if(sessionStorage.pkg=='qingliang'){
        var ua = window.navigator.userAgent.toLowerCase();
        if (/iphone|ipad|ipod/.test(ua)) {
            window.location.href='yazhai://_recharge';

        }else{
            window.location.href='http://web.yazhai.co/milkRecharge/index.html?uid='+sessionStorage.bbb+'&token='+sessionStorage.kkk+'&pkg=qingliang';
        }
    } else if(sessionStorage.pkg=='qiezi'){
        if (/iphone|ipad|ipod/.test(ua)) {
            window.location.href='yazhai://_recharge';

        }else{
            window.location.href='http://web.yazhai.co/guodongRecharge/index.html?uid='+sessionStorage.bbb+'&token='+sessionStorage.kkk+'&pkg=qingliang';
        }
    }
    else{
        window.location.href='http://web.yazhai.co/recharge/index.html?uid='+sessionStorage.bbb+'&token='+sessionStorage.kkk+'&pkg=yabo';
    }
}
function scrollTo(element,speed) {
    if(!speed){
        speed = 300;
    }
    if(!element){
        $("html,body").animate({scrollTop:0},speed);
    }else{
        if(element.length>0){
            $("html,body").animate({scrollTop:$(element).offset().top-200},speed);
        }
    }
}

    //var betEnd = new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate(), new Date().getHours(), 59, 59).getTime();