添加注销功能
This commit is contained in:
@@ -42,7 +42,12 @@ export const sendMessage = (data) => {
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export const deleteUserByUserId = (data) => {
|
||||
return http.request({
|
||||
url: '/user/deleteUser',
|
||||
method: 'post',
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 帮助中心
|
||||
*/
|
||||
@@ -63,6 +68,7 @@ export const collectVideoSummary = () => {
|
||||
method: 'GET'
|
||||
})
|
||||
}
|
||||
// 注销账号
|
||||
|
||||
/**
|
||||
* 金币
|
||||
|
||||
@@ -21,6 +21,10 @@
|
||||
<view class="title">隐私协议</view>
|
||||
<up-icon name="arrow-right" />
|
||||
</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="title">退出登录</view>
|
||||
<up-icon name="arrow-right" />
|
||||
@@ -31,15 +35,44 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { linkTo } from '@/utils/app.js';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
|
||||
const version = ref('');
|
||||
const token = ref('');
|
||||
|
||||
// 退出登录
|
||||
function logout() {
|
||||
import {
|
||||
ref
|
||||
} from 'vue';
|
||||
import {
|
||||
linkTo
|
||||
} from '@/utils/app.js';
|
||||
import {
|
||||
onLoad
|
||||
} from '@dcloudio/uni-app';
|
||||
import {
|
||||
deleteUserByUserId
|
||||
} from '@/api/me/me.js'
|
||||
import {
|
||||
useCommonStore
|
||||
} from '@/store/common.js'
|
||||
const version = ref('');
|
||||
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: '确定要退出登录吗?',
|
||||
@@ -52,9 +85,9 @@ function logout() {
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onLoad(() => {
|
||||
}
|
||||
const $common = useCommonStore()
|
||||
onLoad(() => {
|
||||
token.value = uni.getStorageSync('token');
|
||||
const systemInfo = uni.getSystemInfoSync();
|
||||
//#ifdef APP-PLUS
|
||||
@@ -63,16 +96,20 @@ onLoad(() => {
|
||||
// #ifdef H5
|
||||
version.value = systemInfo.appVersion;
|
||||
// #endif
|
||||
});
|
||||
$common.init()
|
||||
isExamine.value = $common.isIosExamine
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.container {
|
||||
.container {
|
||||
font-size: 28upx;
|
||||
color: #555;
|
||||
}
|
||||
.list {
|
||||
}
|
||||
|
||||
.list {
|
||||
padding-bottom: 120upx;
|
||||
|
||||
.item {
|
||||
padding: 32upx 28upx;
|
||||
border-bottom: 1upx solid #efefef;
|
||||
@@ -80,8 +117,9 @@ onLoad(() => {
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
}
|
||||
.version {
|
||||
}
|
||||
|
||||
.version {
|
||||
width: 100%;
|
||||
height: 120upx;
|
||||
display: flex;
|
||||
@@ -90,5 +128,5 @@ onLoad(() => {
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
color: #999;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user