Login.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <template>
  2. <div class="login">
  3. <div class="login-par">
  4. <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-position="left" label-width="0px" class="demo-ruleForm login-container">
  5. <div class="login-logo">
  6. <img src="../assets/image/login_logo.png" style="width:80px;height:80px;"/>
  7. </div>
  8. <h3 class="title">工时管家</h3>
  9. <el-form-item class="login-input" prop="username">
  10. <el-input type="text" v-model="ruleForm.username" autocomplete="off" placeholder="账号" clearable prefix-icon="el-icon-user-solid"></el-input>
  11. </el-form-item>
  12. <el-form-item class="login-input" prop="password">
  13. <el-input type="password" v-model="ruleForm.password" @keyup.enter.native="handleSubmit" autocomplete="off" placeholder="密码" show-password prefix-icon="el-icon-lock"></el-input>
  14. </el-form-item>
  15. <el-form-item class="login-button" style="width:100%;">
  16. <el-button type="primary" style="width:100%;" @click.native.prevent="handleSubmit" :loading="logining">登录</el-button>
  17. </el-form-item>
  18. <div class="toRegister">
  19. <el-link type="primary" class="btn" style="float:left;" :underline="false">联系客服
  20. <div class="service">
  21. <p style="color: #333">扫码加客服微信</p>
  22. <img src="../assets/image/code.jpg">
  23. <p><span style="color: #333">QQ:</span><span id="QQ">3052894409</span></p>
  24. </div>
  25. </el-link>
  26. <el-link type="primary" style="margin-right:5px;" @click="dialogVisible=true" :underline="false">
  27. 使用说明
  28. </el-link>
  29. <el-link type="primary" @click="jumpTo" :underline="false">企业注册</el-link>
  30. </div>
  31. </el-form>
  32. </div>
  33. <el-dialog title="使用说明" :visible.sync="dialogVisible" width="500px">
  34. <p><a style="color:#409EFF;text-decoration:none" href="upload/工时管家使用说明_管理员.docx" download="工时管家使用说明_管理员.docx"
  35. target="_blank">工时管家使用说明_管理员.docx</a></p>
  36. <p><a style="color:#409EFF;text-decoration:none" href="upload/工时管家使用说明_项目经理.docx" download="工时管家使用说明_项目经理.docx"
  37. target="_blank">工时管家使用说明_项目经理.docx</a></p>
  38. <p><a style="color:#409EFF;text-decoration:none" href="upload/工时管家使用说明_普通员工.docx" download="工时管家使用说明_普通员工.docx"
  39. target="_blank">工时管家使用说明_普通员工.docx</a></p>
  40. </el-dialog>
  41. </div>
  42. </template>
  43. <script>
  44. export default {
  45. data() {
  46. return {
  47. dialogVisible: false,
  48. logining: false,
  49. // 登录信息
  50. ruleForm: {
  51. username: '',
  52. password: ''
  53. },
  54. rules: {
  55. username: [{ required: true, message: '请输入账号', trigger: 'blur' },],
  56. password: [{ required: true, message: '请输入密码', trigger: 'blur' },]
  57. }
  58. };
  59. },
  60. methods: {
  61. handleReset2() {
  62. this.$refs.ruleForm.resetFields();
  63. },
  64. jumpTo() {
  65. this.$router.push({ path: '/register' });
  66. },
  67. handleSubmit(ev) {
  68. this.$refs.ruleForm.validate((valid) => {
  69. if (valid) {
  70. var _this = this;
  71. this.logining = true;
  72. this.http.post(this.port.manage.login, this.ruleForm , res => {
  73. this.logining = false;
  74. if (res.code == "ok") {
  75. var user = res.data;
  76. sessionStorage.setItem('user', JSON.stringify(res.data));
  77. if (user.role == 3) {
  78. //公司高层
  79. this.$router.push({ path: '/cost' });
  80. } else if (user.role == 4) {
  81. //人事管理员
  82. this.$router.push({ path: '/team' });
  83. } else {
  84. this.$router.push({ path: '/daily' });
  85. }
  86. } else {
  87. this.$message({
  88. message: res.msg,
  89. type: 'error'
  90. });
  91. }
  92. }, error => {
  93. this.logining = false;
  94. this.$message({
  95. message: error,
  96. type: 'error'
  97. });
  98. })
  99. }
  100. });
  101. },
  102. },
  103. }
  104. </script>
  105. <style lang="scss" scoped>
  106. .login {
  107. height: 100%;
  108. .login-par {
  109. width: 100%;
  110. min-height: 100%;
  111. background: #f0f2f5 url('../assets/image/background.png') no-repeat 50%;
  112. background-size: 100%;
  113. padding: 110px 0 144px;
  114. position: relative;
  115. box-sizing: border-box;
  116. .login-logo {
  117. text-align: center;
  118. margin: 0 0 20px 0;
  119. }
  120. .login-container {
  121. -webkit-border-radius: 5px;
  122. border-radius: 5px;
  123. -moz-border-radius: 5px;
  124. background-clip: padding-box;
  125. width: 315px;
  126. height: 380px;
  127. padding: 25px 35px 25px 35px;
  128. background: #fff;
  129. border: 1px solid #eaeaea;
  130. box-shadow: 0 0 5px #cac6c6;
  131. border-top: 10px solid #20a0ff;
  132. margin:auto;
  133. .title {
  134. font-size: 20px;
  135. margin: 0px auto 40px auto;
  136. text-align: center;
  137. color: #505458;
  138. }
  139. .remember {
  140. margin: 0px 0px 35px 0px;
  141. }
  142. .login-input {
  143. margin: 30px 0 0 0;
  144. }
  145. .login-button {
  146. margin: 30px 0 0 0;
  147. }
  148. .login-button .el-button {
  149. padding: 14px;
  150. }
  151. }
  152. }
  153. }
  154. .toRegister {
  155. margin: 15px 0;
  156. text-align: right;
  157. position: relative;
  158. .service {
  159. display: none;
  160. width: 120px;
  161. position: absolute;
  162. background: #fff;
  163. text-align: center;
  164. padding: 10px;
  165. left: -30px;
  166. top: -210px;
  167. border-radius: 5px;
  168. box-shadow: 3px 3px 10px #dfdfdf;
  169. img {
  170. width: 80px;
  171. }
  172. }
  173. }
  174. .btn:hover .service {
  175. display: block;
  176. }
  177. </style>