login.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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/drawable-xhdpi/bg03.png" v-bind:style="{ height: bodyH + 'px' }" class="loginImg" />
  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 : '', // 用户名
  84. userPassword : '', // 用户密码
  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. }
  110. this.$post(this.loginUrl, data, function(ret) {
  111. if (ret.code == 0 || ret.code == '0') {
  112. _this.showToast("登录成功");
  113. // 将loginid 保存到本地
  114. $api.setStorage("loginid", ret.data.loginId);
  115. setTimeout(function() {
  116. _this.sendEvent("openFrameGroup", "");
  117. }, 500);
  118. }
  119. })
  120. },
  121. // 获取短信验证码
  122. getCode : function(){
  123. if (this.userCode == "") {
  124. this.showToast("请输入用户手机号");
  125. return;
  126. }
  127. var data = {
  128. mobile : this.userCode
  129. }
  130. this.$post(this.getPhoneCodeUrl, data, function(ret) {
  131. if(ret.code == 0 || ret.code == '0'){
  132. api.toast({
  133. msg:'验证码发送成功'
  134. });
  135. }
  136. })
  137. },
  138. // 跳转注册页面
  139. goRegize : function() {
  140. this.goWin("regize_win", "regize_win.html", "");
  141. }
  142. },
  143. mounted : function() {
  144. var index = 0, _this = this;
  145. this.bodyH = document.documentElement.clientHeight;
  146. api.addEventListener({
  147. name : 'keyback'
  148. }, function(ret, err) {
  149. api.closeWidget({
  150. id : 'A6016891253637', //这里是应用id
  151. retData : {
  152. name : 'closeWidget'
  153. },
  154. animation : {
  155. type : 'flip',
  156. subType : 'from_bottom',
  157. duration : 500
  158. }
  159. });
  160. });
  161. }
  162. })
  163. };
  164. </script>
  165. </html>