login.html 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <!DOCTYPE html>
  2. <html class="">
  3. <!--STATUS OK-->
  4. <head>
  5. <meta name="referrer" content="always" />
  6. <meta charset='utf-8' />
  7. <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
  8. <meta http-equiv="x-dns-prefetch-control" content="on">
  9. <meta name="description" content="">
  10. <meta name="format-detection" content="telephone=no" />
  11. <link rel="stylesheet" type="text/css" href="../css/css/vant-ui.css" />
  12. <link rel="stylesheet" type="text/css" href="../css/css/iconfont.css">
  13. <link rel="stylesheet" type="text/css" href="../css/css/main.css" />
  14. <script src="../script/js/vue.js"></script>
  15. <script src="../script/js/vant-ui.js"></script>
  16. <script src="../script/js/main.js"></script>
  17. <title></title>
  18. </head>
  19. <style>
  20. .login .loginFix {
  21. position: absolute;
  22. }
  23. </style>
  24. <body>
  25. <div id="app" v-cloak>
  26. <div class="login" id="aui-header">
  27. <div class="logo"></div>
  28. <div class="loginBox">
  29. <van-tabs v-model="activeWay" color="#03a9f4" background="transparent">
  30. <van-tab title="账号密码登录" name="userPwd">
  31. <div class="labelTitle flex a-center" style="margin-top: .32rem;">
  32. <b class="i1"></b>
  33. 账号
  34. </div>
  35. <div class="labelValue flex a-center">
  36. <input type="text" placeholder="请输入登录账号" key="user" v-model="userCode"/>
  37. </div>
  38. <div class="labelTitle flex a-center" style="margin-top: 0.3rem;">
  39. <b class="i2"></b>
  40. 密码
  41. </div>
  42. <div class="labelValue flex a-center">
  43. <input :type="type?'password':'text'" placeholder="请输入密码" key="pwd" v-model="userPassword"/>
  44. <div class="labelToolbel flex a-center">
  45. <van-icon name="clear" size="0.3rem" v-if="userPassword.length" @click="userPassword=''"></van-icon>
  46. <div>
  47. <svg @click="type=!type" v-if="type" t="1589111457609" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2189" width="22" height="22">
  48. <path d="M512 209.403241c-201.731514 0-374.009206 125.476783-443.808922 302.596759 69.798692 177.119977 242.077408 302.596759 443.808922 302.596759 201.933105 0 374.010229-125.476783 443.808922-302.596759C886.009206 334.880023 713.933105 209.403241 512 209.403241zM512 713.731514c-111.355157 0-201.731514-90.375334-201.731514-201.731514s90.375334-201.731514 201.731514-201.731514 201.731514 90.375334 201.731514 201.731514S623.355157 713.731514 512 713.731514zM512 390.961296c-66.772776 0-121.038704 54.265928-121.038704 121.038704s54.265928 121.038704 121.038704 121.038704 121.038704-54.265928 121.038704-121.038704S578.772776 390.961296 512 390.961296z" p-id="2190" fill="#00a0ea"></path>
  49. </svg>
  50. <svg @click="type=!type" v-else t="1589111610728" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2762" width="22" height="22">
  51. <path d="M928.312889 267.477333C792.078222 436.906667 655.957333 519.111111 519.651556 519.111111c-136.832 0-278.584889-82.773333-425.031112-252.913778a49.777778 49.777778 0 1 0-75.463111 64.938667C182.826667 521.287111 349.596444 618.666667 519.637333 618.666667c170.609778 0 332.785778-97.934222 486.257778-288.810667a49.777778 49.777778 0 0 0-77.582222-62.378667z" p-id="2763" fill="#00a0ea"></path><path d="M162.730667 469.447111l-94.819556 109.710222a35.555556 35.555556 0 1 0 53.802667 46.506667l94.819555-109.710222a35.555556 35.555556 0 0 0-53.802666-46.506667zM354.247111 598.186667l-37.930667 151.708444a35.555556 35.555556 0 0 0 68.992 17.251556l37.930667-151.708445a35.555556 35.555556 0 0 0-68.992-17.251555zM629.575111 604.387556l53.333333 151.694222a35.555556 35.555556 0 0 0 67.072-23.580445l-53.333333-151.694222a35.555556 35.555556 0 0 0-67.072 23.580445zM823.111111 475.164444l109.710222 109.724445a35.555556 35.555556 0 0 0 50.289778-50.289778l-109.710222-109.710222a35.555556 35.555556 0 0 0-50.289778 50.289778z" p-id="2764" fill="#00a0ea"></path>
  52. </svg>
  53. </div>
  54. </div>
  55. </div>
  56. <div class="loginBtns flex a-center j-center" key="userPwdbtn" v-on:click="login('userPwd')">
  57. 登录
  58. </div>
  59. </van-tab>
  60. <van-tab title="验证码登录" name="phoneCode">
  61. <div class="labelTitle flex a-center" style="margin-top: .32rem;">
  62. <b class="i1"></b> 手机号
  63. </div>
  64. <div class="labelValue flex a-center">
  65. <input type="text" placeholder="请输入手机号" key="phone" v-model="userCode" />
  66. </div>
  67. <div class="labelTitle flex a-center" style="margin-top: 0.3rem;">
  68. <b class="i2"></b> 验证码
  69. </div>
  70. <div class="labelValue flex a-center">
  71. <input type="text" placeholder="请输入验证码" key="code" v-model="userPassword" />
  72. <div class="labelToolbel a-center getCodeBtn" v-bind:class="wait < 60 ? 'dontSend' : ''"
  73. v-on:click="getPhoneCode">
  74. {{ wait == 60 ? '获取验证码' : (wait + "s 后重发") }}
  75. </div>
  76. </div>
  77. <div class="loginBtns flex a-center j-center" key="phoneCodebtn" v-on:click="login('phoneCode')">
  78. 登录
  79. </div>
  80. </van-tab>
  81. </van-tabs>
  82. </div>
  83. <div class="loginFix">
  84. 赛轮集团
  85. </div>
  86. </div>
  87. </div>
  88. </body>
  89. <script type="text/javascript" src="../script/api.js"></script>
  90. <script type="text/javascript" src="../script/httpRequest.js"></script>
  91. <script type="text/javascript" src="../script/vue_plugins.js"></script>
  92. <script type="text/javascript">
  93. apiready = function() {
  94. var header = $api.byId('aui-header');
  95. $api.fixStatusBar(header);
  96. var headerPos = $api.offset(header);
  97. if (api.systemType == 'android') {
  98. $api.css($api.byId('aui-header'), 'padding-top:2.1rem');
  99. };
  100. api.closeFrameGroup({
  101. name: 'indexGrouppcr'
  102. });
  103. api.closeFrameGroup({
  104. name: 'indexGrouptbr'
  105. });
  106. new Vue({
  107. el : '#app',
  108. data : {
  109. activeWay: "userPwd",
  110. userCode : '', // 用户名
  111. userPassword : '', // 用户密码
  112. loginUrl : 'loginUrl',
  113. getPhoneCodeUrl : 'getPhoneCode',
  114. codeCookie: "",//验证码cookie
  115. checked : false,
  116. type : true,
  117. wait: 60,
  118. },
  119. methods : {
  120. // 点击登录
  121. login : function(params) {
  122. var _this = this;
  123. if (this.userCode == "") {
  124. this.showToast("请输入用户账号");
  125. return;
  126. }
  127. if (this.userPassword == "") {
  128. this.showToast("用户密码不能为空");
  129. return;
  130. };
  131. var data;
  132. if(params=="userPwd"){
  133. data = {
  134. clientId : this.userCode,
  135. password : this.userPassword,
  136. authCode : "",
  137. url : 'json',
  138. type : 'body'
  139. };
  140. this.$post(this.loginUrl, data, function(ret) {
  141. if (ret.code == 0 || ret.code == '0') {
  142. if(ret.data.data == null){
  143. api.toast({ msg : "账号不存在" });
  144. return;
  145. };
  146. _this.showToast("登录成功");
  147. // 将loginid 保存到本地
  148. $api.setStorage("token", ret.data.data.token);
  149. $api.setStorage("agentName", ret.data.data.name);
  150. $api.setStorage("kunnr", ret.data.data.kunnr);
  151. $api.setStorage('subRoleName', 'superAdmin');//存储登录的角色
  152. $api.setStorage('showScope', ret.data.data.showScope);
  153. _this.sendEvent("saveUserPwdInfo",ret);
  154. // 判断是否进行选择业务场景
  155. if(ret.data.data.showScope){
  156. setTimeout(function() {
  157. api.closeToWin({
  158. name: 'root'
  159. });
  160. }, 500);
  161. }else{
  162. setTimeout(function() {
  163. api.closeWin({});
  164. $api.setStorage('roleScene', ret.data.data.spart);
  165. _this.loginEntrance(ret.data.data.spart,'..');
  166. }, 500);
  167. }
  168. }
  169. });
  170. }else if(params=="phoneCode"){
  171. data = {
  172. tel : this.userCode,
  173. authCode : this.userPassword,
  174. cookie : this.codeCookie,
  175. url : 'json',
  176. type : 'body'
  177. }
  178. };
  179. this.$post("salesmanRegister", data, function(ret) {
  180. if (ret.code == 0 || ret.code == '0') {
  181. if(ret.data == null){
  182. api.toast({ msg : "账号不存在" });
  183. return;
  184. };
  185. _this.showToast("登录成功");
  186. $api.setStorage("pertel", ret.data.userMsg.tel);
  187. $api.setStorage("loginToken", ret.data.loginToken);
  188. $api.setStorage('subRoleName', 'orderPer');
  189. $api.setStorage('showScope', false);
  190. setTimeout(function() {
  191. $api.setStorage('roleScene', "500");
  192. _this.loginEntrance("500",'..');
  193. }, 500);
  194. }
  195. })
  196. },
  197. // 获取短信验证码
  198. getPhoneCode: function () {
  199. if (this.wait < 60) {
  200. return;
  201. };
  202. var data = "tel=" + this.userCode,_this = this;
  203. var url = "getPhoneCode";
  204. this.$get(url, data, function (ret) {
  205. if (ret.code == 0 || ret.code == '0') {
  206. _this.codeCookie = ret.cookie;
  207. api.toast({
  208. msg: '验证码发送成功'
  209. });
  210. _this.startResod();
  211. }else{
  212. api.toast({
  213. msg: ret.msg
  214. });
  215. }
  216. })
  217. },
  218. // 开始倒计时
  219. startResod: function () {
  220. var _this = this;
  221. if (this.wait == 0) {
  222. this.wait = 60;
  223. } else {
  224. this.wait--;
  225. setTimeout(function () {
  226. _this.startResod();
  227. }, 1000)
  228. }
  229. }
  230. },
  231. filters : {
  232. },
  233. mounted : function() {
  234. api.addEventListener({
  235. name : 'keyback'
  236. }, function(ret, err) {
  237. api.closeWidget({
  238. id : 'A6040771020543', //这里是应用id
  239. retData : {
  240. name : 'closeWidget'
  241. },
  242. animation : {
  243. type : 'flip',
  244. subType : 'from_bottom',
  245. duration : 500
  246. }
  247. });
  248. });
  249. }
  250. })
  251. }
  252. </script>
  253. </html>