update_phone.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <template>
  2. <view>
  3. <hx-navbar :status-bar="true" defaultBackUrl="phone" :fixed="true" left-icon="back" left-text="验证手机号" @click-right="next" right-text="下一步"></hx-navbar>
  4. <view class=" msgBox mRL">
  5. <text class="text-gray ">
  6. 更换手机号后,下次登录可使用新手机号登录。当前手机号:{{mobile}}
  7. </text>
  8. </view>
  9. <view class="content mRL">
  10. <view class="areaCodeBox ">
  11. <text class="areaCode">+86</text>
  12. <text class="areaText">中国大陆</text>
  13. </view>
  14. <view class="phoneBox">
  15. <input type="number" placeholder="你本人手机号" maxlength="11" @blur="inputBlur" @confirm="submit"/>
  16. </view>
  17. </view>
  18. </view>
  19. </template>
  20. <script>
  21. import {
  22. mapState
  23. } from 'vuex';
  24. export default {
  25. data() {
  26. return {
  27. mobile: '',
  28. newMobile: '',
  29. appName: '',
  30. }
  31. },
  32. onLoad() {
  33. this.appName = this.$conf.appName;
  34. this.mobile = this.userData.member.mobile;
  35. },
  36. computed: {
  37. ...mapState(['hasLogin','userData'])
  38. },
  39. methods: {
  40. submit(even){
  41. this.newMobile = even.detail.value;
  42. this.next();
  43. },
  44. inputBlur(even){
  45. this.newMobile = even.detail.value;
  46. },
  47. next(){
  48. let that = this;
  49. let reg =/^1[3-9]\d{9}$/;
  50. if(!reg.exec(that.newMobile)){
  51. uni.showToast({
  52. icon:'none',
  53. title: '手机号格式不正确!',
  54. duration: 2000
  55. })
  56. return;
  57. }
  58. if(that.newMobile == that.mobile){
  59. uni.showToast({
  60. icon:'none',
  61. title: '不能重复绑定该手机号!',
  62. duration: 2000
  63. })
  64. return;
  65. }
  66. uni.navigateTo({
  67. url: 'verification_phone?mobile=' + that.newMobile
  68. });
  69. }
  70. },
  71. }
  72. </script>
  73. <style>
  74. page{
  75. }
  76. .content{
  77. display: flex;
  78. flex-direction:row;
  79. justify-content: center;
  80. align-items: flex-end;
  81. height: 116upx;
  82. margin-top: 50upx;
  83. }
  84. .areaCodeBox{
  85. width: 160upx;
  86. display: flex;
  87. justify-content: center;
  88. align-items: center;
  89. flex-direction:column;
  90. border-bottom: 1px solid #e1e1e1;
  91. padding: 8upx 0;
  92. margin-right: 24upx;
  93. }
  94. .mRL{
  95. margin-left: 40upx;
  96. margin-right: 40upx;
  97. }
  98. .msgBox{
  99. margin-top: 56upx;
  100. }
  101. .areaCode{
  102. font-size: 30upx;
  103. color: #333333;
  104. }
  105. .areaText{
  106. font-size: 16upx;
  107. color: #444444;
  108. }
  109. .phoneBox{
  110. width: 100%;
  111. border-bottom: 1px solid #1AAD19;
  112. font-size: 38upx;
  113. padding: 0 12upx 16upx 12upx;
  114. }
  115. </style>