<template>
    <Cn-page :loading="loading">
        <view slot="body">
            <view class="index">
                <view class="mine-nav" @click="jump('head')" style="box-shadow: 0 4rpx 8rpx #e7e7e74c">
                    <view class="mine-nav-label">头像</view>
                    <image
                        style="height: 120rpx; width: 120rpx; border-radius: 12rpx"
                        :src="userInfo.avatar"
                        mode="scaleToFill"
                        v-if="userInfo.avatar"
                    />
                    <image
                        style="height: 120rpx; width: 120rpx; border-radius: 12rpx"
                        src="/static/head.png"
                        mode="scaleToFill"
                        v-else
                    />
                    <uni-icons type="forward" color="#aaa" size="20"></uni-icons>
                </view>
                <view class="mine-nav" @click="jump('changeName')">
                    <view class="mine-nav-label">名字</view>
                    <view class="mine-nav-des">{{ userInfo.nickname }}</view>
                    <uni-icons type="forward" color="#aaa" size="20"></uni-icons>
                </view>
                <view class="mine-nav" @click="jump('erweima')" style="border-bottom: none">
                    <view class="mine-nav-label">我的二维码</view>
                    <image
                        src="/static/erweima.png"
                        style="height: 50rpx; width: 50rpx; border-radius: 12rpx"
                        mode="scaleToFill"
                    />
                    <uni-icons type="forward" color="#aaa" size="20"></uni-icons>
                </view>
            </view>
        </view>
    </Cn-page>
</template>
<script>
export default {
    data() {
        return {
            loading: false,
            userInfo: {},
        }
    },
    methods: {
        jump(type) {
            console.log(type)
            uni.navigateTo({
                url: `/pages/user/${type}`,
                fail: (err) => {
                    console.log(err)
                },
            })
        },
    },
    onShow() {
        this.userInfo = uni.getStorageSync(this.$cacheKey.userInfo)
    },
}
</script>
<style lang="scss">
.index {
    padding: 20rpx;

    .mine-nav {
        padding: 34rpx;
        display: flex;
        align-items: center;
        background: $uni-theme-white;
        border-bottom: 1rpx solid #e8e8e8;

        &-icon {
            margin-right: 30rpx;
            height: 44rpx;
            width: 44rpx;
            border-radius: $uni-theme-radius;
            overflow: hidden;
        }

        &-label {
            margin-right: 30rpx;
            flex: 1;
            font-size: 28rpx;
            color: #111;
        }

        &-des {
            font-size: 28rpx;
            color: #999;
        }
    }
}
</style>
