login.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <template>
  2. <view class="login-page">
  3. <view class="title">
  4. <view>欢迎使用WORKARK</view>
  5. </view>
  6. <view class="form">
  7. <view class="tab">
  8. <view :class="loginType == 1 ? 'tab-item select type1' : 'tab-item type1'" @click="loginType=1">验证码登录
  9. </view>
  10. <view :class="loginType == 2 ? 'tab-item select type2' : 'tab-item type2'" @click="loginType=2">账号密码登陆
  11. </view>
  12. </view>
  13. <view class="inputs_button">
  14. <view class="inputs">
  15. <view class="account">
  16. <input type="number" v-model="account" :adjust-position="false" placeholder="手机号" />
  17. </view>
  18. <view class="password" v-if="loginType==2">
  19. <input :type="pwdShow? 'text' : 'password'" v-model="password" :adjust-position="false"
  20. placeholder="密码" />
  21. <uni-icons :type="pwdShow? 'eye-filled' : 'eye-slash-filled'" size="24" color="#cccccc"
  22. @click="pwdShow=!pwdShow">
  23. </uni-icons>
  24. </view>
  25. <view class="vcode" v-if="loginType==1">
  26. <input type="number" v-model="vcode" :adjust-position="false" placeholder="验证码" />
  27. <text v-if="vcodeTime==0" style="color:#3264ed" @click="getVcode">获取验证码</text>
  28. <text v-else style="color:#ccc">重新获取({{vcodeTime}}s)</text>
  29. </view>
  30. </view>
  31. <view class="button">
  32. <view @click="login">
  33. 登录
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. <view class="pact">
  39. <radio :checked="pactChecked" activeBackgroundColor="#3264ed" activeBorderColor="#3264ed"
  40. borderColor="#3264ed" color="#fff" @click="pactChange" />
  41. <view>我已阅读并同意<text @click="toPact">《用户协议》</text>和<text @click="toPact">《隐私协议》</text></view>
  42. </view>
  43. </view>
  44. </template>
  45. <script>
  46. export default {
  47. data() {
  48. return {
  49. account: "",
  50. password: "",
  51. vcode: "",
  52. loginType: 1,
  53. pwdShow: false,
  54. pactChecked: false,
  55. vcodeTime: 0,
  56. vcodeTimer: null
  57. }
  58. },
  59. onLoad() {
  60. },
  61. methods: {
  62. login() {
  63. uni.showToast({
  64. title: "登录方式" + this.loginType,
  65. icon: 'none'
  66. })
  67. },
  68. getVcode() {
  69. this.vcodeTime = 60
  70. this.vcodeTimer = setInterval(() => {
  71. if (this.vcodeTime > 0) {
  72. this.vcodeTime--
  73. } else {
  74. clearInterval(this.vcodeTimer)
  75. this.vcodeTimer = null
  76. }
  77. }, 1000)
  78. uni.showToast({
  79. title: "获取验证码",
  80. icon: 'none'
  81. })
  82. },
  83. pactChange() {
  84. this.pactChecked = !this.pactChecked
  85. },
  86. toPact() {
  87. uni.showToast({
  88. title: "协议",
  89. icon: 'none'
  90. })
  91. }
  92. }
  93. }
  94. </script>
  95. <style lang="scss" scoped>
  96. .login-page {
  97. min-height: 100vh;
  98. background: url("https://images.unsplash.com/photo-1519751138087-5bf79df62d5b?crop=entropy&cs=tinysrgb&fit=max&fm=jpg&ixid=M3wyMDUzMDJ8MHwxfHNlYXJjaHwyMHx8YmFja2dyb3VuZHxlbnwxfHx8fDE3MjExOTc4NjJ8MA&ixlib=rb-4.0.3&q=80&w=1080") no-repeat top center;
  99. background-size: 100%;
  100. display: flex;
  101. flex-direction: column;
  102. justify-content: space-between;
  103. .title {
  104. padding-top: 180rpx;
  105. padding-bottom: 40rpx;
  106. padding-left: 64rpx;
  107. font-size: 48rpx;
  108. font-weight: 700;
  109. color: #383838;
  110. }
  111. .form {
  112. flex: 1;
  113. margin: 0 32rpx;
  114. border-radius: 40rpx;
  115. background-color: #fff;
  116. overflow: hidden;
  117. .inputs_button {
  118. background-color: #fff;
  119. .inputs {
  120. padding: 150rpx 32rpx 0;
  121. margin-bottom: 80rpx;
  122. .account,
  123. .password,
  124. .vcode {
  125. height: 96rpx;
  126. border-radius: 20rpx;
  127. padding: 0 48rpx;
  128. display: flex;
  129. align-items: center;
  130. background-color: #f7fafc;
  131. input {
  132. flex: 1;
  133. }
  134. }
  135. .account {
  136. margin-bottom: 48rpx;
  137. }
  138. .vcode {
  139. text {
  140. text-wrap: nowrap;
  141. font-size: 26rpx;
  142. background-color: #fff;
  143. padding: 14rpx 30rpx;
  144. border-radius: 12rpx;
  145. }
  146. }
  147. }
  148. .button {
  149. padding: 0 32rpx;
  150. view {
  151. line-height: 96rpx;
  152. border-radius: 20rpx;
  153. text-align: center;
  154. font-size: 32rpx;
  155. background-color: #3264ed;
  156. color: #fff;
  157. }
  158. }
  159. }
  160. }
  161. .pact {
  162. display: flex;
  163. align-items: center;
  164. justify-content: center;
  165. padding-bottom: 120rpx;
  166. font-size: 24rpx;
  167. text {
  168. color: #3264ed;
  169. }
  170. radio {
  171. :deep(.uni-radio-input) {
  172. border: 1rpx solid #3264ed;
  173. }
  174. transform:scale(0.6)
  175. }
  176. }
  177. }
  178. .tab {
  179. display: flex;
  180. align-items: center;
  181. justify-content: space-between;
  182. background-color: #ecf1fb;
  183. height: 100rpx;
  184. background: linear-gradient(180deg, #e3ebf9 0%, #ffffff 100%);
  185. .tab-item {
  186. width: 340rpx;
  187. line-height: 100rpx;
  188. text-align: center;
  189. color: #9e9e9e;
  190. position: relative;
  191. &::after {
  192. content: '';
  193. width: 50rpx;
  194. height: 8rpx;
  195. display: block;
  196. background-color: $uv-primary;
  197. border-radius: 4rpx;
  198. position: absolute;
  199. left: 50%;
  200. bottom: 14rpx;
  201. transform: translateX(-50%);
  202. opacity: 0;
  203. }
  204. &.select {
  205. background-color: #fff;
  206. color: $uv-primary;
  207. }
  208. &.type1.select {
  209. border-radius: 0 40rpx 0 0;
  210. }
  211. &.type2.select {
  212. border-radius: 40rpx 0 0;
  213. }
  214. &.select::after {
  215. opacity: 1;
  216. }
  217. }
  218. }
  219. </style>