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.
281 lines
8.6 KiB
281 lines
8.6 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 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="../../js/base/rem-layout.js"></script> |
|
<script type="text/javascript" src="../../js/my/my_ajax.js"></script> |
|
<script src="../../../lib/js/require2.1.11.js"></script> |
|
</head> |
|
<style> |
|
|
|
</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">{{dataBase.MySecurityCenterTitle}}</h1> |
|
</header> |
|
<div class="mui-content"> |
|
<ul class="mui-table-view app-table-view app-table-view-darkly"> |
|
<li class="mui-table-view-cell mui-hidden" id="alert-pass"> |
|
<a class="mui-navigate-right view-herf"> |
|
{{alert_pass}} |
|
</a> |
|
</li> |
|
<li class="mui-table-view-cell" id="alert-pay"> |
|
<a class="mui-navigate-right view-herf"> |
|
{{alert_pay_pass}} |
|
</a> |
|
</li> |
|
<li class="mui-table-view-cell app-cell-invalid"> |
|
{{dataBase.MySecurityCenterGesturePassword}} |
|
<div id="gestureSwitch" class="mui-switch mui-switch-mini app-switch" v-bind:class="{'mui-active': isPitch}"> |
|
<div class="mui-switch-handle"></div> |
|
</div> |
|
</li> |
|
<li class="mui-table-view-cell" v-if='isGesture'> |
|
<a class="mui-navigate-right view-herf alert-gesture" view-id="mine/html/my/my_security_center_locker.html" view-url="my_security_center_locker.html"> |
|
{{dataBase.MySecurityCenterAlterGesturePassword}} |
|
</a> |
|
</li> |
|
<!--<li class="mui-table-view-cell app-cell-invalid"> |
|
{{dataBase.MySecurityCenterFingerprintLogin}} |
|
<div id="fingerSwitch" class="mui-switch mui-switch-mini app-switch"> |
|
<div class="mui-switch-handle"></div> |
|
</div> |
|
</li>--> |
|
</ul> |
|
</div> |
|
</div> |
|
</body> |
|
|
|
</html> |
|
|
|
<script> |
|
var v = new Vue({ |
|
el: '#data-info', |
|
data: { |
|
dataBase: {}, |
|
user_info: app.getWalletUserLocalStorage() |
|
}, |
|
computed: { |
|
isPassword: function() { //是否设置密码 |
|
return this.user_info.isPassword |
|
}, |
|
isPayPassword: function() { //是否是否设置支付密码 |
|
return this.user_info.isPayPassword |
|
}, |
|
isPitch: function() { |
|
return this.user_info.enableGp == 1 ? true : false |
|
}, |
|
isGesture: function() { |
|
return this.user_info.enableGp == 1 ? true : false |
|
}, |
|
alert_pass: function() { |
|
return this.isPassword ? this.dataBase.MySecurityCenterAlterPassword : this.dataBase.MySecurityCenterSetPassword |
|
}, |
|
alert_pay_pass: function() { |
|
return this.isPayPassword ? this.dataBase.MySecurityCenterAlterPayPass : this.dataBase.MySecurityCenterSetPayPass |
|
} |
|
} |
|
}) |
|
|
|
//开启手势密码 |
|
function openGesturePassword(enableGp) { |
|
plus.nativeUI.showWaiting(v.dataBase.ShowWaiting); |
|
mui.ajax(myAjaxJs.AJAX_ENABLE_GESTURE_PASSWORD.getUrl, { |
|
headers: { |
|
"X-Requested-Token": localStorage.getItem("user_token"), |
|
}, |
|
data: { |
|
enableGp: enableGp |
|
}, |
|
dataType: 'json', //服务器返回json格式数据 |
|
type: myAjaxJs.AJAX_ENABLE_GESTURE_PASSWORD.getType, //HTTP请求类型 |
|
timeout: 10000, |
|
success: function(data) { |
|
if(data.code == "200") { |
|
plus.nativeUI.closeWaiting(); |
|
} else if(data.code == "201" || data.code == "202") { //未登录 |
|
plus.nativeUI.closeWaiting(); |
|
mui.openWindow({ |
|
id: "mine/html/wallet_login.html", |
|
url: "../wallet_login.html" |
|
}); |
|
} else { |
|
plus.nativeUI.closeWaiting(); |
|
mui.toast(data.msg); |
|
} |
|
}, |
|
error: function(xhr, type, errorThrown) { |
|
plus.nativeUI.closeWaiting(); |
|
// mui.alert(dataBase.AjaxError2, dataBase.AlertMsg) |
|
} |
|
}); |
|
} |
|
|
|
mui.plusReady(function() { |
|
//修改/设置登录密码 |
|
document.getElementById("alert-pass").addEventListener("tap", function() { |
|
var nextId = null; |
|
var nextUrl = null; |
|
if(v.isPassword) { |
|
nextId = 'mine/html/my/my_security_center_save_login_password.html'; |
|
nextUrl = 'my_security_center_save_login_password.html' |
|
} else { |
|
nextId = 'mine/html/my/my_security_center_set_login_password.html'; |
|
nextUrl = 'my_security_center_set_login_password.html' |
|
} |
|
mui.openWindow({ |
|
id: nextId, |
|
url: nextUrl |
|
}); |
|
}); |
|
|
|
//修改/设置登录密码 |
|
document.getElementById("alert-pay").addEventListener("tap", function() { |
|
var nextId = null; |
|
var nextUrl = null; |
|
if(v.isPayPassword) { |
|
nextId = 'mine/html/my/my_security_center_save_pay_password.html'; |
|
nextUrl = 'my_security_center_save_pay_password.html' |
|
} else { |
|
nextId = 'mine/html/my/my_security_center_set_pay_password.html'; |
|
nextUrl = 'my_security_center_set_pay_password.html' |
|
} |
|
mui.openWindow({ |
|
id: nextId, |
|
url: nextUrl |
|
}); |
|
}); |
|
|
|
//修改手势密码 |
|
mui(".mui-table-view").on('tap', '.alert-gesture', function() { |
|
var viewId = this.getAttribute('view-id'); |
|
var viewUrl = this.getAttribute('view-url'); |
|
mui.openWindow({ |
|
id: viewId, |
|
url: viewUrl |
|
}); |
|
}); |
|
|
|
//是否开启手势密码 |
|
document.getElementById("gestureSwitch").addEventListener("toggle", function(event) { |
|
//触发事件时发送请求 |
|
if(event.detail.isActive) { |
|
//开启 |
|
v.isGesture = true; |
|
v.user_info.enableGp = 1; //用户状态:开启手势密码 |
|
openGesturePassword(1); |
|
} else { |
|
//关闭 |
|
v.isGesture = false; |
|
v.user_info.enableGp = 0; //用户状态:关闭手势密码 |
|
openGesturePassword(0); |
|
} |
|
app.setWalletUserLocalStorage(v.user_info); //更新缓存 |
|
}); |
|
|
|
// //是否开启指纹登录 |
|
// document.getElementById("fingerSwitch").addEventListener("toggle", function(event) { |
|
// //打开开关回调 |
|
// if(event.detail.isActive) { |
|
// //判断当前设备是否支持指纹功能 |
|
// if(plus.fingerprint) { |
|
// if(!plus.fingerprint.isSupport()) { |
|
// mui.alert('此设备不支持指纹识别'); |
|
// mui("#fingerSwitch").switch().toggle(); |
|
// return; |
|
// } |
|
// if(!plus.fingerprint.isKeyguardSecure()) { |
|
// mui.alert('此设备未设置密码锁屏,无法使用指纹识别'); |
|
// mui("#fingerSwitch").switch().toggle(); |
|
// return; |
|
// } |
|
// if(!plus.fingerprint.isEnrolledFingerprints()) { |
|
// mui.alert('此设备未录入指纹,请到设置中开启'); |
|
// mui("#fingerSwitch").switch().toggle(); |
|
// return; |
|
// } |
|
// } else { |
|
// mui.alert('当前环境不支持指纹识别API,请更新到最新版本'); |
|
// mui("#fingerSwitch").switch().toggle(); |
|
// } |
|
// |
|
// } else { |
|
// //关闭开关回调 |
|
// } |
|
// }); |
|
|
|
}); |
|
|
|
// // 指纹识别认证 |
|
// function fingerpring() { |
|
// var waiting = null; |
|
// plus.fingerprint.authenticate(function() { |
|
// plus.nativeUI.closeWaiting(); |
|
// mui.toast('指纹识别成功'); |
|
// }, function(e) { |
|
// switch(e.code) { |
|
// case e.AUTHENTICATE_MISMATCH: |
|
// plus.nativeUI.closeWaiting(); |
|
// plus.nativeUI.toast('指纹匹配失败,请重新输入'); |
|
// break; |
|
// case e.AUTHENTICATE_OVERLIMIT: |
|
// plus.nativeUI.closeWaiting(); |
|
// mui.alert('指纹识别失败次数超出限制,请使用其它方式进行认证!', "提示"); |
|
// break; |
|
// case e.CANCEL: |
|
// plus.nativeUI.closeWaiting(); |
|
// break; |
|
// default: |
|
// plus.nativeUI.closeWaiting(); |
|
// mui.alert('指纹识别失败,请重试!', "提示"); |
|
// break; |
|
// } |
|
// }, { |
|
// message: "用触控ID登录" |
|
// }); |
|
// // Android平台使用自定义等待框显示 |
|
// if("Android" == plus.os.name) { |
|
// waiting = plus.nativeUI.showWaiting('验证已有手机指纹', { |
|
// width: '196px', |
|
// height: '196px', |
|
// padding: '16px', |
|
// loading: { |
|
// height: '96px', |
|
// icon: 'fp.png' |
|
// }, |
|
// background: 'rgba(0,0,0,0.3)' |
|
// }); |
|
// waiting.onclose = function() { |
|
// waiting = null; |
|
// plus.fingerprint.cancel(); |
|
// } |
|
// } else if("iOS" == plus.os.name) { |
|
// plus.nativeUI.showWaiting("等待中..."); |
|
// } |
|
// } |
|
|
|
appLanguageFun(); |
|
/** |
|
* 国际化方法 |
|
*/ |
|
function appLanguageFun() { |
|
var type = app.getLanguageLocalStorage(); |
|
require(['../../js/language/' + type], function(dataBase) { |
|
v.dataBase = dataBase; |
|
}) |
|
} |
|
</script> |