forget.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <template>
  2. <view class="container">
  3. <view class="logo-img"><image src="../../static/user/logo.png"></image></view>
  4. <!-- <view class="logo">LOGO</view> -->
  5. <view class="login_text">
  6. <view class="login_input flex_item">
  7. <view class="login_img"><image class="phone" src="/static/img/img25.png"></image></view>
  8. <view class="login_name"><input class="uni-input" type="number" v-model="phone" focus placeholder="请输入手机号码" /></view>
  9. </view>
  10. <view class="login_input flex_item">
  11. <view class="login_img"><image src="/static/img/img26.png"></image></view>
  12. <view class="login_name"><input class="uni-input" type="password" v-model="password" placeholder=" 请输入新的不少于6位的密码" /></view>
  13. </view>
  14. <view class="login_input flex_item">
  15. <view class="login_img"><image src="/static/img/img26.png"></image></view>
  16. <view class="login_name"><input class="uni-input" type="password" v-model="password2" placeholder="请重复输入新密码" /></view>
  17. </view>
  18. <view class="login_input flex">
  19. <view class="login_img"><image class="codeimg" src="/static/img/img27.png"></image></view>
  20. <view class="login_name flex">
  21. <input class="uni-input width" v-model="code" type="number" placeholder="请输入验证码" />
  22. <view class="code" @click="verification">{{ countDown == 0 ? '发送验证码' : countDown }}</view>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="login" @click="updatalogin">确认修改</view>
  27. </view>
  28. </template>
  29. <script>
  30. import { updatalogin } from '@/api/set.js';
  31. import { verify } from '@/api/login.js';
  32. export default {
  33. data() {
  34. return {
  35. phone: '', //用户
  36. code: '', //验证码
  37. password2:'',
  38. password:'',
  39. time: '', //保存倒计时对象
  40. countDown: 0 //倒计时
  41. };
  42. },
  43. onLoad() {},
  44. watch: {
  45. // 监听倒计时
  46. countDown(i) {
  47. if (i == 0) {
  48. clearInterval(this.time);
  49. }
  50. }
  51. },
  52. methods: {
  53. updatalogin() {
  54. let obj = this;
  55. if (obj.phone == '') {
  56. obj.$api.msg('请输入手机号码');
  57. return;
  58. }
  59. if (!/(^1[3|4|5|7|8][0-9]{9}$)/.test(obj.phone)) {
  60. obj.$api.msg('请输入正确的手机号');
  61. return;
  62. }
  63. if (obj.password == '') {
  64. obj.$api.msg('请输入密码');
  65. return;
  66. }
  67. if (obj.password2 == '') {
  68. obj.$api.msg('请再次输入密码');
  69. return;
  70. }
  71. if (obj.password2 != obj.password) {
  72. obj.$api.msg('两次密码不正确');
  73. return;
  74. }
  75. if (obj.code == '') {
  76. obj.$api.msg('请输入验证码');
  77. return;
  78. }
  79. updatalogin({
  80. account: obj.phone, //账号
  81. password:obj.password,
  82. password2:obj.password2,
  83. type:1,
  84. captcha: obj.code
  85. }).then(function(e) {
  86. obj.$api.msg(e.msg);
  87. uni.navigateTo({
  88. url: '/pages/public/login'
  89. });
  90. }).catch((e) => {
  91. console.log(e);
  92. });
  93. },
  94. //发送验证码
  95. verification() {
  96. let obj = this;
  97. if (this.phone == '') {
  98. this.$api.msg('请输入电话号码');
  99. return;
  100. }
  101. if (this.phone.length < 11) {
  102. this.$api.msg('请输入正确的手机号');
  103. return;
  104. }
  105. // 判断是否在倒计时
  106. if (obj.countDown > 0) {
  107. return false;
  108. } else {
  109. obj.countDown = 60;
  110. obj.time = setInterval(() => {
  111. obj.countDown--;
  112. }, 1000);
  113. //调用验证码接口
  114. verify({
  115. phone: obj.phone,
  116. type: 'login'
  117. })
  118. .then(({ data }) => {})
  119. .catch(err => {
  120. console.log(err);
  121. });
  122. }
  123. },
  124. }
  125. };
  126. </script>
  127. <style lang="scss">
  128. page {
  129. min-height: 100%;
  130. background-color: #ffffff;
  131. .container {
  132. width: 100%;
  133. padding: 60rpx 70rpx;
  134. }
  135. }
  136. .logo-img{
  137. width: 161rpx;
  138. height: 161rpx;
  139. margin: auto;
  140. margin-bottom: 15rpx !important;
  141. // background: #5771DF;
  142. // box-shadow: 0px 12rpx 13rpx 0px rgba(51, 145, 255, 0.47);
  143. border-radius: 50%;
  144. image{
  145. width: 161rpx;
  146. height: 161rpx;
  147. border-radius: 50%;
  148. }
  149. }
  150. .logo{
  151. font-size: 36rpx;
  152. font-weight: 400;
  153. color: #5771DF;
  154. text-align: center;
  155. }
  156. .phone{
  157. height: 43rpx !important;
  158. width: 27rpx !important;
  159. }
  160. .codeimg{
  161. height: 39rpx !important;
  162. width: 31rpx !important;
  163. }
  164. .login_text {
  165. border-radius: 20rpx;
  166. margin-top: 80rpx;
  167. .login_input {
  168. // border-bottom: 1px solid #C5CEE0;
  169. margin-bottom:35rpx;
  170. padding-bottom: 60rpx;
  171. .login_img image {
  172. height: 35rpx;
  173. width: 31rpx;
  174. margin-right: 20rpx;
  175. }
  176. .uni-input {
  177. text-align: left;
  178. width: 400rpx;
  179. font-size:32rpx !important;
  180. }
  181. .login_name {
  182. color: #333333;
  183. .code {
  184. color: #141E47;
  185. font-size: 23rpx;
  186. border-left: 1px solid #eeeeee;
  187. width: 150rpx;
  188. flex-shrink: 0;
  189. text-align: center;
  190. }
  191. }
  192. }
  193. }
  194. .login{
  195. background-color: #141E47;
  196. margin-top: 96rpx;
  197. color: #FFFFFF;
  198. text-align: center;
  199. padding: 26rpx 0rpx;
  200. border-radius: 20rpx;
  201. }
  202. </style>