| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243 |
- <!doctype html>
- <html>
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
- <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
- <meta name="format-detection"content="telephone=no">
- <title>login</title>
- <link rel="stylesheet" type="text/css" href="./css/api.css"/>
- <link rel="stylesheet" href="./css/toast.css">
- <link rel="stylesheet" type="text/css" href="./css/style.css"/>
- <style>
- body,html{
- background: #fff;
- }
- .ap_logo{
- width: 100%;
- padding: 60px 0 30px 0;
- text-align: center;
- }
- .ap_logo img{
- width: 159px;
- margin: auto;
- }
- .ap_title{
- font-size: 20px;
- color: #000;
- text-align: center;
- margin-bottom: 30px;
- }
- .ap_formInput{
- width: 100%;
- padding: 0 60px;
- position: relative;
- box-sizing: border-box;
- margin-bottom: 22px;
- }
- .ap_formInput input{
- height: 42px;
- line-height: 42px;
- width: 100%;
- background: #F0F0F0;
- border-radius: 50px;
- padding: 0 60px;
- box-sizing: border-box;
- outline: none;
- }
- .ap_formInput input::-webkit-input-placeholder{
- font-size: 15px;
- position: relative;
- top: 0;
- /*line-height: 50px;*/
- }
- .ap_formInput img{
- width: 25px;
- height: 25px;
- position: absolute;
- top:8px;
- right: 80px;
- }
- .ap_formInput label{
- font-size: 15px;
- color: #000;
- position: absolute;
- left: 80px;
- top: 10px;
- }
- .ap_forget{
- font-size: 15px;
- text-align: center;
- color:#4E5457;
- }
- .ap_login{
- text-align: center;
- }
- .ap_loginBtn{
- width: 195px;
- height: 50px;
- line-height: 50px;
- background: #D9D9D9;
- text-align: center;
- font-size: 20px;
- margin: auto;
- border-radius: 50px;
- color: #fff;
- margin-top: 26px;
- outline: none;
- }
- .api-toast{
- background: rgba(255,255,255,.1);
- }
- </style>
- </head>
- <body>
- <div id="wrap" class="flex-wrap flex-vertical">
- <div id="main" class="flex-con">
- <div class="ap_logo">
- <img src="./image/logo.png" alt="">
- </div>
- <div class="ap_form">
- <p class="ap_title"></p>
- <div class="ap_formMain">
- <div class="ap_formInput">
- <label>工号</label>
- <input type="number" placeholder="请输入工号" value="" id="jobnumber" oninput="on_input(this.value)">
- <img src="./image/Avatar.png" alt="">
- </div>
- <div class="ap_formInput">
- <label>密码</label>
- <input type="password" placeholder="请输入密码" id="password" oninput="on_input(this.value)">
- <img src="./image/Password.png" alt="">
- </div>
- </div>
- </div>
- <p class="ap_forget">忘记密码?请联系信息科管理员重置</p>
- <div class="ap_login">
- <button type="button" name="button" class="ap_loginBtn" id="confirm" onclick="openIndex()">登陆</button>
- </div>
- </div>
- </div>
- </body>
- </html>
- <script type="text/javascript" src="script/api.js"></script>
- <script src="script/config.js" charset="utf-8"></script>
- <script type="text/javascript">
- var login = false;
- apiready = function () {
- $api.html($api.dom('.ap_title'), mineName);
- $api.fixStatusBar( $api.dom('header') );
- var header = document.querySelector('#header');
- api.setStatusBarStyle({
- color: 'rgba(0,0,0,0)',
- style: 'light'
- });
- var userName = JSON.parse($api.getStorage('userInfo')).username;
- var password = JSON.parse($api.getStorage('userInfo')).password;
- var info = $api.getStorage('data'),
- user = JSON.parse(info).data.user;
- token = JSON.parse(info).data.access_token,
- status = api.pageParam.status;
- if (token) {
- if (password == "" || status == true) {
- var jobnumber = $api.val($api.byId('jobnumber'),userName),password = $api.val($api.byId('password'),"");
- }else {
- api.openWin({
- slidBackEnabled:'false',
- reload:true,
- name: 'index',
- url: 'index.html',
- });
- }
- };
- api.addEventListener({
- name: 'keyback'
- }, function(ret, err) {
- api.confirm({
- title: '提示',
- msg: '是否退出应用',
- buttons: ['确定', '取消']
- }, function(ret, err) {
- if (ret.buttonIndex == 1) {
- // 关闭当前的主Widget,就可以实现推出APP的效果
- api.closeWidget({
- silent: true //直接退出,无需提示
- });
- }
- });
- })
- };
- var toast = new auiToast();
- function openIndex () {
- var jobnumber = $api.val($api.byId('jobnumber')),password = $api.val($api.byId('password'));
- var userInfo = {username:jobnumber,password:password}
- if (jobnumber!= '' && password != '') {
- toast.loading({
- title: "加载中",
- duration: 2000
- });
- var values = {
- username: jobnumber,
- password: password,
- }
- $http.fnReuestData(UrlRouter.loginApi,'','post',values,function (ret,err) {
- if (ret) {
- if (ret.code === 0 ) {
- api.toast({
- msg: '登陆成功',
- duration: 2000,
- location: 'top'
- });
- $api.setStorage('userInfo',JSON.stringify(userInfo));
- $api.setStorage('data',JSON.stringify( ret ));
- api.openWin({
- slidBackEnabled:'false',
- reload:true,
- name: 'index',
- url: 'index.html',
- });
- toast.hide();
- } else if (ret.code === 1002) {
- toast.hide();
- api.toast({
- msg: '密码错误',
- duration: 2000,
- location: 'top'
- });
- } else if (ret.code === 1001) {
- toast.hide();
- api.toast({
- msg: '用户不存在',
- duration: 2000,
- location: 'top'
- });
- }
- } else {
- toast.hide();
- api.toast({
- msg: '登陆超时,请检查网络',
- duration: 2000,
- location: 'top'
- });
- }
- });
- }else {
- api.toast({
- msg : '账号或密码不能为空'
- });
- }
- }
- function on_input(value) {
- var jobnumber = $api.val($api.byId('jobnumber')),password = $api.val($api.byId('password'));
- var canLogin = false;
- if (jobnumber != '' && password != '') {
- var confirm = $api.byId("confirm");
- confirm.style.backgroundColor = "#108BE2";
- canLogin = true;
- } else {
- var confirm = $api.byId("confirm");
- confirm.style.backgroundColor = "#D9D9D9";
- canLogin = false;
- }
- }
- </script>
|