index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <template>
  2. <!-- 登录 -->
  3. <view class="container">
  4. <JHeader title="注销账户手机认证" width="50" height="50" style="padding: 24upx 0 0;"></JHeader>
  5. <view class="iphoneNum-box flex-row-plus flex-items">
  6. <view style="margin-right: 30rpx">
  7. <tui-icon :size="50" color="#cccccc" name="mobile" unit="upx" margin="0"></tui-icon>
  8. </view>
  9. <view>
  10. <input
  11. v-model="userInfo.phone" maxlength="11" placeholder-class="iphoneNum-input" type="number"
  12. disabled
  13. placeholder="请输入您的手机号"
  14. />
  15. </view>
  16. </view>
  17. <view class="flex-row-plus mar-top-20 flex-center">
  18. <view class="code-box">
  19. <view style="margin-right: 30rpx">
  20. <tui-icon :size="50" color="#cccccc" name="shield" unit="upx" margin="0"></tui-icon>
  21. </view>
  22. <view>
  23. <input v-model="code" maxlength="6" placeholder-class="codeNum-input" placeholder="请输入验证码" />
  24. </view>
  25. </view>
  26. <view :class="disabled === true ? 'on' : ''" :disabled="disabled" class="getcode" @click="codede">
  27. {{ text }}
  28. </view>
  29. </view>
  30. <view class="mar-top-60">
  31. <view class="registerBut mar-top-100" @click="unsubscribe">立即注销</view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. import { T_STORAGE_KEY } from '../../../constant'
  37. import { getCodeBusinessApi, deleteUserInfoApi } from '../../../api/anotherTFInterface'
  38. export default {
  39. name: 'UnsubscribeCode',
  40. data() {
  41. return {
  42. code: '',
  43. userInfo: {
  44. phone: ''
  45. },
  46. disabled: false,
  47. text: '获取验证码'
  48. }
  49. },
  50. onLoad() {
  51. this.userInfo = uni.getStorageSync(T_STORAGE_KEY)
  52. },
  53. methods: {
  54. // 获取验证码
  55. codede() {
  56. this.getVerify()
  57. },
  58. getVerify() {
  59. getCodeBusinessApi({
  60. phone: this.userInfo.phone
  61. }).then((res) => {
  62. this.sendCode()
  63. })
  64. },
  65. // 账户注销
  66. unsubscribe() {
  67. deleteUserInfoApi({ code: this.code })
  68. .then((res) => {
  69. this.$store.dispatch('auth/logoutAction', true)
  70. })
  71. },
  72. sendCode() {
  73. if (this.disabled) return
  74. this.disabled = true
  75. let n = 60
  76. this.text = n + 's后重新发送'
  77. const run = setInterval(() => {
  78. n = n - 1
  79. if (n < 0) {
  80. clearInterval(run)
  81. }
  82. this.text = n + 's后重新发送'
  83. if (this.text < 0 + 's后重新发送') {
  84. this.disabled = false
  85. this.text = '重新获取'
  86. }
  87. }, 1000)
  88. }
  89. }
  90. }
  91. </script>
  92. <style lang="less" scoped>
  93. .container {
  94. background-color: #FFFFFF;
  95. min-height: 100vh;
  96. .iphoneNum-box {
  97. margin: 100upx auto 0;
  98. border-bottom: 1rpx solid #DDDDDD;
  99. height: 100rpx;
  100. width: 600rpx;
  101. .iphoneNum-input {
  102. color: #999999;
  103. font-size: 28rpx;
  104. font-weight: 400;
  105. }
  106. }
  107. .code-box {
  108. border-bottom: 1rpx solid #DDDDDD;
  109. height: 100rpx;
  110. width: 360rpx;
  111. display: flex;
  112. flex-direction: row;
  113. justify-content: space-between;
  114. align-items: center;
  115. .codeNum-input {
  116. color: #999999;
  117. font-size: 28rpx;
  118. font-weight: 400;
  119. }
  120. }
  121. .getcode {
  122. background-color: #C5AA7B;
  123. height: 100rpx;
  124. width: 230rpx;
  125. display: flex;
  126. flex-direction: row;
  127. justify-content: center;
  128. align-items: center;
  129. margin-left: 20rpx;
  130. color: #FFFFFF;
  131. }
  132. .registerBut {
  133. background: #333333;
  134. color: #FFEBC4;
  135. height: 100rpx;
  136. width: 600rpx;
  137. text-align: center;
  138. line-height: 100rpx;
  139. margin: 30upx auto 0;
  140. }
  141. }
  142. </style>