forgetPass.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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. uni.switchTab({
  83. 'url':'/pages/index/index'
  84. })
  85. },
  86. setShake(type){
  87. if(type===1){
  88. this.phoneShake=true
  89. }else if(type===3){
  90. this.passwordShake=true
  91. }else {
  92. this.codeShake=true
  93. }
  94. setTimeout(()=>{
  95. this.phoneShake=false
  96. this.passwordShake=false
  97. this.codeShake=false
  98. },500)
  99. },
  100. setNavHeight(navHeight){
  101. this.navHeight=navHeight
  102. },
  103. verifyIsLogin(){
  104. this.isLogin = this.phone.length === 11 && this.code !== '' && this.password.length>=6;
  105. },
  106. senCode(){
  107. if(this.phone.length !== 11){
  108. tools.error('请输入手机号码')
  109. this.setShake(2)
  110. tools.vibrate()
  111. return false
  112. }
  113. this.time=60
  114. let timeServe=setInterval(()=>{
  115. --this.time
  116. if(this.time<=0){
  117. clearInterval(timeServe)
  118. }
  119. },1000)
  120. },
  121. goToPass(){
  122. uni.navigateTo({
  123. 'url':'/pages/login/passLogin'
  124. })
  125. }
  126. }
  127. }
  128. </script>
  129. <style scoped lang="scss">
  130. .other-box{
  131. padding: 82rpx 80rpx 0 80rpx;
  132. box-sizing: border-box;
  133. position: relative;
  134. .login-top{
  135. .login-title{
  136. padding-bottom: 60rpx;
  137. .title-item{
  138. font-size: 48rpx;
  139. }
  140. }
  141. .login-from{
  142. .from-text{
  143. width: 100%;
  144. padding-bottom: 40rpx;
  145. border-bottom: 1rpx solid #E0E0E0;
  146. .from-input{
  147. font-size: 32rpx;
  148. height: 44rpx;
  149. line-height: 44rpx;
  150. }
  151. .from-input::placeholder{
  152. color: #999999;
  153. }
  154. }
  155. .from-code{
  156. margin-top: 60rpx;
  157. display: flex;
  158. justify-content: space-between;
  159. .from-text{
  160. width: 344rpx;
  161. }
  162. .code-text{
  163. width: 180rpx;
  164. height: 44rpx;
  165. line-height: 44rpx;
  166. text-align: center;
  167. text{
  168. font-size: 32rpx;
  169. }
  170. }
  171. }
  172. .from-item{
  173. margin-top: 60rpx;
  174. }
  175. }
  176. .login-but{
  177. margin-top: 120rpx;
  178. }
  179. .local-txt{
  180. padding-top: 32rpx;
  181. font-size: 24rpx;
  182. text-align: center;
  183. }
  184. }
  185. .login-bottom{
  186. padding-bottom: calc(186rpx + env(safe-area-inset-bottom));
  187. position: absolute;
  188. bottom: 0;
  189. left: 80rpx;
  190. width:calc(100vw - 160rpx);
  191. }
  192. }
  193. </style>