123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- <template>
- <view class="register-bg">
- <auth-wrap class="register-container" ref="authWrap">
- <view class="form-content" slot="content">
- <RegistForm
- v-if="rules"
- :rules="rules"
- :mode='mode'
- ref="registForm"
- @onSubmitHandle="onFormSubmit"
- :regist-info="model1.userInfo">
- </RegistForm>
- </view>
- </auth-wrap>
- </view>
- </template>
- <script>
- import { fetchUsrApplyDetail, formCfg, putUsrRegist } from '@/common/api';
- import { FORM_MOD, 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';
- 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: '0',
- usrType: '1',
- follows: [],
- },
- },
- rules: null,
- mode: null,
- };
- },
- created() {
- },
- async onLoad(res) {
- 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();
- if (res && res.mode === FORM_MOD.modify) {
- this.mode = FORM_MOD.modify;
- await this.getUsrMeetingInfo(res.apply);
- } else {
- this.$refs.registForm?.restForm();
- }
- },
- onReady() {
- },
- methods: {
- hideKeyboard() {
- uni.hideKeyboard();
- },
- async onFormSubmit(userInfo) {
- const params = {
- conferenceFlag: '',
- comInfo: '',
- backInfo: '',
- };
- Object.assign(params, userInfo);
- const { code } = await putUsrRegist(params, MEETING_TYPE.meeting.value);
- if (code !== 200) {
- return;
- }
- uni.showToast({
- mask: true,
- title: '报名完成',
- icon: 'success',
- success: async () => {
- let pages = getCurrentPages(); //获取当前页面
- let beforePage = pages[pages.length - 2]; //获取上一个页面的实例
- //1、调用上一个页面onLoad
- beforePage.onLoad();
- uni.navigateBack({
- delta: 1,
- });
- },
- });
- },
- async getUsrMeetingInfo(id) {
- const { data } = await fetchUsrApplyDetail(id);
- if (!data) {
- return;
- }
- this.model1.userInfo = data;
- },
- },
- };
- </script>
- <style lang="scss" src="./index.scss" />;
|