zhuxiaozhanghao.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. <template>
  2. <page-meta :page-font-size="fontValue+'px'" :root-font-size="fontValue+'px'"></page-meta>
  3. <view>
  4. <cu-custom bgImage="/static/bg.png" :isBack="true">
  5. <template v-slot:content>
  6. <text class="text-black">注销账号</text>
  7. </template>
  8. </cu-custom>
  9. <view class="contentIncolumnC">
  10. <view style="width: 90%;margin-top: 40rpx;">
  11. <view class="contentInRowL">
  12. <text class="text-bold text-black">用户名:</text>
  13. <text>{{name}}</text>
  14. </view>
  15. <view class="contentInRowL" style="margin-top: 20rpx;">
  16. <text class="text-bold text-black">验证码:</text>
  17. <input type="number" class="main-input" v-model="form.yanzhma" placeholder="请输入验证码"/>
  18. </view>
  19. <view class="yzmbt" @click="getEmailcodeSele">
  20. <text>{{huoquyzm}}</text>
  21. </view>
  22. <view class="contentInRowL" style="margin-top: 20rpx;">
  23. <text class="text-grey">验证码将发至注册时填写的邮箱</text>
  24. </view>
  25. <view class="margin-top text-center">
  26. <button class="cu-btn bg-zblue border lg margin-top" style="width: 100%;" @tap="submit">注销</button>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. </template>
  32. <script setup lang="ts">
  33. import CuCustom from '@/colorui/components/cu-custom.vue'
  34. import {ref,reactive} from "vue";
  35. import Auth from "@/api/Auth";
  36. import {useUserStore} from "@/store/userStore";
  37. import {getcodeByUsername,zhuxiaozhanghao,clearVoipTk} from "@/api/Login";
  38. import MessageUtils from "@/utils/MessageUtils";
  39. const fontValue=ref(Auth.getfontSize());
  40. const userStore = useUserStore();
  41. let name = userStore.getUser()?.name;
  42. let username = userStore.getUser()?.username;
  43. const form = reactive({
  44. yanzhma: ""
  45. });
  46. const huoquyzm=ref('获取验证码');
  47. const timeCall=ref(0);
  48. const timer=ref();
  49. //邮箱验证码
  50. const getEmailcodeSele = () =>{
  51. if(timeCall.value==0){
  52. getEmailcodeact();
  53. }
  54. else{
  55. return;
  56. }
  57. }
  58. const getEmailcodeact = () =>{
  59. uni.showLoading({
  60. mask:true
  61. })
  62. getcodeByUsername(username).then((res : any) => {
  63. console.log('getEmailcode',res);
  64. uni.hideLoading();
  65. if(res.code==200){
  66. MessageUtils.success(res.msg);
  67. timeCall.value=60;
  68. timer.value = setInterval(() => {
  69. timeCall.value=timeCall.value-1;
  70. if(timeCall.value==0){
  71. clearInterval(timer.value);
  72. huoquyzm.value='获取验证码';
  73. }
  74. else{
  75. huoquyzm.value='重新获取'+'('+timeCall.value+')';
  76. }
  77. }, 1000);
  78. }
  79. else{
  80. MessageUtils.success(res.msg);
  81. }
  82. });
  83. }
  84. /** 提交按钮 */
  85. function submit() {
  86. console.log(form.yanzhma);
  87. if(form.yanzhma==''){
  88. MessageUtils.success('验证码不能为空');
  89. return;
  90. }
  91. let data={
  92. username: username,
  93. code:form.yanzhma
  94. }
  95. zhuxiaozhanghao(data)
  96. .then((res) => {
  97. console.log(res)
  98. MessageUtils.success('注销成功');
  99. var data={
  100. "voipTk":Auth.getvoipTk()
  101. }
  102. clearVoipTk(JSON.stringify(data)).then((res)=>{
  103. console.log('clearVoipTk2',res);
  104. })
  105. .catch((err) => {
  106. console.log('clearVoipTk2',err);
  107. });
  108. Auth.logout();
  109. })
  110. .catch((err) => {
  111. MessageUtils.error(err.msg);
  112. })
  113. }
  114. </script>
  115. <style scoped>
  116. @import url('@/static/css/main.css');
  117. .yzmbt{
  118. margin-top: 16rpx;
  119. color: white;
  120. font-size: 26upx;
  121. width: 170rpx;
  122. height: 60rpx;
  123. line-height: 60rpx;
  124. text-align: center;
  125. margin-left: auto;
  126. margin-right: 10rpx;
  127. border-radius: 2rpx;
  128. background-color:#60BA63;
  129. }
  130. .oBorder {
  131. border: none;
  132. border-radius: 8px;
  133. border: 1rpx solid #6E75FB;
  134. -webkit-box-shadow: 0 0 60upx 0 rgba(43, 86, 112, .1);
  135. box-shadow: 0 0 60upx 0 rgba(43, 86, 112, .1);
  136. }
  137. .main-input {
  138. flex: 1;
  139. text-align: left;
  140. font-size: 28upx;
  141. height: 60upx;
  142. padding-right: 10upx;
  143. border-radius: 8px;
  144. border: 1rpx solid #6E75FB;
  145. }
  146. </style>