tom
2023-12-06 9e968679ed2e6937aeb7b50a6c450d5d19251f42
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
$(document).ready( onDocumentReady );
 
function onDocumentReady() {
    Origami.fastclick(document.body);
    showLogin();
}
 
function showLogin() {
    aPage=["login"];
    $("#page_login").fadeIn();
    checkStorage();
}
 
function checkStorage() {
    try { 
        localStorage.setItem("test", "1"); 
    } catch (e) { 
        alertMessage("请关闭[无痕浏览/隐身模式]后再登录"); 
    }
    if (!localStorage.getItem("test")) {
        alertMessage("请关闭[无痕浏览/隐身模式]后再登录");
    } else {
        localStorage.removeItem("test");
    }
}
 
function confirmLogin() {
    var req={};
    req.phone=$("#input_login_phone").val();
    req.vcode=$("#input_login_vcode").val();
    if (window.device) {
        req.device=device.platform+"; "+device.version+"; "+device.model;
        req.uuid=device.uuid;
    }
    jsonRequest("login", "phone_login", req, onLoginResponse, "登录信息验证中……");
}
 
function onLoginResponse(res) {
    alertMessage(res.hint);
    
    if (res.require_register) {
        pageGo("register");
    } 
    else if (res.login_token) {
        localStorage.setItem("login_token", res.login_token);
        sessionStorage.removeItem("account");
        
        if (res.redir_url) {
            location.href=res.redir_url;
        } else {
            goHome();
        }
    }
}
 
function getVcode() {
    var req={};
    req.phone=$("#input_login_phone").val();
    jsonRequest("login", "get_vcode", req, onVcodeResponse, "正在发送短信验证码");
}
 
function onVcodeResponse(res) {
    alertMessage(res.hint);
}
 
function confirmRegister() {
    var req={};
    req.account_name=$("#input_account_name").val();    
    req.account_company=$("#input_account_company").val();    
    req.account_inviter=$("#input_account_inviter").val();
    if (!req.account_name) {
        alertMessage("请输入姓名");
    } else if (!req.account_company) {
        alertMessage("请输入公司名称");
    } else if (!req.account_inviter) {
        alertMessage("请输入邀请码 (详询客户经理)");
    } else {
        jsonRequest("login", "do_register", req, onRegisterResponse);
    }
}    
 
function onRegisterResponse(res) {
    if (res.hint) {
        alertMessage(res.hint);
    } else if (res.login_token) {
        localStorage.setItem("login_token", res.login_token);
        sessionStorage.removeItem("account");
        goHome();
    }
}
 
function goHome() {
    location.href="index.html";
}