|
|
@@ -9,23 +9,24 @@
|
|
|
</uv-input>
|
|
|
</uv-form-item>
|
|
|
<uv-form-item label="所在省份" prop="location" borderBottom required>
|
|
|
- <ie-picker ref="pickerRef" v-model="form.location" :list="appStore.provinceList" placeholder="选择省份"
|
|
|
+ <ie-picker ref="pickerRef" v-model="examTypeForm.location" :list="provinceList" placeholder="选择省份"
|
|
|
:custom-style="customStyle" key-label="dictLabel" key-value="dictValue" :disabled="isProvinceDisabled"
|
|
|
:show-arrow="!isProvinceDisabled" @change="handleProvinceChange"></ie-picker>
|
|
|
</uv-form-item>
|
|
|
<uv-form-item label="考生类别" prop="examType" borderBottom required>
|
|
|
- <ie-picker ref="pickerRef" v-model="form.examType" :list="examTypeList" :disabled="isExamTypeDisabled"
|
|
|
+ <ie-picker ref="pickerRef" v-model="examTypeForm.examType" :list="examTypeList" :disabled="isExamTypeDisabled"
|
|
|
placeholder="选择考生类别" :custom-style="customStyle" key-label="dictLabel" key-value="dictValue"
|
|
|
- :show-arrow="!isExamTypeDisabled" @change="handleExamTypeChange"></ie-picker>
|
|
|
+ :show-arrow="!isExamTypeDisabled"></ie-picker>
|
|
|
</uv-form-item>
|
|
|
- <uv-form-item v-if="form.examType === 'VHS'" label="专业类别" prop="majorType" borderBottom required>
|
|
|
- <ie-picker ref="pickerRef" v-model="form.majorType" :list="majorTypes" :disabled="!form.examType"
|
|
|
- placeholder="选择专业类别" :custom-style="customStyle" key-label="dictLabel" key-value="dictValue"
|
|
|
- @change="handleMajorChange"></ie-picker>
|
|
|
+ <uv-form-item v-if="examTypeForm.examType === 'VHS'" label="专业类别" prop="majorType" borderBottom required>
|
|
|
+ <ie-picker ref="pickerRef" v-model="examTypeForm.majorType" :list="examMajorList"
|
|
|
+ :disabled="!examTypeForm.examType" placeholder="选择专业类别" :custom-style="customStyle" key-label="dictLabel"
|
|
|
+ key-value="dictValue"></ie-picker>
|
|
|
</uv-form-item>
|
|
|
<uv-form-item label="毕业年份" prop="year" required>
|
|
|
- <ie-picker ref="pickerRef" v-model="form.endYear" :list="endYearList" :disabled="!form.examType"
|
|
|
- placeholder="选择毕业年份" :custom-style="customStyle" key-label="dictLabel" key-value="dictValue"></ie-picker>
|
|
|
+ <ie-picker ref="pickerRef" v-model="examTypeForm.endYear" :list="endYearList"
|
|
|
+ :disabled="!examTypeForm.examType" placeholder="选择毕业年份" :custom-style="customStyle" key-label="dictLabel"
|
|
|
+ key-value="dictValue"></ie-picker>
|
|
|
</uv-form-item>
|
|
|
|
|
|
</content-card>
|
|
|
@@ -36,7 +37,7 @@
|
|
|
</uv-input>
|
|
|
</uv-form-item>
|
|
|
</content-card>
|
|
|
- <content-card title="文化素质">
|
|
|
+ <content-card v-if="showCulture" title="文化素质">
|
|
|
<uv-form-item label="语文" prop="form.scores.chinese" borderBottom :required="isImproveMode">
|
|
|
<uv-input v-model="scoresForm.chinese" border="none" type="number" placeholder="满分100分" font-size="30rpx"
|
|
|
:custom-style="customStyle">
|
|
|
@@ -86,92 +87,41 @@
|
|
|
<script lang="ts" setup>
|
|
|
import ContentCard from './components/content-card.vue';
|
|
|
import { useUserStore } from '@/store/userStore';
|
|
|
-import { } from '@/api/modules/login';
|
|
|
-import { getExamTypes, getExamMajors, getGraduateYears } from '@/api/modules/system';
|
|
|
import { registry, improve } from '@/api/modules/login';
|
|
|
import { useTransferPage } from '@/hooks/useTransferPage';
|
|
|
-
|
|
|
+import { useExamType } from '@/composables/useExamType';
|
|
|
import { useAppStore } from '@/store/appStore';
|
|
|
-import { BindCardInfo, ClassItem, RegisterInfo, SchoolItem, Scores, StudentBindCardInfo } from '@/types/user';
|
|
|
-import { DictItem } from '@/types';
|
|
|
-import { STUDENT_BIND_INFO } from '@/types/injectionSymbols';
|
|
|
+import { BindCardInfo, ClassItem, SchoolItem, Scores } from '@/types/user';
|
|
|
+
|
|
|
import { getClassList } from '@/api/modules/user';
|
|
|
+const { form: examTypeForm, examTypeList, examMajorList, provinceList, endYearList } = useExamType();
|
|
|
const userStore = useUserStore();
|
|
|
const appStore = useAppStore();
|
|
|
const { prevData, transferTo, transferBack } = useTransferPage();
|
|
|
|
|
|
-// const form2 = ref<Partial<StudentBindCardInfo>>({});
|
|
|
-// provide(STUDENT_BIND_INFO, form2);
|
|
|
const form = ref<Partial<BindCardInfo>>({});
|
|
|
const scoresForm = ref<Scores>({})
|
|
|
const formRef = ref();
|
|
|
const customStyle = {
|
|
|
paddingLeft: '26px'
|
|
|
};
|
|
|
-const examTypeList = ref<DictItem[]>([]);
|
|
|
-const endYearList = ref<DictItem[]>([]);
|
|
|
-const majorTypes = ref<DictItem[]>([]);
|
|
|
+
|
|
|
const isImproveMode = computed(() => prevData.value.scene === 'phone_improve' || prevData.value.scene === 'card_improve');
|
|
|
const isSchoolDisabled = computed(() => prevData.value.scene === 'card_improve' && prevData.value.card.assignSchoolId);
|
|
|
const isProvinceDisabled = computed(() => prevData.value.scene === 'card_improve' && prevData.value.card.assignLocation);
|
|
|
-const isExamTypeDisabled = computed(() => (prevData.value.scene === 'card_improve' && prevData.value.card.assignExamType) || !form.value.location);
|
|
|
+const isExamTypeDisabled = computed(() => (prevData.value.scene === 'card_improve' && prevData.value.card.assignExamType) || !examTypeForm.value.location);
|
|
|
const handleProvinceChange = (val: string) => {
|
|
|
if (isProvinceDisabled.value) {
|
|
|
return;
|
|
|
}
|
|
|
form.value.examType = '';
|
|
|
form.value.majorType = '';
|
|
|
- loadExamTypes();
|
|
|
-}
|
|
|
-
|
|
|
-const handleExamTypeChange = (val: string) => {
|
|
|
- if (isExamTypeDisabled.value) {
|
|
|
- return;
|
|
|
- }
|
|
|
- form.value.majorType = '';
|
|
|
- loadMajorTypes();
|
|
|
- loadGraduateYears();
|
|
|
-}
|
|
|
-
|
|
|
-const loadExamTypes = async () => {
|
|
|
- console.log(111, form.value.location)
|
|
|
- if (!form.value.location) {
|
|
|
- return;
|
|
|
- }
|
|
|
- getExamTypes(form.value.location).then(res => {
|
|
|
- examTypeList.value = res.data;
|
|
|
- }).catch(err => {
|
|
|
- console.log('获取考生类别失败', err)
|
|
|
- });
|
|
|
-};
|
|
|
-
|
|
|
-const loadMajorTypes = async () => {
|
|
|
- if (!form.value.location || !form.value.examType) {
|
|
|
- return;
|
|
|
- }
|
|
|
- getExamMajors(form.value.location, form.value.examType).then(res => {
|
|
|
- majorTypes.value = res.data;
|
|
|
- }).catch(err => {
|
|
|
- console.log('获取专业类别失败', err)
|
|
|
- });
|
|
|
-}
|
|
|
-
|
|
|
-const loadGraduateYears = async () => {
|
|
|
- if (!form.value.location || !form.value.examType) {
|
|
|
- return;
|
|
|
- }
|
|
|
- getGraduateYears(form.value.location, form.value.examType).then(res => {
|
|
|
- endYearList.value = res.data;
|
|
|
- }).catch(err => {
|
|
|
- console.log('获取毕业年份失败', err)
|
|
|
- });
|
|
|
-}
|
|
|
-
|
|
|
-const handleMajorChange = (val: string) => {
|
|
|
-
|
|
|
}
|
|
|
|
|
|
const classList = ref<ClassItem[]>([]);
|
|
|
+const showCulture = computed(() => {
|
|
|
+ return examTypeForm.value.examType === 'OHS';
|
|
|
+});
|
|
|
const handleSchoolSelect = () => {
|
|
|
if (isSchoolDisabled.value) {
|
|
|
return;
|
|
|
@@ -200,6 +150,10 @@ const handleGetClassList = () => {
|
|
|
|
|
|
|
|
|
const loginValidate = () => {
|
|
|
+ form.value = {
|
|
|
+ ...form.value,
|
|
|
+ ...examTypeForm.value,
|
|
|
+ }
|
|
|
const { nickName, location, examType, endYear } = form.value;
|
|
|
if (!nickName || nickName.trim() === '') {
|
|
|
uni.$ie.showToast('请输入姓名');
|
|
|
@@ -223,34 +177,36 @@ const loginValidate = () => {
|
|
|
uni.$ie.showToast('请选择毕业年份');
|
|
|
return false;
|
|
|
}
|
|
|
- if (isImproveMode.value) {
|
|
|
- if (!scoresForm.value.chinese || scoresForm.value.chinese < 0 || scoresForm.value.chinese > 100) {
|
|
|
- uni.$ie.showToast('请输入正确的语文成绩');
|
|
|
- return false;
|
|
|
+ if (showCulture.value) {
|
|
|
+ if (isImproveMode.value) {
|
|
|
+ if (!scoresForm.value.chinese || scoresForm.value.chinese < 0 || scoresForm.value.chinese > 100) {
|
|
|
+ uni.$ie.showToast('请输入正确的语文成绩');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- if (isImproveMode.value) {
|
|
|
- if (!scoresForm.value.mathematics || scoresForm.value.mathematics < 0 || scoresForm.value.mathematics > 100) {
|
|
|
- uni.$ie.showToast('请输入正确的数学成绩');
|
|
|
- return false;
|
|
|
+ if (isImproveMode.value) {
|
|
|
+ if (!scoresForm.value.mathematics || scoresForm.value.mathematics < 0 || scoresForm.value.mathematics > 100) {
|
|
|
+ uni.$ie.showToast('请输入正确的数学成绩');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- if (isImproveMode.value) {
|
|
|
- if (!scoresForm.value.foreign || scoresForm.value.foreign < 0 || scoresForm.value.foreign > 100) {
|
|
|
- uni.$ie.showToast('请输入正确的外语成绩');
|
|
|
- return false;
|
|
|
+ if (isImproveMode.value) {
|
|
|
+ if (!scoresForm.value.foreign || scoresForm.value.foreign < 0 || scoresForm.value.foreign > 100) {
|
|
|
+ uni.$ie.showToast('请输入正确的外语成绩');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- if (isImproveMode.value) {
|
|
|
- if (!scoresForm.value.physics || scoresForm.value.physics < 0 || scoresForm.value.physics > 100) {
|
|
|
- uni.$ie.showToast('请输入正确的物理成绩');
|
|
|
- return false;
|
|
|
+ if (isImproveMode.value) {
|
|
|
+ if (!scoresForm.value.physics || scoresForm.value.physics < 0 || scoresForm.value.physics > 100) {
|
|
|
+ uni.$ie.showToast('请输入正确的物理成绩');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- if (isImproveMode.value) {
|
|
|
- if (!scoresForm.value.political || scoresForm.value.political < 0 || scoresForm.value.political > 100) {
|
|
|
- uni.$ie.showToast('请输入正确的政治成绩');
|
|
|
- return false;
|
|
|
+ if (isImproveMode.value) {
|
|
|
+ if (!scoresForm.value.political || scoresForm.value.political < 0 || scoresForm.value.political > 100) {
|
|
|
+ uni.$ie.showToast('请输入正确的政治成绩');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if (isImproveMode.value) {
|
|
|
@@ -284,28 +240,9 @@ const handleSubmit = async () => {
|
|
|
}
|
|
|
console.log('params', params)
|
|
|
if (prevData.value.scene === 'card_improve') {
|
|
|
- uni.$ie.showLoading();
|
|
|
- const { token } = await registry(params as BindCardInfo);
|
|
|
- if (token) {
|
|
|
- await userStore.login(token);
|
|
|
- }
|
|
|
- uni.$ie.hideLoading();
|
|
|
- uni.$ie.showSuccess('登录成功');
|
|
|
- setTimeout(() => {
|
|
|
- transferTo('/pagesMain/pages/index/index', {
|
|
|
- type: 'reLaunch'
|
|
|
- });
|
|
|
- }, 800);
|
|
|
+ startLogin(params as BindCardInfo);
|
|
|
} else {
|
|
|
- uni.$ie.showLoading();
|
|
|
- await improve(params as BindCardInfo);
|
|
|
- uni.$ie.hideLoading();
|
|
|
- uni.$ie.showSuccess('绑定成功');
|
|
|
- setTimeout(() => {
|
|
|
- transferTo('/pagesMain/pages/index/index', {
|
|
|
- type: 'reLaunch'
|
|
|
- });
|
|
|
- }, 800);
|
|
|
+ startBind(params as BindCardInfo)
|
|
|
}
|
|
|
} else {
|
|
|
const { mobile, password, code, uuid } = prevData.value;
|
|
|
@@ -316,20 +253,7 @@ const handleSubmit = async () => {
|
|
|
code,
|
|
|
uuid,
|
|
|
}
|
|
|
- uni.$ie.showLoading();
|
|
|
- const { token } = await registry(params as RegisterInfo);
|
|
|
- if (token) {
|
|
|
- const isLogin = await userStore.login(token);
|
|
|
- uni.$ie.hideLoading();
|
|
|
- uni.$ie.showSuccess('登录成功');
|
|
|
- if (isLogin) {
|
|
|
- setTimeout(() => {
|
|
|
- transferTo('/pagesMain/pages/index/index', {
|
|
|
- type: 'reLaunch'
|
|
|
- });
|
|
|
- }, 88);
|
|
|
- }
|
|
|
- }
|
|
|
+ startLogin(params as BindCardInfo);
|
|
|
}
|
|
|
} catch (error) {
|
|
|
console.error(error)
|
|
|
@@ -337,9 +261,45 @@ const handleSubmit = async () => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+const startBind = async (params: BindCardInfo) => {
|
|
|
+ uni.$ie.showLoading();
|
|
|
+ await improve(params);
|
|
|
+ uni.$ie.hideLoading();
|
|
|
+ uni.$ie.showSuccess('绑定成功');
|
|
|
+ goHome();
|
|
|
+}
|
|
|
+
|
|
|
+const startLogin = async (params: BindCardInfo) => {
|
|
|
+ uni.$ie.showLoading();
|
|
|
+ const { token } = await registry(params);
|
|
|
+ if (token) {
|
|
|
+ const isLogin = await userStore.login(token);
|
|
|
+ uni.$ie.hideLoading();
|
|
|
+ uni.$ie.showSuccess('登录成功');
|
|
|
+ if (isLogin) {
|
|
|
+ goHome();
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const goHome = () => {
|
|
|
+ setTimeout(() => {
|
|
|
+ transferTo('/pagesMain/pages/index/index', {
|
|
|
+ type: 'reLaunch'
|
|
|
+ });
|
|
|
+ }, 600);
|
|
|
+}
|
|
|
+
|
|
|
const gatherInfo = () => {
|
|
|
const { scene, card, phone, code, uuid } = prevData.value;
|
|
|
console.log('prevData.value', prevData.value)
|
|
|
+ if (userStore.tempInfo?.location) {
|
|
|
+ examTypeForm.value.location = userStore.tempInfo?.location;
|
|
|
+ setTimeout(() => {
|
|
|
+ examTypeForm.value.examType = userStore.tempInfo!.examType;
|
|
|
+ }, 0)
|
|
|
+ }
|
|
|
+ console.log('examTypeForm', examTypeForm)
|
|
|
if (scene === 'card_improve') {
|
|
|
form.value = {
|
|
|
location: card.assignLocation,
|
|
|
@@ -352,7 +312,6 @@ const gatherInfo = () => {
|
|
|
mobile: phone
|
|
|
// code
|
|
|
};
|
|
|
- loadExamTypes();
|
|
|
handleGetClassList();
|
|
|
} else if (scene === 'phone_improve') {
|
|
|
const { nickName, location, examType, endYear, scores } = userStore.userInfo;
|
|
|
@@ -364,15 +323,6 @@ const gatherInfo = () => {
|
|
|
scores
|
|
|
};
|
|
|
scoresForm.value = scores;
|
|
|
- if (location) {
|
|
|
- loadExamTypes();
|
|
|
- }
|
|
|
- if (examType) {
|
|
|
- loadMajorTypes();
|
|
|
- }
|
|
|
- if (endYear) {
|
|
|
- loadGraduateYears();
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
|