|
@@ -18,7 +18,7 @@ import {
|
|
Popup,
|
|
Popup,
|
|
CountDown
|
|
CountDown
|
|
} from 'vant'
|
|
} from 'vant'
|
|
-import { defineComponent, onMounted, reactive } from 'vue'
|
|
|
|
|
|
+import { defineComponent, onMounted, reactive, ref } from 'vue'
|
|
import { useRoute } from 'vue-router'
|
|
import { useRoute } from 'vue-router'
|
|
import styles from './companion-teacher-register.module.less'
|
|
import styles from './companion-teacher-register.module.less'
|
|
import ImgCode from '@/components/o-img-code'
|
|
import ImgCode from '@/components/o-img-code'
|
|
@@ -41,10 +41,12 @@ export default defineComponent({
|
|
showSubject: false,
|
|
showSubject: false,
|
|
submitStatus: false,
|
|
submitStatus: false,
|
|
showEducation: false,
|
|
showEducation: false,
|
|
|
|
+ checkPhone: true,
|
|
id: route.query.id,
|
|
id: route.query.id,
|
|
name: route.query.name,
|
|
name: route.query.name,
|
|
t: route.query.t as any, // 过期时间
|
|
t: route.query.t as any, // 过期时间
|
|
- // qrCodeStatus: false, // 二维码是否失效
|
|
|
|
|
|
+ qrCodeStatus: false, // 二维码是否失效
|
|
|
|
+ qrCodeMessage: '',
|
|
pattern: /^1(3|4|5|6|7|8|9)\d{9}$/,
|
|
pattern: /^1(3|4|5|6|7|8|9)\d{9}$/,
|
|
columns: [] as any,
|
|
columns: [] as any,
|
|
pickerType: null, // 下拉类型
|
|
pickerType: null, // 下拉类型
|
|
@@ -66,7 +68,6 @@ export default defineComponent({
|
|
idcardBackImg: '' // 身份证反面照
|
|
idcardBackImg: '' // 身份证反面照
|
|
},
|
|
},
|
|
btnLoading: false,
|
|
btnLoading: false,
|
|
- checkPhone: false,
|
|
|
|
checked: true,
|
|
checked: true,
|
|
columnSubject: [] as any,
|
|
columnSubject: [] as any,
|
|
countDownStatus: true, // 是否发送验证码
|
|
countDownStatus: true, // 是否发送验证码
|
|
@@ -77,19 +78,21 @@ export default defineComponent({
|
|
})
|
|
})
|
|
|
|
|
|
const onSubmit = async () => {
|
|
const onSubmit = async () => {
|
|
- // if (state.qrCodeStatus) {
|
|
|
|
- // showDialog({
|
|
|
|
- // title: '提示',
|
|
|
|
- // message: '二维码已失效',
|
|
|
|
- // theme: 'round-button',
|
|
|
|
- // confirmButtonColor: '#ff8057'
|
|
|
|
- // })
|
|
|
|
- // return
|
|
|
|
- // }
|
|
|
|
|
|
+ if (state.qrCodeStatus) {
|
|
|
|
+ showDialog({
|
|
|
|
+ title: '提示',
|
|
|
|
+ message: state.qrCodeMessage,
|
|
|
|
+ theme: 'round-button',
|
|
|
|
+ confirmButtonColor: '#ff8057'
|
|
|
|
+ })
|
|
|
|
+ return
|
|
|
|
+ }
|
|
if (!state.checked) {
|
|
if (!state.checked) {
|
|
showToast('请阅读并同意协议')
|
|
showToast('请阅读并同意协议')
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+ console.log(state.forms, '///222')
|
|
|
|
+ return
|
|
state.btnLoading = true
|
|
state.btnLoading = true
|
|
try {
|
|
try {
|
|
const forms = state.forms
|
|
const forms = state.forms
|
|
@@ -198,6 +201,28 @@ export default defineComponent({
|
|
// return
|
|
// return
|
|
// }
|
|
// }
|
|
|
|
|
|
|
|
+ // t: route.query.t, // 过期时间
|
|
|
|
+ try {
|
|
|
|
+ const res = await request.post('/api-school/open/schoolTeacherStudent/queryQrCodeStatus', {
|
|
|
|
+ data: {
|
|
|
|
+ schoolId: state.id,
|
|
|
|
+ qrCodeEffectiveStartTime: state.t ? dayjs(state.t).format('YYYY-MM-DD HH:mm:ss') : null
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ if (res.code === 999) {
|
|
|
|
+ showDialog({
|
|
|
|
+ title: '提示',
|
|
|
|
+ message: res.message,
|
|
|
|
+ theme: 'round-button',
|
|
|
|
+ confirmButtonColor: '#ff8057'
|
|
|
|
+ })
|
|
|
|
+ state.qrCodeStatus = true
|
|
|
|
+ }
|
|
|
|
+ } catch (e: any) {
|
|
|
|
+ //
|
|
|
|
+ console.log(e)
|
|
|
|
+ }
|
|
|
|
+
|
|
try {
|
|
try {
|
|
const tempareas: any = []
|
|
const tempareas: any = []
|
|
areas.forEach((item) => {
|
|
areas.forEach((item) => {
|
|
@@ -241,38 +266,6 @@ export default defineComponent({
|
|
confirmButtonColor: '#ff8057'
|
|
confirmButtonColor: '#ff8057'
|
|
})
|
|
})
|
|
}
|
|
}
|
|
-
|
|
|
|
- // t: route.query.t, // 过期时间
|
|
|
|
- try {
|
|
|
|
- await request.post('/api-school/open/schoolTeacherStudent/queryQrCodeStatus', {
|
|
|
|
- data: {
|
|
|
|
- schoolId: state.id
|
|
|
|
- // qrCodeEffectiveStartTime: state.t ? dayjs(state.t).format('YYYY-MM-DD HH:mm:ss') : null
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- // if (state.t) {
|
|
|
|
- // const { data } = await request.get('/api-school/open/paramConfig/queryByParamName', {
|
|
|
|
- // requestType: 'form',
|
|
|
|
- // params: {
|
|
|
|
- // paramName: 'qr_code_expire_hours'
|
|
|
|
- // }
|
|
|
|
- // })
|
|
|
|
- // if (dayjs(Number(state.t)).add(data.paramValue, 'hour').isBefore(dayjs())) {
|
|
|
|
- // showDialog({
|
|
|
|
- // title: '提示',
|
|
|
|
- // message: '二维码已失效',
|
|
|
|
- // theme: 'round-button',
|
|
|
|
- // confirmButtonColor: '#ff8057'
|
|
|
|
- // })
|
|
|
|
- // state.qrCodeStatus = true
|
|
|
|
- // } else {
|
|
|
|
- // state.qrCodeStatus = false
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
- } catch (e: any) {
|
|
|
|
- //
|
|
|
|
- console.log(e)
|
|
|
|
- }
|
|
|
|
})
|
|
})
|
|
|
|
|
|
const onPreview = () => {
|
|
const onPreview = () => {
|
|
@@ -282,6 +275,76 @@ export default defineComponent({
|
|
)
|
|
)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ const formRef = ref()
|
|
|
|
+ const checkchangePhone = async () => {
|
|
|
|
+ try {
|
|
|
|
+ await formRef.value?.validate('phone')
|
|
|
|
+ state.checkPhone = false
|
|
|
|
+
|
|
|
|
+ getTeacherDetails()
|
|
|
|
+ } catch {
|
|
|
|
+ //
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ const getTeacherDetails = async () => {
|
|
|
|
+ try {
|
|
|
|
+ if (!state.forms.phone) return
|
|
|
|
+ const { data } = await request.post(
|
|
|
|
+ '/api-school/open/teacher/detail/' + state.forms.phone,
|
|
|
|
+ {
|
|
|
|
+ requestType: 'form',
|
|
|
|
+ data: {
|
|
|
|
+ phone: state.forms.phone
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ )
|
|
|
|
+ // 判断是否有数据
|
|
|
|
+ if (!data) return
|
|
|
|
+ const subjects = data.subjectId
|
|
|
|
+ ? data.subjectId.split(',').map((subject: any) => Number(subject))
|
|
|
|
+ : []
|
|
|
|
+ // 显示声部
|
|
|
|
+ subjects.forEach((subject: any) => {
|
|
|
|
+ const item = state.columnSubject.find((item: any) => item.value === subject)
|
|
|
|
+
|
|
|
|
+ if (item) {
|
|
|
|
+ state.selectSubjects.push(item)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ let cityCodeName = ''
|
|
|
|
+ state.columns.forEach((p: any) => {
|
|
|
|
+ if (p.areas && p.areas.length > 0) {
|
|
|
|
+ p.areas.forEach((c: any) => {
|
|
|
|
+ if (c.code === Number(data.cityCode)) {
|
|
|
|
+ cityCodeName = c.name
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ state.forms = {
|
|
|
|
+ realName: data.realName,
|
|
|
|
+ phone: data.phone,
|
|
|
|
+ gender: data.gender,
|
|
|
|
+ idCardNo: data.idCardNo,
|
|
|
|
+ cityCode: data.cityCode,
|
|
|
|
+ cityCodeName: cityCodeName,
|
|
|
|
+ provinceCode: data.provinceCode,
|
|
|
|
+ showSubjectIds: data.subjectId,
|
|
|
|
+ subjectIds: subjects as any,
|
|
|
|
+ smsValidCode: '',
|
|
|
|
+ educationBackground: data.educationBackground || '', // 学历
|
|
|
|
+ graduateSchool: data.graduateSchool, // 毕业学校
|
|
|
|
+ idcardFrontImg: data.idcardFrontImg || '',
|
|
|
|
+ idcardBackImg: data.idcardBackImg || '' // 身份证反面照
|
|
|
|
+ }
|
|
|
|
+ } catch {
|
|
|
|
+ //
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
return () => (
|
|
return () => (
|
|
<div class={styles.register}>
|
|
<div class={styles.register}>
|
|
<div class={styles.title}>
|
|
<div class={styles.title}>
|
|
@@ -290,20 +353,10 @@ export default defineComponent({
|
|
<span>{state.name}</span>
|
|
<span>{state.name}</span>
|
|
</p>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
- <Form validateFirst scrollToError onSubmit={onSubmit} ref="form" class={styles.form}>
|
|
|
|
|
|
+ <Form validateFirst scrollToError onSubmit={onSubmit} ref={formRef} class={styles.form}>
|
|
<CellGroup inset class={styles['cell-group']}>
|
|
<CellGroup inset class={styles['cell-group']}>
|
|
<Field
|
|
<Field
|
|
required
|
|
required
|
|
- label="真实姓名"
|
|
|
|
- v-model={state.forms.realName}
|
|
|
|
- rules={[{ required: true, message: '请填写真实姓名' }]}
|
|
|
|
- name="realName"
|
|
|
|
- placeholder="请填写真实姓名"
|
|
|
|
- maxlength="50"
|
|
|
|
- ></Field>
|
|
|
|
-
|
|
|
|
- <Field
|
|
|
|
- required
|
|
|
|
label="手机号码"
|
|
label="手机号码"
|
|
v-model={state.forms.phone}
|
|
v-model={state.forms.phone}
|
|
rules={[
|
|
rules={[
|
|
@@ -313,8 +366,19 @@ export default defineComponent({
|
|
name="phone"
|
|
name="phone"
|
|
placeholder="请输入手机号码"
|
|
placeholder="请输入手机号码"
|
|
maxlength={11}
|
|
maxlength={11}
|
|
|
|
+ onBlur={checkchangePhone}
|
|
type="tel"
|
|
type="tel"
|
|
></Field>
|
|
></Field>
|
|
|
|
+ <Field
|
|
|
|
+ required
|
|
|
|
+ label="真实姓名"
|
|
|
|
+ v-model={state.forms.realName}
|
|
|
|
+ rules={[{ required: true, message: '请填写真实姓名' }]}
|
|
|
|
+ name="realName"
|
|
|
|
+ placeholder="请填写真实姓名"
|
|
|
|
+ maxlength="50"
|
|
|
|
+ disabled={state.checkPhone}
|
|
|
|
+ ></Field>
|
|
|
|
|
|
<Field
|
|
<Field
|
|
required
|
|
required
|
|
@@ -331,6 +395,7 @@ export default defineComponent({
|
|
name="idCardNo"
|
|
name="idCardNo"
|
|
maxlength={18}
|
|
maxlength={18}
|
|
placeholder="请输入身份证号码"
|
|
placeholder="请输入身份证号码"
|
|
|
|
+ disabled={state.checkPhone}
|
|
></Field>
|
|
></Field>
|
|
|
|
|
|
<Field
|
|
<Field
|
|
@@ -345,6 +410,7 @@ export default defineComponent({
|
|
checked-color="#FF8057"
|
|
checked-color="#FF8057"
|
|
v-model={state.forms.gender}
|
|
v-model={state.forms.gender}
|
|
direction="horizontal"
|
|
direction="horizontal"
|
|
|
|
+ disabled={state.checkPhone}
|
|
>
|
|
>
|
|
<Tag
|
|
<Tag
|
|
size="large"
|
|
size="large"
|
|
@@ -385,6 +451,7 @@ export default defineComponent({
|
|
<OUpload
|
|
<OUpload
|
|
style={{ width: '100%' }}
|
|
style={{ width: '100%' }}
|
|
tips="上传身份证正面"
|
|
tips="上传身份证正面"
|
|
|
|
+ disabled={state.checkPhone}
|
|
v-model:modelValue={state.forms.idcardFrontImg}
|
|
v-model:modelValue={state.forms.idcardFrontImg}
|
|
/>
|
|
/>
|
|
)
|
|
)
|
|
@@ -404,6 +471,7 @@ export default defineComponent({
|
|
<OUpload
|
|
<OUpload
|
|
style={{ width: '100%' }}
|
|
style={{ width: '100%' }}
|
|
tips="上传身份证反面"
|
|
tips="上传身份证反面"
|
|
|
|
+ disabled={state.checkPhone}
|
|
v-model:modelValue={state.forms.idcardBackImg}
|
|
v-model:modelValue={state.forms.idcardBackImg}
|
|
/>
|
|
/>
|
|
)
|
|
)
|
|
@@ -415,8 +483,12 @@ export default defineComponent({
|
|
label="学历"
|
|
label="学历"
|
|
v-model={state.forms.educationBackground}
|
|
v-model={state.forms.educationBackground}
|
|
readonly
|
|
readonly
|
|
|
|
+ disabled={state.checkPhone}
|
|
name="educationBackground"
|
|
name="educationBackground"
|
|
- onClick={() => (state.showEducation = true)}
|
|
|
|
|
|
+ onClick={() => {
|
|
|
|
+ if (state.checkPhone) return
|
|
|
|
+ state.showEducation = true
|
|
|
|
+ }}
|
|
rules={[{ required: true, message: '请选择学历', trigger: 'onChange' }]}
|
|
rules={[{ required: true, message: '请选择学历', trigger: 'onChange' }]}
|
|
placeholder="请选择学历"
|
|
placeholder="请选择学历"
|
|
>
|
|
>
|
|
@@ -430,6 +502,7 @@ export default defineComponent({
|
|
<Field
|
|
<Field
|
|
required
|
|
required
|
|
label="毕业学校"
|
|
label="毕业学校"
|
|
|
|
+ disabled={state.checkPhone}
|
|
v-model={state.forms.graduateSchool}
|
|
v-model={state.forms.graduateSchool}
|
|
rules={[{ required: true, message: '请输入毕业学校' }]}
|
|
rules={[{ required: true, message: '请输入毕业学校' }]}
|
|
name="graduateSchool"
|
|
name="graduateSchool"
|
|
@@ -441,8 +514,12 @@ export default defineComponent({
|
|
label="所在城市"
|
|
label="所在城市"
|
|
v-model={state.forms.cityCodeName}
|
|
v-model={state.forms.cityCodeName}
|
|
readonly
|
|
readonly
|
|
|
|
+ disabled={state.checkPhone}
|
|
name="cityCodeName"
|
|
name="cityCodeName"
|
|
- onClick={() => (state.showPicker = true)}
|
|
|
|
|
|
+ onClick={() => {
|
|
|
|
+ if (state.checkPhone) return
|
|
|
|
+ state.showPicker = true
|
|
|
|
+ }}
|
|
rules={[{ required: true, message: '请选择所在城市', trigger: 'onChange' }]}
|
|
rules={[{ required: true, message: '请选择所在城市', trigger: 'onChange' }]}
|
|
placeholder="请选择所在城市"
|
|
placeholder="请选择所在城市"
|
|
>
|
|
>
|
|
@@ -459,7 +536,11 @@ export default defineComponent({
|
|
v-model={state.forms.showSubjectIds}
|
|
v-model={state.forms.showSubjectIds}
|
|
readonly
|
|
readonly
|
|
name="showSubjectIds"
|
|
name="showSubjectIds"
|
|
- onClick={() => (state.showSubject = true)}
|
|
|
|
|
|
+ disabled={state.checkPhone}
|
|
|
|
+ onClick={() => {
|
|
|
|
+ if (state.checkPhone) return
|
|
|
|
+ state.showSubject = true
|
|
|
|
+ }}
|
|
rules={[{ required: true, message: '请选择声部', trigger: 'onChange' }]}
|
|
rules={[{ required: true, message: '请选择声部', trigger: 'onChange' }]}
|
|
placeholder="请选择声部"
|
|
placeholder="请选择声部"
|
|
>
|
|
>
|
|
@@ -504,12 +585,20 @@ export default defineComponent({
|
|
rules={[{ required: true, message: '请输入验证码', trigger: 'onChange' }]}
|
|
rules={[{ required: true, message: '请输入验证码', trigger: 'onChange' }]}
|
|
placeholder="请输入验证码"
|
|
placeholder="请输入验证码"
|
|
maxlength={6}
|
|
maxlength={6}
|
|
|
|
+ disabled={state.checkPhone}
|
|
type="tel"
|
|
type="tel"
|
|
>
|
|
>
|
|
{{
|
|
{{
|
|
button: () =>
|
|
button: () =>
|
|
state.countDownStatus ? (
|
|
state.countDownStatus ? (
|
|
- <Button type="primary" round size="small" color="#ff8057" onClick={onSendCode}>
|
|
|
|
|
|
+ <Button
|
|
|
|
+ type="primary"
|
|
|
|
+ round
|
|
|
|
+ size="small"
|
|
|
|
+ disabled={state.checkPhone}
|
|
|
|
+ color="#ff8057"
|
|
|
|
+ onClick={onSendCode}
|
|
|
|
+ >
|
|
发送验证码
|
|
发送验证码
|
|
</Button>
|
|
</Button>
|
|
) : (
|
|
) : (
|
|
@@ -559,10 +648,12 @@ export default defineComponent({
|
|
color="#FF8057"
|
|
color="#FF8057"
|
|
loading={state.btnLoading}
|
|
loading={state.btnLoading}
|
|
native-type="submit"
|
|
native-type="submit"
|
|
|
|
+ disabled={state.checkPhone || state.btnLoading}
|
|
>
|
|
>
|
|
完成
|
|
完成
|
|
</Button>
|
|
</Button>
|
|
</Form>
|
|
</Form>
|
|
|
|
+ {/* 城市 */}
|
|
<Popup v-model:show={state.showPicker} position="bottom" round>
|
|
<Popup v-model:show={state.showPicker} position="bottom" round>
|
|
<Picker
|
|
<Picker
|
|
showToolbar
|
|
showToolbar
|