user-login.html 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <!DOCTYPE html>
  2. <html class="h100p">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>登录-爽客邦</title>
  6. <meta name="keywords" content="登录-爽客邦">
  7. <meta name="description" content="登录-爽客邦">
  8. <meta content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,shrink-to-fit=no,user-scalable=no" name="viewport" viewport="cover">
  9. <meta name="apple-mobile-web-app-capable" content="yes">
  10. <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
  11. <meta content="telephone=no" name="format-detection">
  12. <meta content="email=no" name="format-detection">
  13. <meta name="apple-mobile-web-app-title" content="登录-爽客邦">
  14. <meta http-equiv="Cache-Control" content="no-siteapp">
  15. <link rel="stylesheet" href="./static/css/main.css">
  16. </head>
  17. <body class="bgc-back h100p nopb login">
  18. <div class="rel h100p" id="app">
  19. <div class="logo tc"><img src="./static/images/logo-text.png" alt=""></div>
  20. <div class="login-box" v-cloak>
  21. <van-field class="mb12" v-model="username" @input="checkLogin" placeholder="请输入登录手机号"></van-field>
  22. <van-field v-model="password" @input="checkLogin" :type="isShowPwd ? 'text' : 'password'" placeholder="请输入密码">
  23. <template #button>
  24. <van-button class="fr" @click="showPwd()"><img class="fr" :src="isShowPwd ? './static/images/show-icon@3x.png' : './static/images/noshow-icon@3x.png'" alt=""></van-button>
  25. </template>
  26. </van-field>
  27. <div class="df pt16">
  28. <van-checkbox v-model="autoLogin" icon-size=".426667rem" checked-color="#ec5e3b"><span class="f12 c999">记住密码</span></van-checkbox>
  29. <div class="f12 c999 flex1 tr" @click="forgetpwd">忘记密码?</div>
  30. </div>
  31. <div class="pt16">
  32. <van-button type="primary" block :disabled="canLogin ? false : true" color="#FF502A" @click="login">登录</van-button>
  33. </div>
  34. <div class="login-tip tc">
  35. <div class="f12 c999">还没有账号?<span class="more" @click="regist">立即注册 &gt;</span></div>
  36. </div>
  37. </div>
  38. <div class="login-bottom tc abs">
  39. <div class="f12 caaa pb8 van-hairline--bottom">登录即表示同意<span @click="goservice">「爽客邦服务协议」</span></div>
  40. <div class="f12 caaa pt8">客服热线:4001363866</div>
  41. </div>
  42. </div>
  43. <script src="./static/js/klm-vv.min.js"></script>
  44. <script src="./static/js/klm-axios-config.js"></script>
  45. <script>
  46. // 通过 CDN 引入时不会自动注册 Lazyload 组件
  47. // 可以通过下面的方式手动注册
  48. Vue.use(vant.Lazyload);
  49. // 在 #app 标签下渲染一个按钮组件
  50. let app = new Vue({
  51. el: '#app',
  52. data() {
  53. return {
  54. username: '',
  55. password: '',
  56. isShowPwd: false,
  57. autoLogin: false,
  58. canLogin: false,
  59. };
  60. },
  61. created() {
  62. this.gettoken();
  63. this.username = PublicLib.getCookieInfo('userName');
  64. if(PublicLib.getCookieInfo('userPassword').length >= 6) this.password = PublicLib.getCookieInfo('userPassword');
  65. this.checkLogin();
  66. this.autoLogin = Boolean(PublicLib.getCookieInfo('userautologin'));
  67. console.log(this.autoLogin)
  68. console.log(Boolean(PublicLib.getCookieInfo('userautologin')))
  69. },
  70. methods: {
  71. //- giveToast(){
  72. //- vant.Toast('提示');
  73. //- },
  74. showPwd(){
  75. this.isShowPwd = !this.isShowPwd;
  76. },
  77. checkLogin(){
  78. this.canLogin = (this.username !== '' && this.password !== '') ? true : false;
  79. },
  80. //- 注册
  81. regist(){
  82. PublicLib.Goto({Url:'user-regist'});
  83. },
  84. //- 获取token
  85. async gettoken(){
  86. const res = await getRequest('/api/systemset/appchecktest',JSON.stringify({"uuid":"123456","salt":"123456"}));
  87. PublicLib.putCookieInfo('token', res.data.Token);
  88. },
  89. //- 登录
  90. async login(){
  91. PublicLib.putCookieInfo('userName', this.username);
  92. PublicLib.putCookieInfo('userPassword', '');
  93. PublicLib.putCookieInfo('userautologin', '');
  94. if(this.autoLogin) {
  95. PublicLib.putCookieInfo('userPassword', this.password);
  96. PublicLib.putCookieInfo('userautologin', this.autoLogin);
  97. };
  98. //- 验证手机号码是否正确
  99. if(!verificationphonenumber(this.username)){
  100. return tips('手机号码格式错误');
  101. };
  102. if(verificationpassword(this.password)) return;
  103. const value = JSON.stringify({Mobile:this.username,LoginPwd:this.password});
  104. const res = await getRequest('/api/v1/users/login',value);
  105. if(res.status !== '1') return tips(res.info);
  106. if(PublicLib.getCookieInfo('step') === '2'){
  107. PublicLib.Goto({Url:'gesture-inputpassword'});
  108. }else if(PublicLib.getCookieInfo('step') === undefined){
  109. PublicLib.Goto({Url:'gesture-setpassword'});
  110. }else {
  111. PublicLib.Goto({Url:'index'});
  112. };
  113. //- 存储用户ID
  114. PublicLib.putCookieInfo('userId', res.data.Id);
  115. },
  116. forgetpwd(){
  117. PublicLib.Goto({Url:'user-forgetpwd'});
  118. },
  119. goservice(){
  120. PublicLib.Goto({Url:'user-servce-agreement'});
  121. }
  122. }
  123. });
  124. </script>
  125. </body>
  126. </html>