<template>
    <!-- 我的--设置 -->
    <view class="h5-container my-setting">
        <view style="padding: 15px">
            <van-icon name="arrow-left" @click="onClickLeft" />
            <text style="color: #000"> 设置 </text>
        </view>

        <van-cell-group inset style="flex: 1">
            <van-cell is-link title="个人资料" @click="onJumpToMyInfo" />
            <van-cell is-link title="账户与安全" @click="onJumpToMyAccount" />
            <van-cell is-link title="退出登录" @click="onLogOut" />
        </van-cell-group>
    </view>
</template>

<script setup>
import { useMemberStore } from '@/stores/index.js'
const memberStore = useMemberStore()
const onClickLeft = () => {
    uni.navigateBack()
}
const onJumpToMyInfo = () => {
    uni.navigateTo({
        url: '/pages/my-info/index',
    })
}
const onJumpToMyAccount = () => {
    uni.navigateTo({
        url: '/pages/my-account/index',
    })
}
const onLogOut = () => {
    showConfirmDialog({
        title: '温馨提示',
        message: '是否确定退出当前登录',
    })
        .then(async () => {
            // 清除缓存
            uni.clearStorageSync()
            uni.clearStorage()
            // memberStore.clearUserInfo()
            uni.reLaunch({ url: '/pages/login/index' })
        })
        .catch(() => {})
}
</script>

<style lang="scss" scoped>
.my-setting {
    padding: 10px 0;
    color: #333;
    box-sizing: border-box;
    background: linear-gradient(to bottom, #c0e9ce, #e4f2f2, #f9f9f9);
}

:deep(.van-cell-group--inset) {
    padding: 15px 0;
}
</style>
