login.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <view class="normal-login-container">
  3. <view class="logo-content">
  4. <!-- <image src="../../static/jnImage/loginPage/logo.png">
  5. </image> -->
  6. <view class="logoTit">
  7. <view class="titleZN">晋能控股电力集团</view>
  8. <view class="titleZN">清洁能源有限公司</view>
  9. <view class="titleEN">发电场站生产实时运营管理平台</view>
  10. </view>
  11. </view>
  12. <view class="login-form-content">
  13. <view class="input-item flex align-center">
  14. <image src="../../static/jnImage/loginPage/userName.png">
  15. <input v-model="loginForm.username" class="input" type="text" placeholder="用户名" maxlength="30" />
  16. </view>
  17. <view class="input-item flex align-center">
  18. <image src="../../static/jnImage/loginPage/locked.png">
  19. <input v-model="loginForm.password" type="password" class="input" placeholder="密码" maxlength="20" />
  20. </view>
  21. <view class="action-btn">
  22. <button @click="handleLogin" class="login-btn">登录</button>
  23. </view>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. import {
  29. setToken
  30. } from '@/utils/auth'
  31. import {
  32. login
  33. } from '../../api/login.js'
  34. export default {
  35. name: 'Login',
  36. data() {
  37. return {
  38. captchaEnabled: false, // 验证码开关 TODO 芋艿:需要抽到配置里
  39. globalConfig: getApp().globalData.config,
  40. loginForm: {
  41. username: "admin",
  42. password: "123456"
  43. }
  44. }
  45. },
  46. methods: {
  47. // 登录方法
  48. handleLogin(params) {
  49. let that = this
  50. if (this.loginForm.username === "") {
  51. this.$modal.msgError("请输入您的账号")
  52. } else if (this.loginForm.password === "") {
  53. this.$modal.msgError("请输入您的密码")
  54. } else {
  55. this.pwdLogin({})
  56. }
  57. // that.$tab.switchTab('/pages/home/index')
  58. },
  59. // 密码登录
  60. pwdLogin() {
  61. this.$modal.loading("登录中,请耐心等待...")
  62. let params = {
  63. username: this.loginForm.username,
  64. password: this.loginForm.password
  65. }
  66. login(params).then(res => {
  67. if (res && res.data) {
  68. this.$modal.closeLoading()
  69. setToken(res.data)
  70. this.$tab.switchTab('/pages/home/index')
  71. }
  72. })
  73. },
  74. }
  75. }
  76. </script>
  77. <style lang="scss">
  78. page {
  79. background-color: #202246;
  80. }
  81. .normal-login-container {
  82. background: url('../../static/jnImage/loginPage/loginBac.png');
  83. background-size: cover;
  84. width: 100%;
  85. hieght: 100vh;
  86. .logo-content {
  87. width: 100%;
  88. font-size: 21px;
  89. text-align: center;
  90. padding-top: 45%;
  91. // image {
  92. // border-radius: 4px;
  93. // margin-top: 40px;
  94. // width: 80px;
  95. // height: 60px;
  96. // }
  97. .logoTit {
  98. color: #fff;
  99. .titleZN {
  100. font-size: 60upx;
  101. font-family: FZZhengHeiS-M-GB;
  102. font-weight: 500;
  103. color: #FFFFFF;
  104. letter-spacing: 3px;
  105. }
  106. .titleEN {
  107. margin-top: 5px;
  108. font-size: 26upx;
  109. color: #E5E9F2;
  110. letter-spacing: 5px;
  111. }
  112. }
  113. }
  114. .login-form-content {
  115. text-align: center;
  116. margin: 20px auto;
  117. margin-top: 50%;
  118. width: 80%;
  119. .input-item {
  120. margin: 20px auto;
  121. // background-color: #f5f6f7;
  122. height: 45px;
  123. border-bottom: 1px solid #f5f6f7;
  124. image {
  125. width: 20px;
  126. height: 23px;
  127. }
  128. .input {
  129. color: #fff;
  130. width: 100%;
  131. font-size: 14px;
  132. line-height: 20px;
  133. text-align: left;
  134. padding-left: 15px;
  135. .uni-input-wrapper {
  136. .input-placeholder {
  137. color: #fff;
  138. font-size: 16px;
  139. }
  140. }
  141. }
  142. }
  143. .login-btn {
  144. margin-top: 30px;
  145. height: 40px;
  146. color: #fff;
  147. background: #4287FF;
  148. border-radius: 10px;
  149. letter-spacing: 10px;
  150. line-height: 40px;
  151. }
  152. }
  153. .easyinput {
  154. width: 100%;
  155. }
  156. }
  157. .login-code-img {
  158. height: 45px;
  159. }
  160. </style>