<template>
  <view class="body-background"></view>
  <u-navbar
      :title="title"
      :auto-back="true"
      left-icon-size="40rpx"
      :safe-area-inset-top="true"
      :placeholder="true"
      bgColor="#ffffff"
  ></u-navbar>
  <view class="app-wallpaper">
    <u-row :custom-style="{
      backgroundColor:'#fff',
      borderRadius:'10rpx',
      alignItems:'flex-start'
    }">
      <u-col :custom-style="{padding:'30rpx 40rpx',height:size.height+'px'}">
        <u-form
            labelPosition="left"
            :model="model1"
            :rules="rules"
            ref="form1"
            labelWidth="200rpx"
        >
          <u-form-item
              :custom-style="{
                  padding:'34rpx 0'
              }"
              label="姓名"
              prop="userInfo.name"
              borderBottom
              ref="item1"
          >
            <u-input
                fontSize="28"
                placeholder="请填写您的真实姓名"
                v-model="model1.userInfo.name"
                border="none"
            ></u-input>
          </u-form-item>
          <u-form-item
              :custom-style="{
                  padding:'34rpx 0'
              }"
              label="手机号码"
              prop="userInfo.name"
              borderBottom
              ref="item1"
          >
            <u-input
                fontSize="28"
                placeholder="请输入"
                v-model="model1.userInfo.name"
                border="none"
            ></u-input>
          </u-form-item>
          <u-form-item
              :custom-style="{
                  padding:'34rpx 0'
              }"
              label="所属街道"
              prop="userInfo.name"
              borderBottom
              ref="item1"
          >
            <u-input
                fontSize="28"
                placeholder="请选择"
                v-model="model1.userInfo.name"
                border="none"
            ></u-input>
          </u-form-item>
          <u-form-item
              :custom-style="{
                  padding:'34rpx 0'
              }"
              label="所属社区"
              prop="userInfo.name"
              borderBottom
              ref="item1"
          >
            <u-input
                fontSize="28"
                placeholder="请选择"
                v-model="model1.userInfo.name"
                border="none"
            ></u-input>
          </u-form-item>

          <u-form-item
              :custom-style="{
                  padding:'34rpx 0'
              }"
              label="公司全称"
              prop="userInfo.name"
              borderBottom
              ref="item1"
          >
            <u-input
                fontSize="28"
                placeholder="请输入"
                v-model="model1.userInfo.name"
                border="none"
            ></u-input>
          </u-form-item>
          <u-form-item
              :custom-style="{
                  padding:'34rpx 0'
              }"
              label="职业分类"
              prop="userInfo.name"
              borderBottom
              ref="item1"
          >
            <u-input
                fontSize="28"
                placeholder="请选择"
                v-model="model1.userInfo.name"
                border="none"
            ></u-input>
          </u-form-item>
          <u-form-item
              :custom-style="{
                  padding:'34rpx 0'
              }"
              label="身份证号码"
              prop="userInfo.name"
              ref="item1"
          >
            <u-input
                fontSize="28"
                placeholder="请输入"
                v-model="model1.userInfo.name"
                border="none"
            ></u-input>
          </u-form-item>
        </u-form>
      </u-col>
    </u-row>
  </view>
  <view class="foot-button border-box">
    <u-button
        type="primary"
        text="保存"
        shape="circle"
        :custom-style="{
              color:'#020B18',
              backgroundColor:'#FF9545',
              border:'none',
              fontSize:'36',
              fontWeight:'400',
              height:'80rpx'
            }"
    ></u-button>
  </view>
</template>

<script>
import {
  imghost
} from '@/config/host.js'
import MzSubsection from '@/components/MzSubsection/Index.vue';
import api from '@/utils/functions.js';

export default {
  components: {
    MzSubsection
  },
  data() {
    return {
      model1: {
        userInfo: {
          name: '',
          sex: 1,
        },
      },
      rules: {
        'userInfo.name': {
          type: 'string',
          required: true,
          message: '请填写姓名',
          trigger: ['blur', 'change']
        },
        'userInfo.sex': {
          type: 'string',
          max: 1,
          required: true,
          message: '请选择男或女',
          trigger: ['blur', 'change']
        },
      },
      sexList:[
        {
          id:1,
          name: '男',
          disabled: false,
        },
        {
          i:2,
          name: '女',
          disabled: false,
        },
      ],
      list: [{
        name: '最新资讯'
      }, {
        name: '表彰评优'
      }, {
        name: '活动回顾'
      }],
      // 或者如下，也可以配置keyName参数修改对象键名
      // list: [{name: '未付款'}, {name: '待评价'}, {name: '已付款'}],
      current: 1,
      title: '编辑资料',
      loading: true,
      staticImage: {
        bg: imghost + '/static/image/BG.png',
        newIcon: imghost + '/static/image/new-icon.png',
      },
      user: {
        avatar: imghost + '/static/image/banner.png',
        nickname: '清晨的风',
        coupons: 221,
        id: 88685,
      },
      isTop: false,
      lists: [
        {
          id: 1,
          thumb: imghost + '/static/image/new-1.png',
          title: '全市公安机关夏季治安打击整治“彭安行动”新闻发布会召开',
          desc: '需要您带一点猫砂上门，谢谢',
          time: '2023/06/16',
          is_new: true
        }, {
          id: 2,
          thumb: imghost + '/static/image/new-2.png',
          title: '全市公安机关夏季治安打击整治“彭安行动”新闻发布会召开',
          desc: '需要您带一点猫砂上门，谢谢',
          time: '2023/06/16',
          is_new: true
        }, {
          id: 3,
          thumb: imghost + '/static/image/new-3.png',
          title: '全市公安机关夏季治安打击整治“彭安行动”111开',
          desc: '需要您带一点猫砂上门，谢谢',
          time: '2023/06/16',
          is_new: false
        },
      ],
      size: {
        height: 500,
      }
    }
  },
  onLoad() {

  },
  onReady() {
    let that = this;
    let height = api.wxSystemInfo().system.windowHeight
    let headerHeight = uni.$u.getPx(44) + uni.$u.sys().statusBarHeight
    console.log('headerHeight',headerHeight)

    let info = uni.createSelectorQuery().in(this).select('.foot-button');
    info.boundingClientRect(function (data) {
      that.size.height = that.size.height = height - headerHeight - data.height - uni.$u.getPx('32rpx');
    }).exec(function (res) {

    });
  },
  computed: {
    api() {
      return api
    },
    sectionStyle() {
      const style = {};
      style.padding = '0 26rpx';
      style.position = 'sticky';
      style.zIndex = '9999';
      style.top = api.navHeight().systemBarHeight + 'px'
      return style;
    },
    listHeight() {
      let that = this;
      let height;
      let info = uni.createSelectorQuery().in(this).select('.subsection');
      info.boundingClientRect(function (data) {
        that.size.height = data.height;
      }).exec(function (res) {

      });
      // that.size.height = (api.navHeight().windowHeight - height);
    }
  },
  methods: {
    chatDetail(item) {
      wx.navigateTo({
        url: '/pages/ChatDetail/index?id=' + item.id
      });
    },
    checkSection(index) {
      this.current = edit;
    },
    scrollToLower() {

    },
  },
  onPageScroll(res) {
    if (res.scrollTop <= 20) {
      uni.$emit('isTop', true);
    } else {
      uni.$emit('isTop', false);
    }
  },
  created() {
    this.listHeight();
    // this.pagePadding = (api.navHeight().navPaddingTop +
    // 	api.navHeight().navHeight + (api.navHeight().headerPadding * 2))
  }
}
</script>

<style lang="scss">
@import './components/index.scss';
</style>