index.vue 3 KB
<template>
  <div class="person_cantainer">
    <NafmHeader :title="$t('title.person')" navClass="nafmii-head-bg3" />
    <div class="setting_list">
      <van-cell :title="$t('person.photo')" center is-link value-class="right_content">
        <template #default>
          <img :src="headerIcon" class="headerImg" alt="">
        </template>
      </van-cell>
      <van-cell :title="$t('person.nickName')" center is-link @click="editCommon('设置昵称',nickname)" value-class="right_content">
        <template #default>
          <span v-if="nickname">{{nickname}}</span>
          <span v-else>{{$t('person.nickNamePlaceholder')}}</span>
        </template>
      </van-cell>
      <van-cell :title="$t('person.phoneNumber')" center value-class="right_content">
        <template #default>
          183****8924
        </template>
      </van-cell>
      <van-cell :title="$t('person.name')" center is-link @click="editCommon('设置姓名',name)" value-class="right_content">
        <template #default>
          <span v-if="name">{{name}}</span>
          <span v-else>{{$t('person.namePlaceholder')}}</span>
        </template>
      </van-cell>
      <van-cell :title="$t('person.nationality')" center is-link value-class="right_content">
        <template #default>
          <span v-if="nationality">{{nationality}}</span>
          <span v-else>{{$t('person.nationalityPlaceholder')}}</span>
        </template>
      </van-cell>
      <van-cell :title="$t('person.birthday')" center is-link value-class="right_content">
        <template #default>
          <span v-if="birthday">{{birthday}}</span>
          <span v-else>{{$t('person.birthdayPlaceholder')}}</span>
        </template>
      </van-cell>
      <van-cell :title="$t('person.email')" center is-link @click="editCommon('设置邮箱',email)" value-class="right_content">
        <template #default>
          <span v-if="name">{{email}}</span>
          <span v-else>{{$t('person.emailPlaceholder')}}</span>
        </template>
      </van-cell>
      <van-cell :title="$t('person.company')" center is-link @click="editCommon('设置单位',company)" value-class="right_content">
        <template #default>
          <span v-if="name">{{company}}</span>
          <span v-else>{{$t('person.companyPlaceholder')}}</span>
        </template>
      </van-cell>
    </div>
  </div>
</template>
<script>
export default {
  name: 'Person',
  data() {
    return {
      headerIcon: require('@/assets/icon/photo_default.png'),
      nickname: '',
      name: '',
      nationality: '',
      birthday: '',
      email: '',
      company: ''
    }
  },
  methods: {
    editCommon(title, value) {
      this.$router.push({
        path: '/user/commonEdit',
        query: {
          title,
          value
        }
      })
    }
  }
}
</script>
<style lang="less" scoped>
.person_cantainer{
  background: #fafafa;
  height: 100vh;
}
.headerImg {
  width: 55px;
  height: 55px;
  border-radius: 50%;
}
.right_content {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
</style>