| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275 |
- <template>
- <ie-page bg-color="#F6F8FA" :safeAreaInsetBottom="false">
- <ie-navbar title="完善信息" custom-back @left-click="handleBack" />
- <uv-form labelPosition="left" :model="examTypeForm" labelWidth="70px" ref="formRef">
- <content-card title="个人信息">
- <uv-form-item label="姓名" prop="name" borderBottom required>
- <uv-input v-model="form.nickName" border="none" placeholder="请输入姓名" placeholderClass="text-30"
- font-size="30rpx" :custom-style="customStyle">
- </uv-input>
- </uv-form-item>
- <uv-form-item label="所在省份" prop="location" borderBottom required>
- <ie-picker ref="pickerRef" v-model="examTypeForm.location" :list="provinceList"
- :placeholder="pickerPlaceholder" :custom-style="customStyle" key-label="areaName" key-value="shortName"
- :disabled="disabledEdit">
- <template v-if="disabledEdit" #right>
- <ie-image src="/static/image/icon-lock.png" custom-class="w-24 h-30" mode="aspectFill" />
- </template></ie-picker>
- </uv-form-item>
- <uv-form-item label="考生类别" prop="examType" borderBottom required>
- <ie-picker ref="pickerRef" v-model="examTypeForm.examType" :list="examTypeList"
- :disabled="!examTypeForm.location || disabledEdit" :placeholder="pickerPlaceholder"
- :custom-style="customStyle" key-label="dictLabel" key-value="dictValue" @change="handleExamTypeChange">
- <template v-if="disabledEdit" #right>
- <ie-image src="/static/image/icon-lock.png" custom-class="w-24 h-30" mode="aspectFill" />
- </template>
- </ie-picker>
- </uv-form-item>
- <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 || disabledEdit" :placeholder="pickerPlaceholder"
- :custom-style="customStyle" key-label="dictLabel" key-value="dictValue">
- <template v-if="disabledEdit" #right>
- <ie-image src="/static/image/icon-lock.png" custom-class="w-24 h-30" mode="aspectFill" />
- </template></ie-picker>
- </uv-form-item>
- <uv-form-item label="单招年份" prop="year" required>
- <ie-picker ref="pickerRef" v-model="examTypeForm.endYear" :list="endYearList"
- :disabled="!examTypeForm.examType || disabledEdit" :placeholder="pickerPlaceholder"
- :custom-style="customStyle" key-label="dictLabel" key-value="dictValue">
- <template v-if="disabledEdit" #right>
- <ie-image src="/static/image/icon-lock.png" custom-class="w-24 h-30" mode="aspectFill" />
- </template></ie-picker>
- </uv-form-item>
- </content-card>
- <content-card v-if="showCulture" title="文化素质">
- <uv-form-item label="语文" prop="form.scores.chinese" borderBottom :required="isScoreRequired">
- <uv-input v-model.number="scoresForm.chinese" border="none" type="number" :placeholder="inputPlaceholder"
- font-size="30rpx" :custom-style="customStyle" :readonly="disabledEdit">
- </uv-input>
- </uv-form-item>
- <uv-form-item label="数学" prop="form.score.mathematics" borderBottom :required="isScoreRequired">
- <uv-input v-model.number="scoresForm.mathematics" border="none" type="number" :placeholder="inputPlaceholder"
- font-size="30rpx" :custom-style="customStyle" :readonly="disabledEdit">
- </uv-input>
- <ie-image v-if="disabledEdit" slot="right" src="/static/image/icon-lock.png" custom-class="w-24 h-30"
- mode="aspectFill" />
- </uv-form-item>
- <uv-form-item label="外语" prop="form.scores.foreign" borderBottom :required="isScoreRequired">
- <uv-input v-model.number="scoresForm.foreign" border="none" type="number" :placeholder="inputPlaceholder"
- font-size="30rpx" :custom-style="customStyle" :readonly="disabledEdit">
- </uv-input>
- <ie-image v-if="disabledEdit" slot="right" src="/static/image/icon-lock.png" custom-class="w-24 h-30"
- mode="aspectFill" />
- </uv-form-item>
- <uv-form-item label="物理" prop="form.scores.physics" borderBottom :required="isScoreRequired">
- <uv-input v-model.number="scoresForm.physics" border="none" type="number" :placeholder="inputPlaceholder"
- font-size="30rpx" :custom-style="customStyle" :readonly="disabledEdit">
- </uv-input>
- <ie-image v-if="disabledEdit" slot="right" src="/static/image/icon-lock.png" custom-class="w-24 h-30"
- mode="aspectFill" />
- </uv-form-item>
- <uv-form-item label="政治" prop="form.scores.political" :required="isScoreRequired">
- <uv-input v-model.number="scoresForm.political" border="none" type="number" :placeholder="inputPlaceholder"
- font-size="30rpx" :custom-style="customStyle" :readonly="disabledEdit">
- </uv-input>
- <ie-image v-if="disabledEdit" slot="right" src="/static/image/icon-lock.png" custom-class="w-24 h-30"
- mode="aspectFill" />
- </uv-form-item>
- </content-card>
- <content-card v-if="showSchoolInfo" title="学校信息">
- <uv-form-item label="学校名称" prop="form.campusName" borderBottom>
- <uv-input v-model="form.campusName" border="none" placeholder="" placeholderClass="text-30" font-size="30rpx"
- :custom-style="customStyle" readonly>
- </uv-input>
- <ie-image slot="right" src="/static/image/icon-lock.png" custom-class="w-24 h-30" mode="aspectFill" />
- </uv-form-item>
- <uv-form-item label="所在班级" prop="form.campusClassName">
- <uv-input v-model="form.campusClassName" border="none" placeholder="" placeholderClass="text-30"
- font-size="30rpx" :custom-style="customStyle" readonly>
- </uv-input>
- <ie-image slot="right" src="/static/image/icon-lock.png" custom-class="w-24 h-30" mode="aspectFill" />
- </uv-form-item>
- </content-card>
- </uv-form>
- <ie-safe-toolbar :height="84" :shadow="false">
- <view class="px-30 py-16">
- <ie-button @click="handleSubmit">确认提交</ie-button>
- </view>
- </ie-safe-toolbar>
- </ie-page>
- </template>
- <script lang="ts" setup>
- import ContentCard from '@/pagesSystem/components/content-card.vue';
- import { useExamType } from '@/composables/useExamType';
- import { updateUserInfo } from '@/api/modules/login';
- import { useUserStore } from '@/store/userStore';
- import { ClassItem, Scores, UserInfo } from '@/types/user';
- import { useTransferPage } from '@/hooks/useTransferPage';
- import { EnumExamType, EnumUserType } from '@/common/enum';
- import { getClassList } from '@/api/modules/user';
- const { prevData, transferTo, transferBack } = useTransferPage();
- const { form: examTypeForm, examTypeList, examMajorList, provinceList, endYearList } = useExamType();
- const userStore = useUserStore();
- const userInfo = computed(() => userStore.userInfo);
- const classList = ref<ClassItem[]>([]);
- const customStyle = {
- paddingLeft: '26px'
- };
- const inputPlaceholder = computed(() => {
- return true ? '请输入(提交后不可修改)' : '请输入';
- });
- const pickerPlaceholder = computed(() => {
- return true ? '请选择(提交后不可修改)' : '请选择';
- });
- const form = ref<UserInfo>({
- ...userInfo.value,
- });
- const scoresForm = ref<Scores>({})
- examTypeForm.value.location = form.value.location;
- examTypeForm.value.examType = form.value.examType;
- examTypeForm.value.endYear = form.value.endYear;
- examTypeForm.value.majorType = form.value.majorType;
- scoresForm.value = form.value.scores || {}
- const disabledEdit = computed(() => {
- return !!userInfo.value.location;
- })
- // 普高-文化成绩必填,保存后锁定不可修改
- // 中职务-文化成绩不填,保存后可修改
- const isScoreRequired = computed(() => examTypeForm.value.examType === EnumExamType.OHS);
- const showCulture = computed(() => {
- return examTypeForm.value.examType === EnumExamType.OHS;
- });
- // 代理机构不显示学校
- const showSchoolInfo = computed(() => userStore.userInfo.userType !== EnumUserType.AGENT);
- const handleBack = () => {
- if (disabledEdit.value) {
- transferBack();
- return;
- }
- uni.$ie.showToast('请先完善信息');
- };
- const loginValidate = () => {
- form.value = {
- ...form.value,
- ...examTypeForm.value,
- }
- const { nickName, location, examType, endYear } = form.value;
- if (!nickName || nickName.trim() === '') {
- uni.$ie.showToast('请输入姓名');
- return false;
- }
- if (!location || location.trim() === '') {
- uni.$ie.showToast('请选择省份');
- return false;
- }
- if (!examType || examType.trim() === '') {
- uni.$ie.showToast('请选择考生类别');
- return false;
- }
- if (examType === 'VHS') {
- if (!form.value.majorType) {
- uni.$ie.showToast('请选择专业类别');
- return false;
- }
- }
- if (!endYear) {
- uni.$ie.showToast('请选择毕业年份');
- return false;
- }
- if (showCulture.value) {
- if (isScoreRequired.value) {
- if (!scoresForm.value.chinese) {
- uni.$ie.showToast('请输入语文成绩');
- return false;
- }
- }
- if (scoresForm.value?.chinese && (scoresForm.value.chinese < 0 || scoresForm.value.chinese > 100)) {
- uni.$ie.showToast('请输入正确的语文成绩');
- return false;
- }
- //
- if (isScoreRequired.value) {
- if (!scoresForm.value.mathematics) {
- uni.$ie.showToast('请输入数学成绩');
- return false;
- }
- }
- if (scoresForm.value?.mathematics && (scoresForm.value.mathematics < 0 || scoresForm.value.mathematics > 100)) {
- uni.$ie.showToast('请输入正确的数学成绩');
- return false;
- }
- //
- if (isScoreRequired.value) {
- if (!scoresForm.value.foreign) {
- uni.$ie.showToast('请输入外语成绩');
- return false;
- }
- }
- if (scoresForm.value?.foreign && (scoresForm.value.foreign < 0 || scoresForm.value.foreign > 100)) {
- uni.$ie.showToast('请输入正确的外语成绩');
- return false;
- }
- //
- if (isScoreRequired.value) {
- if (!scoresForm.value.physics) {
- uni.$ie.showToast('请输入物理成绩');
- return false;
- }
- }
- if (scoresForm.value?.physics && (scoresForm.value.physics < 0 || scoresForm.value.physics > 100)) {
- uni.$ie.showToast('请输入正确的物理成绩');
- return false;
- }
- //
- if (isScoreRequired.value) {
- if (!scoresForm.value.political) {
- uni.$ie.showToast('请输入政治成绩');
- return false;
- }
- }
- if (scoresForm.value?.political && (scoresForm.value.political < 0 || scoresForm.value.political > 100)) {
- uni.$ie.showToast('请输入正确的政治成绩');
- return false;
- }
- }
- return true;
- }
- const handleExamTypeChange = () => {
- scoresForm.value = {};
- }
- const handleSubmit = async () => {
- console.log('handleSubmit', examTypeForm.value)
- if (!loginValidate()) {
- return;
- }
- const params = {
- ...userStore.userInfo,
- ...form.value,
- scores: scoresForm.value,
- } as UserInfo;
- console.log(params)
- uni.$ie.showLoading();
- await updateUserInfo(params);
- await userStore.getUserInfo();
- uni.$ie.hideLoading();
- uni.$ie.showToast('保存成功');
- setTimeout(() => {
- transferTo('/pagesMain/pages/index/index', {
- type: 'reLaunch'
- });
- }, 800);
- };
- </script>
- <style></style>
|