login.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. <!DOCTYPE html>
  2. <html lang="zh-cn">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="format-detection" content="email=no" />
  6. <meta name="format-detection" content="telephone=no" />
  7. <title>登录</title>
  8. <link rel="stylesheet" href="../css/reset.css">
  9. <script src="../js/flexible.js"></script>
  10. <script src="../js/api.js"></script>
  11. <script src="../js/checkLanguage.js"></script>
  12. <style>
  13. html,body{
  14. height: 100%;
  15. overflow: hidden;
  16. }
  17. .flex-wrap{
  18. display: -webkit-box;
  19. display: -webkit-flex;
  20. display: flex;
  21. }
  22. .flex-con{
  23. -webkit-box-flex: 1;
  24. -webkit-flex: 1;
  25. flex: 1;
  26. }
  27. body{
  28. display: -webkit-box;
  29. display: -webkit-flex;
  30. display: flex;
  31. -webkit-box-orient: vertical;
  32. -webkit-flex-flow: column;
  33. flex-flow: column;
  34. }
  35. header{
  36. height: 1.4rem;
  37. line-height: 1.4rem;
  38. background-color: #51c4d4;
  39. display: none;
  40. }
  41. header h2{
  42. width: 100%;
  43. height: 100%;
  44. font-size: .5rem;
  45. color: #fff;
  46. font-weight: normal;
  47. text-align: center;
  48. position: relative;
  49. }
  50. main{
  51. height: calc(100% - 1.4rem);
  52. padding-top: 1.5rem;
  53. }
  54. .banner{
  55. width: 7.7rem;
  56. height: 5.77rem;
  57. margin: .3rem auto 1rem;
  58. }
  59. .banner img{
  60. display: block;
  61. width: 100%;
  62. height: 100%;
  63. }
  64. .inputDiv{
  65. padding: 0 1.02rem;
  66. }
  67. .inputDiv label{
  68. display: block;
  69. height: 1.1rem;
  70. border: 1px solid rgba(255,255,255,0.6);
  71. border-radius: 1rem;
  72. padding-left: .6rem;
  73. margin-bottom: .4rem;
  74. position: relative;
  75. }
  76. label>input{
  77. width: 100%;
  78. height: .5rem;
  79. color: rgba(255,255,255,0.8);
  80. background-color: rgba(0,0,0,0);
  81. border: none;
  82. outline: none;
  83. font-size: .4rem;
  84. padding-left: .4rem;
  85. margin-top: .34rem;
  86. }
  87. .inputDiv label>i{
  88. display: inline-block;
  89. position: absolute;
  90. left: .33rem;
  91. top: 50%;
  92. -webkit-transform: translateY(-50%);
  93. transform: translateY(-50%);
  94. }
  95. .inputDiv label.userName>i{
  96. width: .37rem;
  97. height: .54rem;
  98. top: 60%;
  99. }
  100. .inputDiv label.password>i{
  101. width: .33rem;
  102. height: .49rem;
  103. }
  104. .loginBtn{
  105. width: 100%;
  106. height: 1.1rem;
  107. line-height: 1.1rem;
  108. text-align: center;
  109. font-size: .48rem;
  110. color: #00b2e0;
  111. background-color: rgba(255,255,255,0.9);
  112. border-radius: .6rem;
  113. margin: .6rem 0;
  114. }
  115. .other{
  116. padding: .3rem 1.02rem 0;
  117. font-size: .36rem;
  118. color:rgba(255,255,255,0.8);
  119. }
  120. ::-webkit-input-placeholder{
  121. color: rgba(255,255,255,0.8);
  122. }
  123. </style>
  124. </head>
  125. <body>
  126. <header>
  127. <h2 class="headTit"></h2>
  128. </header>
  129. <main class="flex-con">
  130. <div class="banner">
  131. <img src="../images/loginLogo.png" alt="">
  132. </div>
  133. <div class="inputDiv">
  134. <form action="#">
  135. <label class="userName"><i><img src="../images/login1.png" alt=""></i><input type="text" value="" class="login1Input" id="username" placeholder="请输入手机号/邮箱"></label>
  136. <label class="password"><i><img src="../images/login2.png" alt=""></i><input type="password" value="" class="login2Input" id="password" placeholder="请输入密码"></label>
  137. </form>
  138. <div class="loginBtn btn1"></div>
  139. </div>
  140. <div class="other clearFix">
  141. <span class="left register btn2"></span>
  142. <span class="right findPW btn3"></span>
  143. </div>
  144. </main>
  145. <script type="text/javascript">
  146. try {
  147. var text=languages.login;
  148. $api.dom(".headTit").innerText=text.tit;
  149. $api.dom(".login1Input").setAttribute("placeholder",text.login1Input);
  150. $api.dom(".login2Input").setAttribute("placeholder",text.login2Input);
  151. $api.dom(".btn1").innerText=text.btn1;
  152. $api.dom(".btn2").innerText=text.btn2;
  153. $api.dom(".btn3").innerText=text.btn3;
  154. }catch (e){
  155. alert(languages.all.list5)
  156. }
  157. </script>
  158. <script src="../js/publicData.js"></script>
  159. <script src="../js/jquery-3.1.0.min.js"></script>
  160. <script src="../js/pinyin.js" type="text/javascript" charset="utf-8"></script>
  161. <script>
  162. try{
  163. var userInfo=$api.getStorage("thisUP");
  164. if(userInfo&&userInfo.username){
  165. $api.dom('#username').value=userInfo.username;
  166. $api.dom('#password').value=userInfo.password;
  167. }
  168. }catch (e){console.log('err')}
  169. apiready=function () {
  170. $(".loginBtn").on('click',function () {
  171. if(!$("#username").val()){
  172. api.toast({
  173. msg: languages.login.remind1,
  174. duration: 1000,
  175. location: 'bottom'
  176. });
  177. return;
  178. }
  179. if(!$("#password").val()){
  180. api.toast({
  181. msg: languages.login.remind2,
  182. duration: 1000,
  183. location: 'bottom'
  184. });
  185. return;
  186. }
  187. api.toast({
  188. msg: languages.login.remind3+'...',
  189. duration: 1000,
  190. location: 'bottom'
  191. });
  192. $api.setStorage("orderIndex",0);
  193. $api.setStorage("issueIndex",0);
  194. var postData={
  195. number:$("#username").val(),
  196. repwd:$("#password").val()
  197. }
  198. api.ajax({
  199. url: pageUrl+"login/login",
  200. method: 'post',
  201. timeout: 30,
  202. dataType: 'json',
  203. returnAll: false,
  204. data: {
  205. values: postData
  206. }
  207. }, function (ret, err) {
  208. var data=ret;
  209. console.log(JSON.stringify(data))
  210. if(data.status=="200"){
  211. //更新运价数据
  212. $(".loginBtn").off('click').text(languages.login.remind4+"...");
  213. $api.setStorage("user",data.data);
  214. $api.setStorage("thisUP",{"username":postData.number,"password":postData.repwd});
  215. var services={
  216. "shop":data['data']['user_singel']?data['data']['user_singel']['Isshop']:0,
  217. "assurance":data['data']['user_singel']?data['data']['user_singel']['IsGuarantee']:0,
  218. "recommend":data['data']['user_singel']?data['data']['user_singel']['IsRecommend']:0,
  219. "partner":data['data']['user_singel']?data['data']['user_singel']['IsTeam']:0
  220. }
  221. $api.setStorage("serviceStatus",services);
  222. $api.setStorage("issueName","Putaway");
  223. //登陆后加载初始化数据
  224. setTimeout(function () {
  225. api.execScript({
  226. name: 'root',
  227. frameName: 'orderUntreated',
  228. script: 'getdata(true,0);'
  229. });
  230. api.execScript({
  231. name: 'root',
  232. frameName: 'orderNav',
  233. script: 'getTotal();'
  234. });
  235. api.sendEvent({
  236. name: 'loginInit',
  237. extra: {key: 'yes'}
  238. });
  239. },200)
  240. setTimeout(function () {
  241. api.closeToWin({
  242. name: 'root',
  243. animation: {
  244. type: 'reveal',
  245. subType: 'from_left',
  246. duration: 400
  247. },
  248. delay:200
  249. });
  250. },2500)
  251. }else {
  252. api.toast({
  253. msg: data.message,
  254. duration: 2000,
  255. location: 'bottom'
  256. });
  257. }
  258. })
  259. })
  260. $(".findPW").click(function () {
  261. api.openWin({
  262. name: 'findPW',
  263. url: './findPW.html',
  264. animation: {
  265. type: 'push',
  266. subType: 'from_right',
  267. duration: 400
  268. },
  269. delay:200
  270. });
  271. })
  272. $(".register").click(function () {
  273. api.openWin({
  274. name: 'register',
  275. url: './register.html',
  276. bgColor:"widget://images/loginBG.jpg",
  277. animation: {
  278. type: 'push',
  279. subType: 'from_left',
  280. duration: 400
  281. },
  282. delay:200
  283. });
  284. })
  285. var backSecond = 0;
  286. api.addEventListener({
  287. name: 'keyback'
  288. }, function(ret, err) {
  289. var curSecond = new Date().getSeconds();
  290. if (Math.abs(curSecond - backSecond) > 2) {
  291. backSecond = curSecond;
  292. api.toast({
  293. msg: languages.all.list29,
  294. duration: 2000,
  295. location: 'bottom'
  296. });
  297. } else {
  298. api.closeWidget({
  299. id: 'A6050144312590', //这里改成自己的应用ID
  300. retData: {
  301. name: 'closeWidget'
  302. },
  303. silent: true
  304. });
  305. }
  306. });
  307. }
  308. function changePW(val) {
  309. $api.dom('#password').value=val;
  310. }
  311. </script>
  312. </body>
  313. </html>