retrieve-account-phone.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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. export default {
  57. data() {
  58. return {
  59. show: false,
  60. userInfo: {
  61. phonenumber: ''
  62. },
  63. rules: {
  64. phonenumber:{
  65. required: true,
  66. min: 10,
  67. max: 12,
  68. message: '请输入11位电话号码',
  69. trigger: ['blur', 'change'],
  70. },
  71. },
  72. }
  73. },
  74. onLoad() {
  75. },
  76. onReady() {
  77. this.$refs.form1.setRules(this.rules)
  78. },
  79. methods: {
  80. // 去选择找回方式
  81. gotoRetrieveMethod(){
  82. let that = this;
  83. this.$refs.form1.validate().then(res => {
  84. that.phoneIsExist();
  85. }).catch(errors => {
  86. uni.$u.toast('校验失败,请认真填写')
  87. })
  88. },
  89. sureClose(){
  90. this.show = false;
  91. uni.$u.route({
  92. url: '/pages/login/login',
  93. params: {
  94. name: 'lisa'
  95. }
  96. })
  97. },
  98. // 验证电话号码是否存在
  99. phoneIsExist(){
  100. let that = this;
  101. // 验证电话号码是否存在
  102. phoneIsExist(null,{data:this.userInfo}).then((res)=>{
  103. console.log(res)
  104. if(res.phoneIsExist){ // 存在
  105. uni.$u.route({
  106. url: '/pages/login/retrieve-method',
  107. params: {
  108. data: that.userInfo.phonenumber
  109. }
  110. })
  111. } else {
  112. that.show = true;
  113. }
  114. }).catch(() =>{
  115. uni.showToast({
  116. title: "操作失败"
  117. })
  118. });
  119. },
  120. }
  121. }
  122. </script>
  123. <style lang="scss">
  124. page,body{
  125. background: #fff;
  126. }
  127. .container{
  128. background: #fff;
  129. height: 300px;
  130. .login-wrap {
  131. display: flex;
  132. justify-content: center;
  133. .login-form{
  134. width: 90%;
  135. }
  136. .account{
  137. display: flex;
  138. }
  139. .identifying-code{
  140. }
  141. }
  142. .op-btn-wrap{
  143. margin-top: 30px;
  144. display: flex;
  145. justify-content: center;
  146. align-items: center;
  147. .h-btn{
  148. text-align: center;
  149. width: 343px;
  150. height: 42px;
  151. background: #FFE05C;
  152. border-radius: 27px;
  153. line-height: 42px;
  154. }
  155. }
  156. }
  157. .h-popo-content{
  158. height: 170px;
  159. padding: 12px;
  160. width: 300px;
  161. text-align: center;
  162. font-size: 14px;
  163. font-family: PingFangSC-Semibold, PingFang SC;
  164. .h-img{
  165. display: flex;
  166. justify-content: center;
  167. }
  168. .h-text{
  169. margin-top: 12px;
  170. font-weight: 400;
  171. color: #666666;
  172. }
  173. .text{
  174. margin-top: 6px;
  175. font-weight: 400;
  176. color: #666666;
  177. }
  178. .h-btn-wrap{
  179. display: flex;
  180. justify-content: space-between;
  181. color: #333333;
  182. text-align: center;
  183. margin-top: 14px;
  184. .h-left-btn{
  185. height: 32px;
  186. line-height: 30px;
  187. background: #EEEEEE;
  188. width: 100px;
  189. text-align: center;
  190. border-radius: 16px;
  191. margin: 0 auto;
  192. }
  193. .h-right-btn{
  194. height: 32px;
  195. line-height: 30px;
  196. background: #FFE05C;
  197. width: 100px;
  198. border-radius: 16px;
  199. margin: 0 auto;
  200. }
  201. }
  202. }
  203. </style>