forgetPass.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template>
  2. <view class="other-box">
  3. <en-nav @navHeight="setNavHeight" ></en-nav>
  4. <view class="login-box" :style="{'height':'calc(100vh - '+navHeight+'px)'}">
  5. <view class="login-top">
  6. <view class="login-title">
  7. <text class="title-item sys-color-black sys-weight-600">验证登录</text>
  8. </view>
  9. <view class="login-from">
  10. <view class="from-text" :class="{'apply-shake':phoneShake}">
  11. <input type="tel" class="from-input sys-color-gray-3" max="11" v-model="phone" placeholder="请输入手机号"></input>
  12. </view>
  13. <view class="from-code" :class="{'apply-shake':codeShake}">
  14. <view class="from-text">
  15. <input type="tel" class="from-input sys-color-gray-3" v-model="code" placeholder="请输入验证码"></input>
  16. </view>
  17. <view class="code-text">
  18. <text class="sys-color-gray-3" v-if="time<=0" @click="senCode">获取验证码</text>
  19. <text class="sys-color-gray-3" v-else>{{time}} s</text>
  20. </view>
  21. </view>
  22. <view class="from-text from-item" :class="{'apply-shake':passwordShake}">
  23. <input type="password" class="from-input sys-color-gray-3" v-model="password" placeholder="请输入密码"></input>
  24. </view>
  25. </view>
  26. <view class="login-but sys-color-white sys-background-black sys-selected-but" @click="setPass" :class="{'sys-unselected-but':!isLogin}">提交</view>
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. import EnNav from "@/components/en-utils/en-nav/en-nav";
  33. import tools from "@/service/tools";
  34. import OtherLogin from "@/pages/login/model/otherLogin";
  35. export default {
  36. name:'forgetPass',
  37. components: {OtherLogin, EnNav},
  38. data() {
  39. return {
  40. navHeight:40,
  41. isLogin:false,
  42. phoneShake:false,
  43. codeShake:false,
  44. passwordShake:false,
  45. phone:'',
  46. code:'',
  47. password:'',
  48. time:0
  49. }
  50. },
  51. watch:{
  52. 'phone':function (){
  53. this.verifyIsLogin()
  54. },
  55. 'code':function (){
  56. this.verifyIsLogin()
  57. },
  58. 'password':function (){
  59. this.verifyIsLogin()
  60. },
  61. },
  62. methods: {
  63. setPass(){
  64. if(this.phone.length !== 11){
  65. tools.error('请输入手机号码')
  66. this.setShake(1)
  67. tools.vibrate()
  68. return false
  69. }
  70. if(this.code ===''){
  71. tools.error('请输入验证码')
  72. this.setShake(2)
  73. tools.vibrate()
  74. return false
  75. }
  76. if(this.password ===''){
  77. tools.error('请输入密码')
  78. this.setShake(3)
  79. tools.vibrate()
  80. return false
  81. }
  82. },
  83. setShake(type){
  84. if(type===1){
  85. this.phoneShake=true
  86. }else if(type===3){
  87. this.passwordShake=true
  88. }else {
  89. this.codeShake=true
  90. }
  91. setTimeout(()=>{
  92. this.phoneShake=false
  93. this.passwordShake=false
  94. this.codeShake=false
  95. },500)
  96. },
  97. setNavHeight(navHeight){
  98. this.navHeight=navHeight
  99. },
  100. verifyIsLogin(){
  101. this.isLogin = this.phone.length === 11 && this.code !== '' && this.password.length>=6;
  102. },
  103. senCode(){
  104. if(this.phone.length !== 11){
  105. tools.error('请输入手机号码')
  106. this.setShake(2)
  107. tools.vibrate()
  108. return false
  109. }
  110. this.time=60
  111. let timeServe=setInterval(()=>{
  112. --this.time
  113. if(this.time<=0){
  114. clearInterval(timeServe)
  115. }
  116. },1000)
  117. },
  118. goToPass(){
  119. uni.navigateTo({
  120. 'url':'/pages/login/passLogin'
  121. })
  122. }
  123. }
  124. }
  125. </script>
  126. <style scoped lang="scss">
  127. .other-box{
  128. padding: 82rpx 80rpx 0 80rpx;
  129. box-sizing: border-box;
  130. position: relative;
  131. .login-top{
  132. .login-title{
  133. padding-bottom: 60rpx;
  134. .title-item{
  135. font-size: 48rpx;
  136. }
  137. }
  138. .login-from{
  139. .from-text{
  140. width: 100%;
  141. padding-bottom: 40rpx;
  142. border-bottom: 1rpx solid #E0E0E0;
  143. .from-input{
  144. font-size: 32rpx;
  145. height: 44rpx;
  146. line-height: 44rpx;
  147. }
  148. .from-input::placeholder{
  149. color: #999999;
  150. }
  151. }
  152. .from-code{
  153. margin-top: 60rpx;
  154. display: flex;
  155. justify-content: space-between;
  156. .from-text{
  157. width: 344rpx;
  158. }
  159. .code-text{
  160. width: 180rpx;
  161. height: 44rpx;
  162. line-height: 44rpx;
  163. text-align: center;
  164. text{
  165. font-size: 32rpx;
  166. }
  167. }
  168. }
  169. .from-item{
  170. margin-top: 60rpx;
  171. }
  172. }
  173. .login-but{
  174. margin-top: 120rpx;
  175. }
  176. .local-txt{
  177. padding-top: 32rpx;
  178. font-size: 24rpx;
  179. text-align: center;
  180. }
  181. }
  182. .login-bottom{
  183. padding-bottom: calc(186rpx + env(safe-area-inset-bottom));
  184. position: absolute;
  185. bottom: 0;
  186. left: 80rpx;
  187. width:calc(100vw - 160rpx);
  188. }
  189. }
  190. </style>