login-phone.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. <template>
  2. <view class="container">
  3. <u-navbar :is-fixed="false" :border-bottom="false" :is-back="false" back-icon-name="arrow-leftward" title="登录"
  4. :background="{ background: '#fff' }" title-color="#000000">
  5. <view class="" slot="right">
  6. <image src="/static/images/user/c8.png" class="set-icon" mode="widthFix"></image>
  7. </view>
  8. </u-navbar>
  9. <view class="content">
  10. <view class="top">
  11. <image src="/static/images/logo.png" class="logo" mode="widthFix"></image>
  12. <view class="cell">
  13. <view class="name">手机号</view>
  14. <view class="input-box">
  15. <input type="number" v-model="phone" placeholder="请输入手机号码" class="ipt" placeholder-class="hold"
  16. @blur="handleInputCheck" />
  17. </view>
  18. </view>
  19. <view class="cell">
  20. <view class="name">短信验证码</view>
  21. <view class="input-box">
  22. <input type="number" v-model="code" placeholder="请输入验证码" class="ipt" placeholder-class="hold"
  23. @blur="handleInputCheck" />
  24. <view class="code" @click="sendCode" v-if="count === 60">获取验证码</view>
  25. <view class="code" v-else><text>{{ count }}</text>秒重新获取</view>
  26. </view>
  27. </view>
  28. <!-- <view class="agree">
  29. 登录即代表同意
  30. <text class="a">《用户协议》</text>
  31. <text class="a">《隐私政策》</text>
  32. </view> -->
  33. <button class="submit" @click="submit" :disabled="disabled">登录</button>
  34. <view class="tip">未注册用户验证后将自动注册并登录</view>
  35. <navigator url="/pages/login/login-account" hover-class="none" class="change">密码登录 ></navigator>
  36. </view>
  37. <!-- 社交账号登录 -->
  38. <view class="bottom">
  39. <view class="tag">社交账号登录</view>
  40. <view class="chat-arr">
  41. <image src="/static/images/wx.png" class="icon" mode=""></image>
  42. <image src="/static/images/qq.png" class="icon" mode=""></image>
  43. <image src="/static/images/wb.png" class="icon" mode=""></image>
  44. </view>
  45. </view>
  46. </view>
  47. <!-- -->
  48. </view>
  49. </template>
  50. <script>
  51. export default {
  52. data() {
  53. return {
  54. phone: '',
  55. code: '',
  56. disabled: true,
  57. count: 60,
  58. timer: ''
  59. };
  60. },
  61. methods: {
  62. submit() {
  63. this.$u.func.showToast({
  64. title: '新版本即将到来',
  65. })
  66. },
  67. handleInputCheck() {
  68. if (!this.phone && !/^1\d{10}$/.test(this.phone)) {
  69. this.disabled = true
  70. return uni.showToast({
  71. title: '请输入正确的手机号',
  72. duration: 2000,
  73. icon: 'none'
  74. });
  75. }
  76. if (!this.code) {
  77. this.disabled = true
  78. return uni.showToast({
  79. title: '请输入验证码',
  80. duration: 2000,
  81. icon: 'none'
  82. });
  83. }
  84. this.disabled = false
  85. },
  86. async sendCode() {
  87. this.count = this.count - 1;
  88. this.timer = setInterval(() => {
  89. if (this.count == 0) {
  90. clearInterval(this.timer);
  91. this.count = 60;
  92. return;
  93. }
  94. this.count = this.count - 1;
  95. }, 1000);
  96. }
  97. }
  98. };
  99. </script>
  100. <style lang="scss">
  101. .container {
  102. min-height: 100vh;
  103. overflow: hidden;
  104. .set-icon {
  105. vertical-align: middle;
  106. width: 41rpx;
  107. height: auto;
  108. margin-right: 35rpx;
  109. }
  110. }
  111. .content {
  112. display: flex;
  113. flex-direction: column;
  114. justify-content: space-around;
  115. align-items: center;
  116. height: 90vh;
  117. width: 100%;
  118. .top {
  119. width: 100%;
  120. }
  121. .logo {
  122. display: block;
  123. width: 281rpx;
  124. height: auto;
  125. margin: 0 auto 120rpx;
  126. }
  127. .cell {
  128. width: 100%;
  129. padding: 0 85rpx;
  130. box-sizing: border-box;
  131. margin-top: 36rpx;
  132. .name {
  133. font-size: 22rpx;
  134. font-family: Source Han Sans CN;
  135. font-weight: 400;
  136. color: #3e4a59;
  137. line-height: 30rpx;
  138. opacity: 0.72;
  139. }
  140. .input-box {
  141. padding: 30rpx 0;
  142. border-bottom: 2rpx solid #f6f6f6;
  143. display: flex;
  144. align-items: center;
  145. .code {
  146. font-size: 22rpx;
  147. font-family: Source Han Sans CN;
  148. font-weight: 400;
  149. color: #0d0d0d;
  150. line-height: 30rpx;
  151. text {
  152. color: #14b9c8;
  153. }
  154. }
  155. .ipt {
  156. flex: 1;
  157. // height: 24rpx;
  158. font-size: 24rpx;
  159. }
  160. .hold {
  161. font-size: 26rpx;
  162. font-family: Source Han Sans CN;
  163. font-weight: 400;
  164. color: #3e4a59;
  165. line-height: 30px;
  166. opacity: 0.45;
  167. }
  168. }
  169. }
  170. .agree {
  171. margin: 27rpx 95rpx 0;
  172. font-size: 22rpx;
  173. font-family: Adobe Heiti Std;
  174. font-weight: normal;
  175. color: #cacaca;
  176. line-height: 34rpx;
  177. .a {
  178. color: #000000;
  179. }
  180. }
  181. .submit {
  182. margin: 60rpx 90rpx 0;
  183. border: none;
  184. width: 572rpx;
  185. height: 86rpx;
  186. line-height: 86rpx;
  187. box-sizing: border-box;
  188. border-radius: 15rpx;
  189. background-color: #14b9c8;
  190. color: #ffffff;
  191. &::after {
  192. content: none;
  193. }
  194. &::before {
  195. content: none;
  196. }
  197. &[disabled='true'] {
  198. background: #e4e4e4;
  199. font-size: 36rpx;
  200. font-family: Source Han Sans CN;
  201. font-weight: 500;
  202. color: #ffffff;
  203. }
  204. }
  205. .tip {
  206. margin-top: 30rpx;
  207. text-align: center;
  208. font-size: 22rpx;
  209. font-family: Adobe Heiti Std;
  210. font-weight: normal;
  211. color: #cacaca;
  212. line-height: 34rpx;
  213. }
  214. .change {
  215. margin-top: 20rpx;
  216. text-align: center;
  217. font-size: 22rpx;
  218. font-family: Adobe Heiti Std;
  219. font-weight: normal;
  220. color: #14b9c8;
  221. line-height: 34rpx;
  222. }
  223. .tag {
  224. display: flex;
  225. justify-content: center;
  226. align-items: center;
  227. font-size: 22rpx;
  228. font-family: Adobe Heiti Std;
  229. font-weight: normal;
  230. color: #9f9f9f;
  231. line-height: 34rpx;
  232. &::before {
  233. content: '';
  234. display: block;
  235. width: 160rpx;
  236. height: 1px;
  237. background: #d8d8d8;
  238. opacity: 0.86;
  239. }
  240. &::after {
  241. content: '';
  242. display: block;
  243. width: 160rpx;
  244. height: 1px;
  245. background: #d8d8d8;
  246. opacity: 0.86;
  247. }
  248. }
  249. .chat-arr {
  250. margin-top: 50rpx;
  251. display: flex;
  252. align-items: center;
  253. justify-content: space-between;
  254. .icon {
  255. width: 73rpx;
  256. height: 73rpx;
  257. }
  258. }
  259. }
  260. </style>