123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417 |
- <!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>
- <link rel="stylesheet" type="text/css" href="../../../common/cross/css/cross.ui.css" />
- <script src="../../../js/mui.min.js"></script>
- <link href="../../../css/mui.min.css" rel="stylesheet" />
- <link rel="stylesheet" type="text/css" href="../css/login.css" />
- <link rel="stylesheet" type="text/css" href="../iconfont/iconfont.css" />
- <script src="../../../js/jquery/2.1.3/jquery.js" type="text/javascript" charset="utf-8"></script>
- </head>
- <body>
- <header class="mui-bar mui-bar-nav" style="background: #17b3ec;">
- <h1 class="mui-title" style="color: #fff;">登录</h1>
- </header>
- <div class="mui-content">
- <div class="mui-content-padded">
- <img src="../images/logo.png" />
- </div>
- <div id="yzm_login">
- <div class="mui-input-group mui-card">
- <div class="mui-input-row">
- <label><span class="iconfont icon-shouji1" style="font-size: 25px"></span></label>
- <input id="tel" type="text" class="mui-input-clear mobile" maxlength="11" placeholder="输入手机号码">
- </div>
- <div class="mui-input-row ">
- <label><span class="iconfont icon-yanzhengma01" style="font-size: 25px"></span></label>
- <input id="verity_code" style="padding-right: 100px;" type="text" placeholder="输入短信验证码" maxlength="6">
- <button id="btn_getVerity" type="button" class="mui-btn mui-btn-outlined " style="font-size: 14px;">获取验证码</button>
- </div>
- </div>
- <div id="div_tip" class="c-17b3ec c-f14 c-t-center c-hide">
- 系统已经发送验证码到您的手机上,请查收
- </div>
- <div class="mui-content-padded">
- <button type="button" class="mui-btn mui-btn-blue mui-btn-block btn_login" style="font-size: 16px;">登 录</button>
- </div>
-
- <div class="mui-content-padded">
- <a class="btn-rt login-type psw">账号密码登录</a>
- </div>
- </div>
-
- <div id="psw_login" style="display: none;">
- <div class="mui-input-group mui-card">
- <div class="mui-input-row">
- <label><span class="iconfont icon-shouji1" style="font-size: 25px"></span></label>
- <input type="text" class="mui-input-clear mobile" maxlength="11" placeholder="输入手机号码">
- </div>
- <div class="mui-input-row ">
- <label><span class="iconfont icon-yanzhengma01" style="font-size: 25px"></span></label>
- <input class="psdipt" type="password" style="padding-right: 50px;" placeholder="初始密码为手机号后六位">
- <input class="psdipt" type="text" style="padding-right: 50px; display: none;" placeholder="初始密码为手机号后六位">
- <a href="#" class="yanjing" style="">
-
- </a>
- </div>
- </div>
- <div class="mui-content-padded">
- <button type="button" class="mui-btn mui-btn-blue mui-btn-block btn_login" style="font-size: 16px;">登 录</button>
- </div>
-
- <div class="mui-content-padded">
- <a class="btn-lt login-type yzm">验证码快速登录</a>
- <a id="login_forget">忘记密码</a>
- </div>
- </div>
-
-
- </div>
- </body>
- <!--<script src="../../../js/app.js" type="text/javascript" charset="utf-8"></script>-->
- <script src="../../../js/security.js" type="text/javascript" charset="utf-8"></script>
- <script src="../../../js/common_http.js" type="text/javascript" charset="utf-8"></script>
- <script src="../../../js/rtcsdk.js" type="text/javascript" charset="utf-8"></script>
- <script src="../js/login.js" type="text/javascript" charset="utf-8"></script>
- <script src="../../js/common.js" type="text/javascript" charset="utf-8"></script>
- <script src="../../../js/im.client.js" type="text/javascript" charset="utf-8"></script>
- <script type="text/javascript">
- var self;
- var mobile = "";
- var curTime = 120;
- var checkReload = false;
- var type = 1;
- var beOut;
- mui.init({
- gestureConfig:{
- tap: true,
- doubletap: false,
- longtap: true
- }
- });
-
- mui.plusReady(function() {
- window.localStorage.removeItem("isLoginOut");
- plus.nativeUI.closeWaiting();
- self = plus.webview.currentWebview();
- if(self.exit) {
- beOut = self.beOut;
- // mui.later(function() {
- exitUser();
- // }, 1000);
- }
-
- plus.runtime.setBadgeNumber(0);
-
- $('.mui-content').css('height', plus.display.resolutionHeight + "px");
- });
-
- /*
- * 获取验证码
- */
- $("#btn_getVerity").click(function() {
- mobile = $(".mobile:visible").val();
- if(!isphone(mobile)) {
- mui.toast("请输入有效的手机号码");
- return;
- }
- plus.nativeUI.showWaiting();
- var $this = $(this);
- console.log($this)
- sendPost("common/captcha", {
- mobile: mobile,
- type: 5,
- captchaToke: ""
- }, function(){
- plus.nativeUI.closeWaiting();
- mui.toast("程序开了点小差, 请稍后重试!");
- }, function(res) {
- if(res.status == 200) {
- $("#div_tip").removeClass("c-hide");
- $this.text(curTime + "秒");
- $this.attr("disabled", "disabled");
- $("#verity_code").attr("autofocus", "autofocus");
- plus.nativeUI.closeWaiting();
- var timer = setInterval(function() {
- curTime--;
- $this.text(curTime + "秒");
- if(curTime == 0) {
- clearInterval(timer);
- $this.text("获取验证码");
- $this.removeAttr("disabled");
- $("#div_tip").addClass("c-hide");
- curTime = 120;
- }
- }, 1000);
- } else {
- mui.toast(res.msg);
- plus.nativeUI.closeWaiting();
- }
- })
- });
- $('.btn_login').on("longtap", login).on("click", login);
-
- function login(){
- disabledDom("btn_login");
- mobile = $(".mobile:visible").val();
- if(!isphone(mobile)) {
- mui.toast("请输入有效的手机号码");
- enabledDom("btn_login");
- return;
- }
- plus.storage.setItem("userMobile", mobile);
-
- if(type == 1){
- var verity = $("#verity_code").val().trim();
- if(verity.length != 6) {
- mui.toast("验证码格式错误,请重新输入");
- enabledDom("btn_login");
- return;
- }
- plus.nativeUI.showWaiting();
- verifyLogin(mobile, verity);
- } else {
- var pwd = $(".psdipt:visible").val().trim();
- if(pwd == "") {
- mui.toast("请输入密码");
- enabledDom("btn_login");
- return;
- }
-
- plus.nativeUI.showWaiting();
- RSAUtils.getKeyFromServer("/login/public_key", function(res) {
- if (res.status == 200) {
- var mod = res.data.modulus;
- var exp = res.data.exponent;
- key = RSAUtils.getKeyPair(exp, "", mod);
- if (key) {
- var encryedPwd = RSAUtils.encryStr(key, pwd);
- verifyLogin(mobile, "", encryedPwd);
- }else {
- plus.nativeUI.closeWaiting();
- toast("程序开了点小差!");
- }
- }
- });
- }
- }
-
- function disabledDom() {
- $(".btn_login").attr("disabled", true);
- }
- function enabledDom(id) {
- $(".btn_login").removeAttr("disabled");
- }
-
-
- /*
- * 验证登录
- */
- var docType = "";
- function verifyLogin(mobile, verity, psd) {
-
- sendPost("login/doctor", {
- mobile: mobile,
- captcha: verity || "",
- password: psd || ""
- }, function(){
- plus.nativeUI.closeWaiting();
- mui.toast("程序开了点小差, 请稍后重试!");
- enabledDom("btn_login");
- }, function(res) {
- if(res.status == 200) {
- console.log("1/"+JSON.stringify(res));
- var info = res.data;
- docType = res.data.doctorType;
- plus.storage.setItem("docType", docType+"");
- var iMei = plus.device.uuid;
- var docId = info.id;
- var uId = info.uid;
- var token = info.token;
- var hospital=info.hospital;
- var name = info.name;
- var photo = info.photo;
- var type = info.doctorType;
- var userRole=JSON.stringify([{"code":"350200","name":"厦门","areas":"350200"}]);//级别 省市县区
- userRole=JSON.stringify(info.userRole);//级别 省市县区
- var hospital = info.hospital;
- var platform = 2;
- plus.storage.setItem("hospital", hospital);
-
- plus.storage.setItem("userRole", userRole);
- var userAgent = plus.storage.getItem("userAgent");
- if(userAgent) {
- plus.storage.removeItem("userAgent");
- }
- var oUserAgent = {
- "id": docId,
- "uid": uId,
- "imei": iMei,
- "token": token,
- "platform": 2,
- "hospital":hospital
- };
- userAgent = JSON.stringify(oUserAgent);
- plus.navigator.setUserAgent(userAgent);
- plus.storage.setItem("userAgent", userAgent);
- plus.storage.setItem("flag", "hello");
- mui.later(function() {
- mui.toast("登录成功");
- mui.openWindow('../../home/html/main.html', 'main', {});
- }, 500);
- } else {
- mui.toast(res.msg);
- enabledDom("btn_login");
- }
- plus.nativeUI.closeWaiting();
- })
- }
-
- /*
- * 注销用户
- */
- function exitUser() {
- var aWv = plus.webview.all();
- var lanWv = plus.webview.getLaunchWebview();
- for(var i = 0; i < aWv.length; i++) {
- if(aWv[i].id == self.id || aWv[i].id == lanWv.id) {
- continue;
- } else {
- aWv[i].close("none");
- }
- }
- var mobile = plus.storage.getItem("userMobile");
- if(mobile) {
- $(".mobile:visible").val(mobile);
- }
- var flag = plus.storage.getItem('flag');
- if(flag) {
- plus.storage.removeItem("flag");
- }
- var useragent = plus.storage.getItem("userAgent");
- if(useragent) {
- //不logout IM的用户信息,防止用户在其他设备登录时,IM的登录状态在此被关闭
- if(!beOut){
- imClient.Users.logout(JSON.parse(useragent).uid);
- }
- plus.storage.removeItem("userAgent");
- }
- var docInfo = plus.storage.getItem("docInfo");
- if(docInfo) {
- plus.storage.removeItem("docInfo");
- }
- var docType = plus.storage.getItem("docType");
- if(docType) {
- plus.storage.removeItem("docType");
- }
- //logout();
- plus.nativeUI.closeWaiting();
- }
- window.addEventListener("exit", function() {
- exitUser();
- });
- /*
- * 定义退出方法
- */
- mui.back = function() {
- plus.nativeUI.confirm("确定退出?", function(e) {
- if(e.index == "0") {
- plus.runtime.quit();
- }
- }, "", ["确定", "取消"]);
- }
-
-
-
- /*
- * 加密设置:获取public_key
- */
- // var key;
- /**
- *登陆事件
- */
- // document.getElementById("btn_login").addEventListener('tap', function() {
- // plus.nativeUI.showWaiting("登录中...");
- // var encryURL = "login/public_key";
- // RSAUtils.getKeyFromServer(encryURL, handlSucc);
- // });
- //
- // function handlSucc(res) {
- // if (res.status == 200) {
- // var mod = res.data.modulus;
- // var exp = res.data.exponent;
- // key = RSAUtils.getKeyPair(exp, "", mod);
- // if (key) {
- // var account = document.querySelector("#tel").value.trim();
- // var pwd = document.querySelector("#pwd").value.trim();
- // if (!account || account.length != 11) {
- // plus.nativeUI.toast("请输入有效的手机号码");
- // plus.nativeUI.closeWaiting();
- // return;
- // }
- // if (!pwd || pwd.length < 6) {
- // plus.nativeUI.toast("请输入不少于6位密码");
- // plus.nativeUI.closeWaiting();
- // return;
- // }
- //
- // var encryedPwd = RSAUtils.encryStr(key, pwd);
- // verifyLogin(account, encryedPwd);
- // }
- //
- // }
- // }
- /*
- * 注册事件
- */
- //document.getElementById("login_reg").addEventListener('tap', function() {
- // mui.openWindow('../../register/html/regist-1phone.html', 'regist-1phone', {});
- // })
- /*
- * 忘记密码
- */
- //document.getElementById("login_forget").addEventListener('tap', function() {
- // mui.openWindow('../../forgetpwd/html/forget-1phone.html', 'forget-1phone', {})
- //});
-
- //cyc 20160826
- // function fixedWatch(el) {
- // if(document.activeElement.nodeName == 'INPUT'){
- // console.log(1)
- // } else {
- //
- // var html=el.prop("outerHTML")
- // if(el.length!=0){
- // el.remove();
- // }
- //
- // $("body").prepend(html);
- //
- //// el.css('position', 'fixed');
- // }
- // }
- //
- // setInterval(function () {
- //
- // fixedWatch($('.mui-bar.mui-bar-nav'));
- // }, 1000);
-
- </script>
-
- </html>
|