forget.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <template>
  2. <view class="forget">
  3. <uni-nav-bar
  4. :status-bar="true"
  5. :shadow="false"
  6. :border="false"
  7. background-color="#f1f1f1">
  8. <view slot="left">
  9. <view class="cu-bar">
  10. <view class="action">
  11. <text class="cuIcon-close" @click="closePage"></text>
  12. </view>
  13. <view class="content text-bold">
  14. </view>
  15. </view>
  16. </view>
  17. </uni-nav-bar>
  18. <view class="content">
  19. <!-- 主体 -->
  20. <view class="main">
  21. <view class="tips">若你忘记了密码,可在此重置新密码。</view>
  22. <wInput
  23. v-model="phoneData"
  24. type="text"
  25. maxlength="11"
  26. placeholder="请输入手机号码"
  27. ></wInput>
  28. <wInput
  29. v-model="passData"
  30. type="password"
  31. maxlength="11"
  32. placeholder="请输入新密码"
  33. isShowPass
  34. ></wInput>
  35. <wInput
  36. v-model="verCode"
  37. type="number"
  38. maxlength="4"
  39. placeholder="验证码"
  40. isShowCode
  41. codeText="获取重置码"
  42. setTime="30"
  43. ref="runCode"
  44. @setCode="getVerCode()"
  45. ></wInput>
  46. </view>
  47. <wButton
  48. text="重置密码"
  49. :rotate="isRotate"
  50. @click.native="startRePass()"
  51. ></wButton>
  52. </view>
  53. </view>
  54. </template>
  55. <script>
  56. var _this;
  57. import wInput from '@/components/watch-login/watch-input.vue' //input
  58. import wButton from '@/components/watch-login/watch-button.vue' //button
  59. export default {
  60. data() {
  61. return {
  62. phoneData: "", //电话
  63. passData: "", //密码
  64. verCode:"", //验证码
  65. isRotate: false, //是否加载旋转
  66. }
  67. },
  68. components:{
  69. wInput,
  70. wButton
  71. },
  72. mounted() {
  73. _this= this;
  74. console.log('hello');
  75. },
  76. methods: {
  77. getVerCode(){
  78. //获取验证码
  79. if (_this.phoneData.length != 11) {
  80. uni.showToast({
  81. icon: 'none',
  82. position: 'bottom',
  83. title: '手机号不正确'
  84. });
  85. return false;
  86. }
  87. console.log("获取验证码")
  88. this.$refs.runCode.$emit('runCode'); //触发倒计时(一般用于请求成功验证码后调用)
  89. uni.showToast({
  90. icon: 'none',
  91. position: 'bottom',
  92. title: '模拟倒计时触发'
  93. });
  94. setTimeout(function(){
  95. _this.$refs.runCode.$emit('runCode',0); //假装模拟下需要 终止倒计时
  96. uni.showToast({
  97. icon: 'none',
  98. position: 'bottom',
  99. title: '模拟倒计时终止'
  100. });
  101. },3000)
  102. },
  103. startRePass() {
  104. //重置密码
  105. if(this.isRotate){
  106. //判断是否加载中,避免重复点击请求
  107. return false;
  108. }
  109. if (this.phoneData.length != 11) {
  110. uni.showToast({
  111. icon: 'none',
  112. position: 'bottom',
  113. title: '手机号不正确'
  114. });
  115. return false;
  116. }
  117. if (this.passData.length < 6) {
  118. uni.showToast({
  119. icon: 'none',
  120. position: 'bottom',
  121. title: '密码不正确'
  122. });
  123. return false;
  124. }
  125. if (this.verCode.length != 4) {
  126. uni.showToast({
  127. icon: 'none',
  128. position: 'bottom',
  129. title: '验证码不正确'
  130. });
  131. return false;
  132. }
  133. console.log("重置密码成功")
  134. _this.isRotate=true
  135. setTimeout(function(){
  136. _this.isRotate=false
  137. },3000)
  138. }
  139. }
  140. }
  141. </script>
  142. <style>
  143. .content {
  144. display: flex;
  145. flex-direction: column;
  146. justify-content:center;
  147. /* margin-top: 128upx; */
  148. }
  149. /* 头部 logo */
  150. .header {
  151. width:161upx;
  152. height:161upx;
  153. box-shadow:0upx 0upx 60upx 0upx rgba(0,0,0,0.1);
  154. border-radius:50%;
  155. background-color: #000000;
  156. margin-top: 128upx;
  157. margin-bottom: 72upx;
  158. margin-left: auto;
  159. margin-right: auto;
  160. }
  161. .header image{
  162. width:161upx;
  163. height:161upx;
  164. border-radius:50%;
  165. }
  166. /* 主体 */
  167. .main {
  168. display: flex;
  169. flex-direction: column;
  170. padding-left: 70upx;
  171. padding-right: 70upx;
  172. }
  173. .tips {
  174. color: #999999;
  175. font-size: 28upx;
  176. margin-top: 64upx;
  177. margin-left: 48upx;
  178. }
  179. /* 其他登录方式 */
  180. .other_login{
  181. display: flex;
  182. flex-direction: row;
  183. justify-content: center;
  184. align-items: center;
  185. margin-top: 256upx;
  186. text-align: center;
  187. }
  188. .login_icon{
  189. border: none;
  190. font-size: 64upx;
  191. margin: 0 64upx 0 64upx;
  192. color: rgba(0,0,0,0.7)
  193. }
  194. .wechat_color{
  195. color: #83DC42;
  196. }
  197. .weibo_color{
  198. color: #F9221D;
  199. }
  200. .github_color{
  201. color: #24292E;
  202. }
  203. /* 底部 */
  204. .footer{
  205. display: flex;
  206. flex-direction: row;
  207. justify-content: center;
  208. align-items: center;
  209. font-size: 28upx;
  210. margin-top: 64upx;
  211. color: rgba(0,0,0,0.7);
  212. text-align: center;
  213. height: 40upx;
  214. line-height: 40upx;
  215. }
  216. .footer text{
  217. font-size: 24upx;
  218. margin-left: 15upx;
  219. margin-right: 15upx;
  220. }
  221. </style>