系统设置:接入完成

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" :border="false"
class="list-border" class="list-border"
@tap="onCheckUpdate" @tap="onCheckUpdate"
></uni-list-item> />
<uni-list-item <uni-list-item
title="本地缓存" title="本地缓存"
:rightText="storageSize" :rightText="storageSize"
showArrow showArrow
:border="false" :border="false"
class="list-border" class="list-border"
></uni-list-item> />
<!-- TODO 芋艿统一的配置界面 -->
<uni-list-item <uni-list-item
title="关于我们" title="关于我们"
showArrow showArrow
@ -39,8 +40,8 @@
title: appInfo.about_us.title, title: appInfo.about_us.title,
}) })
" "
></uni-list-item> />
<!-- 为了过审 只有iOS-App有注销账号功能 --> <!-- 为了过审 只有 iOS-App 有注销账号功能 -->
<uni-list-item <uni-list-item
v-if="isLogin && sheep.$platform.os === 'ios' && sheep.$platform.name === 'App'" v-if="isLogin && sheep.$platform.os === 'ios' && sheep.$platform.name === 'App'"
title="注销账号" title="注销账号"
@ -50,10 +51,10 @@
:border="false" :border="false"
class="list-border" class="list-border"
@click="onLogoff" @click="onLogoff"
></uni-list-item> />
</uni-list> </uni-list>
</view> </view>
<!-- TODO 芋艿统一的配置界面 -->
<view class="set-footer ss-flex-col ss-row-center ss-col-center"> <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="agreement-box ss-flex ss-col-center ss-m-b-40">
<view class="ss-flex ss-col-center ss-m-b-10"> <view class="ss-flex ss-col-center ss-m-b-10">
@ -116,32 +117,36 @@
// H5 // H5
// App 1. 2. 3. // App 1. 2. 3.
} }
//
function onLogoff() { function onLogoff() {
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '确认注销账号?', content: '确认注销账号?',
success: async function (res) { success: async function (res) {
if (res.confirm) { if (!res.confirm) {
const { error } = await sheep.$api.user.logoff(); return;
if (error === 0) { }
sheep.$store('user').logout(); const result = await sheep.$store('user').logout();
sheep.$router.go('/pages/index/user'); if (result) {
} sheep.$router.go('/pages/index/user');
} }
}, },
}); });
} }
// 退
function onLogout() { function onLogout() {
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '确认退出账号?', content: '确认退出账号?',
success: async function (res) { success: async function (res) {
if (res.confirm) { if (!res.confirm) {
const result = await sheep.$store('user').logout(); return;
if (result) { }
sheep.$router.go('/pages/index/user'); 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 { import {
showAuthModal showAuthModal
} from '@/sheep/hooks/useModal'; } from '@/sheep/hooks/useModal';
import AuthUtil from '@/sheep/api/member/auth';
// 默认用户信息 // 默认用户信息
const defaultUserInfo = { const defaultUserInfo = {
@ -58,7 +59,7 @@ const user = defineStore({
} = await userApi.profile(); } = await userApi.profile();
// 为了兼容 获取用户余额 可能还会用到其他参数 // 为了兼容 获取用户余额 可能还会用到其他参数
// 优惠券数量,积分数量 应该在这里 // 优惠券数量,积分数量 应该在这里
const { const {
code: code2, code: code2,
data: data2 data: data2
@ -169,10 +170,8 @@ const user = defineStore({
// 登出 // 登出
async logout(force = false) { async logout(force = false) {
if (!force) { if (!force) {
const { const { code } = AuthUtil.logout();
error if (code === 0) {
} = await userApi.logout();
if (error === 0) {
this.resetUserData(); this.resetUserData();
} }
} }