<template>
  <div class="page">
    <div class="header">
      <n-avatar class="ava" :size="80" round :src="info ? info.avaUrl : ''"></n-avatar>
      <div v-if="info" class="nickname">{{ info.nickname }}</div>
    </div>

    <div class="group">
      <div class="row" @click="updateInfo">
        <n-h6 prefix="bar">
          <n-text type="primary">
            更改信息
          </n-text>
        </n-h6>
        <div class="right">
          <n-icon size="20">
            <right />
          </n-icon>
        </div>
      </div>
      <div class="row" @click="handdleGotoGallery">
        <n-h6 prefix="bar">
          <n-text type="primary">
            画廊管理
          </n-text>
        </n-h6>
        <div class="right">
          <n-icon size="20">
            <right />
          </n-icon>
        </div>
      </div>
      <div class="row" @click="handdleGotoArti">
        <n-h6 prefix="bar">
          <n-text type="primary">
            文章管理
          </n-text>
        </n-h6>
        <div class="right">
          <n-icon size="20">
            <right />
          </n-icon>
        </div>
      </div>
    </div>

    <div class="group">
      <div class="row" @click="backhome">
        <n-h6 prefix="bar">
          <n-text type="primary">
            退回首页
          </n-text>
        </n-h6>
        <div class="right">
          <n-icon size="20">
            <right />
          </n-icon>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
//mark import
import right from '@/icon/right.svg';
import cookie from 'vue-cookies';

//mark data
const info = ref({})
const router = useRouter()
//mark method
function backhome() {
  router.push('/')
}

function handdleGotoGallery() {
  router.push('/m/gallery')
}
function handdleGotoArti() {
  router.push('/m/article')
}
function updateInfo() {
  router.push("/m/profile")
}
//mark watch

//mark 周期、内置函数等
info.value = cookie.get('userinfo')

</script>

<style scoped lang="less">
.page {
  background-color: #f4f5f6;
  height: calc(100vh - 42px);
}

.header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 50px 0;
  background: url(@/assets/bg.jpg) 100% 100% /cover no-repeat;
}

.nickname {
  margin-top: 10px;
  font-size: 20px;
  text-align: center;
  width: 40%;
  margin: 40rpx auto 0;
}

.group {
  margin-top: 40px;
  box-shadow: @ps;

  .row {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    border-bottom: 1px solid #efefef;
    background-color: #fff;

    .right {
      color: @purple;
    }
  }
}

:deep(.n-h) {
  margin: unset !important;
}
</style>