commonEdit.vue 1.76 KB
<!-- 设置用户名 设置姓名 设置邮箱 设置单位 -->
<template>
  <div class="common_container">
    <NafmHeader :title="title" class="header">
      <template slot="right">
        <span class="finish" @click="handleFinish">完成</span>
      </template>
    </NafmHeader>
    <div class="search">
      <input type="text" v-model="value" :placeholder="placeholder" class="input">
      <span class="close" @click="handleClear">&times;</span>
    </div>
  </div>
</template>
<script>
export default {
  name: 'CommonEdit',
  data() {
    return {
      title: '',
      value: '',
      placeholder: ''
    }
  },
  mounted() {
    const { title, value } = this.$route.query
    this.title = title
    this.userName = value
    console.log('title', title)
    if (title == '设置用户名') {
      this.placeholder = '请输入用户名'
    } else if (title == '设置姓名') {
      this.placeholder = '请输入您的姓名'
    } else if (title == '设置邮箱') {
      this.placeholder = '请输入您的邮箱'
    } else if (title == '设置单位') {
      this.placeholder = '请输入您的单位全称'
    }
  },
  methods: {
    handleFinish() {
      // 调用设置接口
      this.$router.back()
    },
    handleClear() {
      this.value = ''
    }
  }
}
</script>
<style lang="less" scoped>
.header .finish {
  font-size: 28px;
}
.search {
  margin: 15px;
  position: relative;
}
.input {
  height: 100px;
  line-height: 100px;
  background-color: #f6f6f6;
  width: 100%;
  border-radius: 16px;
  color: #333;
  font-size: 32px;
  padding: 0 100px 0 25px;
}
.close {
  position: absolute;
  right: 30px;
  top: 35px;
  width: 35px;
  height: 35px;
  line-height: 35px;
  text-align: center;
  color: #fff;
  background-color: #c4c4c4;
  border-radius: 50%;
}
</style>