unsubscribeCode.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <template>
  2. <!-- 登录 -->
  3. <view class="container flex-items-plus flex-column">
  4. <global-loading />
  5. <view class="login-logoBox">
  6. <image class="login-logo" src="../../static/images/origin/loginLogo.png"></image>
  7. </view>
  8. <view class="iphoneNum-box flex-row-plus flex-items">
  9. <view style="margin-right: 30rpx">
  10. <image class="loginIcon" src="../../static/images/origin/phone.png"></image>
  11. </view>
  12. <view>
  13. <input
  14. v-model="userInfo.phone" maxlength="11" placeholder-class="iphoneNum-input" type="number"
  15. disabled
  16. placeholder="请输入您的手机号"
  17. />
  18. </view>
  19. </view>
  20. <view class="flex-row-plus mar-top-20">
  21. <view class="code-box">
  22. <view style="margin-right: 30rpx">
  23. <image class="loginIcon" src="../../static/images/origin/code.png"></image>
  24. </view>
  25. <view>
  26. <input v-model="code" maxlength="6" placeholder-class="codeNum-input" placeholder="请输入验证码" />
  27. </view>
  28. </view>
  29. <view :class="disabled === true ? 'on' : ''" :disabled="disabled" class="getcode" @click="codede">
  30. {{ text }}
  31. </view>
  32. </view>
  33. <view class="mar-top-60">
  34. <view class="registerBut mar-top-100" @click="unsubscribe">立即注销</view>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. import sendVerifyCode from '@/mixins/SendVerifyCode'
  40. import { J_STORAGE_KEY } from '../../config/constant'
  41. const NET = require('../../utils/request')
  42. const API = require('../../config/api')
  43. import { getVerifyCodeApi } from '../../api/user'
  44. export default {
  45. name: 'UnsubscribeCode',
  46. mixins: [ sendVerifyCode ],
  47. data() {
  48. return {
  49. code: '',
  50. userInfo: {}
  51. }
  52. },
  53. onLoad() {
  54. this.userInfo = uni.getStorageSync('storage_userInfo')
  55. },
  56. methods: {
  57. // 获取验证码
  58. codede() {
  59. this.getVerify()
  60. },
  61. getVerify() {
  62. getVerifyCodeApi({
  63. phone: this.userInfo.phone
  64. }).then((res) => {
  65. this.sendCode()
  66. })
  67. .catch((res) => {
  68. uni.showToast({
  69. title: res.data.message,
  70. duration: 1000,
  71. icon: 'none'
  72. })
  73. })
  74. },
  75. // 账户注销
  76. unsubscribe() {
  77. NET.request(API.delUser + this.code, {}, 'delete').then((res) => {
  78. if (res.code == '200') {
  79. // uni.showLoading({
  80. // mask: true,
  81. // title: '注销成功,正在退出...',
  82. // duration: 2000,
  83. // });
  84. setTimeout(function () {
  85. uni.removeStorageSync(J_STORAGE_KEY)
  86. uni.removeStorageSync('distributorId')
  87. uni.reLaunch({
  88. url: 'login',
  89. success() {
  90. // uni.hideLoading()
  91. }
  92. })
  93. }, 1000)
  94. } else {
  95. uni.showToast({
  96. title: res.data.message,
  97. duration: 1000,
  98. icon: 'none'
  99. })
  100. }
  101. })
  102. }
  103. }
  104. }
  105. </script>
  106. <style lang="scss">
  107. .container {
  108. background-color: #FFFFFF;
  109. height: 100vh;
  110. .login-logoBox {
  111. margin-top: -300rpx;
  112. .login-logo {
  113. width: 234rpx;
  114. height: 193rpx;
  115. }
  116. }
  117. .iphoneNum-box {
  118. margin-top: 100rpx;
  119. border-bottom: 1rpx solid #DDDDDD;
  120. height: 100rpx;
  121. width: 600rpx;
  122. .loginIcon {
  123. width: 40rpx;
  124. height: 53rpx;
  125. }
  126. .iphoneNum-input {
  127. color: #999999;
  128. font-size: 28rpx;
  129. font-weight: 400;
  130. }
  131. }
  132. .passwordNum-box {
  133. border-bottom: 1rpx solid #DDDDDD;
  134. height: 100rpx;
  135. width: 600rpx;
  136. .passwordNum-input {
  137. color: #999999;
  138. font-size: 28rpx;
  139. font-weight: 400;
  140. width: 346rpx;
  141. }
  142. }
  143. .code-box {
  144. border-bottom: 1rpx solid #DDDDDD;
  145. height: 100rpx;
  146. width: 360rpx;
  147. display: flex;
  148. flex-direction: row;
  149. justify-content: space-between;
  150. align-items: center;
  151. .loginIcon {
  152. width: 44rpx;
  153. height: 50rpx;
  154. }
  155. .code-lab {
  156. width: 200rpx;
  157. }
  158. .codeNum-input {
  159. color: #999999;
  160. font-size: 28rpx;
  161. font-weight: 400;
  162. }
  163. }
  164. .getcode {
  165. background-color: #C5AA7B;
  166. height: 100rpx;
  167. width: 230rpx;
  168. display: flex;
  169. flex-direction: row;
  170. justify-content: center;
  171. align-items: center;
  172. margin-left: 20rpx;
  173. color: #FFFFFF;
  174. }
  175. .registerBut {
  176. background: #333333;
  177. color: #FFEBC4;
  178. height: 100rpx;
  179. width: 600rpx;
  180. text-align: center;
  181. line-height: 100rpx;
  182. margin-top: 30rpx;
  183. }
  184. }
  185. </style>