m-p-setPhone.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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="re_btn" @click="bang_phone()">
  16. 绑定
  17. </view>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. export default {
  23. data() {
  24. return {
  25. mobile:'',
  26. vcode:'',
  27. };
  28. },
  29. methods:{
  30. async send_vcode(){
  31. if(this.mobile == ''){
  32. uni.showToast({
  33. icon:'none',
  34. title:'手机号不能为空'
  35. })
  36. return
  37. }
  38. const res = await this.$myRequest({
  39. method:"POST",
  40. url:'/sms/vcode',
  41. header:{
  42. "Content-Type":"application/json",
  43. Authorization : uni.getStorageSync('token_type') +' '+uni.getStorageSync('Authorization')
  44. },
  45. data:{
  46. mobile:this.mobile
  47. }
  48. })
  49. },
  50. async bang_phone(){
  51. if(this.mobile == ''){
  52. uni.showToast({
  53. icon:'none',
  54. title:'手机号不能为空'
  55. })
  56. return
  57. }
  58. if(this.vcode == ''){
  59. uni.showToast({
  60. icon:'none',
  61. title:'验证码不能为空'
  62. })
  63. return
  64. }
  65. const res = await this.$myRequest({
  66. method:"POST",
  67. url:'/user/mobile/set',
  68. header:{
  69. "Content-Type":"application/json",
  70. Authorization : uni.getStorageSync('token_type') +' '+uni.getStorageSync('Authorization')
  71. },
  72. data:{
  73. mobile:this.mobile,
  74. vcode:this.vcode
  75. }
  76. })
  77. },
  78. }
  79. }
  80. </script>
  81. <style lang="scss">
  82. page{
  83. background-color: #f0f0f0;
  84. }
  85. .content{
  86. padding: 21rpx 30rpx 0;
  87. .input_box{
  88. margin-bottom: 20rpx;
  89. padding: 10rpx 25rpx;
  90. background-color: #fff;
  91. input{
  92. height: 60rpx;
  93. font-size: 28rpx;
  94. color: #333;
  95. }
  96. }
  97. .send_box{
  98. display: flex;
  99. justify-content: space-between;
  100. margin-bottom: 20rpx;
  101. .send_code{
  102. width: 400rpx;
  103. padding: 10rpx 25rpx;
  104. background-color: #fff;
  105. input{
  106. height: 60rpx;
  107. font-size: 28rpx;
  108. color: #333;
  109. }
  110. }
  111. .send_btn{
  112. width: 200rpx;
  113. background-color: #009FE8;
  114. text-align: center;
  115. color: #fff;
  116. font-size: 28rpx;
  117. line-height: 80rpx;
  118. }
  119. }
  120. .re_btn{
  121. background-color: #009FE8;
  122. text-align: center;
  123. color: #fff;
  124. font-size: 28rpx;
  125. line-height: 80rpx;
  126. }
  127. }
  128. </style>