|
|
@@ -37,23 +37,48 @@ |
|
|
|
document.addEventListener('pause', onPause.bind(this), false); |
|
|
|
document.addEventListener('resume', onResume.bind(this), false); |
|
|
|
learun.tab.init(tabdata); |
|
|
|
|
|
|
|
var logininfo = learun.storage.get('logininfo'); |
|
|
|
if (logininfo) {// 有登录的token |
|
|
|
learun.tab.go('workspace'); |
|
|
|
$.ajax({ |
|
|
|
url: config.webapi + "weixinapi/weixinconfig", |
|
|
|
type: "get", |
|
|
|
success: function (res) { |
|
|
|
learun.storage.set('weixinappid', res.data.appid ); |
|
|
|
learun.storage.set('weixinappsecret', res.data.secret ); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
else { |
|
|
|
learun.nav.go({ path: 'login', isBack: false, isHead: false }); |
|
|
|
//直接登录 |
|
|
|
var data = { |
|
|
|
username: '', |
|
|
|
password: $.md5('www.qj.com') |
|
|
|
}; |
|
|
|
if (window.location.href.split('?')[1]) { |
|
|
|
data.username = window.location.href.split('?')[1].split('username=')[1] |
|
|
|
} |
|
|
|
learun.splashscreen.hide(); |
|
|
|
var postdata = { |
|
|
|
token: '', |
|
|
|
loginMark: learun.deviceId(),// 正式请换用设备号 |
|
|
|
data: JSON.stringify(data) |
|
|
|
}; |
|
|
|
learun.http.post(config.webapi + "learun/adms/user/logindt", postdata, (res) => { |
|
|
|
console.log(res); |
|
|
|
var logininfo = {}; |
|
|
|
if (res.data.username) { |
|
|
|
logininfo = { |
|
|
|
account: data.username, |
|
|
|
token: res.data.baseinfo.token, |
|
|
|
date: learun.date.format(new Date(), 'yyyy-MM-dd hh:mm:ss') |
|
|
|
}; |
|
|
|
learun.storage.set('logininfo', logininfo); |
|
|
|
learun.storage.set('userinfo', res.data); |
|
|
|
} |
|
|
|
var logininfo = learun.storage.get('logininfo'); |
|
|
|
if (logininfo) {// 有登录的token |
|
|
|
learun.tab.go('workspace'); |
|
|
|
// $.ajax({ |
|
|
|
// url: config.webapi + "weixinapi/weixinconfig", |
|
|
|
// type: "get", |
|
|
|
// success: function (res) { |
|
|
|
// learun.storage.set('weixinappid', res.data.appid ); |
|
|
|
// learun.storage.set('weixinappsecret', res.data.secret ); |
|
|
|
// } |
|
|
|
// }); |
|
|
|
} |
|
|
|
else { |
|
|
|
learun.nav.go({ path: 'login', isBack: false, isHead: false }); |
|
|
|
} |
|
|
|
learun.splashscreen.hide(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
function onPause() { |
|
|
|