添加注销功能
This commit is contained in:
@@ -42,7 +42,12 @@ export const sendMessage = (data) => {
|
|||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
export const deleteUserByUserId = (data) => {
|
||||||
|
return http.request({
|
||||||
|
url: '/user/deleteUser',
|
||||||
|
method: 'post',
|
||||||
|
})
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 帮助中心
|
* 帮助中心
|
||||||
*/
|
*/
|
||||||
@@ -63,6 +68,7 @@ export const collectVideoSummary = () => {
|
|||||||
method: 'GET'
|
method: 'GET'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// 注销账号
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 金币
|
* 金币
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
<view class="title">隐私协议</view>
|
<view class="title">隐私协议</view>
|
||||||
<up-icon name="arrow-right" />
|
<up-icon name="arrow-right" />
|
||||||
</view>
|
</view>
|
||||||
|
<view class="item" @click="outuser" v-if="token&&!isExamine">
|
||||||
|
<view class="title">注销账号</view>
|
||||||
|
<up-icon name="arrow-right" />
|
||||||
|
</view>
|
||||||
<view class="item" @click="logout" v-if="token">
|
<view class="item" @click="logout" v-if="token">
|
||||||
<view class="title">退出登录</view>
|
<view class="title">退出登录</view>
|
||||||
<up-icon name="arrow-right" />
|
<up-icon name="arrow-right" />
|
||||||
@@ -31,64 +35,98 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue';
|
import {
|
||||||
import { linkTo } from '@/utils/app.js';
|
ref
|
||||||
import { onLoad } from '@dcloudio/uni-app';
|
} from 'vue';
|
||||||
|
import {
|
||||||
const version = ref('');
|
linkTo
|
||||||
const token = ref('');
|
} from '@/utils/app.js';
|
||||||
|
import {
|
||||||
// 退出登录
|
onLoad
|
||||||
function logout() {
|
} from '@dcloudio/uni-app';
|
||||||
uni.showModal({
|
import {
|
||||||
title: '注意',
|
deleteUserByUserId
|
||||||
content: '确定要退出登录吗?',
|
} from '@/api/me/me.js'
|
||||||
success: (res) => {
|
import {
|
||||||
if (res.confirm) {
|
useCommonStore
|
||||||
uni.clearStorageSync();
|
} from '@/store/common.js'
|
||||||
uni.reLaunch({
|
const version = ref('');
|
||||||
url: '/pages/login/login'
|
const token = ref('');
|
||||||
});
|
let isExamine = ref(false)
|
||||||
|
// 注销账号
|
||||||
|
function outuser() {
|
||||||
|
uni.showModal({
|
||||||
|
title: '注意',
|
||||||
|
content: '确定要注销账号吗?',
|
||||||
|
success: async (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
let userInfo = uni.getStorageSync('userInfo')
|
||||||
|
let res = await deleteUserByUserId(userInfo.userId)
|
||||||
|
if (res.code == 0) {
|
||||||
|
uni.reLaunch({
|
||||||
|
url: '/pages/login/login'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
}
|
||||||
|
// 退出登录
|
||||||
|
function logout() {
|
||||||
|
uni.showModal({
|
||||||
|
title: '注意',
|
||||||
|
content: '确定要退出登录吗?',
|
||||||
|
success: (res) => {
|
||||||
|
if (res.confirm) {
|
||||||
|
uni.clearStorageSync();
|
||||||
|
uni.reLaunch({
|
||||||
|
url: '/pages/login/login'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const $common = useCommonStore()
|
||||||
|
onLoad(() => {
|
||||||
|
token.value = uni.getStorageSync('token');
|
||||||
|
const systemInfo = uni.getSystemInfoSync();
|
||||||
|
//#ifdef APP-PLUS
|
||||||
|
version.value = systemInfo.appWgtVersion;
|
||||||
|
//#endif
|
||||||
|
// #ifdef H5
|
||||||
|
version.value = systemInfo.appVersion;
|
||||||
|
// #endif
|
||||||
|
$common.init()
|
||||||
|
isExamine.value = $common.isIosExamine
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
onLoad(() => {
|
|
||||||
token.value = uni.getStorageSync('token');
|
|
||||||
const systemInfo = uni.getSystemInfoSync();
|
|
||||||
//#ifdef APP-PLUS
|
|
||||||
version.value = systemInfo.appWgtVersion;
|
|
||||||
//#endif
|
|
||||||
// #ifdef H5
|
|
||||||
version.value = systemInfo.appVersion;
|
|
||||||
// #endif
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
.container {
|
.container {
|
||||||
font-size: 28upx;
|
font-size: 28upx;
|
||||||
color: #555;
|
color: #555;
|
||||||
}
|
}
|
||||||
.list {
|
|
||||||
padding-bottom: 120upx;
|
.list {
|
||||||
.item {
|
padding-bottom: 120upx;
|
||||||
padding: 32upx 28upx;
|
|
||||||
border-bottom: 1upx solid #efefef;
|
.item {
|
||||||
display: flex;
|
padding: 32upx 28upx;
|
||||||
align-items: center;
|
border-bottom: 1upx solid #efefef;
|
||||||
justify-content: space-between;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.version {
|
||||||
|
width: 100%;
|
||||||
|
height: 120upx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
color: #999;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
.version {
|
|
||||||
width: 100%;
|
|
||||||
height: 120upx;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
position: fixed;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
color: #999;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
Reference in New Issue
Block a user