login.html 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
  6. <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
  7. <title>title</title>
  8. <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
  9. <link rel="stylesheet" href="../../css/common.css"/>
  10. <link rel="stylesheet" href="../../css/login.css"/>
  11. <link rel="stylesheet" href="../../css/html.css"/>
  12. <style>
  13. body,html {
  14. background-color: transparent;
  15. overflow: hidden;
  16. }
  17. .zc_btn {
  18. text-align: center;
  19. margin-top: 10px;
  20. color: #374782;
  21. }
  22. .zmq-form {
  23. top: 42%;
  24. position: absolute;
  25. box-sizing: border-box;
  26. width : 90%;
  27. left: 5%;
  28. }
  29. </style>
  30. </head>
  31. <body>
  32. <div id="app">
  33. <!--<div id="login"></div>-->
  34. <img src="../../image/zy_logo.png" style="width: 60%;height: 40px;margin-left: 20%;margin-top: 30%"/>
  35. <div >
  36. <form class="zmq-form" action="">
  37. <div class="userName zmq-input-parent">
  38. <img src="../../image/drawable-xhdpi/11.png" class="zmq-input-img"/>
  39. <input class="zmq-input" type="text" name="name" placeholder="请输入用户名" required v-model = "userCode"/>
  40. </div>
  41. <!--<div class="passWord zmq-input-parent-margin zmq-flex zmq-flex-between">
  42. <img src="../../image/drawable-xhdpi/pass2.png" class="zmq-input-img zmq-input-ru" style="margin-top: 3%"/>
  43. <input class="zmq-input zmq-margin-auto" type="number" name="phoneCode" placeholder="请输入验证码" required v-model="userPassword" style="width: 45%"/>
  44. <div class="zmq-text-font-07 zmq-btn-getCode" v-on:click="getCode">获取验证码</div>
  45. </div>-->
  46. <div class="passWord zmq-input-parent">
  47. <img src="../../image/drawable-xhdpi/pass.png" class="zmq-input-img"/>
  48. <input class="zmq-input" type="password" name="password" placeholder="请输入密码" required v-model="userPassword" />
  49. </div>
  50. <div class="choose_box">
  51. <!--<a href="javascript:void(0)" class="zmq-text-msg zmq-text-font-09">忘记密码?</a>-->
  52. </div>
  53. <div class="zmq-btn zmq-btn-img" v-on:click="login">
  54. 登&nbsp;&nbsp;录
  55. </div>
  56. <div class="zmq-text-font-09 zmq-text-right">
  57. 还没有账号?<em class="zmq-text-msg" v-on:click="goRegize">我要注册</em>
  58. </div>
  59. </form>
  60. <!--<div class="other_login">
  61. <div class="other"></div>
  62. <span>其他方式登录</span>
  63. <div class="other"></div>
  64. </div>
  65. <div class="other_choose">
  66. <a href=""> <img src="../../image/qq.png" alt=""/> </a>
  67. <a href=""> <img src="../../image/wx.png" alt=""/> </a>
  68. <a href=""> <img src="../../image/wb.png" alt=""/> </a>
  69. </div>-->
  70. </div>
  71. </div>
  72. </body>
  73. <script type="text/javascript" src="../../script/api.js"></script>
  74. <script type="text/javascript" src="../../script/vue.js"></script>
  75. <script type="text/javascript" src="../../script/httpRequest.js"></script>
  76. <script type="text/javascript" src="../../script/vue_plugins.js"></script>
  77. <script type="text/javascript">
  78. apiready = function() {
  79. new Vue({
  80. el : '#app',
  81. data : {
  82. // 输入的用户名和密码
  83. userCode : '15066668888', // 用户名
  84. userPassword : '12345', // 用户密码
  85. loginUrl : 'loginUrl',
  86. bodyH : '', // 设置背景图高度
  87. mobile : '',
  88. getPhoneCodeUrl : 'getPhoneCode',
  89. },
  90. methods : {
  91. // 注册成功,跳转登录
  92. login : function() {
  93. var _this = this;
  94. // setTimeout(function() {
  95. // _this.sendEvent("openFrameGroup", "");
  96. // }, 500);
  97. if (this.userCode == "") {
  98. this.showToast("请输入用户手机号");
  99. return;
  100. }
  101. if (this.userPassword == "") {
  102. this.showToast("用户密码不能为空");
  103. return;
  104. }
  105. var data = {
  106. mobile : this.userCode,
  107. // password : this.userPassword,
  108. mobileCode : this.userPassword,
  109. url : 'json',
  110. type : 'body'
  111. }
  112. this.$post(this.loginUrl, data, function(ret) {
  113. if (ret.code == 0 || ret.code == '0') {
  114. _this.showToast("登录成功");
  115. // 将loginid 保存到本地
  116. $api.setStorage("loginid", ret.data.loginId);
  117. setTimeout(function() {
  118. _this.sendEvent("openFrameGroup", "");
  119. }, 500);
  120. }
  121. })
  122. },
  123. // 获取短信验证码
  124. getCode : function(){
  125. if (this.userCode == "") {
  126. this.showToast("请输入用户手机号");
  127. return;
  128. }
  129. var data = {
  130. mobile : this.userCode
  131. }
  132. this.$post(this.getPhoneCodeUrl, data, function(ret) {
  133. if(ret.code == 0 || ret.code == '0'){
  134. api.toast({
  135. msg:'验证码发送成功'
  136. });
  137. }
  138. })
  139. },
  140. // 跳转注册页面
  141. goRegize : function() {
  142. this.goWin("regize_win", "regize_win.html", "");
  143. }
  144. },
  145. mounted : function() {
  146. var index = 0, _this = this;
  147. this.bodyH = document.documentElement.clientHeight;
  148. api.addEventListener({
  149. name : 'keyback'
  150. }, function(ret, err) {
  151. api.closeWidget({
  152. id : 'A6016891253637', //这里是应用id
  153. retData : {
  154. name : 'closeWidget'
  155. },
  156. animation : {
  157. type : 'flip',
  158. subType : 'from_bottom',
  159. duration : 500
  160. }
  161. });
  162. });
  163. }
  164. })
  165. };
  166. </script>
  167. </html>