login6.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <template>
  2. <view class="login-box">
  3. <view class="top-right-corner"></view>
  4. <view class="lower-left-corner"></view>
  5. <view class="login-top">欢迎登录</view>
  6. <fs-form ref="loginRef" :model="loginModel">
  7. <fs-field bgColor="#f8f7fc" placeholder="请输入账号" v-model="loginModel.name">
  8. <template #before>
  9. <fs-icon type="icon-user" color="#666666"></fs-icon>
  10. </template>
  11. </fs-field>
  12. <fs-gutter height="40rpx" bgColor="#fff"></fs-gutter>
  13. <fs-field bgColor="#f8f7fc" placeholder="请输入密码" v-model="loginModel.password">
  14. <template #before>
  15. <fs-icon type="icon-password" color="#666666"></fs-icon>
  16. </template>
  17. </fs-field>
  18. <fs-gutter height="100rpx" bgColor="#fff"></fs-gutter>
  19. <fs-button full round @click="handleLogin" type="danger">登录</fs-button>
  20. </fs-form>
  21. </view>
  22. </template>
  23. <script setup>
  24. import { ref, reactive } from 'vue'
  25. import useForm from '@/hooks/useForm'
  26. import { useUserStore } from '@/stores/user'
  27. const user = useUserStore()
  28. const loginRules = {
  29. name: {
  30. required: true,
  31. message: '请输入账号'
  32. },
  33. password: {
  34. required: true,
  35. message: '请输入密码'
  36. }
  37. }
  38. const loginModel = reactive({
  39. name: '',
  40. password: ''
  41. })
  42. const loginRef = ref(null)
  43. const loginForm = useForm(loginRules, 'loginRef')
  44. const handleLogin = () => {
  45. loginForm.validate().then(() => {
  46. user
  47. .login({
  48. ...loginModel
  49. })
  50. .then(res => {
  51. uni.navigateBack()
  52. })
  53. })
  54. }
  55. </script>
  56. <style>
  57. page {
  58. background-color: #fff;
  59. }
  60. </style>
  61. <style lang="scss" scoped>
  62. .top-right-corner {
  63. position: fixed;
  64. top: -280rpx;
  65. right: -280rpx;
  66. width: 600rpx;
  67. height: 600rpx;
  68. background-color: #fff;
  69. border: 100rpx solid #ffdddf;
  70. border-radius: 100%;
  71. z-index: 1;
  72. }
  73. .lower-left-corner {
  74. position: fixed;
  75. bottom: -450rpx;
  76. left: -200rpx;
  77. width: 600rpx;
  78. height: 600rpx;
  79. background-color: #fff;
  80. border: 100rpx solid #c7e1fa;
  81. transform: rotate(-45deg);
  82. z-index: 1;
  83. }
  84. .login-box {
  85. padding: 30rpx;
  86. }
  87. .login-top {
  88. font-size: 50rpx;
  89. letter-spacing: 5rpx;
  90. font-weight: bold;
  91. text-align: center;
  92. margin: 300rpx 0 100rpx;
  93. }
  94. </style>