Commit 31e99d76 by hanpeng

-mark- 论坛增加登录拦截

parent f3f814cc
define(['zepto','medtap'],function($,medtap){
var rukou = {
wechatId:medtap.getRequest('wechatId'),
init:function(){
rukou.getToken()
},
checkUser:function(){
medtap.loading(1);
medtap.submitAjax({
url:'https://testdevgw.medtap.cn/wechat/user/getWechatUser',
type:'GET',
async: false,
data:{
wechatId:rukou.wechatId
},
success:function(res){
medtap.loading(0);
var info = res.content.wechatUser;
if(info.hasOwnProperty('userId')){
//medtap.pushWindow('index.html?wechatId=' + rukou.wechatId)
window.location.replace('index.html?wechatId=' + rukou.wechatId)
}else{
window.location.replace('https://review-formal.iplusmed.com/wechatForLungCancer/dev/wechat_lung_login/login.html?wechatId=' + rukou.wechatId)
}
}
})
},
getToken:function(){
localStorage.wxLungToken = '';
medtap.loading(1);
medtap.submitAjax({
url: 'https://testdevgw.medtap.cn/user/auth/token',
type: 'POST',
async: false,
contentType: 'application/json',
data: {
wechatId: rukou.wechatId
},
success: function(res) {
medtap.loading(0);
if (res.success == true) {
var token = res.content.token;
localStorage.setItem('wxLungToken', token);
rukou.checkUser();
} else {
}
},
error: function(res) {
console.log(res.resultDesc);
}
})
}
}
rukou.init();
})
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>加载中...</title>
<script src="https://review-formal.iplusmed.com/Common/javaScript/require.min.js"></script>
<script type="text/javascript">
require.config({
baseUrl: "./",
paths: {
"zepto": "https://review-formal.iplusmed.com/Common/javaScript/zepto.min",
"medtap": "https://review-formal.iplusmed.com/Common/javaScript/medtap_core_wx",
"md5": "https://review-formal.iplusmed.com/Common/javaScript/md5.min"
},
shim: {
"zepto": {
exports: "$"
}
}
});
</script>
</head>
<body>
</body>
<script type="text/javascript">
require(['javaScript/rukou.js'])
</script>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment