<template>
  <view class="container commonPageBox">
    <!-- 公共组件-每个页面必须引入 -->
    <public-module></public-module>
    <z-nav-bar title="个人资料" bgColor="#258feb" fontColor="#fff"></z-nav-bar>
    
    <UserInfo :userInfo="userInfo" :$http="$http" :dataList="dataList" @show-submit-info="onShowSubmitInfo" @close-submit-info="closeManager"></UserInfo>
		<addCerInfo v-if="showSubmitInfoBlank" :submitInfo="submitInfo" @close="closeManager()" ></addCerInfo>
  </view>
</template>

<script>
	import addCerInfo from "@/components/addCerInfo.vue";
  import UserInfo from "edu-core/components/user-info/index.vue";
  import $http from "@/config/requestConfig.js";
  import { mapState } from "vuex";

export default {
  data() {
    return {
      showSubmitInfoBlank: false,
      submitInfo: {},
      dataList: [
        {
          title: "昵称",
          indexValue: "nickname",
          type: "nickname",
        },
        {
          title: "手机号",
          indexValue: "tel",
          type: "tel",
        },
        {
          title: "邮箱",
          indexValue: "email",
          type: "email",
        },
        {
          title: "密码",
          indexValue: "password",
          type: "password",
        },
        {
          title: "年龄",
          indexValue: "age",
          type: "age",
        },
        {
          title: "性别",
          indexValue: "sex",
          type: "sex",
        },
		    {
          title: "真实姓名/证书姓名",
          indexValue: "name",
          type: "name",
        },
        {
          title: "证件照",
          indexValue: "photo",
          type: "photo",
        },
        {
          title: "身份",
          indexValue: "socialIdentity",
          type: "profile",
        },
      ],
    }
  },
  //第一次加载
  onLoad(e) {
    // 隐藏原生的tabbar
    uni.hideTabBar();
  },
  computed: {
    ...mapState(["userInfo"]),
  },
  //页面显示
  onShow() {
    // 隐藏原生的tabbar
    uni.hideTabBar();
  },
  components: {
	  addCerInfo,
	  UserInfo
  },
  //方法
  methods: {
    onShowSubmitInfo(info) {
      this.submitInfo = info;
      this.showSubmitInfoBlank = true;
    },
    closeManager() {
      this.submitInfo = {};
      this.showSubmitInfoBlank = false;
    },
  },
};
</script>
<style lang="scss" scoped>
// @import "@/style/mixin.scss";
</style>
