|
@@ -12,12 +12,11 @@
|
|
|
<Button type="primary" @click="redirectTo('/pages/index')">返回首页</Button>
|
|
<Button type="primary" @click="redirectTo('/pages/index')">返回首页</Button>
|
|
|
</Result>
|
|
</Result>
|
|
|
<!--注册-->
|
|
<!--注册-->
|
|
|
- <FlexCol v-else-if="step === 'register'" :padding="30">
|
|
|
|
|
|
|
+ <FlexCol v-else-if="step === 'register'">
|
|
|
<DynamicForm
|
|
<DynamicForm
|
|
|
ref="registerFormRef"
|
|
ref="registerFormRef"
|
|
|
:model="registerFormModel"
|
|
:model="registerFormModel"
|
|
|
:options="registerFormDefine"
|
|
:options="registerFormDefine"
|
|
|
- :formGlobalParams="querys"
|
|
|
|
|
/>
|
|
/>
|
|
|
<Height :height="20" />
|
|
<Height :height="20" />
|
|
|
<Button block type="primary" @click="registerSubmit" :loading="registerFormLoading">提交</Button>
|
|
<Button block type="primary" @click="registerSubmit" :loading="registerFormLoading">提交</Button>
|
|
@@ -72,21 +71,14 @@ import DynamicForm from '@/components/dynamic/DynamicForm.vue';
|
|
|
import { useAppInit } from '@/common/composeabe/AppInit';
|
|
import { useAppInit } from '@/common/composeabe/AppInit';
|
|
|
import { UserApi } from '@/api/auth/UserApi';
|
|
import { UserApi } from '@/api/auth/UserApi';
|
|
|
import { useAuthStore } from '@/store/auth';
|
|
import { useAuthStore } from '@/store/auth';
|
|
|
-import { useAliOssUploadCo } from '@/common/components/upload/AliOssUploadCo';
|
|
|
|
|
import { redirectTo } from '@/components/utils/PageAction';
|
|
import { redirectTo } from '@/components/utils/PageAction';
|
|
|
import { closeToast, toast } from '@/components/dialog/CommonRoot';
|
|
import { closeToast, toast } from '@/components/dialog/CommonRoot';
|
|
|
import { showError } from '@/common/composeabe/ErrorDisplay';
|
|
import { showError } from '@/common/composeabe/ErrorDisplay';
|
|
|
import { useLoadQuerys } from '@/common/composeabe/LoadQuerys';
|
|
import { useLoadQuerys } from '@/common/composeabe/LoadQuerys';
|
|
|
import { onMounted, ref } from 'vue';
|
|
import { onMounted, ref } from 'vue';
|
|
|
-import VillageApi, { type VolunteerInfo } from '@/api/inhert/VillageApi';
|
|
|
|
|
-import CommonContent from '@/api/CommonContent';
|
|
|
|
|
-import type { IDynamicFormItemCallbackAdditionalProps, IDynamicFormOptions, IDynamicFormRef } from '@/components/dynamic';
|
|
|
|
|
-import type { FieldProps } from '@/components/form/Field.vue';
|
|
|
|
|
-import type { RuleItem } from 'async-validator';
|
|
|
|
|
-import type { PickerIdFieldProps } from '@/components/dynamic/wrappers/PickerIdField';
|
|
|
|
|
-import type { RadioValueProps } from '@/components/dynamic/wrappers/RadioValue';
|
|
|
|
|
-import type { UploaderFieldProps } from '@/components/form/UploaderField.vue';
|
|
|
|
|
-import type { FormProps } from '@/components/form/Form.vue';
|
|
|
|
|
|
|
+import { getVolunteerForm } from '../admin/data/volunteer';
|
|
|
|
|
+import VillageApi, { VolunteerInfo } from '@/api/inhert/VillageApi';
|
|
|
|
|
+import type { IDynamicFormOptions, IDynamicFormRef } from '@/components/dynamic';
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 分享注册页面
|
|
* 分享注册页面
|
|
@@ -110,6 +102,13 @@ onMounted(async () => {
|
|
|
step.value = 'error';
|
|
step.value = 'error';
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
+ registerFormDefine.value = getVolunteerForm({
|
|
|
|
|
+ canSetCatalog: false,
|
|
|
|
|
+ villageId: querys.value.villageId,
|
|
|
|
|
+ onlyPassword: false,
|
|
|
|
|
+ isNew: ref(true),
|
|
|
|
|
+ formRef: registerFormRef,
|
|
|
|
|
+ });
|
|
|
if (authStore.isLogged) {
|
|
if (authStore.isLogged) {
|
|
|
try {
|
|
try {
|
|
|
await VillageApi.getVolunteerInfo();
|
|
await VillageApi.getVolunteerInfo();
|
|
@@ -154,118 +153,8 @@ async function loginWechat() {
|
|
|
|
|
|
|
|
const registerFormLoading = ref(false);
|
|
const registerFormLoading = ref(false);
|
|
|
const registerFormRef = ref<IDynamicFormRef>();
|
|
const registerFormRef = ref<IDynamicFormRef>();
|
|
|
-const registerFormModel = ref<VolunteerInfo>();
|
|
|
|
|
-const registerFormDefine : IDynamicFormOptions = {
|
|
|
|
|
- formItems: [
|
|
|
|
|
- {
|
|
|
|
|
- name: 'groupBase',
|
|
|
|
|
- type: 'flat-simple',
|
|
|
|
|
- children: [
|
|
|
|
|
- {
|
|
|
|
|
- label: '登录账号', name: 'username', type: 'text',
|
|
|
|
|
- additionalProps: {
|
|
|
|
|
- placeholder: '请输入用户名',
|
|
|
|
|
- },
|
|
|
|
|
- rules: [{ required: true, message: '请输入用户名' }],
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- label: '密码',
|
|
|
|
|
- name: 'password',
|
|
|
|
|
- type: 'text',
|
|
|
|
|
- additionalProps: {
|
|
|
|
|
- placeholder: '请输入密码',
|
|
|
|
|
- type: 'password',
|
|
|
|
|
- } as FieldProps,
|
|
|
|
|
- rules: [{ required: true, message: '请输入密码' }],
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- label: '确认密码',
|
|
|
|
|
- name: 'passwordRepeat',
|
|
|
|
|
- type: 'text',
|
|
|
|
|
- additionalProps: {
|
|
|
|
|
- placeholder: '请再输入一次密码',
|
|
|
|
|
- type: 'password',
|
|
|
|
|
- } as FieldProps,
|
|
|
|
|
- rules: [
|
|
|
|
|
- { required: true, message: '请再输入一次密码' },
|
|
|
|
|
- {
|
|
|
|
|
- async validator(rule, value) {
|
|
|
|
|
- if (value != registerFormRef.value?.getValueByPath('password'))
|
|
|
|
|
- throw '两次输入密码不一致,请检查';
|
|
|
|
|
- },
|
|
|
|
|
- }
|
|
|
|
|
- ] as RuleItem[],
|
|
|
|
|
- },
|
|
|
|
|
- ]
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- name: 'groupExtra',
|
|
|
|
|
- type: 'flat-simple',
|
|
|
|
|
- childrenColProps: {
|
|
|
|
|
- span: 24,
|
|
|
|
|
- },
|
|
|
|
|
- children: [
|
|
|
|
|
- {
|
|
|
|
|
- label: '真实名称', name: 'name', type: 'text',
|
|
|
|
|
- additionalProps: { placeholder: '请输入真实名称' },
|
|
|
|
|
- rules: [{ required: true, message: '请输入真实名称' }],
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- label: '手机号', name: 'mobile', type: 'text',
|
|
|
|
|
- additionalProps: { placeholder: '请输入手机号' },
|
|
|
|
|
- rules: [{ required: true, message: '请输入手机号' }],
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- label: '区域', name: 'regionId', type: 'select-id',
|
|
|
|
|
- additionalProps: {
|
|
|
|
|
- placeholder: '请选择区域',
|
|
|
|
|
- loadData: async () => (await CommonContent.getCategoryList(1)).map(p => ({ text: p.title, value: p.id, raw: p }))
|
|
|
|
|
- } as IDynamicFormItemCallbackAdditionalProps<PickerIdFieldProps>,
|
|
|
|
|
- rules: [{ required: true, message: '请选择区域' }],
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- label: '性别', name: 'sex', type: 'radio-value',
|
|
|
|
|
- additionalProps: {
|
|
|
|
|
- options: [
|
|
|
|
|
- { text: '男', value: 1 },
|
|
|
|
|
- { text: '女', value: 2 }
|
|
|
|
|
- ]
|
|
|
|
|
- } as RadioValueProps,
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- label: '头像', name: 'image', type: 'uploader',
|
|
|
|
|
- additionalProps: {
|
|
|
|
|
- single: true,
|
|
|
|
|
- maxFileSize: 1024 * 1024 * 10,
|
|
|
|
|
- upload: useAliOssUploadCo('xiangyuan/volunteer/images')
|
|
|
|
|
- } as UploaderFieldProps,
|
|
|
|
|
- },
|
|
|
|
|
- { label: '地址', name: 'address', type: 'text', additionalProps: { placeholder: '请输入地址' } },
|
|
|
|
|
- {
|
|
|
|
|
- label: '介绍',
|
|
|
|
|
- name: 'intro',
|
|
|
|
|
- type: 'textarea',
|
|
|
|
|
- additionalProps: {
|
|
|
|
|
- placeholder: '请输入介绍',
|
|
|
|
|
- showWordLimit: true,
|
|
|
|
|
- maxLength: 200,
|
|
|
|
|
- } as FieldProps,
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- label: '村落认领说明', name: 'claimReason', type: 'text',
|
|
|
|
|
- additionalProps: { placeholder: '请输入村落认领说明' } ,
|
|
|
|
|
- },
|
|
|
|
|
- ]
|
|
|
|
|
- },
|
|
|
|
|
- ],
|
|
|
|
|
- formAdditionaProps: {
|
|
|
|
|
- labelWidth: '160rpx',
|
|
|
|
|
- labelAlign: 'right',
|
|
|
|
|
- innerStyle: {
|
|
|
|
|
- radius: '10rpx',
|
|
|
|
|
- },
|
|
|
|
|
- } as Omit<FormProps, 'model'>,
|
|
|
|
|
-}
|
|
|
|
|
|
|
+const registerFormModel = ref<VolunteerInfo>(new VolunteerInfo());
|
|
|
|
|
+const registerFormDefine = ref<IDynamicFormOptions>();
|
|
|
|
|
|
|
|
async function registerSubmit() {
|
|
async function registerSubmit() {
|
|
|
if (!registerFormRef.value || !registerFormModel.value)
|
|
if (!registerFormRef.value || !registerFormModel.value)
|
|
@@ -279,7 +168,7 @@ async function registerSubmit() {
|
|
|
try {
|
|
try {
|
|
|
registerFormLoading.value = true;
|
|
registerFormLoading.value = true;
|
|
|
registerFormModel.value!.villageId = querys.value.villageId;
|
|
registerFormModel.value!.villageId = querys.value.villageId;
|
|
|
- const loginRes = await VillageApi.shareAddVolunteer(registerFormModel.value!);
|
|
|
|
|
|
|
+ const loginRes = await VillageApi.shareAddVolunteer(registerFormModel.value as VolunteerInfo);
|
|
|
await authStore.loginResultHandle(loginRes, UserApi.LOGIN_TYPE_USER);
|
|
await authStore.loginResultHandle(loginRes, UserApi.LOGIN_TYPE_USER);
|
|
|
await init();
|
|
await init();
|
|
|
toast({ content: '注册成功' });
|
|
toast({ content: '注册成功' });
|