Files
meida_applet/pages/index/user.vue
T
2025-09-23 22:27:41 +08:00

112 lines
2.6 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!-- 个人中心支持装修 -->
<template>
<s-layout
title="我的"
tabbar="/pages/index/user"
navbar="custom"
:bgStyle="template.page"
:navbarStyle="template.navigationBar"
onShareAppMessage
>
<userAvatarCard />
<s-block
v-for="(item, index) in template.components"
:key="index"
:styles="item.property.style"
>
<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="chat-box" @click="sheep.$router.go('/pages/chat/index')">
<uni-icons type="chat" size="28" color="#fff" />
</view>
</s-layout>
</template>
<script setup>
import { computed, reactive, ref } from 'vue';
import { onShow, onPageScroll, onPullDownRefresh } from '@dcloudio/uni-app';
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({
fail: () => {},
});
const template = computed(() => sheep.$store('app').template.user);
const isLogin = computed(() => sheep.$store('user').isLogin);
onShow(() => {
sheep.$store('user').updateUserData();
});
onPullDownRefresh(() => {
sheep.$store('user').updateUserData();
setTimeout(function () {
uni.stopPullDownRefresh();
}, 800);
});
onPageScroll(() => {});
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>
.chat-box {
width: 80rpx;
height: 80rpx;
border-radius: 50%;
background: #000;
position: fixed;
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>