index.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <template>
  2. <view class="login">
  3. <capsule></capsule>
  4. <view class="login-container">
  5. <view class="login-tab">
  6. <view v-for="item in loginList" :key="item.id" :class="idx == item.id ? 'act' : ''"
  7. @click="changeIdx(item.id)">{{ item.title }}</view>
  8. </view>
  9. <view class="login-ipt">
  10. <view class="ipt-list">
  11. <tui-input placeholder="请输入您的账号" v-model="loginAccount.account" :inputBorder="true"
  12. :radius="16"></tui-input>
  13. <view class="password" v-show="idx == 0">
  14. <tui-input :type="!showIcon ? 'text' : 'password'" placeholder="请输入您的密码"
  15. v-model="loginAccount.password" :inputBorder="true" :radius="16">
  16. <template #right>
  17. <view v-if="showIcon">
  18. <tui-icon name="unseen" :size="26" @click="changeIcon(false)"></tui-icon>
  19. </view>
  20. <view v-else>
  21. <tui-icon name="seen" :size="26" @click="changeIcon(true)"></tui-icon>
  22. </view>
  23. </template>
  24. </tui-input>
  25. </view>
  26. <view class="code" v-show="idx == 1">
  27. <tui-input placeholder="请输入验证码" v-model="loginAccount.code" :inputBorder="true" :radius="16">
  28. <template #right>
  29. <tui-countdown-verify :successVal="successVal" @send="getVerify" color="#EF530E"
  30. borderColor="transparent" :size="28" :seconds="60"
  31. :resetVal="resetVal"></tui-countdown-verify>
  32. </template>
  33. </tui-input>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="login-protocol">
  38. <view class="protocal-conter">
  39. <view v-show="protocolTrue" @click="radioClick(false)">
  40. <tui-icon name="circle-selected" :size="32" unit="rpx" color="#EF530E"></tui-icon>
  41. </view>
  42. <view v-show="!protocolTrue" @click="radioClick(true)">
  43. <tui-icon name="circle" :size="32" unit="rpx"></tui-icon>
  44. </view>
  45. <view class="protocol-txt">
  46. <text :style="{ color: protocolTrue ? '#000' : '#CCCCCC' }">我已经阅读并同意</text>
  47. <text :style="{ color: protocolTrue ? '#EF530E' : '#FFD2BE' }">《用户协议及隐私政策》</text>
  48. </view>
  49. </view>
  50. </view>
  51. <view class="btn-list">
  52. <view class="login-btn">登陆</view>
  53. <view class="register-btn">注册开店</view>
  54. </view>
  55. </view>
  56. </view>
  57. </template>
  58. <script>
  59. export default {
  60. data() {
  61. return {
  62. idx: 0,
  63. loginList: [
  64. {
  65. id: 0,
  66. title: '密码登录'
  67. },
  68. {
  69. id: 1,
  70. title: '验证码登录'
  71. }
  72. ],
  73. loginAccount: {
  74. account: '',
  75. password: '',
  76. code: ''
  77. },
  78. showIcon: true,
  79. protocolTrue: false,
  80. // 控制获取验证码成功
  81. successVal: 0,
  82. // 控制获取验证码失败
  83. resetVal: 0
  84. }
  85. },
  86. methods: {
  87. changeIdx(index) {
  88. this.idx = index
  89. },
  90. // 控制眼睛切换
  91. changeIcon(flag) {
  92. this.showIcon = flag
  93. },
  94. // 单选框修改
  95. radioClick(flag) {
  96. this.protocolTrue = flag
  97. },
  98. getVerify() {
  99. console.log("获取验证码");
  100. this.successVal++
  101. }
  102. },
  103. }
  104. </script>
  105. <style lang="scss" scoped>
  106. .login {
  107. width: 100vw;
  108. height: 100vh;
  109. .login-container {
  110. width: 100%;
  111. height: 100rpx;
  112. margin-top: 172rpx;
  113. padding: 0 68rpx;
  114. box-sizing: border-box;
  115. .login-tab {
  116. justify-content: space-between;
  117. font-size: 48rpx;
  118. padding-right: 70rpx;
  119. color: #999999;
  120. @include flex(space-between);
  121. margin-bottom: 60rpx;
  122. .act {
  123. color: #000;
  124. }
  125. }
  126. .login-ipt {
  127. width: 100%;
  128. .ipt-list {
  129. @include flex(center, column, 24rpx);
  130. .password{
  131. width: 100%;
  132. }
  133. .code{
  134. width: 100%;
  135. }
  136. }
  137. }
  138. .login-protocol {
  139. @include flex(center);
  140. margin-top: 34rpx;
  141. .protocal-conter {
  142. @include flex(center, null, 10rpx);
  143. .protocol-txt {
  144. font-size: 24rpx;
  145. }
  146. }
  147. }
  148. .btn-list {
  149. width: 100%;
  150. margin-top: 48rpx;
  151. @include flex(center, column, 32rpx);
  152. view {
  153. width: 100%;
  154. font-size: 36rpx;
  155. height: 96rpx;
  156. text-align: center;
  157. line-height: 96rpx;
  158. border-radius: 16rpx;
  159. }
  160. .login-btn {
  161. background-color: $primary-color;
  162. color: #fff;
  163. }
  164. .register-btn {
  165. border: 2rpx solid $primary-color;
  166. color: $primary-color;
  167. box-sizing: border-box;
  168. }
  169. }
  170. }
  171. }
  172. </style>