系统设置:接入完成

pull/29/head^2
YunaiV 2023-12-16 21:40:34 +08:00
parent d63bbf9dc3
commit d95786154c
3 changed files with 40 additions and 22 deletions

View File

@ -19,14 +19,15 @@
:border="false"
class="list-border"
@tap="onCheckUpdate"
></uni-list-item>
/>
<uni-list-item
title="本地缓存"
:rightText="storageSize"
showArrow
:border="false"
class="list-border"
></uni-list-item>
/>
<!-- TODO 芋艿统一的配置界面 -->
<uni-list-item
title="关于我们"
showArrow
@ -39,7 +40,7 @@
title: appInfo.about_us.title,
})
"
></uni-list-item>
/>
<!-- 为了过审 只有 iOS-App 有注销账号功能 -->
<uni-list-item
v-if="isLogin && sheep.$platform.os === 'ios' && sheep.$platform.name === 'App'"
@ -50,10 +51,10 @@
:border="false"
class="list-border"
@click="onLogoff"
></uni-list-item>
/>
</uni-list>
</view>
<!-- TODO 芋艿统一的配置界面 -->
<view class="set-footer ss-flex-col ss-row-center ss-col-center">
<view class="agreement-box ss-flex ss-col-center ss-m-b-40">
<view class="ss-flex ss-col-center ss-m-b-10">
@ -116,33 +117,37 @@
// H5
// App 1. 2. 3.
}
//
function onLogoff() {
uni.showModal({
title: '提示',
content: '确认注销账号?',
success: async function (res) {
if (res.confirm) {
const { error } = await sheep.$api.user.logoff();
if (error === 0) {
sheep.$store('user').logout();
sheep.$router.go('/pages/index/user');
if (!res.confirm) {
return;
}
const result = await sheep.$store('user').logout();
if (result) {
sheep.$router.go('/pages/index/user');
}
},
});
}
// 退
function onLogout() {
uni.showModal({
title: '提示',
content: '确认退出账号?',
success: async function (res) {
if (res.confirm) {
if (!res.confirm) {
return;
}
const result = await sheep.$store('user').logout();
if (result) {
sheep.$router.go('/pages/index/user');
}
}
},
});
}

14
sheep/api/member/auth.js Normal file
View File

@ -0,0 +1,14 @@
import request2 from '@/sheep/request2';
const AuthUtil = {
// 登出系统
logout: () => {
return request2({
url: '/app-api/member/auth/logout',
method: 'POST'
});
},
};
export default AuthUtil;

View File

@ -14,6 +14,7 @@ import app from './app';
import {
showAuthModal
} from '@/sheep/hooks/useModal';
import AuthUtil from '@/sheep/api/member/auth';
// 默认用户信息
const defaultUserInfo = {
@ -169,10 +170,8 @@ const user = defineStore({
// 登出
async logout(force = false) {
if (!force) {
const {
error
} = await userApi.logout();
if (error === 0) {
const { code } = AuthUtil.logout();
if (code === 0) {
this.resetUserData();
}
}