accountSafe.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <template>
  2. <view class="content">
  3. <view class="set-box" >
  4. <view class="item" @tap="showAlert()">
  5. <view class="left">
  6. <view class="title">账号注销及删除应用数据</view>
  7. </view>
  8. </view>
  9. </view>
  10. <view class="checkbox">
  11. <view class="checkbox-icon" @tap="handleAgree">
  12. <image src="../../static/image/login/radio_default.png" v-show="!agree"></image>
  13. <image src="../../static/image/login/radio_choose.png" v-show="agree"></image>
  14. </view>
  15. <view>我已阅读并同意<text @tap="goToWeb()">《用户注销协议》</text> </view>
  16. </view>
  17. <u-modal
  18. :show="showCustomModal"
  19. title="您正在申请注销账户"
  20. content="1.账户一旦注销,不可恢复\n 2.用户权益等视为自行放弃,无法继续使用\n"
  21. :show-cancel-button="true"
  22. cancel-text="我再想想"
  23. confirm-text="仍然注销"
  24. @confirm="deleteUser"
  25. @cancel="showCustomModal = false">
  26. </u-modal>
  27. </view>
  28. </template>
  29. <script>
  30. import { removeUser } from '@/api/user'
  31. export default {
  32. data() {
  33. return {
  34. showCustomModal:false,
  35. userInfo:null,
  36. agree: false
  37. }
  38. },
  39. onLoad() {
  40. this.userInfo = JSON.parse(uni.getStorageSync('userInfo'));
  41. },
  42. methods: {
  43. // 同意
  44. handleAgree() {
  45. this.agree = !this.agree
  46. },
  47. showAlert(){
  48. if(!this.agree){
  49. uni.showToast({icon:'none',title: "请先同意用户注销协议"});
  50. return;
  51. }
  52. let that=this;
  53. this.showCustomModal=true;
  54. },
  55. deleteUser(){
  56. let that=this;
  57. uni.showLoading({title:""});
  58. removeUser().then(res => {
  59. uni.hideLoading();
  60. if(res.code==200){
  61. uni.showToast({icon:'none',title: "账号已注销"});
  62. setTimeout(()=>{
  63. uni.$emit("loginOut");
  64. },2000);
  65. }
  66. else{
  67. uni.showToast({
  68. icon:'none',
  69. title: res.msg
  70. });
  71. }
  72. },
  73. rej => {}
  74. );
  75. },
  76. goToWeb(index){
  77. uni.setStorageSync('url',"https://userapp.zkhj6.com/web/userRemoveService");
  78. uni.navigateTo({
  79. url:"/pages/index/h5"
  80. })
  81. },
  82. }
  83. }
  84. </script>
  85. <style scoped lang="scss">
  86. @mixin u-flex($flexD, $alignI, $justifyC) {
  87. display: flex;
  88. flex-direction: $flexD;
  89. align-items: $alignI;
  90. justify-content: $justifyC;
  91. }
  92. page{
  93. height: 100%;
  94. }
  95. .content{
  96. height: 100%;
  97. background-color: #f5f5f5;
  98. }
  99. .line{
  100. height: 1px;background-color: #F7F7F7;
  101. }
  102. .logo{
  103. padding-top: 15%;
  104. text-align: center;
  105. image{
  106. width: 120rpx;
  107. height: 120rpx;
  108. border-radius: 10rpx;
  109. box-shadow:0px 0px 20rpx rgba(0,0,0,0.2);
  110. }
  111. p{
  112. margin: 10px 0px;
  113. font-size: 14px;
  114. }
  115. }
  116. .set-box{
  117. margin-top: 20upx;
  118. background: #fff;
  119. padding: 0 30upx;
  120. .item{
  121. position: relative;
  122. display: flex;
  123. align-items: center;
  124. justify-content: space-between;
  125. padding: 25upx 0;
  126. .left{
  127. display: flex;
  128. flex-direction: column;
  129. .title{
  130. font-size: 32upx;
  131. font-weight: bold;
  132. color: #333;
  133. margin-bottom: 10rpx;
  134. }
  135. .text{
  136. font-size: 22upx;
  137. color: #999;
  138. }
  139. }
  140. .right{
  141. width: 10upx;
  142. height: 20upx;
  143. }
  144. .right-text{
  145. }
  146. }
  147. }
  148. .checkbox {
  149. margin-left: 24rpx;
  150. margin-top: 24rpx;
  151. @include u-flex(row, flex-start, flex-start);
  152. font-family: PingFang SC, PingFang SC;
  153. font-weight: 400;
  154. font-size: 26rpx;
  155. color: #999999;
  156. line-height: 38rpx;
  157. text-align: left;
  158. text {
  159. color:#2583EB;
  160. }
  161. &-icon {
  162. flex-shrink: 0;
  163. margin-right: 12rpx;
  164. image {
  165. height: 24rpx;
  166. width: 24rpx;
  167. }
  168. }
  169. }
  170. </style>