retrieve-account-phone.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <template>
  2. <view class="container">
  3. <view class="login-wrap">
  4. <view class="login-form">
  5. <u--form
  6. labelPosition="left"
  7. :model="userInfo"
  8. :rules="rules"
  9. ref="form1"
  10. >
  11. <u-form-item
  12. label="手机号"
  13. prop="phonenumber"
  14. borderBottom
  15. labelWidth="auto"
  16. labelAlign="right"
  17. >
  18. <u--input
  19. v-model="userInfo.phonenumber"
  20. placeholder="请输入账号绑定的手机号"
  21. border="bottom"
  22. type="number"
  23. maxlength="11"
  24. ></u--input>
  25. </u-form-item>
  26. </u--form>
  27. </view>
  28. </view>
  29. <view @click="gotoRetrieveMethod()" class="op-btn-wrap">
  30. <view class="h-btn">
  31. <text>下一步</text>
  32. </view>
  33. </view>
  34. <!-- 密码正确 -->
  35. <u-popup :show="show" :round="10" mode="center" >
  36. <view class="h-popo-content">
  37. <view class="h-img">
  38. <u-icon name="/static/login/u01.png" color="red" size="50"></u-icon>
  39. </view>
  40. <view class="text">
  41. <text>找回失败</text>
  42. </view>
  43. <view class="text">
  44. <text>未查询到该手机号绑定的账号</text>
  45. </view>
  46. <view class="h-btn-wrap">
  47. <view @click="sureClose" class="h-right-btn">
  48. <text>确定</text>
  49. </view>
  50. </view>
  51. </view>
  52. </u-popup>
  53. </view>
  54. </template>
  55. <script>
  56. import {phoneIsExist} from '/src/api/login/login.js';
  57. export default {
  58. data() {
  59. return {
  60. show: false,
  61. userInfo: {
  62. phonenumber: ''
  63. },
  64. rules: {
  65. phonenumber:{
  66. required: true,
  67. min: 10,
  68. max: 12,
  69. message: '请输入11位电话号码',
  70. trigger: ['blur', 'change'],
  71. },
  72. },
  73. }
  74. },
  75. onLoad() {
  76. },
  77. onReady() {
  78. this.$refs.form1.setRules(this.rules)
  79. },
  80. methods: {
  81. // 去选择找回方式
  82. gotoRetrieveMethod(){
  83. let that = this;
  84. this.$refs.form1.validate().then(res => {
  85. that.phoneIsExist();
  86. }).catch(errors => {
  87. uni.$u.toast('校验失败,请认真填写')
  88. })
  89. },
  90. sureClose(){
  91. this.show = false;
  92. uni.$u.route({
  93. url: '/pages/login/login',
  94. params: {
  95. name: 'lisa'
  96. }
  97. })
  98. },
  99. // 验证电话号码是否存在
  100. phoneIsExist(){
  101. let that = this;
  102. // 验证电话号码是否存在
  103. phoneIsExist(null,{data:this.userInfo}).then((res)=>{
  104. console.log(res)
  105. if(res.phoneIsExist){ // 存在
  106. uni.$u.route({
  107. url: '/pages/login/retrieve-method',
  108. params: {
  109. data: that.userInfo.phonenumber
  110. }
  111. })
  112. } else {
  113. that.show = true;
  114. }
  115. }).catch(() =>{
  116. uni.showToast({
  117. title: "操作失败"
  118. })
  119. });
  120. },
  121. }
  122. }
  123. </script>
  124. <style lang="scss">
  125. page,body{
  126. background: #fff;
  127. }
  128. .container{
  129. background: #fff;
  130. height: 300px;
  131. .login-wrap {
  132. display: flex;
  133. justify-content: center;
  134. .login-form{
  135. width: 90%;
  136. }
  137. .account{
  138. display: flex;
  139. }
  140. .identifying-code{
  141. }
  142. }
  143. .op-btn-wrap{
  144. margin-top: 30px;
  145. display: flex;
  146. justify-content: center;
  147. align-items: center;
  148. .h-btn{
  149. text-align: center;
  150. width: 343px;
  151. height: 42px;
  152. background: #FFE05C;
  153. border-radius: 27px;
  154. line-height: 42px;
  155. }
  156. }
  157. }
  158. .h-popo-content{
  159. height: 170px;
  160. padding: 12px;
  161. width: 300px;
  162. text-align: center;
  163. font-size: 14px;
  164. font-family: PingFangSC-Semibold, PingFang SC;
  165. .h-img{
  166. display: flex;
  167. justify-content: center;
  168. }
  169. .h-text{
  170. margin-top: 12px;
  171. font-weight: 400;
  172. color: #666666;
  173. }
  174. .text{
  175. margin-top: 6px;
  176. font-weight: 400;
  177. color: #666666;
  178. }
  179. .h-btn-wrap{
  180. display: flex;
  181. justify-content: space-between;
  182. color: #333333;
  183. text-align: center;
  184. margin-top: 14px;
  185. .h-left-btn{
  186. height: 32px;
  187. line-height: 30px;
  188. background: #EEEEEE;
  189. width: 100px;
  190. text-align: center;
  191. border-radius: 16px;
  192. margin: 0 auto;
  193. }
  194. .h-right-btn{
  195. height: 32px;
  196. line-height: 30px;
  197. background: #FFE05C;
  198. width: 100px;
  199. border-radius: 16px;
  200. margin: 0 auto;
  201. }
  202. }
  203. }
  204. </style>