1. 注销申请成功后立即调用clearLoginState清除登录态,避免残留账号信息 2. 所有跳转均改用reLaunch模式清空页面栈,防止用户通过回退键回到历史页面 3. 新增完整的注销流程行为测试用例覆盖所有场景
107 lines
2.4 KiB
Vue
107 lines
2.4 KiB
Vue
<template>
|
|
<view class="container" :style="themeColor">
|
|
<view class="cancel-wrap">
|
|
<view class="cancel-img">
|
|
<image :src="$util.img('public/uniapp/member/success.png')" show-menu-by-longpress></image>
|
|
</view>
|
|
<view class="cancel-title">{{ $lang('member.cancelsuccess.title') }}</view>
|
|
<view class="cancel-reason">{{ $lang('member.cancelsuccess.cancelsuccess.desc') }}</view>
|
|
<view class="cancel-btn"><button class="color-base-bg" @click="success">{{ $lang('member.cancelsuccess.cancelsuccess.done') }}</button></view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import memberPublic from './public/js/member-public.js';
|
|
|
|
export default {
|
|
mixins: [memberPublic],
|
|
components: {},
|
|
data() {
|
|
return {
|
|
state: ''
|
|
};
|
|
},
|
|
onLoad(option) {
|
|
|
|
if (option.back) this.back = option.back;
|
|
|
|
// 判断登录
|
|
if (!this.storeToken) {
|
|
// 使用 reLaunch 清空页面栈,避免通过标题栏/导航栏返回到注销流程的历史页面
|
|
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL, {}, 'reLaunch');
|
|
} else {
|
|
this.getStatus();
|
|
}
|
|
},
|
|
methods: {
|
|
getStatus() {
|
|
this.$api.sendRequest({
|
|
url: '/membercancel/api/membercancel/info',
|
|
success: res => {
|
|
if (res.code >= 0) {
|
|
if (res.data && res.data.status == 1) {
|
|
this.clearLoginState();
|
|
// 使用 reLaunch 清空页面栈,避免通过标题栏/导航栏返回到注销流程的历史页面
|
|
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL, {}, 'reLaunch');
|
|
}
|
|
}
|
|
}
|
|
});
|
|
},
|
|
success() {
|
|
this.clearLoginState();
|
|
// 使用 reLaunch 清空页面栈,避免通过标题栏/导航栏返回到注销流程的历史页面
|
|
this.$util.redirectTo(this.$util.LOGIN_PAGE_URL, {}, 'reLaunch');
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.cancel-wrap {
|
|
padding-top: 84rpx;
|
|
text-align: center;
|
|
|
|
.cancel-img {
|
|
width: 100rpx;
|
|
height: 100rpx;
|
|
display: inline-block;
|
|
|
|
image {
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
}
|
|
|
|
.cancel-title {
|
|
text-align: center;
|
|
font-size: 24rpx;
|
|
line-height: 24rpx;
|
|
margin-top: 30rpx;
|
|
}
|
|
|
|
.cancel-reason {
|
|
color: #838383;
|
|
font-size: 20rpx;
|
|
line-height: 40rpx;
|
|
margin-top: 20rpx;
|
|
padding: 0 175rpx;
|
|
}
|
|
|
|
.cancel-btn {
|
|
width: 100%;
|
|
margin-top: 173rpx;
|
|
|
|
button {
|
|
display: inline-block;
|
|
width: 300rpx;
|
|
height: 80rpx;
|
|
font-size: 28rpx;
|
|
line-height: 80rpx;
|
|
margin: 0 15rpx;
|
|
color: #ffffff;
|
|
}
|
|
}
|
|
}
|
|
</style> |