This commit is contained in:
杨鹏
2025-09-23 22:27:41 +08:00
parent 232cea0f7e
commit aed85c92df
19 changed files with 238 additions and 374 deletions
+45 -5
View File
@@ -17,9 +17,14 @@
<s-block-item :type="item.id" :data="item.property" :styles="item.property.style" />
</s-block>
<userTryOn />
<view class="logout-box" v-if="isLogin">
<button class="ss-rest-button logout-btn" @click="handleLayout">退出登录</button>
</view>
<!-- 购物车 -->
<view class="cart-box" @click="sheep.$router.go('/pages/index/cart')">
<uni-icons type="cart" size="28" color="#fff" />
<view class="chat-box" @click="sheep.$router.go('/pages/chat/index')">
<uni-icons type="chat" size="28" color="#fff" />
</view>
</s-layout>
</template>
@@ -30,6 +35,7 @@
import sheep from '@/sheep';
import userAvatarCard from './components/user-avatar-card.vue';
import userTryOn from './components/user-tryOn.vue';
import AuthUtil from '@/sheep/api/member/auth';
// 隐藏原生tabBar
uni.hideTabBar({
@@ -37,6 +43,7 @@
});
const template = computed(() => sheep.$store('app').template.user);
const isLogin = computed(() => sheep.$store('user').isLogin);
onShow(() => {
sheep.$store('user').updateUserData();
@@ -54,18 +61,51 @@
const pattern = reactive({
icon: 'uni-icons-heart',
});
const handleLayout = () => {
uni.showModal({
title: '提示',
content: '确认注销账号?',
success: async function (res) {
if (!res.confirm) {
return;
}
const { code } = await AuthUtil.logout();
if (code !== 0) {
return;
}
sheep.$store('user').logout();
sheep.$router.go('/pages/login/index');
},
});
};
</script>
<style lang="scss" scoped>
.cart-box {
.chat-box {
width: 80rpx;
height: 80rpx;
border-radius: 50%;
background: red;
background: #000;
position: fixed;
bottom: 80px;
bottom: 100px;
right: 10px;
text-align: center;
line-height: 80rpx;
}
.logout-box {
width: 100%;
box-sizing: border-box;
margin: 24rpx 0;
background: #fff;
.logout-btn {
width: 710rpx;
height: 80rpx;
background: linear-gradient(90deg, #000, #000);
border-radius: 40rpx;
font-size: 30rpx;
font-weight: 500;
color: $white;
}
}
</style>