<template>
  <div class="myProfile_main">
    <div class="title_main">
      <div class="return_icon" @click="previousStep"></div>
      <div class="title">我的资料</div>
    </div>
    <div class="head_main">
      <div class="head_img">
        <img src="../../../assets/images/sunVillage/head_portrait.jpg" />
      </div>
      <div class="head_info">
        <div class="name">王云</div>
        <div class="tel">15854545454</div>
      </div>
    </div>
    <div class="list_main">
      <div class="flex_block" @click="headModify">
        <div class="title">头像</div>
        <div class="main">
          <div class="head">
            <img src="../../../assets/images/sunVillage/head_portrait.jpg" />
          </div>
          <div class="more_icon"></div>
        </div>
      </div>
      <div class="flex_block" @click="skip('/sunVillage/user/information')">
        <div class="title">姓名</div>
        <div class="main">
          <div class="text">王云</div>
          <div class="more_icon"></div>
        </div>
      </div>
      <div class="flex_block" @click="skip('/sunVillage/user/mobile')">
        <div class="title">手机号</div>
        <div class="main">
          <div class="text">15854545454</div>
          <div class="more_icon"></div>
        </div>
      </div>
      <div class="flex_block" @click="skip('/sunVillage/user/information')">
        <div class="title">密码</div>
        <div class="main">
          <div class="text">修改密码</div>
          <div class="more_icon"></div>
        </div>
      </div>
      <div class="flex_block" @click="genderModify">
        <div class="title">性别</div>
        <div class="main">
          <div class="text">男</div>
          <div class="more_icon"></div>
        </div>
      </div>
      <div class="flex_block" @click="birthDateModify">
        <div class="title">出生日期</div>
        <div class="main">
          <div class="text">1985-05-24</div>
          <div class="more_icon"></div>
        </div>
      </div>
      <div class="flex_block" @click="skip('/sunVillage/user/cooperative')">
        <div class="title">所属合作社</div>
        <div class="main">
          <div class="text">王云经济合作社</div>
          <div class="more_icon"></div>
        </div>
      </div>
    </div>
    <div class="exit_main">
      <div class="exit_btn">退出登录</div>
    </div>

    <van-popup
      v-model="myProfileVisibile"
      position="bottom"
      round
      :style="{ height: '364px' }"
    >
      <div class="takingPictures_main">
        <div class="title">选择操作</div>
        <div class="main">
          <div class="takingPictures">
            <van-uploader>
              <div class="icon"></div>
            </van-uploader>
          </div>
          <div class="folder">
            <van-uploader>
              <div class="icon"></div>
            </van-uploader>
          </div>
        </div>
      </div>
    </van-popup>

    <van-popup
      v-model="genderObj.visibile"
      position="bottom"
      round
      :style="{ height: '45%' }"
    >
      <van-picker
        show-toolbar
        :columns="genderObj.list"
        @cancel="genderObj.visibile = false"
        @confirm="onChangeGenderObj"
      />
    </van-popup>

    <van-popup
      v-model="birthDateObj.visibile"
      position="bottom"
      round
      :style="{ height: '45%' }"
    >
      <van-datetime-picker
        v-model="birthDateObj.currentDate"
        type="date"
        title="选择年月日"
        :min-date="birthDateObj.minDate"
        :max-date="birthDateObj.maxDate"
        @cancel="birthDateObj.visibile = false"
        @confirm="onChangeBirthDateObj"
      />
    </van-popup>
  </div>
</template>
<script>
export default {
  data() {
    return {
      myProfileVisibile: false,
      genderObj: {
        visibile: false,
        list: ["男", "女"],
      },
      birthDateObj: {
        visibile: false,
        minDate: new Date(2020, 0, 1),
        maxDate: new Date(2025, 10, 1),
        currentDate: new Date(2021, 0, 17),
      },
    };
  },
  mounted() {},
  methods: {
    headModify() {
      this.myProfileVisibile = true;
    },
    genderModify() {
      this.genderObj.visibile = true;
    },
    skip(url) {
      this.$router.push(url);
    },
    onChangeGenderObj() {
      this.genderObj.visibile = false;
    },
    birthDateModify() {
      this.birthDateObj.visibile = true;
    },
    onChangeBirthDateObj() {
      this.birthDateObj.visibile = false;
    },
    previousStep() {
      let setupEntrance = window.localStorage.getItem("setupEntrance");
      if (setupEntrance) {
        this.$router.push(setupEntrance);
      } else {
        this.$router.push("/sunVillage/index");
      }
    },
  },
};
</script>

<style scoped lang="scss">
.myProfile_main {
  width: 100vw;
  height: 100vh;
  background: #fff;
  position: relative;
  padding-top: 90px;
  .title_main {
    display: flex;
    height: 90px;
    padding: 0 24px;
    align-items: center; /*  子元素相对父元素垂直居中 */
    border-bottom: 1px solid #e5e5e5;
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    background: #fff;
    .return_icon {
      width: 16px;
      height: 26px;
      background: url("../../../assets/images/sunVillage/headings_return.png")
        no-repeat;
      background-size: 100% 100%;
      margin-right: 16px;
      margin-left: 8px;
    }
    .title {
      font-size: 32px;
    }
  }
  .head_main {
    height: 144px;
    margin: 20px 56px 0;
    display: flex;
    justify-content: center; /* 相对父元素水平居中 */
    align-items: center; /*  子元素相对父元素垂直居中 */
    border-bottom: 1px solid #e6e6e6;
    .head_img {
      width: 96px;
      height: 96px;
      border-radius: 15px;
      img {
        width: 96px;
        height: 96px;
      }
    }
    .head_info {
      flex: 1;
      margin-left: 28px;
      .name {
        font-size: 34px;
        margin-bottom: 10px;
      }
      .tel {
        font-size: 28px;
        color: #999;
      }
    }
  }
  .list_main {
    margin: 0 56px;
    .flex_block {
      margin-top: 20px;
      display: flex;
      height: 105px;
      border-bottom: 1px solid #e6e6e6;
      align-items: center; /*  子元素相对父元素垂直居中 */
      justify-content: space-between;
      .title {
        width: 210px;
        font-size: 34px;
        color: #999;
      }
      .main {
        display: flex;
        align-items: center; /*  子元素相对父元素垂直居中 */
        .head {
          width: 80px;
          height: 80px;
          margin-right: 55px;
          img {
            width: 80px;
            height: 80px;
          }
        }
        .more_icon {
          width: 14px;
          height: 26px;
          background: url("../../../assets/images/sunVillage/more.png")
            no-repeat;
          background-size: 100% 100%;
          margin-bottom: -10px;
        }
        .text {
          font-size: 34px;
          margin-right: 55px;
        }
      }
    }
  }
  .exit_main {
    padding: 70px 0;
    .exit_btn {
      height: 80px;
      width: 340px;
      background: #b9b9b9;
      color: #fff;
      font-size: 34px;
      text-align: center;
      line-height: 80px;
      margin: 0 auto;
      border-radius: 8px;
    }
  }
  .takingPictures_main {
    .title {
      text-align: center;
      font-size: 30px;
      padding: 20px 0;
    }
    .main {
      margin: 15px 80px 0;
      display: flex;
      .takingPictures {
        width: 120px;
        height: 112px;
        margin-right: 40px;
        .icon {
          width: 120px;
          height: 112px;
          background: url("../../../assets/images/sunVillage/TakingPictures.png")
            no-repeat;
          background-size: 100% 100%;
        }
      }
      .folder {
        width: 120px;
        height: 112px;
        .icon {
          width: 120px;
          height: 112px;
          background: url("../../../assets/images/sunVillage/TakingPictures_2.png")
            no-repeat;
          background-size: 100% 100%;
        }
      }
    }
  }
}
</style>