<template>
  <view class="register-bg">
    <view class="bg-container">
      参会报名
    </view>
    <auth-wrap class="register-container" ref="authWrap">
      <view class="form-content" slot="content">
        <RegistForm v-if="rules" :rules="rules" ref="registForm"></RegistForm>
      </view>
    </auth-wrap>
  </view>
</template>

<script>

import { formCfg } from '@/common/api';
import { ICON_CFG, USR_TYPE_LIST } from '@/common/EnumConst';
import AuthWrap from '@/components/AuthComp/index.vue';
import SingleDropList from '@/components/SingleDropList/index.vue';
import RegistForm from '@/pasb/pages/regist/RegistForm.vue';

const staticRules = {
  'userInfo.email': {
    pattern: /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/,
  },
};
export default {
  name: 'login',
  components: {
    RegistForm,
    AuthWrap,
    SingleDropList,
  },
  props: {},
  data() {
    return {
      ICON_CFG,
      USR_TYPE_LIST,
      showEnterprise: false,
      loading: false,
      model1: {
        userInfo: {
          usrName: '',
          conferenceFlag: '1',
        },
      },
      rules: null,
    };
  },
  created() {

  },
  async onLoad() {
    const { msg } = await formCfg('meet_form_cfg');
    if (msg) {
      const cfgJson = JSON.parse(msg);
        Object.keys(staticRules).forEach(item => {
          Object.assign(cfgJson[item], staticRules[item]);
        });
        this.rules = cfgJson;
      }
    //如果需要兼容微信小程序，并且校验规则中含有方法等，只能通过setRules方法设置规则。
    this.$refs.authWrap.reloadPage();
    this.$refs.registForm?.setFormRules();
  },
  onReady() {

  },
  methods: {
    hideKeyboard() {
      uni.hideKeyboard();
    },
  },
};
</script>
<style lang="scss" src="./index.scss" />;
