updatePwd.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <template>
  2. <view class="page">
  3. <!-- <cus-head title='' bg='#fff' back></cus-head> -->
  4. <view class="title">
  5. 修改密码
  6. </view>
  7. <view class="input-box">
  8. <input type="number" maxlength="11" class="input" v-model="phone" placeholder="请输入手机号码">
  9. </view>
  10. <view class="input-box">
  11. <input type="text" v-model="code" class="input" style="width: 400rpx;" placeholder="请输入验证码">
  12. <view class="vcode" @click="getVcode" v-if="countdown <= 0">
  13. 获取验证码
  14. </view>
  15. <view class="vcode" v-else>
  16. {{countdown}}
  17. </view>
  18. </view>
  19. <view class="input-box">
  20. <input type="password" class="input" v-model="password" placeholder="输入新密码">
  21. </view>
  22. <view class="input-box">
  23. <input type="password" class="input" v-model="pwd2" placeholder="再次输入新密码">
  24. </view>
  25. <view class="submit" @click="login">
  26. 确认
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. export default {
  32. data() {
  33. return {
  34. password: '',
  35. pwd2: '',
  36. phone: '',
  37. code: '',
  38. checked: false,
  39. key: '',
  40. countdown: 0
  41. }
  42. },
  43. methods: {
  44. login() {
  45. let tip = ''
  46. if (!this.phone) {
  47. tip = '请输入手机号码'
  48. } else if (!this.code) {
  49. tip = '请输入验证码'
  50. } else if (!this.password) {
  51. tip = '请输入密码'
  52. } else if (!this.pwd2) {
  53. tip = '请正常输入密码'
  54. }
  55. if (tip) {
  56. uni.showToast({
  57. title: tip,
  58. icon: "none"
  59. })
  60. return
  61. }
  62. this.$post({
  63. data:{
  64. do:'UpdatePwd',
  65. data:{
  66. phone:this.phone,
  67. password:this.password,
  68. code:this.code
  69. }
  70. }
  71. }).then(res=>{
  72. console.log(res,'+++')
  73. uni.showToast({
  74. title:'重置成功',
  75. mask:true
  76. })
  77. setTimeout(()=>{
  78. uni.navigateBack()
  79. },1500)
  80. })
  81. },
  82. getVcode() {
  83. if (!this.phone) {
  84. uni.showToast({
  85. title: '请输入手机号',
  86. icon: "none",
  87. })
  88. return
  89. }
  90. this.$post({
  91. data:{
  92. do:'GetPhoneCode',
  93. data:{
  94. phone:this.phone
  95. }
  96. }
  97. }).then(res=>{
  98. console.log(res,'++++++++')
  99. if(res.errno==2004){
  100. uni.showToast({
  101. title: '短信已发送',
  102. icon: "none",
  103. duration: 5000
  104. })
  105. this.key = res.key;
  106. if (this.countdown <= 0) {
  107. this.countdown = 60
  108. let timer = setInterval(() => {
  109. this.countdown--;
  110. if (this.countdown < 1) {
  111. clearInterval(timer);
  112. this.countdown = 0
  113. }
  114. }, 1000)
  115. }
  116. }
  117. })
  118. }
  119. }
  120. }
  121. </script>
  122. <style lang="less" scoped>
  123. .page {
  124. padding: 0 32rpx;
  125. width: 100vw;
  126. box-sizing: border-box;
  127. }
  128. .vcode {
  129. width: 180rpx;
  130. height: 70rpx;
  131. border-radius: 4rpx;
  132. border: 2rpx solid #57BD37;
  133. text-align: center;
  134. line-height: 70rpx;
  135. font-size: 32rpx;
  136. color: #57BD37;
  137. position: absolute;
  138. right: 0;
  139. bottom: 14rpx;
  140. }
  141. .title {
  142. height: 72rpx;
  143. font-size: 52rpx;
  144. font-family: PingFang SC-Bold, PingFang SC;
  145. font-weight: bold;
  146. color: #333333;
  147. padding-top: 54rpx;
  148. margin-bottom: 74rpx;
  149. }
  150. .tab {
  151. display: flex;
  152. align-items: center;
  153. margin-bottom: 114rpx;
  154. .item {
  155. height: 50rpx;
  156. margin-right: 86rpx;
  157. font-size: 36rpx;
  158. font-family: PingFang SC-Medium, PingFang SC;
  159. font-weight: 500;
  160. color: #333333;
  161. &.active {
  162. color: #57BD37;
  163. position: relative;
  164. &:after {
  165. display: block;
  166. position: absolute;
  167. content: '';
  168. left: 50%;
  169. transform: translateX(-50%);
  170. width: 56rpx;
  171. height: 6rpx;
  172. background-color: #57BD37;
  173. bottom: -10rpx;
  174. }
  175. }
  176. }
  177. }
  178. .input-box {
  179. padding-bottom: 26rpx;
  180. border-bottom: 2rpx solid #E4E4E4;
  181. height: 42rpx;
  182. font-size: 30rpx;
  183. font-family: PingFang SC-Regular, PingFang SC;
  184. font-weight: 400;
  185. margin-bottom: 88rpx;
  186. width: 100%;
  187. position: relative;
  188. }
  189. .submit {
  190. width: 100%;
  191. height: 88rpx;
  192. background: linear-gradient(180deg, #6AD449 0%, #4EB32F 100%);
  193. border-radius: 40rpx;
  194. display: flex;
  195. align-items: center;
  196. justify-content: center;
  197. font-size: 36rpx;
  198. font-family: PingFang SC-Medium, PingFang SC;
  199. font-weight: 500;
  200. color: #FFFFFF;
  201. margin-top: 142rpx;
  202. }
  203. .b-btn {
  204. display: flex;
  205. width: 100%;
  206. justify-content: space-between;
  207. height: 44rpx;
  208. font-size: 32rpx;
  209. font-family: PingFang SC-Medium, PingFang SC;
  210. font-weight: 500;
  211. color: #666666;
  212. line-height: 44rpx;
  213. .r {
  214. color: #57BD37;
  215. }
  216. }
  217. .radio {
  218. width: 30rpx;
  219. height: 30rpx;
  220. display: inline-block;
  221. margin-right: 16rpx;
  222. }
  223. .xieyi {
  224. height: 40rpx;
  225. font-size: 28rpx;
  226. font-family: PingFang SC-Regular, PingFang SC;
  227. font-weight: 400;
  228. color: #333333;
  229. .c {
  230. color: #57BD37;
  231. }
  232. }
  233. </style>