12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <template>
- <view class="register-bg">
- <auth-wrap class="register-container" ref="authWrap">
- <view class="form-content" slot="content">
- <RegistForm v-if="rules" :rules="rules" ref="registForm" @onSubmitHandle="onFormSubmit"></RegistForm>
- </view>
- </auth-wrap>
- </view>
- </template>
- <script>
- import { fetchUsrInfo, formCfg, putUsrRegist } from '@/common/api';
- import { ICON_CFG, MEETING_TYPE, USR_TYPE_LIST } from '@/common/EnumConst';
- import AuthWrap from '@/components/AuthComp/index.vue';
- import RegistForm from '@/components/RegistForm';
- import SingleDropList from '@/components/SingleDropList/index.vue';
- import { getUserInfo, setUserInfo } from '@/util';
- 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 => {
- if (!cfgJson[item]) {
- Object.assign(cfgJson[item], staticRules[item]);
- }
- });
- this.rules = cfgJson;
- }
- //如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。
- this.$refs.authWrap.reloadPage();
- this.$refs.registForm?.setFormRules();
- },
- onReady() {
- },
- methods: {
- hideKeyboard() {
- uni.hideKeyboard();
- },
- async onFormSubmit(userInfo) {
- const { code } = await putUsrRegist(userInfo, MEETING_TYPE.meeting.value);
- if (code !== 200) {
- return;
- }
- uni.showToast({
- mask: true,
- title: '报名完成',
- icon: 'success',
- success: async () => {
- const user = getUserInfo();
- const newUsr = await fetchUsrInfo(user.id);
- if (newUsr.code === 200) {
- setUserInfo(newUsr.data);
- }
- uni.navigateBack({
- delta: 1,
- });
- },
- });
- },
- },
- };
- </script>
- <style lang="scss" src="./index.scss" />;
|