<template>
	<view class="page">
    <u-cell-group
        style="width: 100%;
        margin: 15rpx auto;
        background-color: #fff;
        box-sizing: border-box;
        padding: 10rpx 20rpx;
        box-shadow: #EFEFEF 2px 2px;
        border-radius: 15rpx"
        :border="false"
    >
      <u-cell
          title="头像"
          :isLink="true"
          :border="false"
          style="border-bottom: 1px solid #E9E9E9"
          @click="handleAvatar"
      >
        <image
          :src="infos.avatar"
          slot="value"
          style="width: 5vh; height: 5vh; border-radius: 50%"
        ></image>
      </u-cell>
      <u-cell
          title="姓名"
          :isLink="true"
          :border="false"
      >
        <span slot="value">{{ infos.username }}</span>
      </u-cell>
    </u-cell-group>
    <u-cell-group
        style="width: 100%;
        margin: 15rpx auto;
        background-color: #fff;
        box-sizing: border-box;
        padding: 10rpx 20rpx;
        box-shadow: #EFEFEF 2px 2px;
        border-radius: 15rpx"
        :border="false"
    >
      <u-cell
          title="工作单位"
          :isLink="true"
          :border="false"
      >
        <span slot="value" style="width: 180px;">{{ infos.unit }}</span>
      </u-cell>
    </u-cell-group>
	</view>
</template>

<script>
import config from '@/config'

	export default {
		data() {
			return {
        infos: {
          avatar: config.fileUrl + uni.getStorageSync('facePath'),
          username: '',
          unit: ''
        }
			}
		},
    onLoad(opt) {
      console.log('🚀 ~ onLoad')
      opt = JSON.parse(opt.params)
      this.infos.username = opt.userName
      this.infos.unit = opt.className
    },
		methods: {
      // 点击头像
      handleAvatar() {
        uni.navigateTo({
          url: '/pages/YNEduApp/user/faceScan'
        })
      }
		}
	}
</script>

<style lang="scss">

  .page{

    width: 100vw;
    height: 100vh;
    background-color: #F8F8F8;
    box-sizing: border-box;
    padding: 5vw;

  }

</style>
