| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419 |
- <!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 viewport-fit=cover" />
- <meta name="apple-mobile-web-app-capable" content="yes" />
- <meta name="apple-mobile-web-app-status-bar-style" content="black" />
- <title>登录页面</title>
- <link href="css/mui.min.css" rel="stylesheet" />
- <link href="css/app.css" rel="stylesheet">
- <script src="js/mui.min.js"></script>
- <style>
- /* 全局样式 */
- * {
- margin: 0px;
- padding: 0px;
- }
- body,
- html {
- width: 100%;
- height: calc(100vh);
- }
- /* 顶部视图容器样式 */
- .wc-ico-panel {
- width: 100%;
- height: 170px;
- line-height: 170px;
- text-align: center;
- margin-top: 10px;
- margin-bottom: 10px;
- }
- /* 顶部视图图标样式 */
- .wc-ico {
- width: 100px;
- height: 100px;
- }
- /* 顶部视图标题文字样式 */
- .wc-title {
- font-size: 26px;
- height: 40px;
- line-height: 40px;
- font-weight: bold;
- color: rgb(59, 146, 255);
- }
- /* 顶部视图APP版本样式 */
- .wc-version {
- position: relative;
- font-size: 15px;
- height: 30px;
- line-height: 30px;
- font-weight: normal;
- color: rgb(59, 146, 255);
- }
- /* 底部容器样式 */
- .wc-div-bottom {
- position: absolute;
- width: 100%;
- bottom: 10px;
- text-align: center;
- }
- /* 底部容器内段落样式 */
- .wc-div-bottom p {
- font-size: 12px;
- color: #000;
- margin: 0px;
- padding: 0px;
- }
- /* 底部连接样式 */
- .link-area {
- display: block;
- margin-top: 25px;
- text-align: center;
- font-size: 15px;
- }
- /* 输入行样式 */
- .wc-input-row {
- position: relative;
- height: 40px;
- line-height: 40px;
- border: solid 1px rgb(121, 183, 246);
- border-radius: 20px;
- margin-left: 15%;
- margin-right: 15%;
- display: flex;
- flex-direction: row;
- align-items: center;
- margin-bottom: 10px;
- }
- .wc-input-row-none {
- border: solid 0px rgb(121, 183, 246);
- }
- /* 输入行小图标样式 */
- .wc-input-img {
- width: 24px;
- height: 24px;
- margin-left: 20px;
- margin-right: 10px;
- }
- /* 输入行竖向分隔线样式 */
- .wc-input-v-line {
- width: 1px;
- height: 80%;
- background-color: rgb(145, 195, 249);
- }
- /* 输入行输入行样式 */
- .wc-input-row .mui-input-row {
- width: 90% !important;
- }
- /* 输入行输入控件样式 */
- .wc-input-row .mui-input-row>input {
- margin-bottom: 0px !important;
- height: 34px !important;
- border: solid 0px red !important;
- background-color: rgba(255, 255, 255, 0) !important;
- }
- /* 标签样式 */
- .wc-input-label {
- margin-left: 20px;
- font-size: 14px;
- }
- /* 开关样式 */
- .wc-input-switch {
- margin-left: auto;
- margin-right: 20px;
- }
- /* 按钮样式 */
- .wc-login-btn {
- border-radius: 25px;
- height: 50px;
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: center;
- border: solid 1px rgba(255, 255, 255, 0);
- }
- /* 整体内容样式 */
- .wc-content {
- position: absolute;
- width: 100%;
- top: 30%;
- }
- </style>
- </head>
- <body style="background-image: url(img/login/back_login.jpg);background-size: 100% 100%;">
- <div class="wc-content">
- <!-- 顶部图标及应用名称 -->
- <div class="mui-row">
- <div class="wc-ico-panel">
- <div style="height: 100px;line-height: 100px;">
- <img src="img/login/login_log.png" class="wc-ico" />
- </div>
- <div class="wc-title">兰山区综合执法</div>
- <div class="wc-version">APP版本{V3.0.0}</div>
- </div>
- </div>
- <!-- 账号输入框 -->
- <div class="mui-row wc-input-row">
- <img class="wc-input-img" src="img/login/ico_login_user.png">
- <div class="wc-input-v-line"></div>
- <div class="mui-input-row">
- <input id="userName" type="text" class="mui-input-clear mui-input f-color" placeholder="请输入账号">
- </div>
- </div>
- <!-- 密码输入框 -->
- <div class="mui-row wc-input-row">
- <img class="wc-input-img" src="img/login/ico_login_passwrod.png">
- <div class="wc-input-v-line"></div>
- <div class="mui-input-row">
- <input id="passWord" type="password" class="mui-input mui-input-password f-color"
- placeholder="请输入密码">
- </div>
- </div>
- <!-- 记住用户名和密码 -->
- <div class="mui-row wc-input-row wc-input-row-none">
- <span class="wc-input-label f-color">记住用户名和密码</span>
- <div id="autoLogin" class="mui-switch mui-active mui-switch-blue mui-switch-mini wc-input-switch">
- <div class="mui-switch-handle"></div>
- </div>
- </div>
- <!-- 登录按钮 -->
- <div class="mui-content-padded" style="margin-top: 50px;margin-left: 15%;margin-right: 15%;">
- <button type="button" class="mui-btn mui-btn-block mui-btn-primary wc-login-btn"
- onclick="loginCheck()">登录</button>
- <div class="link-area">
- <a href="#" onclick="setting()">服务设置</a>
- </div>
- </div>
- </div>
- <div id="divButtom" class="wc-div-bottom">
- <p>版权所有:临沂市兰山区自然资源与规划局</p>
- <p>技术支持:金田产业发展(山东)集团有限公司 @2021</p>
- </div>
- </body>
- </html>
- <!-- 引入存储脚本 -->
- <script type="text/javascript" src="js/save.js"></script>
- <!-- 引入远程请求脚本 -->
- <script type="text/javascript" src="js/ajax.js"></script>
- <!-- 通用脚本 -->
- <script src="js/common.js" type="text/javascript" charset="utf-8"></script>
- <!-- 引入webview脚本 -->
- <script src="js/webview.js" type="text/javascript" charset="utf-8"></script>
- <!-- 引入数据库管理脚本 -->
- <script src="js/DatabaseManager.js" type="text/javascript" charset="utf-8"></script>
- <!-- 本页独有脚本 -->
- <script type="text/javascript">
- /* 变量定义及绑定 */
- var dUserName = document.getElementById('userName');
- var dPassWord = document.getElementById('passWord');
- var divButtom = document.getElementById("divButtom");
- var dAutoLoginSwitch = document.getElementById("autoLogin");
- var height = window.innerHeight; //初始的窗口高度
- mui.init(); /* 初始化*/
- /**
- * plus初始化完成
- */
- plusInit(function() {
- /* 设置状态栏背景色 注意不能设置为沉浸式 否则无效 */
- plus.navigator.setStatusBarBackground(colorBackground);
- /* 设置全屏 */
- plus.navigator.setFullscreen(true);
- /* 窗口变化监听 */
- window.onresize = function(e) {
- var curHeight = window.innerHeight;
- if (curHeight < height) {
- divButtom.style.display = 'none';
- } else {
- divButtom.style.display = 'block';
- }
- }
- /* 获取存储的用户名和密码 填充*/
- getUserNameAndPassword({
- success: function(userData) {
- dUserName.value = userData.username;
- dPassWord.value = userData.password;
- },
- });
-
- /* 检测数据库文件 */
- DB_CheckDatabase({
- success:function(msg){
- printToConsole(msg);
- },
- error:function(err){
- printToConsole(err);
- }
- });
- });
- /* iOS平台单独初始化 */
- plusInitiOS(function() {
- });
- /* Android平台单独初始化 */
- plusInitAndroid(function() {
- })
- /* 打开设置页面 */
- function setting() {
- // mui.openWindow('setIpAndCom.html');
- createAndOpenPage({
- htmlPath: 'setIpAndCom.html',
- autoback: true,
- title: '设置Ip和端口'
- });
- }
- /**
- * 登录信息检查验证
- */
- function loginCheck() {
- var strUserName = dUserName.value.trim();
- var strPassWord = dPassWord.value.trim();
- if (strUserName == "") {
- muiAlert("请输入用户名!", "提示", function() {
- dUserName.focus();
- });
- } else if (strPassWord == "") {
- muiAlert("请输入密码!", "提示", function() {
- dPassWord.focus();
- });
- } else {
- var userData = {
- userId: strUserName,
- userPwd: strPassWord
- };
- /* 登录请求 */
- login(userData);
- }
- }
- /**
- * 登录请求
- * @param {JSON} userData 账号数据
- */
- function login(userData) {
- /**
- * 远程请求
- */
- sendAjax({
- data: userData,
- type: 'post',
- url: 'appQueryUser',
- waitMessage: '正在认证登录...',
- success: function(resData) {
- /* 如果认证成功 则保存用户信息 */
- saveUserInfo({
- user: resData[0],
- success: function() {
- /* 判断是否需要保存账号和密码 */
- var isSave = dAutoLoginSwitch.classList.contains("mui-active");
- if (isSave) {
- saveUserNameAndPassword({
- username: userData.userId,
- password: userData.userPwd,
- success: function() {
- getLayers(resData[0].userID);
- },
- error: function(err) {
- muiAlert(err, "错误");
- }
- })
- } else {
- removeUserNameAndPassword({
- success: function() {
- getLayers(resData[0].userID);
- },
- error: function(err) {
- muiAlert(err, "错误");
- }
- })
- }
- },
- error: function(err) {
- muiAlert(err, "错误");
- }
- })
- },
- nodata: function(msg) {
- muiAlert(msg, "警告");
- },
- error: function(err) {
- muiAlert(err, "错误");
- }
- })
- }
- /**
- * 获取图层列表
- * @param {String} userId 账号Id
- */
- function getLayers(userId) {
- /**
- * 远程请求
- */
- sendAjax({
- data: {
- userId: userId
- },
- type: 'post',
- url: 'appQueryLayers',
- waitMessage: '初始化地图图层...',
- success: function(resData) {
- saveUserLayers({
- layers: resData,
- success: function() {
- mui.openWindow({
- url: 'main.html',
- show: {
- autoShow: true, //页面loaded事件发生后自动显示,默认为true
- aniShow: 'slide-in-right', //页面显示动画,默认为”slide-in-right“;
- duration: 300 //页面动画持续时间,Android平台默认100毫秒,iOS平台默认200毫秒;
- },
- styles: {
- "contentAdjust": false
- },
- });
- },
- error: function(err) {
- muiAlert(err, "错误");
- }
- })
- },
- nodata: function(msg) {
- muiAlert(msg, "警告");
- },
- error: function(err) {
- muiAlert(err, "错误");
- }
- })
- }
- </script>
|