<template>
  <div>
    <Navbar title="个人信息" />
    <u-cell-group :border="false">
      <u-cell title="头像">
        <u--image slot="value" :src="avatar" shape="circle" width="36" height="36"></u--image>
      </u-cell>
      <u-cell title="姓名" :value="userName">
        <text slot="value">{{ userName }}</text>
      </u-cell>
      <u-cell title="手机号" :value="phone">
        <text slot="value">{{ phone }}</text>
      </u-cell>
      <u-cell title="部门" :value="department">
        <text slot="value">{{ department }}</text>
      </u-cell>
      <u-cell title="岗位" :value="job">
        <text slot="value">{{ job }}</text>
      </u-cell>
    </u-cell-group>
  </div>
</template>

<script>
export default {
  data() {
    return {
      // 头像 url
      avatar: '',
      // 姓名
      userName: '',
      // 手机号
      phone: '',
      // 部门
      department: '',
      // 岗位
      job: '',
      // 人脸照片
      facePhoto: ''
    }
  },
  created() {
    // 获取用户信息
    const userInfo = uni.getStorageSync('userInfo')
    console.log('🚀 ~ created ~ userInfo:', userInfo)
    this.avatar = userInfo.avatar || '/static/images/imgs/user-info.png'
    this.userName = userInfo.nickName
    this.phone = userInfo.phonenumber || '暂无'
    this.department = userInfo.department || '暂无'
    this.job = userInfo.job || '暂无',
    this.facePhoto = userInfo.facePhoto || '未上传'
  }
}
</script>

<style lang="scss" scoped></style>
