index.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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 {pageStudyInfo, listStudyInfo} from 'common/api/index';
  35. export default {
  36. data() {
  37. return {
  38. isLogin: true,
  39. radioShow: true, //默认勾上
  40. title: '黑马教育',
  41. eyeOpen: false,
  42. pwdOpen: true,
  43. userInfo: {
  44. username: '',
  45. password: ''
  46. }
  47. }
  48. },
  49. methods: {
  50. // 登录
  51. async login() {
  52. if (!this.radioShow) {
  53. this.$tools.msg('用户协议和隐私政策未勾选')
  54. } else if (!this.userInfo.username) {
  55. this.$tools.msg('请填写账号')
  56. } else if (!this.userInfo.password) {
  57. this.$tools.msg('请输入密码')
  58. } else {
  59. // let token = 'token123'
  60. // uni.setStorageSync('token', token)
  61. //
  62. // uni.switchTab({
  63. // url: '/pages/index/index'
  64. // })
  65. // setTimeout(() => {
  66. // }, 500)
  67. let res = await pageStudyInfo();
  68. console.log(res)
  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: 2rem 0 1.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 40rpx;
  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. .agree-radio {
  134. width: 1.2rem;
  135. height: 1.2rem;
  136. border-radius: 50%;
  137. border: 1px solid #999;
  138. }
  139. .agree-radio-active {
  140. position: relative;
  141. width: 1.2rem;
  142. height: 1.2rem;
  143. border-radius: 50%;
  144. border: 1px solid transparent;
  145. background-color: #428AF6;
  146. }
  147. .agree-radio-active::after {
  148. position: absolute;
  149. content: '';
  150. left: 50%;
  151. width: 4rpx;
  152. height: 8rpx;
  153. top: 50%;
  154. transform: translateY(-60%) translateX(-50%) rotate(38deg);
  155. border: 4rpx solid #fff;
  156. border-width: 0 3rpx 3rpx 0;
  157. }
  158. .agree-title {
  159. margin-left: 10rpx;
  160. font-size: 1.2rem;
  161. color: #333;
  162. }
  163. }
  164. .container-bth {
  165. margin: 1.5rem 40rpx;
  166. border-radius: 16rpx;
  167. height: 4rem;
  168. background-color: #5990F5;
  169. text-align: center;
  170. color: #fff;
  171. font-size: 1.8rem;
  172. line-height: 4rem;
  173. letter-spacing: 2rpx;
  174. }
  175. </style>