m-repassword.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <template>
  2. <view>
  3. <view class="content">
  4. <view class="input_box">
  5. <input type="text" v-model="mobile" placeholder="请输入手机号" placeholder-style="color:#999;"/>
  6. </view>
  7. <view class="send_box">
  8. <view class="send_code">
  9. <input type="text" v-model="vcode" placeholder="验证码" placeholder-style="color:#999;"/>
  10. </view>
  11. <view class="send_btn" @click="send_vcode()">
  12. 发送验证码
  13. </view>
  14. </view>
  15. <view class="input_box">
  16. <input type="text" v-model="password" placeholder="请输入新密码" placeholder-style="color:#999;"/>
  17. </view>
  18. <view class="input_box">
  19. <input type="text" v-model="copypassword" placeholder="请重复新密码" placeholder-style="color:#999;"/>
  20. </view>
  21. <view class="re_btn" @click="repassword()">
  22. 确认修改
  23. </view>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. export default {
  29. data() {
  30. return {
  31. mobile:'',
  32. vcode:'',
  33. password:'',
  34. copypassword:''
  35. };
  36. },
  37. methods:{
  38. async send_vcode(){
  39. if(this.mobile == ''){
  40. uni.showToast({
  41. icon:'none',
  42. title:'手机号不能为空'
  43. })
  44. return
  45. }
  46. const res = await this.$myRequest({
  47. method:"POST",
  48. url:'/sms/vcode',
  49. header:{
  50. "Content-Type":"application/json",
  51. Authorization : uni.getStorageSync('token_type') +' '+uni.getStorageSync('Authorization')
  52. },
  53. data:{
  54. mobile:this.mobile
  55. }
  56. })
  57. },
  58. async repassword(){
  59. if(this.password == '' || this.copypassword){
  60. uni.showToast({
  61. icon:'none',
  62. title:'请填写完整信息'
  63. })
  64. return
  65. }
  66. if(this.password !== this.copypassword){
  67. uni.showToast({
  68. icon:'none',
  69. title:'两次密码输入不一致'
  70. })
  71. return
  72. }
  73. console.log("发送请求")
  74. const res = await this.$myRequest({
  75. method:"POST",
  76. url:'/user/repassword',
  77. header:{
  78. "Content-Type":"application/json",
  79. Authorization : uni.getStorageSync('token_type') +' '+uni.getStorageSync('Authorization')
  80. },
  81. data:{
  82. mobile:this.mobile,
  83. vcode:this.vcode,
  84. password:this.password
  85. }
  86. })
  87. }
  88. }
  89. }
  90. </script>
  91. <style lang="scss">
  92. page{
  93. background-color: #f0f0f0;
  94. }
  95. .content{
  96. padding: 21rpx 30rpx 0;
  97. .input_box{
  98. margin-bottom: 20rpx;
  99. padding: 10rpx 25rpx;
  100. background-color: #fff;
  101. input{
  102. height: 60rpx;
  103. font-size: 28rpx;
  104. color: #333;
  105. }
  106. }
  107. .send_box{
  108. display: flex;
  109. justify-content: space-between;
  110. margin-bottom: 20rpx;
  111. .send_code{
  112. width: 400rpx;
  113. padding: 10rpx 25rpx;
  114. background-color: #fff;
  115. input{
  116. height: 60rpx;
  117. font-size: 28rpx;
  118. color: #333;
  119. }
  120. }
  121. .send_btn{
  122. width: 200rpx;
  123. background-color: #009FE8;
  124. text-align: center;
  125. color: #fff;
  126. font-size: 28rpx;
  127. line-height: 80rpx;
  128. }
  129. }
  130. .re_btn{
  131. background-color: #009FE8;
  132. text-align: center;
  133. color: #fff;
  134. font-size: 28rpx;
  135. line-height: 80rpx;
  136. }
  137. }
  138. </style>