Login.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  1. <template>
  2. <div class="login-all">
  3. <div class="login-haed">
  4. <div class="img-logo">
  5. <div class="logos">
  6. <img src="../assets/logo2.png" />
  7. </div>
  8. <div class="names">PAN-AMEPICAN INTERNATIONAL</div>
  9. </div>
  10. <div class="help-box">
  11. <div class="help-title">没有企业账户?</div>
  12. <div class="help-btn">去注册</div>
  13. </div>
  14. </div>
  15. <div class="login-dominant">
  16. <div class="login-box">
  17. <div class="login-title">泛美国际 - AI智能办公系统</div>
  18. <div class="login-input">
  19. <el-input class="accounts" placeholder="请输入您的账户" v-model="usernum">
  20. <i slot="prefix" class="el-input__icon icon-zhanghu"></i>
  21. </el-input>
  22. <el-input class="passwords" placeholder="请输入您的密码" show-password v-model="password">
  23. <i slot="prefix" class="el-input__icon icon-mima"></i>
  24. </el-input>
  25. <div class="el-input remembers">
  26. <div class="el-input-box">
  27. <input id="ckxjz" :checked="msgs" type="checkbox">
  28. <span class="two" @click="ckxclick"></span>
  29. <label for="ckxjz">记住账户</label>
  30. </div>
  31. <div class="fotger-pass">
  32. 忘记密码?
  33. </div>
  34. </div>
  35. <div class="loginbtn-box">
  36. <el-button @keyup.enter.native="Login()" @click="Login()" class="loginbtn" v-loading.fullscreen.lock="fullscreenLoading" round>登 录</el-button>
  37. </div>
  38. </div>
  39. <div></div>
  40. </div>
  41. </div>
  42. <div class="fout-box">
  43. PAN AMEPICAN INTERNATIONAL OA AI SYSTEM<br>
  44. © 2023 PAN AMEPICAN INTERNATIONAL CORPOPATION.ALL Rights Reserved.
  45. </div>
  46. </div>
  47. </template>
  48. <script>
  49. import Vuex from 'vuex';
  50. import { mapMutations, mapActions } from 'vuex'
  51. export default {
  52. ...mapMutations(['setphone']),//引入保存phone数据方法
  53. data() {
  54. return {
  55. usernum: '',
  56. password: '',
  57. msgs: false,
  58. fullscreenLoading:false
  59. }
  60. },
  61. methods: {
  62. ...mapActions(['vlogin']),
  63. //记住账户click
  64. ckxclick() {
  65. if (document.getElementById("ckxjz").checked == true) {
  66. document.getElementById("ckxjz").checked = false;
  67. } else {
  68. document.getElementById("ckxjz").checked = true;
  69. }
  70. },
  71. //登录
  72. Login() {
  73. if(this.usernum==""||this.password==""){
  74. this.$message({
  75. message: "请填写账号密码!",
  76. type: 'warning'
  77. });
  78. return false;
  79. }
  80. this.fullscreenLoading=true;
  81. var url="/api/login"
  82. var that=this
  83. this.$axios({
  84. method: 'post',
  85. url:url,
  86. data:{
  87. number: this.usernum,
  88. password: this.password
  89. }
  90. }).then(function(res){
  91. console.log(res)
  92. if(res.data.code==200){
  93. localStorage.setItem('userinif', JSON.stringify(res.data.data));
  94. that.fullscreenLoading=false;
  95. that.$router.push('/home/index')
  96. }else{
  97. that.fullscreenLoading=false;
  98. that.$message({
  99. message: res.data.msg,
  100. type: 'warning'
  101. });
  102. }
  103. })
  104. }
  105. },
  106. mounted() {
  107. document.querySelector(".login-all").style.height = window.innerHeight + "px";
  108. let that = this
  109. document.onkeydown = function (e) {
  110. e = window.event || e
  111. console.log(e.code)
  112. //保证是在登录页面发出的enter事件
  113. if (e.code === 'Enter' || e.code === 'enter'|| e.code === 'NumpadEnter') {
  114. //调用登录函数
  115. that.Login();
  116. }
  117. }
  118. }
  119. }
  120. </script>
  121. <style scoped>
  122. .fout-box {
  123. width: 100%;
  124. text-align: center;
  125. background-color: #0008;
  126. padding: 20px;
  127. color: #fff;
  128. line-height: 34px;
  129. position: fixed;
  130. bottom: 0;
  131. font-size: 14px;
  132. }
  133. #ckxjz {
  134. cursor: pointer;
  135. opacity: 0;
  136. }
  137. #ckxjz[type=checkbox]+span {
  138. display: inline-block;
  139. border-radius: 2px;
  140. width: 15px;
  141. height: 15px;
  142. border: 1px solid #FFF;
  143. background-color: transparent;
  144. position: absolute;
  145. left: 0px;
  146. top: 3px;
  147. cursor: pointer;
  148. }
  149. #ckxjz[type=checkbox]:checked+span::after {
  150. content: '\2714';
  151. color: #fff;
  152. position: absolute;
  153. font-size: 20px;
  154. left: 2px;
  155. bottom: -2px;
  156. }
  157. .login-all {
  158. background-image: url("../assets/back.png");
  159. background-repeat: no-repeat;
  160. background-size: 100% 100%;
  161. }
  162. .login-haed {
  163. padding: 50px 100px;
  164. display: flex;
  165. justify-content: space-between;
  166. }
  167. .img-logo {
  168. display: flex;
  169. align-items: center;
  170. }
  171. .logos {
  172. color: #fff;
  173. font-size: 48px;
  174. font-weight: 600;
  175. font-family: fangsong;
  176. width: 80px;
  177. height: 80px;
  178. }
  179. .logos img {
  180. width: 100%;
  181. }
  182. .names {
  183. color: #fff;
  184. margin-left: 20px;
  185. font-size: 24px;
  186. font-weight: 600;
  187. font-family: fangsong;
  188. }
  189. .help-box {
  190. display: flex;
  191. align-items: center;
  192. }
  193. .help-title {
  194. color: #fff;
  195. }
  196. .help-btn {
  197. margin-left: 20px;
  198. color: #1DA3D8;
  199. }
  200. .login-box {
  201. width: 400px;
  202. height: 300px;
  203. background-color: rgba(26, 30, 42, 0.7);
  204. /*background-color: rgba(42,53,88);*/
  205. margin: 0 auto;
  206. border-radius: 20px;
  207. padding: 20px 50px;
  208. margin-top: 120px;
  209. }
  210. .login-title {
  211. color: #fff;
  212. font-size: 24px;
  213. font-weight: 600;
  214. text-align: center;
  215. margin-top: 10px;
  216. margin-bottom: 20px;
  217. }
  218. .icon-mima {
  219. font-weight: 600;
  220. }
  221. .icon-zhanghu {
  222. color: #1DA3D8;
  223. }
  224. .icon-mima {
  225. color: #1DA3D8;
  226. }
  227. .remembers {
  228. display: flex;
  229. justify-content: space-between;
  230. align-items: center;
  231. }
  232. .fotger-pass {
  233. color: #1DA3D8;
  234. }
  235. .loginbtn {
  236. background-color: transparent;
  237. color: #1DA3D8;
  238. border: 1px solid #1DA3D8;
  239. }
  240. .loginbtn-box {
  241. text-align: center;
  242. padding: 25px;
  243. }
  244. </style>
  245. <style >
  246. body {
  247. margin: 0;
  248. padding: 0;
  249. }
  250. .login-input .el-input input {
  251. border-radius: 20px;
  252. background-color: transparent;
  253. color: #fff;
  254. }
  255. .loginbtn-box .el-button.is-round {
  256. border-radius: 25px;
  257. padding: 12px 50px;
  258. font-size: 20px;
  259. }
  260. .login-input .el-input {
  261. margin-top: 20px;
  262. }
  263. .el-input label {
  264. color: #fff;
  265. }
  266. .el-input__prefix {
  267. width: 40px;
  268. }
  269. .el-input--prefix .el-input__inner {
  270. padding-left: 50px;
  271. }
  272. /*.accounts{
  273. position: relative;
  274. }
  275. .accounts::after{
  276. content: "请输入您的账户";
  277. display: inline-block;
  278. position: absolute;
  279. color: #fff;
  280. left: 50px;
  281. top: -10px;
  282. background-color: rgba(42,53,88);
  283. /*background-image: url("../assets/zhedang.png");
  284. }
  285. .passwords{
  286. position: relative;
  287. }
  288. .passwords::after{
  289. content: "请输入您的密码";
  290. display: inline-block;
  291. position: absolute;
  292. color: #fff;
  293. left: 50px;
  294. top: -10px;
  295. background-color: rgba(42,53,88);
  296. /*background-image: url("../assets/zhedang.png");
  297. }*/</style>