血透系统pad前端

login.vue 5.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <template>
  2. <div class="container">
  3. <div class="newLogin">
  4. <div class="login">
  5. <div class="logo">
  6. <img src="../../assets/login/newLogo.png" alt />
  7. </div>
  8. <div class="reg">
  9. <div class="form">
  10. <ul>
  11. <li>
  12. <span class="iconfont">&#xe78b;</span>
  13. <input
  14. placeholder="请输入手机号"
  15. type="tel"
  16. class="tel"
  17. v-model="form.mobile"
  18. />
  19. </li>
  20. <li>
  21. <span class="iconfont">&#xe6c0;</span>
  22. <input
  23. placeholder="请输入密码"
  24. type="password"
  25. class="tel"
  26. v-model="form.pwd"
  27. />
  28. </li>
  29. </ul>
  30. </div>
  31. <!-- <router-link to="/product"> -->
  32. <button
  33. class="loginBtn"
  34. @click="loginAction"
  35. :class="loginDisable ? 'disableLoginBtn' : ''"
  36. :disabled="loginDisable"
  37. >
  38. 登录
  39. </button>
  40. <!-- <router-link to="/forgetPassword"> -->
  41. <div class="newForget" style="display:none">忘记密码</div>
  42. <!-- </router-link> -->
  43. <!-- </router-link> -->
  44. <!-- <div class="forget">
  45. <a href="">免密码登录</a>
  46. <a href="">忘记密码?</a>
  47. </div>-->
  48. </div>
  49. </div>
  50. </div>
  51. </div>
  52. </template>
  53. <script>
  54. import { loginByPwd } from "@/api/login";
  55. import { hex_md5 } from "@/utils/md5";
  56. import { getLoginInfoCache, cacheLoginInfo } from "@/utils/admin_info_cache";
  57. import { Toast } from "vant";
  58. export default {
  59. name: "Home",
  60. data() {
  61. return {
  62. form: {
  63. mobile: "",
  64. pwd: ""
  65. }
  66. };
  67. },
  68. computed: {
  69. loginDisable() {
  70. // return false
  71. return this.form.mobile.length == 0 || this.form.pwd.length == 0;
  72. }
  73. },
  74. created() {
  75. var loginInfo = getLoginInfoCache();
  76. this.form.mobile = loginInfo.mobile;
  77. this.form.pwd = loginInfo.password;
  78. },
  79. methods: {
  80. loginAction: function() {
  81. loginByPwd(this.form.mobile, hex_md5(this.form.pwd)).then(rs => {
  82. var resp = rs.data;
  83. if (resp.state == 1) {
  84. cacheLoginInfo(this.form.mobile, this.form.pwd);
  85. console.log(resp);
  86. var user = resp.data.user;
  87. var org = resp.data.org;
  88. var subscibe = resp.data.subscibe;
  89. var config_list = resp.data.config_list;
  90. var template_info = resp.data.template_info;
  91. var filed_list = resp.data.filed_list;
  92. console.log(resp.data.filed_list);
  93. console.log(filed_list);
  94. this.$store.dispatch("InitUserInfo", {
  95. user: user,
  96. org: org,
  97. subscibe: subscibe,
  98. template_info: template_info,
  99. filed_list: filed_list
  100. });
  101. this.$store.dispatch("SetConfigList", config_list);
  102. // this.$router.push({path: "/product"})
  103. this.$router.push({ path: "/main" });
  104. } else {
  105. this.$toast({
  106. message: resp.msg
  107. });
  108. }
  109. });
  110. },
  111. to: function() {
  112. this.$router.push({ path: "/forgetPassword" });
  113. }
  114. }
  115. };
  116. </script>
  117. <style rel="stylesheet/scss" lang="scss" scoped>
  118. .container {
  119. // background: $white-bg;
  120. background: #f5f5f5;
  121. @include box-sizing;
  122. position: fixed;
  123. width: 100%;
  124. height: 100%;
  125. display: flex;
  126. justify-content: space-between;
  127. .newLogin {
  128. width: 90%;
  129. height: 90%;
  130. margin: auto;
  131. box-shadow: 0px 2px 25px 0px rgba(37, 143, 252, 0.1);
  132. border-radius: 14px;
  133. background: #fff;
  134. }
  135. .login {
  136. // @include box-shadow;
  137. @include text-align;
  138. @include display-flex;
  139. @include align-items-center;
  140. // @include justify-content-center;
  141. @include flex-direction;
  142. height: 100%;
  143. .logo {
  144. padding: 3rem 0 2.5rem;
  145. img {
  146. width: 44%;
  147. height: auto;
  148. display: inline-block;
  149. }
  150. }
  151. .reg {
  152. width: 9.3rem;
  153. .welcome {
  154. text-align: left;
  155. font-size: 0.55rem;
  156. font-weight: 400;
  157. color: rgba(37, 143, 252, 1);
  158. margin-bottom: 0.5rem;
  159. // line-height: 14px;
  160. }
  161. .newForget {
  162. text-align: right;
  163. font-size: 0.45rem;
  164. font-weight: 400;
  165. color: rgba(37, 143, 252, 1);
  166. margin-top: 0.3rem;
  167. }
  168. .form {
  169. border: 1px $border-color solid;
  170. border-radius: 4px;
  171. li {
  172. border-bottom: 1px $border-color solid;
  173. @include align-items-center;
  174. @include text-align;
  175. @include display-flex;
  176. @include box-sizing;
  177. .tel {
  178. padding: 0.4rem 0;
  179. width: 90%;
  180. border: none;
  181. outline: none;
  182. font-size: 0.45rem;
  183. }
  184. .mint-cell {
  185. width: 100%;
  186. }
  187. &:last-child {
  188. border: none;
  189. }
  190. .iconfont {
  191. color: $main-color;
  192. font-size: 0.6rem;
  193. margin: 0 0.46rem;
  194. }
  195. }
  196. }
  197. .forget {
  198. text-align: left;
  199. padding: 0.45rem 1rem;
  200. a {
  201. float: left;
  202. font-size: 0.28rem;
  203. color: $main-color;
  204. &:nth-child(2) {
  205. color: #999999;
  206. float: right;
  207. }
  208. &:active {
  209. background: $white-bg;
  210. }
  211. }
  212. }
  213. .loginBtn {
  214. width: 100%;
  215. height: 1.4rem;
  216. line-height: 1.4rem;
  217. background: $main-color;
  218. color: #fff;
  219. font-size: 0.45rem;
  220. @include text-align;
  221. border-radius: 4px;
  222. margin: 1rem 0 0 0;
  223. }
  224. .disableLoginBtn {
  225. background: lightgray;
  226. }
  227. }
  228. }
  229. }
  230. </style>