|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
|
|
|
|
<title>我的登录</title>
|
|
|
|
<!--REM自适应布局JS-->
|
|
|
|
<link rel="stylesheet" type="text/css" href="../../lib/css/mui.min.css">
|
|
|
|
<link rel="stylesheet" type="text/css" href="../../lib/css/basic.css" />
|
|
|
|
<link rel="stylesheet" type="text/css" href="../css/base.css" />
|
|
|
|
<script src="../../lib/js/mui.min.js"></script>
|
|
|
|
<script src="../../lib/js/vue.js"></script>
|
|
|
|
<script src="../../lib/js/app.js"></script>
|
|
|
|
<script src="../../lib/js/jsdeferred.nodoc.js"></script>
|
|
|
|
<script type="text/javascript" src="../js/base/rem-layout.js"></script>
|
|
|
|
<script type="text/javascript" src="../js/login/login_ajax.js"></script>
|
|
|
|
<script src="../../html/wakuang/js/eth/ajax/eth.ajaxApi.js"></script>
|
|
|
|
<script src="../js/base/getClientInfo.js"></script>
|
|
|
|
</head>
|
|
|
|
<style>
|
|
|
|
#user-login {
|
|
|
|
margin: 0.25rem 0.25rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
#user-login label {
|
|
|
|
width: 1.25rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
#user-login .app-input {
|
|
|
|
width: 60%;
|
|
|
|
}
|
|
|
|
|
|
|
|
#user-login #mobile-phone .app-input {
|
|
|
|
flex-grow: 7;
|
|
|
|
}
|
|
|
|
|
|
|
|
#user-login #password-input .app-input {
|
|
|
|
flex-grow: 7;
|
|
|
|
}
|
|
|
|
|
|
|
|
#user-login .app-group-right-text {
|
|
|
|
width: 40%;
|
|
|
|
border: 0px solid white;
|
|
|
|
}
|
|
|
|
|
|
|
|
#user-login .app-input-row-list {
|
|
|
|
border-radius: 0.2rem;
|
|
|
|
margin: 0.2rem 0;
|
|
|
|
overflow: hidden;
|
|
|
|
border: 1px solid #DDDDDD !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
#login-text-info {
|
|
|
|
margin: 0.3rem 0 0 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.mui-slider-item {
|
|
|
|
border: none !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
.login-slider {
|
|
|
|
top: 90px !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
.login-slider-title {
|
|
|
|
padding: 0 0.68rem 0 0.68rem !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
#sliderSegmentedControl {
|
|
|
|
margin: 0 0 0 0.25rem !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
#forget-password {
|
|
|
|
margin: 0.4rem;
|
|
|
|
font-size: 0.25rem;
|
|
|
|
line-height: 1.5em;
|
|
|
|
}
|
|
|
|
@media only screen and (-webkit-device-pixel-ratio: 3) and (device-height: 812px) and (device-width: 375px) {
|
|
|
|
.mui-bar-nav~.mui-content {
|
|
|
|
position: absolute;
|
|
|
|
top: .8rem;
|
|
|
|
right: 15px;
|
|
|
|
left: 15px;
|
|
|
|
bottom: 0;
|
|
|
|
margin: 0;
|
|
|
|
padding: 0 !important;
|
|
|
|
overflow: scroll;
|
|
|
|
-webkit-overflow-scrolling: touch;
|
|
|
|
|
|
|
|
}
|
|
|
|
::-webkit-scrollbar {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
.mui-bar-nav{
|
|
|
|
height: .6rem;
|
|
|
|
}
|
|
|
|
.mui-bar.mui-bar-nav {
|
|
|
|
top: 0 !important;
|
|
|
|
padding: 0;
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
<div id="data-info">
|
|
|
|
<header class="mui-bar mui-bar-nav ">
|
|
|
|
<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
|
|
|
|
<h1 class="mui-title">{{langue.title}}</h1>
|
|
|
|
<a id="js-pass-login" class="mui-pull-right" style="position: absolute; right: 12px;bottom: .28rem; color:#333333;">{{langue.passwordLogin}}</a>
|
|
|
|
</header>
|
|
|
|
<div class="mui-content" style="margin-top: 0.5rem;">
|
|
|
|
<div id="user-login" class="app-input-group app-input-group-darkly">
|
|
|
|
<div id="international-div" class="app-input-row-list">
|
|
|
|
<label class="mui-text-center">{{langue.countriesAndRegions}}</label>
|
|
|
|
<!--<label>请选择国家</label>-->
|
|
|
|
<input id="international_code" class="app-input" type="text" readonly="readonly" :value="langue.Hongkong" />
|
|
|
|
<input id="internationalCode" type="hidden" value="86" />
|
|
|
|
</div>
|
|
|
|
<div id="mobile-phone" class="app-input-row-list">
|
|
|
|
<label id="mobilePhoneLabel" class="mui-text-center">{{langue.phone}}</label>
|
|
|
|
<input id="mobilePhone" class="app-input" type="text" v-model="dataParameter.mobilePhone" :placeholder="langue.placeholder01" />
|
|
|
|
</div>
|
|
|
|
<div class="app-input-row-list">
|
|
|
|
<input class="app-input" type="text" v-model="dataParameter.verificationCode" :placeholder="langue.placeholder02" />
|
|
|
|
<button id="verification-code-btn" class="app-group-right-text app-text-color app-background-color">{{langue.sendCode}}</button>
|
|
|
|
</div>
|
|
|
|
<p class="mui-text-right" style="padding-right: 0.1rem;">
|
|
|
|
<a id="js-openview-signup">{{langue.register}}</a>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
<div class="login-btn">
|
|
|
|
<button id="login-btn" class="app-btn app-btn-darkly" style="margin-top: 0.5rem;width: 90%; margin-left: 5%;">{{langue.login}}</button>
|
|
|
|
<p id="login-text-info" class="mui-text-center">{{langue.loginText}}
|
|
|
|
<a id="protocol">{{langue.loginHref}}</a>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
|
|
|
|
</html>
|
|
|
|
<script>
|
|
|
|
// 国际化
|
|
|
|
var langues = {
|
|
|
|
zh_CN: {
|
|
|
|
title: "验证码登录",
|
|
|
|
sendCode: "获取验证码",
|
|
|
|
phone: "账号",
|
|
|
|
placeholder01: "请输入手机号/邮箱",
|
|
|
|
placeholder02: "请输入验证码",
|
|
|
|
register: "新用户注册",
|
|
|
|
login: "登录",
|
|
|
|
loginText: "点击'登录'代表你已阅读并同意",
|
|
|
|
loginHref: "《服务协议》",
|
|
|
|
alert01: "账号不能为空",
|
|
|
|
alert02: "验证码不能为空",
|
|
|
|
passwordLogin: "密码登录",
|
|
|
|
countriesAndRegions: "国家地区",
|
|
|
|
Hongkong: "中国",
|
|
|
|
netError: "网络异常,请检查网络状态!",
|
|
|
|
},
|
|
|
|
zh_HK: {
|
|
|
|
title: "驗證碼登錄",
|
|
|
|
sendCode: "獲取驗證碼",
|
|
|
|
phone: "賬號",
|
|
|
|
placeholder01: "請輸入手機號/郵箱",
|
|
|
|
placeholder02: "請輸入驗證碼",
|
|
|
|
register: "新用戶註冊",
|
|
|
|
login: "登錄",
|
|
|
|
loginText: "點擊'登錄'代表妳已閱讀並同意",
|
|
|
|
loginHref: "《服務協議》",
|
|
|
|
alert01: "賬號不能為空",
|
|
|
|
alert02: "驗證碼不能為空",
|
|
|
|
passwordLogin: "密碼登錄",
|
|
|
|
countriesAndRegions: "國家地區",
|
|
|
|
Hongkong: "中国",
|
|
|
|
netError: "網絡異常,請檢查網絡狀態!",
|
|
|
|
},
|
|
|
|
en_US: {
|
|
|
|
title: "Verification code login",
|
|
|
|
sendCode: "Send",
|
|
|
|
phone: "Account",
|
|
|
|
placeholder01: "Input phone number/mailbox",
|
|
|
|
placeholder02: "Input code",
|
|
|
|
register: "Register",
|
|
|
|
login: "Login",
|
|
|
|
loginText: "Click 'login' to read and agree",
|
|
|
|
loginHref: " Service Agreement ",
|
|
|
|
alert01: "The account cannot be empty",
|
|
|
|
alert02: "The verification code cannot be empty",
|
|
|
|
passwordLogin: "Switch",
|
|
|
|
countriesAndRegions: "Country Areas",
|
|
|
|
Hongkong: "China",
|
|
|
|
netError: "Network anomaly!",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<script>
|
|
|
|
var dataInfo = new Vue({
|
|
|
|
el: "#data-info",
|
|
|
|
data: {
|
|
|
|
langue: langues[app.getLanguageLocalStorage()],
|
|
|
|
dataParameter: {
|
|
|
|
mobilePhone: "", // 手机号验证
|
|
|
|
mobilePhone2: '', // 账号登录
|
|
|
|
verificationCode: "", // 验证码
|
|
|
|
password: "",
|
|
|
|
internationalCode: "86"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
mui.init({
|
|
|
|
gestureConfig: {
|
|
|
|
longtap: true, //默认为false
|
|
|
|
release: true
|
|
|
|
}
|
|
|
|
});
|
|
|
|
mui.plusReady(function() {
|
|
|
|
//登录
|
|
|
|
document.getElementById("login-btn").addEventListener("tap", function() {
|
|
|
|
var ajaxData = {
|
|
|
|
tel: dataInfo.dataParameter.mobilePhone,
|
|
|
|
verifyCode: dataInfo.dataParameter.verificationCode,
|
|
|
|
};
|
|
|
|
if(!valueIsNotNull(ajaxData.tel)) {
|
|
|
|
mui.toast(dataInfo.langue.alert01);
|
|
|
|
} else if(!valueIsNotNull(ajaxData.verifyCode)) {
|
|
|
|
mui.toast(dataInfo.langue.alert02);
|
|
|
|
} else {
|
|
|
|
plus.nativeUI.showWaiting();
|
|
|
|
ajaxData.tel = ajaxData.tel;
|
|
|
|
ajaxData.code = ajaxData.verifyCode;
|
|
|
|
//该值请从 mine/js/base/getClientInfo.js 中查看
|
|
|
|
ajaxData.clientId = plusClientId;
|
|
|
|
login(loginAjaxJs.AJAX_CODE_LOGIN, ajaxData);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
document.getElementById('protocol').addEventListener('tap', function() {
|
|
|
|
mui.openWindow({
|
|
|
|
id: "mine/html/wallet_terms_of_service.html",
|
|
|
|
url: "wallet_terms_of_service.html"
|
|
|
|
});
|
|
|
|
})
|
|
|
|
|
|
|
|
// 跳转到注册页面
|
|
|
|
document.getElementById('js-openview-signup').addEventListener('tap', function() {
|
|
|
|
app.openWin("wallet_sign_up.html", "mine/html/wallet_sign_up.html");
|
|
|
|
})
|
|
|
|
|
|
|
|
//获取验证码
|
|
|
|
document.getElementById('verification-code-btn').addEventListener('tap', function() {
|
|
|
|
getCode();
|
|
|
|
});
|
|
|
|
//验证码登录
|
|
|
|
document.getElementById('js-pass-login').addEventListener('tap', function() {
|
|
|
|
// colseWin();
|
|
|
|
app.openWin("wallet_pass_login.html", "mine/html/wallet_pass_login.html");
|
|
|
|
})
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 国际代码回掉监听
|
|
|
|
*/
|
|
|
|
window.addEventListener("internationalCode", function(event) {
|
|
|
|
document.getElementById("internationalCode").value = event.detail.code;
|
|
|
|
document.getElementById('international_code').value = event.detail.name;
|
|
|
|
// document.getElementById("mobilePhoneLabel").innerText = "+" + event.detail.code;
|
|
|
|
dataInfo.langue.Hongkong = event.detail.name;
|
|
|
|
dataInfo.dataParameter.internationalCode = event.detail.code;
|
|
|
|
});
|
|
|
|
|
|
|
|
//选择国际点击事件
|
|
|
|
document.getElementById('international_code').addEventListener('tap', function() {
|
|
|
|
app.openWin('indexed-list.html', 'indexed-list.html', null, null);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 倒计时
|
|
|
|
*
|
|
|
|
* @param {Object} obj docm对象
|
|
|
|
* @param {Object} time 时间
|
|
|
|
*/
|
|
|
|
function setTime(obj, inputObj, time) {
|
|
|
|
//开始判断倒计时是否为0
|
|
|
|
if(time == 0) {
|
|
|
|
obj.removeAttribute("disabled");
|
|
|
|
inputObj.style.color = "white";
|
|
|
|
inputObj.removeAttribute("disabled");
|
|
|
|
obj.innerText = dataInfo.langue.sendCode;
|
|
|
|
return;
|
|
|
|
} else {
|
|
|
|
obj.setAttribute("disabled", "disabled");
|
|
|
|
inputObj.color = "#666666";
|
|
|
|
inputObj.setAttribute("disabled", "disabled");
|
|
|
|
obj.innerText = time;
|
|
|
|
time--;
|
|
|
|
}
|
|
|
|
//过1秒后执行倒计时函数
|
|
|
|
setTimeout(function() {
|
|
|
|
setTime(obj, inputObj, time);
|
|
|
|
}, 1000)
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 空判断
|
|
|
|
* @param {Object} value 参数
|
|
|
|
*/
|
|
|
|
function valueIsNotNull(value) {
|
|
|
|
if(null != value && value.replace(/\s+/g, "") != "") {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
//获取验证码
|
|
|
|
function getCode() {
|
|
|
|
//获取验证码按钮
|
|
|
|
var verificationCodeBtn = document.getElementById('verification-code-btn');
|
|
|
|
//获取input控件
|
|
|
|
var mobilePhone = document.getElementById("mobilePhone");
|
|
|
|
if(!valueIsNotNull(dataInfo.dataParameter.mobilePhone)) {
|
|
|
|
app.toast(dataInfo.langue.alert01);
|
|
|
|
} else {
|
|
|
|
mui.ajax(loginAjaxJs.AJAX_GET_CODE.getUrl, {
|
|
|
|
headers: {
|
|
|
|
"locale": app.getLanguageLocalStorage(), // 语种头部
|
|
|
|
},
|
|
|
|
type: loginAjaxJs.AJAX_GET_CODE.getType, //HTTP请求类型
|
|
|
|
data: {
|
|
|
|
tel: dataInfo.dataParameter.mobilePhone,
|
|
|
|
internationalCode: dataInfo.dataParameter.internationalCode
|
|
|
|
},
|
|
|
|
dataType: 'json', //服务器返回json格式数据
|
|
|
|
timeout: 10000, //超时时间设置为10秒;
|
|
|
|
success: function(data) {
|
|
|
|
if("200" == data.code) {
|
|
|
|
setTime(verificationCodeBtn, mobilePhone, 60);
|
|
|
|
} else {
|
|
|
|
mui.toast(data.msg);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
error: function(xhr, type, errorThrown) {
|
|
|
|
mui.toast(dataInfo.langue.netError)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//登录
|
|
|
|
function login(ajaxObj, ajaxData) {
|
|
|
|
mui.ajax(ajaxObj.getUrl, {
|
|
|
|
headers: {
|
|
|
|
"locale": app.getLanguageLocalStorage(), // 语种头部
|
|
|
|
},
|
|
|
|
type: ajaxObj.getType, //HTTP请求类型
|
|
|
|
data: ajaxData,
|
|
|
|
dataType: 'json', //服务器返回json格式数据
|
|
|
|
timeout: 10000, //超时时间设置为10秒;
|
|
|
|
success: function(data) {
|
|
|
|
if("200" == data.code) {
|
|
|
|
saveLocalStorage(data) //更新缓存
|
|
|
|
synchrodataFun(); // 其他页面同步数据
|
|
|
|
plus.nativeUI.closeWaiting();
|
|
|
|
mui.back();
|
|
|
|
} else {
|
|
|
|
plus.nativeUI.closeWaiting();
|
|
|
|
app.toast(data.msg);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
error: function(xhr, type, errorThrown) {
|
|
|
|
plus.nativeUI.closeWaiting();
|
|
|
|
// app.toast(dataBase.AjaxError);
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
function sleep(numberMillis) {
|
|
|
|
var now = new Date();
|
|
|
|
var exitTime = now.getTime() + numberMillis;
|
|
|
|
while(true) {
|
|
|
|
now = new Date();
|
|
|
|
if(now.getTime() > exitTime)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 数据同步
|
|
|
|
*/
|
|
|
|
function synchrodataFun() {
|
|
|
|
//“我的”首页
|
|
|
|
var walletMyView = plus.webview.getWebviewById("mine/html/wallet_my.html");
|
|
|
|
walletMyView.evalJS("saveUserInfoData();");
|
|
|
|
// 钱包页面
|
|
|
|
var walletView = plus.webview.getWebviewById("html/wallet/html/wallet.html");
|
|
|
|
mui.fire(walletView, "walletSaveEvent");
|
|
|
|
// 币币页面
|
|
|
|
var CCTView = plus.webview.getWebviewById("html/cct/html/cct_index.html");
|
|
|
|
mui.fire(CCTView, "login");
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 更新缓存
|
|
|
|
*/
|
|
|
|
function saveLocalStorage(data) {
|
|
|
|
app.setUserLocalStorage(data.data);
|
|
|
|
app.setTokenStorage(data.data.token);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 关闭当前页面
|
|
|
|
*/
|
|
|
|
function colseWin() {
|
|
|
|
var view = plus.webview.currentWebview();
|
|
|
|
setTimeout(function() {
|
|
|
|
view.hide();
|
|
|
|
view.close();
|
|
|
|
}, 500)
|
|
|
|
}
|
|
|
|
|
|
|
|
// 国际化统一方法
|
|
|
|
window.addEventListener('switchLangueData', function(e) {
|
|
|
|
dataInfo.langue = langues[e.detail];
|
|
|
|
});
|
|
|
|
</script>
|