DelMemVerify.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. <template>
  2. <view class="page">
  3. <view class="list_info">
  4. <view class="title">删除账号</view>
  5. <view class="subtitle">若要继续,你需要完成短信验证。请输入我们通过短信发送的验证码</view>
  6. <view class="subtitle">验证码已发送至{{ formatPhoneNumber(phoneNumber) }}</view>
  7. <view class="card">
  8. <!-- <view class="title">block</view> -->
  9. <!-- <view><button @click="onClear" style="background: #ff5500; color: #fff;">清除内容</button></view> -->
  10. <view class="body">
  11. <yi-code ref="code" inputType="number" :width="660" :maxlength="6" @onComplete="complete"></yi-code>
  12. </view>
  13. </view>
  14. <view class="blankHeight"></view>
  15. </view>
  16. <view class="code">
  17. <view class="btn" v-if="captchaTime === 0" @click="obtainVerificationCode()">重新发送</view>
  18. <view class="btn disabled" v-else>{{ captchaTime }}秒后重试</view>
  19. </view>
  20. <view class="btn_submit" @click="DelMem()">确认删除</view>
  21. <DialogBox ref="DialogBox"></DialogBox>
  22. </view>
  23. </template>
  24. <script>
  25. import DialogBox from '@/components/DialogBox/DialogBox.vue';
  26. export default {
  27. components: { DialogBox },
  28. data() {
  29. return {
  30. mobile: '',
  31. code: '',
  32. captchaTime: 0,
  33. phoneNumber: '',
  34. };
  35. },
  36. onLoad() {
  37. this.loadUserInfo();
  38. this.obtainVerificationCode();
  39. },
  40. methods: {
  41. onClear() {
  42. this.$refs.code.clear()
  43. },
  44. complete(code) {
  45. console.log(`complete:${code}`);
  46. },
  47. formatPhoneNumber(phoneNumber) {
  48. if (phoneNumber && phoneNumber.length === 11) {
  49. return phoneNumber.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2');
  50. }
  51. return phoneNumber;
  52. },
  53. loadUserInfo() {
  54. // 这里添加获取用户信息的逻辑
  55. // 获取手机号等信息
  56. uni.request({
  57. url: this.$apiHost + "/User/getinfo",
  58. data: {
  59. uuid: getApp().globalData.uuid,
  60. skey: getApp().globalData.skey,
  61. },
  62. header: {
  63. "content-type": "application/json",
  64. sign: getApp().globalData.headerSign,
  65. },
  66. success: (res) => {
  67. this.phoneNumber = res.data.mobile;
  68. },
  69. complete: (com) => {
  70. },
  71. fail: (e) => {
  72. console.log("----e:", e);
  73. },
  74. });
  75. },
  76. obtainVerificationCode() {
  77. if (this.code) {
  78. this.onClear();
  79. }
  80. uni.request({
  81. url: this.$apiHost + "/Member/getcode",
  82. data: {
  83. uuid: getApp().globalData.uuid,
  84. },
  85. header: {
  86. 'content-type': 'application/json'
  87. },
  88. success: (res) => {
  89. uni.showToast({
  90. title: res.data.str,
  91. icon: 'none'
  92. })
  93. if (res.data.success == 'yes') {
  94. this.getCodeTime();
  95. } else {
  96. this.captchaTime = 0;
  97. }
  98. }
  99. });
  100. },
  101. DelMem() {
  102. var that = this;
  103. // 验证原始手机号
  104. uni.request({
  105. url: this.$apiHost + '/Member/checkMobile',
  106. data: {
  107. uuid: getApp().globalData.uuid,
  108. code: this.code,
  109. },
  110. header: {
  111. 'content-type': 'application/json'
  112. },
  113. success: (res) => {
  114. console.log("----", res.data);
  115. uni.showToast({
  116. title: res.data.str,
  117. icon: 'none'
  118. });
  119. if (res.data.success == "yes") {
  120. var that = this;
  121. this.$refs['DialogBox'].confirm({
  122. title: '警告',
  123. content: '1、注销账号是不可逆操作,该账号下所有一切资料一旦注销无法恢复;\n2、注销后,你账号下所有权益将被清除。',
  124. DialogType: 'inquiry',
  125. btn1: '否',
  126. btn2: '是',
  127. animation: 0
  128. }).then(() => {
  129. uni.request({
  130. url: that.$apiHost + '/My/delete', //检测是否已绑定
  131. data: {
  132. uuid: getApp().globalData.uuid
  133. },
  134. header: {
  135. 'content-type': 'application/json' //自定义请求头信息
  136. },
  137. success: (res) => {
  138. uni.removeStorageSync("wapptoken");
  139. uni.redirectTo({
  140. url: '/pages/login/login',
  141. })
  142. }
  143. });
  144. })
  145. }
  146. }
  147. });
  148. },
  149. getCodeTime() {
  150. this.captchaTime = 60;
  151. let timer = setInterval(() => {
  152. this.captchaTime--;
  153. if (this.captchaTime < 1) {
  154. clearInterval(timer);
  155. this.captchaTime = 0
  156. }
  157. }, 1000)
  158. },
  159. },
  160. };
  161. </script>
  162. <style scoped lang="scss">
  163. .list_info {
  164. display: flex;
  165. flex-direction: column;
  166. justify-content: flex-start;
  167. align-items: center;
  168. color: #fff;
  169. width: 750rpx;
  170. .title {
  171. text-align: center;
  172. margin-top: 96rpx;
  173. width: 100%;
  174. font-weight: 600;
  175. font-family: PingFang SC, PingFang SC;
  176. font-weight: 500;
  177. font-size: 48rpx;
  178. color: #1F1F1F;
  179. }
  180. .subtitle {
  181. font-size: 24rpx;
  182. font-weight: 400;
  183. color: #959595;
  184. text-align: center;
  185. margin-top: 20rpx;
  186. width: 100%;
  187. }
  188. .phone_input {
  189. width: 626rpx;
  190. height: 84rpx;
  191. margin-top: 96rpx;
  192. background: #ffffff;
  193. border-radius: 24rpx;
  194. display: flex;
  195. align-items: center;
  196. border: 4rpx solid #000000;
  197. border-radius: 74rpx;
  198. .area_code {
  199. padding: 0 20rpx;
  200. font-size: 28rpx;
  201. color: #333;
  202. border-right: 1rpx solid #e0e0e0;
  203. }
  204. .input {
  205. flex: 1;
  206. height: 100%;
  207. padding-left: 20rpx;
  208. font-size: 28rpx;
  209. color: #333;
  210. }
  211. }
  212. .code_input {
  213. width: 626rpx;
  214. height: 84rpx;
  215. margin-top: 20rpx;
  216. background: #ffffff;
  217. border-radius: 24rpx;
  218. display: flex;
  219. align-items: center;
  220. border: 4rpx solid #000000;
  221. border-radius: 74rpx;
  222. padding-right: 8rpx;
  223. .input {
  224. flex: 1;
  225. height: 100%;
  226. padding-left: 20rpx;
  227. font-size: 28rpx;
  228. color: #333;
  229. }
  230. .btn {
  231. padding: 11rpx 26rpx;
  232. font-size: 28rpx;
  233. background: #000000;
  234. border-radius: 74rpx;
  235. font-family: 'PingFang SC-Bold';
  236. &.disabled {
  237. color: #999;
  238. background: transparent;
  239. }
  240. }
  241. }
  242. .btn_submit {
  243. width: 660rpx;
  244. height: 96rpx;
  245. margin: 0 auto;
  246. margin-top: 74rpx;
  247. background: #1f1f1f;
  248. border-radius: 50rpx;
  249. font-weight: bold;
  250. font-size: 32rpx;
  251. color: #ffffff;
  252. display: flex;
  253. flex-direction: row;
  254. justify-content: center;
  255. align-items: center;
  256. }
  257. .card {
  258. margin: 40rpx auto;
  259. color: #000000;
  260. .title {
  261. font-size: 14px;
  262. text-align: center;
  263. line-height: 30px;
  264. border-bottom: 1px solid #f0f0f0;
  265. }
  266. .body {
  267. display: flex;
  268. align-items: center;
  269. justify-content: center;
  270. height: 150rpx;
  271. }
  272. }
  273. }
  274. ::v-deep.yi-code {
  275. .yi-code-show {
  276. .yi-code-show-item {
  277. width: 90rpx;
  278. height: 90rpx;
  279. border: 4rpx #000 solid;
  280. border-radius: 20rpx;
  281. &.yi-code-show-active {
  282. border: solid 2px #ff5500;
  283. animation: myfirst 600ms infinite;
  284. @keyframes myfirst {
  285. 0% {
  286. opacity: 0.1
  287. }
  288. 100% {
  289. opacity: 1
  290. }
  291. }
  292. }
  293. }
  294. .yi-code-hide {
  295. height: 90rpx;
  296. }
  297. }
  298. }
  299. .btn {
  300. color: #0084FF;
  301. text-align: center;
  302. font-family: 'PingFang SC-Medium';
  303. font-weight: 400;
  304. &.disabled {
  305. color: #7C7C7C;
  306. }
  307. }
  308. .btn_submit {
  309. background: #1F1F1F;
  310. border-radius: 76rpx;
  311. color: #fff;
  312. margin: 0 auto;
  313. margin-top: 500rpx;
  314. width: 626rpx;
  315. height: 88rpx;
  316. display: flex;
  317. align-items: center;
  318. justify-content: center;
  319. }
  320. </style>