You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

435 lines
13 KiB

<!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 href="../../lib/css/basic.css" rel="stylesheet" />
<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="../../lib/js/require2.1.11.js"></script>
<script src="../../lib/js/internationalCode.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 app-header app-header-darkly">
<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-code-login" class="mui-pull-right" style="position: absolute; right: 12px;bottom: .28rem; display: none;">{{langue.Codelogin}}</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">+86</label>-->
<label class="mui-text-center">{{langue.phone}}</label>
<input id="mobilePhone" class="app-input" type="text" v-model="dataParameter.mobilePhone" :placeholder="langue.placeholder01" />
</div>
<div id="mobile-phone" class="app-input-row-list">
<label class="mui-text-center">{{langue.Code}}</label>
<input id="password" class="app-input" type="password" v-model="dataParameter.password" :placeholder="langue.placeholder02" />
</div>
<div>
<p class="mui-text-right" style="padding: 0.2rem; float: right;" id="js-openview-signup">
<a>{{langue.register}}</a>
</p>
<p class="mui-text-left" style="padding: 0.2rem; float: left;" id="js-openview-forget">
<a>{{langue.ForgetThePassword}}</a>
</p>
</div>
</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: "密码登录",
Code: "密码",
phone: "账号",
placeholder01: "请输入手机号/邮箱",
placeholder02: "请输入密码",
register: "新用户注册",
login: "登录",
loginText: "点击'登录'代表你已阅读并同意",
loginHref: "《服务协议》",
alert01: "账号不能为空",
alert02: "密码不能为空",
Codelogin: "验证码登录",
ForgetThePassword: "忘记密码",
WalletLoginSuccessMsg: "登录成功!",
WalletLoginMobilePhoneNullMsg: "手机号不能为空!",
countriesAndRegions: "国家地区",
// China: "中国"
Hongkong: "中国"
},
zh_HK: {
title: "密碼登錄",
Code: "密碼",
phone: "賬號",
placeholder01: "請輸入手機號/郵箱",
placeholder02: "請輸入密碼",
register: "新用戶註冊",
login: "登錄",
loginText: "點擊'登錄'代表妳已閱讀並同意",
loginHref: "《服務協議》",
alert01: "賬號不能為空",
alert02: "密碼不能為空",
Codelogin: "驗證碼登錄",
ForgetThePassword: "忘記密碼",
WalletLoginSuccessMsg: "登錄成功!",
WalletLoginMobilePhoneNullMsg: "手機號不能為空!",
countriesAndRegions: "國家地區",
// China: "中國"
Hongkong: "中国"
},
en_US: {
title: "Password login",
Code: "Password",
phone: "Account",
placeholder01: "Input phone number/mailbox",
placeholder02: "Input password",
register: "Register",
login: "Login",
loginText: "Click 'login' to read and agree",
loginHref: " Service Agreement ",
alert01: "The account cannot be empty",
alert02: "The password cannot be empty",
Codelogin: "Switch",
ForgetThePassword: "Forgot Password",
WalletLoginSuccessMsg: "Login succeeded!",
WalletLoginMobilePhoneNullMsg: "The phone number cannot be empty!",
countriesAndRegions: "Country Areas",
// China: "China"
Hongkong: "China"
}
}
</script>
<script>
var dataInfo = new Vue({
el: "#data-info",
data: {
langue: langues[app.getLanguageLocalStorage()],
dataBase: {}, // 页面渲染
dataParameter: {
mobilePhone: "", // 手机号验证
password: "",
internationalCode: "86"
}
}
});
mui.init({
gestureConfig: {
longtap: true, //默认为false
release: true
}
});
mui.plusReady(function() {
//登录
document.getElementById("login-btn").addEventListener("tap", function() {
var ajaxData = {
username: dataInfo.dataParameter.mobilePhone,
password: dataInfo.dataParameter.password
};
if(!valueIsNotNull(ajaxData.username)) {
mui.toast(dataInfo.langue.WalletLoginMobilePhoneNullMsg);
} else if(!isPoneAvailable(ajaxData.username)) {
mui.toast(dataInfo.langue.alert01)
} else if(!valueIsNotNull(ajaxData.password)) {
mui.toast(dataInfo.langue.alert02);
} else {
plus.nativeUI.showWaiting(dataInfo.langue.ShowWaiting);
ajaxData.tel = ajaxData.username;
ajaxData.password = ajaxData.password;
//该值请从 mine/js/base/getClientInfo.js 中查看
ajaxData.clientId = plusClientId;
login(loginAjaxJs.AJAX_PASS_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('js-openview-forget').addEventListener('tap', function() {
app.openWin("user/not_login_user_forget-password.html", "not_login_user_forget-password.html");
})
//验证码登录
document.getElementById('js-code-login').addEventListener('tap', function() {
colseWin();
app.openWin("wallet_login.html", "mine/html/wallet_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} value 参数
*/
function valueIsNotNull(value) {
if(null != value && value.replace(/\s+/g, "") != "") {
return true;
}
return false;
}
/**
* 判断是否为有效手机号
* @param {Object} str
*/
/*function isPoneAvailable(str) {
var myreg = /^1[3-9][0-9]{9}$/;
if(!myreg.test(str)) {
return false;
} else {
return true;
}
}*/
/**
* 空判断
* @param {Object} value 参数
*/
function isPoneAvailable(value) {
if(null != value && value.replace(/\s+/g, "") != "") {
return true;
}
return false;
}
//登录
function login(ajaxObj, ajaxData) {
mui.ajax(ajaxObj.getUrl, {
headers: {
// "X-Requested-Token": app.getTokenStorage(), // token头部
"locale": app.getLanguageLocalStorage() // 语种头部
},
type: ajaxObj.getType, //HTTP请求类型
data: ajaxData,
dataType: 'json', //服务器返回json格式数据
timeout: 10000, //超时时间设置为10秒;
success: function(data) {
if("200" == data.code) {
JSON.stringify(data);
//用户数据加入缓存
saveLocalStorage(data);
synchrodataFun();
// getEthWallet();
// sleep(2000);
plus.nativeUI.closeWaiting();
mui.back();
// plus.webview.currentWebview().close();
// mui.toast(dataInfo.langue.WalletLoginSuccessMsg);
} else {
plus.nativeUI.closeWaiting();
app.toast(data.msg);
}
},
error: function(xhr, type, errorThrown) {
plus.nativeUI.closeWaiting();
}
})
}
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 initJoinChatRoom() {
//“聊天室”
// let chatRoomView = plus.webview.getWebviewById("wallet_chat_room.html");
// chatRoomView.evalJS("flushView();");
}*/
/*function getEthWallet() {
mui.ajax(ethAjaxApi.SELECT_ETHWALLET.getUrl, {
headers: {
"X-Requested-Token": app.getTokenStorage(), // token头部
"locale": app.getLanguageLocalStorage() // 语种头部
},
dataType: 'json', //服务器返回json格式数据
type: ethAjaxApi.SELECT_ETHWALLET.getType, //HTTP请求类型
timeout: 10000, //超时时间设置为10秒
success: function(data) {
app.setEthWalletInfoLocalStorage(data.data);
console.log(JSON.stringify(app.getEthWalletInfoLocalStorage()));
synchrodataFun(); //数据同步
}
});
}*/
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>