index.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <template>
  2. <view>
  3. <view class="tips">
  4. <view class="title">欢迎{{ isLogin ? '登录' : '注册' }}{{ title }}</view>
  5. <view class="sub-title" style="">便捷高效管理学生信息</view>
  6. </view>
  7. <u-form :model="userInfo">
  8. <view class="container-input">
  9. <u-form-item style="padding: .5rem 0">
  10. <input placeholder="请输入账号" v-model="userInfo.userName" placeholderStyle="color: #c0c4cc"
  11. style="font-size: 1.5rem;"></input>
  12. </u-form-item>
  13. </view>
  14. <view class="container-input" style="margin-top: 1.2rem;">
  15. <u-form-item style="padding: .5rem 0">
  16. <input :password="pwdOpen" placeholder="请输入密码" v-model="userInfo.password"
  17. placeholderStyle="color: #c0c4cc" style="font-size: 1.5rem">
  18. </input>
  19. </u-form-item>
  20. </view>
  21. </u-form>
  22. <view class="agree-list">
  23. <view :class="[radioShow ? 'agree-radio-active' : 'agree-radio']" @click="agree"></view>
  24. <view class="agree-title">我已阅读并同意
  25. <text style="font-size: 1.2rem;color: #428AF6;">《用户协议》</text>
  26. 以及
  27. <text style="font-size: 1.2rem;color: #428AF6;">《隐私政策》</text>
  28. </view>
  29. </view>
  30. <view class="container-bth" @click="login">登录</view>
  31. </view>
  32. </template>
  33. <script>
  34. import {login} from 'common/api/index';
  35. import UFormItem from "../../uview-ui/components/u-form-item/u-form-item.vue";
  36. export default {
  37. components: {UFormItem},
  38. data() {
  39. return {
  40. isLogin: true,
  41. radioShow: true, //默认勾上
  42. title: '黑马教育',
  43. eyeOpen: false,
  44. pwdOpen: true,
  45. userInfo: {
  46. userName: '',
  47. password: ''
  48. }
  49. }
  50. },
  51. methods: {
  52. // 登录
  53. async login() {
  54. if (!this.radioShow) {
  55. this.$tools.msg('用户协议和隐私政策未勾选')
  56. } else if (!this.userInfo.userName) {
  57. this.$tools.msg('请填写账号')
  58. } else if (!this.userInfo.password) {
  59. this.$tools.msg('请输入密码')
  60. } else {
  61. // await login(this.userInfo).then((res) => {
  62. // console.log(res,'11111')
  63. // let token = res.token
  64. // uni.setStorageSync('token', token)
  65. uni.switchTab({
  66. url: '/pages/index/index'
  67. })
  68. // })
  69. }
  70. },
  71. agree() {
  72. this.radioShow = !this.radioShow
  73. },
  74. }
  75. }
  76. </script>
  77. <style>
  78. page {
  79. background: linear-gradient(270deg, #E1ECFE 0%, #DDFCFF 100%);
  80. overflow: hidden;
  81. }
  82. </style>
  83. <style lang="scss" scoped>
  84. .tips {
  85. margin: 1rem 0 .5rem 0;
  86. width: 100%;
  87. text-align: center;
  88. .title {
  89. font-size: 1.5rem;
  90. font-family: PingFang SC, PingFang SC;
  91. font-weight: bold;
  92. letter-spacing: 2rpx;
  93. color: #26344D;
  94. }
  95. .sub-title {
  96. font-size: 1.1rem;
  97. font-family: PingFang SC, PingFang SC;
  98. letter-spacing: 2rpx;
  99. color: #26344D;
  100. margin-top: 10rpx;
  101. }
  102. }
  103. .container-input {
  104. margin: 0 20%;
  105. background-color: #fff;
  106. border-radius: 16rpx;
  107. padding-left: 32rpx;
  108. padding-right: 32rpx;
  109. .eye-input {
  110. width: 100%;
  111. position: relative;
  112. display: flex;
  113. justify-content: space-between;
  114. align-items: center;
  115. .eye-image {
  116. position: absolute;
  117. right: 0;
  118. width: 30rpx;
  119. height: 30rpx;
  120. margin-left: 20rpx;
  121. flex-shrink: 0;
  122. image {
  123. width: 100%;
  124. height: 100%;
  125. }
  126. }
  127. }
  128. }
  129. .agree-list {
  130. margin: 16px 0 0 20px;
  131. display: flex;
  132. align-items: center;
  133. justify-content: center;
  134. .agree-radio {
  135. width: 1.2rem;
  136. height: 1.2rem;
  137. border-radius: 50%;
  138. border: 1px solid #999;
  139. }
  140. .agree-radio-active {
  141. position: relative;
  142. width: 1.2rem;
  143. height: 1.2rem;
  144. border-radius: 50%;
  145. border: 1px solid transparent;
  146. background-color: #428AF6;
  147. }
  148. .agree-radio-active::after {
  149. position: absolute;
  150. content: '';
  151. left: 50%;
  152. width: 4rpx;
  153. height: 8rpx;
  154. top: 50%;
  155. transform: translateY(-60%) translateX(-50%) rotate(38deg);
  156. border: 4rpx solid #fff;
  157. border-width: 0 3rpx 3rpx 0;
  158. }
  159. .agree-title {
  160. margin-left: 10rpx;
  161. font-size: 1.2rem;
  162. color: #333;
  163. }
  164. }
  165. .container-bth {
  166. margin: 1.5rem 30%;
  167. border-radius: 16rpx;
  168. height: 4rem;
  169. background-color: #5990F5;
  170. text-align: center;
  171. color: #fff;
  172. font-size: 1.8rem;
  173. line-height: 4rem;
  174. letter-spacing: 2rpx;
  175. }
  176. </style>