index.vue 2.75 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="https://himg.bdimg.com/sys/portraitn/item/a0abbaacd0a6d2bbb9fd73756e6e798e8d" class="headerImg" alt="">
        </template>
      </van-cell>
      <van-cell :title="$t('person.nickName')" center is-link @click="editUserName('设置用户名',userName)" value-class="right_content">
        <template #default>
          <span v-if="userName">{{userName}}</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="editUserName('设置姓名',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>中国</template>
      </van-cell>
      <van-cell :title="$t('person.birthday')" center is-link value-class="right_content">
        <template #default>
          <span v-if="name">{{name}}</span>
          <span v-else>请选择您的出生日期</span>
        </template>
      </van-cell>
      <van-cell :title="$t('person.email')" center is-link @click="editUserName('设置邮箱',email)" value-class="right_content">
        <template #default>
          <span v-if="name">{{email}}</span>
          <span v-else>请输入您的邮箱</span>
        </template>
      </van-cell>
      <van-cell :title="$t('person.company')" center is-link @click="editUserName('设置单位',company)" value-class="right_content">
        <template #default>
          <span v-if="name">{{company}}</span>
          <span v-else>请输入您的单位全称</span>
        </template>
      </van-cell>
    </div>
  </div>
</template>
<script>
export default {
  name: 'Person',
  data() {
    return {
      userName: '',
      name: '',
      email: '',
      company: ''
    }
  },
  methods: {
    editUserName(title, value) {
      this.$router.push({
        path: '/user/commonEdit',
        query: {
          title,
          value
        }
      })
    }
  }
}
</script>
<style lang="less" scoped>
.headerImg {
  width: 55px;
  height: 55px;
  border-radius: 50%;
}
.right_content {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
</style>