index - 副本.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <template>
  2. <view class="content">
  3. <view class="title">辉南渣土车运输</view>
  4. <view class="loginBox">
  5. <u--form :model="loginForm" ref="uForm" :rules="rules">
  6. <u-form-item label="" prop="username">
  7. <u-input class="inputStyle" v-model="loginForm.username" placeholder="请输入用户账号" />
  8. </u-form-item>
  9. <u-form-item label="" prop="password">
  10. <u-input class="inputStyle" type="password" v-model="loginForm.password" placeholder="请输入密码" />
  11. </u-form-item>
  12. </u--form>
  13. <u-button @click="submit" class="mt buttonStyle">登 陆</u-button>
  14. <text class="register" @click="register">注册账号</text>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. export default {
  20. data() {
  21. return {
  22. loginForm: {
  23. username: '',
  24. password: '',
  25. },
  26. rules: {
  27. username: [{
  28. required: true,
  29. message: '请输入用户账号',
  30. trigger: ['blur', 'change']
  31. }, ],
  32. password: [{
  33. required: true,
  34. message: '请输入密码',
  35. trigger: ['blur', 'change']
  36. }, ]
  37. }
  38. }
  39. },
  40. onLoad() {
  41. },
  42. methods: {
  43. async register() {
  44. this.$tab.navigateTo('/pages/register/index')
  45. },
  46. // 密码登录
  47. async pwdLogin() {
  48. this.$store.dispatch('Login', this.loginForm).then(() => {
  49. this.$modal.closeLoading()
  50. this.loginSuccess()
  51. }).catch(() => {
  52. })
  53. },
  54. // 登录成功后,处理函数
  55. loginSuccess(result) {
  56. // 设置用户信息
  57. this.$store.dispatch('GetInfo').then(res => {
  58. this.$tab.reLaunch('/pages/home/index')
  59. })
  60. },
  61. submit() {
  62. this.$tab.navigateTo('/pages/home/index')
  63. // this.$refs.uForm.validate().then(res => {
  64. // this.$modal.loading("登录中,请耐心等待...")
  65. // this.pwdLogin()
  66. // }).catch(errors => {
  67. // })
  68. }
  69. }
  70. }
  71. </script>
  72. <style lang="scss" scoped>
  73. .content {
  74. width: 100%;
  75. height: 100vh;
  76. background-image: url('@/static/images/loginBj.png');
  77. background-size: 100% 100%;
  78. display: flex;
  79. flex-direction: column;
  80. /* border: 1px salmon soli;
  81. background-color: aquamarine; */
  82. }
  83. .title {
  84. text-align: center;
  85. font-size: 60rpx;
  86. // font-family: FZZongYi-M05S;
  87. font-weight: 600;
  88. margin-top: 18vh;
  89. color: #FFFFFF;
  90. letter-spacing: 9rpx;
  91. text-shadow: 0rpx 2rpx 13rpx rgba(27, 43, 95, 0.25);
  92. margin-bottom: 18vh;
  93. }
  94. .loginBox {
  95. width: 80%;
  96. margin: 0 auto;
  97. text-align: center;
  98. }
  99. .mt {
  100. margin-top: 78rpx;
  101. margin-bottom: 25rpx;
  102. }
  103. .register {
  104. margin-top: 47rpx;
  105. font-size: 26rpx;
  106. font-family: Source Han Sans CN;
  107. font-weight: 400;
  108. color: #FFFFFF;
  109. opacity: 0.5;
  110. }
  111. // // 未通过校验提示
  112. // /deep/ .u-form-item__body__right__message {
  113. // margin-left: 0 !important;
  114. // text-align: left;
  115. // }
  116. // /deep/ .u-form-item__body__right__content__slot{
  117. // // width: 562rpx;
  118. // height: 72rpx;
  119. // background: #A1C5EF;
  120. // border: 2rpx solid #77A8FF;
  121. // box-shadow: 0px 2rpx 13rpx 0px rgba(27,43,95,0.25), 0px 0px 24rpx 6rpx rgba(109,160,251,0.6);
  122. // // opacity: 0.8;
  123. // border-radius: 15rpx;
  124. // color: #FFFFFF;
  125. // font-size: 28rpx;
  126. // }
  127. .inputStyle {
  128. // border-width: 0 !important;
  129. // height: 72rpx;
  130. background: #A1C5EF;
  131. // background: rgba(255,255,255,0.74);
  132. border: 2rpx solid #77A8FF !important;
  133. box-shadow: 0px 2rpx 13rpx 0px rgba(27, 43, 95, 0.25), 0px 0px 24rpx 6rpx rgba(109, 160, 251, 0.6);
  134. // opacity: 0.8;
  135. border-radius: 15rpx;
  136. /deep/ .u-input__content__field-wrapper__field {
  137. color: #FFFFFF !important;
  138. font-size: 28rpx;
  139. }
  140. /deep/ .input-placeholder {
  141. color: #FFFFFF !important;
  142. font-size: 28rpx;
  143. }
  144. }
  145. .buttonStyle {
  146. // width: 562px;
  147. height: 72rpx;
  148. background: linear-gradient(0deg, #FFD334 0%, #F59A02 100%);
  149. box-shadow: 0px 2rpx 13rpx 0px rgba(27, 43, 95, 0.25);
  150. border-radius: 15rpx;
  151. border-width: 0;
  152. color: #FFFFFF;
  153. font-size: 28rpx;
  154. }
  155. </style>