You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

126 lines
2.6 KiB

10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
  1. <template>
  2. <view class="content">
  3. <view class="form">
  4. <view class="formItem">
  5. <view class="icon">
  6. <image src="../../static/images/icon (18).png" mode=""></image>
  7. </view>
  8. <view class="inputW">
  9. <u--input v-model="FormData.username" placeholder="请输入用户名" clearable></u--input>
  10. </view>
  11. </view>
  12. <view class="formItem">
  13. <view class="icon">
  14. <image src="../../static/images/icon (14).png" mode=""></image>
  15. </view>
  16. <view class="inputW">
  17. <u--input v-model="FormData.password" placeholder="请输入密码" clearable></u--input>
  18. </view>
  19. </view>
  20. <!-- <view class="formItem">
  21. <view class="inputW">
  22. <u--input v-model="FormData.phone" placeholder="请输入验证码" type="number" clearable></u--input>
  23. </view>
  24. <view class="sendCode">{{ sendCode }}</view>
  25. </view> -->
  26. <view class="formItem btnBg" @click="loginFn" :class="{actvie: loginActive}">登录</view>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. import { login } from '@/config/api.js'
  32. import md5 from 'js-md5';
  33. export default {
  34. data() {
  35. return {
  36. FormData: {
  37. password: 'fwq1234567890',
  38. username: 'fangwq'
  39. },
  40. sendCode: '获取验证码'
  41. }
  42. },
  43. onLoad() {
  44. },
  45. computed: {
  46. loginActive() {
  47. if(this.FormData.password.length>4&&this.FormData.username.length>4) {
  48. return true
  49. }
  50. return false
  51. }
  52. },
  53. methods: {
  54. async loginFn() {
  55. let obj = Object.assign({},this.FormData)
  56. obj.password = md5(this.FormData.password)
  57. const res = await login(obj)
  58. console.log(res)
  59. if(res.code==200) {
  60. this.FormData = {
  61. password: '',
  62. username: ''
  63. }
  64. console.log(res)
  65. this.$store.commit('update_vuex_loginInfo', res.data)
  66. this.$goPage('/pages/index/index')
  67. }
  68. }
  69. }
  70. }
  71. </script>
  72. <style lang="scss" scoped>
  73. .content {
  74. width: 100%;
  75. display: flex;
  76. justify-content: center;
  77. align-items: center;
  78. width: 100%;
  79. .form {
  80. width: 86%;
  81. margin-top: 24%;
  82. .formItem {
  83. width: 100%;
  84. display: flex;
  85. align-items: center;
  86. justify-content: center;
  87. height: 112rpx;
  88. border-radius: 56rpx;
  89. background: #f4f7ff;
  90. margin-bottom: 44rpx;
  91. padding: 0 50rpx;
  92. .icon {
  93. width: 48rpx;
  94. height: 48rpx;
  95. }
  96. .inputW {
  97. flex: 1;
  98. width: 0;
  99. u--input {
  100. }
  101. }
  102. .sendCode {
  103. font-size: 26rpx;
  104. color: rgb(192, 196, 204);;
  105. }
  106. &.btnBg {
  107. background: $themC;
  108. text-align: center;
  109. font-size: 30rpx;
  110. width: 100%;
  111. letter-spacing: 1em;
  112. opacity: 0.4;
  113. &.actvie {
  114. opacity: 1;
  115. }
  116. }
  117. }
  118. }
  119. }
  120. </style>