master
xy 1 year ago
parent 679318d77e
commit e9031caf4d

@ -8,7 +8,9 @@ let apiApp = {
middleSchoolIndicatorDetail: '/api/mobile/school/middle-school-indicator-detail',
independentRecruitmentsSubmit: '/api/mobile/batch/independent-recruitments-submit',
batchIndex: '/api/mobile/batch/index',
batchDetail: '/api/mobile/batch/detail'
batchDetail: '/api/mobile/batch/detail',
batchSubmit: '/api/mobile/batch/user-submit',
batchData: '/api/mobile/user/batch-data',
}
const apiUser = {
appletLogin: '/api/mobile/user/applet-login',
@ -42,6 +44,8 @@ const install = (Vue, vm) => {
const independentRecruitmentsSubmit = (params = {}) => vm.$u.post(apiApp.independentRecruitmentsSubmit, params)
const batchIndex = (params = {}) => vm.$u.get(apiApp.batchIndex, params)
const batchDetail = (params = {}) => vm.$u.get(apiApp.batchDetail, params)
const batchSubmit = (params = {}) => vm.$u.post(apiApp.batchSubmit, params)
const batchData = (params = {}) => vm.$u.get(apiApp.batchData, params)
// 将各个定义的接口名称统一放进对象挂载到vm.$u.api(因为vm就是this也即this.$u.api)下
vm.$u.api = {
// 用户相关
@ -62,6 +66,8 @@ const install = (Vue, vm) => {
independentRecruitmentsSubmit,
batchIndex,
batchDetail,
batchSubmit,
batchData,
};
}

@ -16,6 +16,21 @@
}"
@click="isShowTime = true"></u-input>
</view>
<view class="user-form">
<view class="user-form__input">
<u-form :model="form" ref="uForm" :label-style="{ 'font-weight': '500' }" label-width="auto">
<u-form-item label="学生姓名" required prop="name">
<u-input v-model="form.name" placeholder="请输入" input-align="right" />
</u-form-item>
<u-form-item label="准考证" required prop="examination_number">
<u-input v-model="form.examination_number" placeholder="请输入" input-align="right" />
</u-form-item>
<u-form-item label="毕业学校" required prop="finish_school">
<u-input v-model="form.finish_school" placeholder="请输入" input-align="right" />
</u-form-item>
</u-form>
</view>
</view>
<view class="area-pick">
<view class="area-pick__title">所在区域</view>
<view class="area-pick__panel">
@ -78,10 +93,10 @@
</view>
<view class="sub-form1__row">
<view class="sub-form1__col1">
<u-input :height="50" border border-color="#e0e0e0" input-align="center" :clearable="false"></u-input>
<u-input v-model="flatForm[`${currentBatch.id}-${item.id}-${school.id}-code`]" :height="50" border border-color="#e0e0e0" input-align="center" :clearable="false"></u-input>
</view>
<view class="sub-form1__col2">
<u-input :height="50" border border-color="#e0e0e0" input-align="center" :clearable="false"></u-input>
<u-input v-model="flatForm[`${currentBatch.id}-${item.id}-${school.id}-value`]" :height="50" border border-color="#e0e0e0" input-align="center" :clearable="false"></u-input>
</view>
</view>
</view>
@ -99,15 +114,15 @@
</view>
</view>
<view class="sub-form2__row" v-for="spec in school.specialty" :key="spec.number">
<view class="sub-form2__row" v-for="(spec, specIndex) in school.specialty" :key="spec.number">
<view class="sub-form2__col1">
{{ spec.number }}
</view>
<view class="sub-form2__col2">
<u-input :height="50" border border-color="#e0e0e0" input-align="center" :clearable="false"></u-input>
<u-input v-model="flatForm[`${currentBatch.id}-${item.id}-${school.id}-${specIndex}-code`]" :height="50" border border-color="#e0e0e0" input-align="center" :clearable="false"></u-input>
</view>
<view class="sub-form2__col3">
<u-input :height="50" border border-color="#e0e0e0" input-align="center" :clearable="false"></u-input>
<u-input v-model="flatForm[`${currentBatch.id}-${item.id}-${school.id}-${specIndex}-name`]" :height="50" border border-color="#e0e0e0" input-align="center" :clearable="false"></u-input>
</view>
</view>
</view>
@ -116,9 +131,9 @@
<view>
其他专业是否服从
</view>
<u-radio-group>
<u-radio name=""></u-radio>
<u-radio name=""></u-radio>
<u-radio-group v-model="flatForm[`${currentBatch.id}-${item.id}-specialty`]">
<u-radio name="1"></u-radio>
<u-radio name="0"></u-radio>
</u-radio-group>
</view>
</view>
@ -127,9 +142,9 @@
<view>
其他院校是否服从
</view>
<u-radio-group>
<u-radio name=""></u-radio>
<u-radio name=""></u-radio>
<u-radio-group v-model="flatForm[`${currentBatch.id}-${item.id}-school`]">
<u-radio name="1"></u-radio>
<u-radio name="0"></u-radio>
</u-radio-group>
</view>
</view>
@ -176,7 +191,7 @@
'color': '#fff',
'margin-left': '64rpx'
}"
@click="">提交</u-button>
@click="isShowModal = true">提交</u-button>
</template>
</view>
</view>
@ -193,6 +208,7 @@
second: false
}"
@confirm="e => form.year = e.year"></u-picker>
<u-modal v-model="isShowModal" content="确认提交数据?" show-cancel-button @confirm="submit"></u-modal>
</view>
</template>
@ -200,10 +216,14 @@
export default {
data() {
return {
isShowModal: false,
step: 1,
isShowTime: false,
areaList: [],
form: {
name: "",
finish_school: "",
examination_number: "",
area_id: "",
year: new Date().getFullYear().toString(),
aspiration_id: ""
@ -215,6 +235,7 @@ export default {
batchSub: {},
subForm: [],
flatForm: {},
};
},
methods: {
@ -242,13 +263,14 @@ export default {
name: subSchool.number,
code: "",
value: "",
specialties: subSchool.specialty?.map(spec => ({
specialties: subSchool.specialty?.map((spec, specIndex) => ({
specialtyId: specIndex,
code: "",
value: ""
}))
})),
isSpecialtyObey: 1,
isSchoolObey: 1
specialtyObey: "1",
schoolObey: "1"
}))
} catch (err) {
console.error(err)
@ -256,7 +278,45 @@ export default {
}
this.currentBatchId = batchId
console.log(44, this.subForm)
const resolveData = (batch) => {
const myBatchId = batch.batchId
if (batch.batchSubs && batch.batchSubs.length > 0) {
batch.batchSubs.forEach(batchSub => {
const myBatchSubId = batchSub.batchSubId
if (!this.flatForm.hasOwnProperty(`${myBatchId}-${myBatchSubId}-specialty`)) {
this.flatForm[`${myBatchId}-${myBatchSubId}-specialty`] = "1"
}
if (!this.flatForm.hasOwnProperty(`${myBatchId}-${myBatchSubId}-school`)) {
this.flatForm[`${myBatchId}-${myBatchSubId}-school`] = "1"
}
if (batchSub.batchSubSchools && batchSub.batchSubSchools.length > 0) {
batchSub.batchSubSchools.forEach(batchSubSchool => {
const myBatchSubSchoolId = batchSubSchool.batchSubSchoolId
if (!this.flatForm.hasOwnProperty(`${myBatchId}-${myBatchSubId}-${myBatchSubSchoolId}-value`)) {
this.flatForm[`${myBatchId}-${myBatchSubId}-${myBatchSubSchoolId}-value`] = ''
}
if (!this.flatForm.hasOwnProperty(`${myBatchId}-${myBatchSubId}-${myBatchSubSchoolId}-code`)) {
this.flatForm[`${myBatchId}-${myBatchSubId}-${myBatchSubSchoolId}-code`] = ''
}
if (batchSubSchool.specialties && batchSubSchool.specialties.length > 0) {
batchSubSchool.specialties.forEach(specialty => {
const mySpecialtyId = specialty.specialtyId
if (!this.flatForm.hasOwnProperty(`${myBatchId}-${myBatchSubId}-${myBatchSubSchoolId}-${mySpecialtyId}-value`)) {
this.flatForm[`${myBatchId}-${myBatchSubId}-${myBatchSubSchoolId}-${mySpecialtyId}-value`] = ''
}
if (!this.flatForm.hasOwnProperty(`${myBatchId}-${myBatchSubId}-${myBatchSubSchoolId}-${mySpecialtyId}-code`)) {
this.flatForm[`${myBatchId}-${myBatchSubId}-${myBatchSubSchoolId}-${mySpecialtyId}-code`] = ''
}
})
}
})
}
})
}
}
this.subForm.forEach(batch => resolveData(batch))
},
async getConfig () {
try {
@ -304,6 +364,61 @@ export default {
console.error(err)
}
},
submit () {
const idName = ['batchId', 'batchSubId', 'batchSubSchoolId', 'specialtyId']
const linkName = ['batchSubs', 'batchSubSchools', 'specialties']
for (let key in this.flatForm) {
let target = null
let keys = key.split('-')
for (let i = 0;i < keys.length;i++) {
const val = keys[i]
if (i === 1) {
let myTarget = target.find(j => j[idName[i]] === Number(val))
if (/school$/.test(key)) {
if (myTarget.hasOwnProperty('schoolObey')) {
myTarget['schoolObey'] = this.flatForm[key]
}
} else if (/specialty$/.test(key)) {
if (myTarget.hasOwnProperty('specialtyObey')) {
myTarget['specialtyObey'] = this.flatForm[key]
}
}
} else if (i === 2) {
let myTarget = target.find(j => j[idName[i]] === Number(val))
if (val === 'code') {
if (myTarget.hasOwnProperty('code')) {
myTarget['code'] = this.flatForm[key]
}
} else if (val === 'value') {
if (myTarget.hasOwnProperty('value')) {
myTarget['value'] = this.flatForm[key]
}
}
}
if (isNaN(Number(val))) {
} else {
target = target ? target.find(j => j[idName[i]] === Number(val))[linkName[i]] : this.subForm.find(j => j[idName[i]] === Number(val))[linkName[i]]
}
}
}
this.$u.api.batchSubmit({
aspiration_id: this.aspiration.id,
data: this.subForm,
name: this.form.name,
finish_school: this.form.finish_school,
examination_number: this.form.examination_number,
}).then(_ => {
this.$u.route({
url: '/package_sub/pages/FormSuccess/FormSuccess',
params: {
title: "志愿填报",
redirect: '/pages/list/list'
}
})
})
}
},
computed: {
formArea() {
@ -374,6 +489,27 @@ export default {
margin-left: 32rpx;
}
}
.user-form {
background: #fff;
display: flex;
align-items: center;
margin: 40rpx 24rpx 0;
padding: 32rpx 75rpx 32rpx 46rpx;
border-radius: 20rpx;
filter: drop-shadow(-2.179rpx 3.355rpx 2.5rpx rgba(208, 209, 209, 0.3));
&__title {
font-size: 30rpx;
text-transform: uppercase;
color: #333333;
font-weight: 500;
}
&__input {
flex: 1;
margin-left: 32rpx;
}
}
.area-pick {
margin: 0 24rpx;

@ -3,10 +3,10 @@
<template v-if="vuex_user.mobile">
<view class="wrap">
<view class="list">
<view class="list-item">
<view class="list-item" v-for="item in list" :key="item.id">
<view class="list-item__title">
<view class="list-item__title--time">
填报时间2025-02-06 18:00
填报时间{{ item.created_at }}
</view>
<view class="list-item__title--tag">
规划师已查看
@ -73,15 +73,37 @@ export default {
if (refresh) {
this.select.page = 1
this.list.length = 0
this.status = 'loadmore'
}
if (this.status === 'nomore') return
try {
this.status = 'loading'
const res = await this.$u.api.batchData(this.select);
console.log(res);
this.list.push(...res.list)
if (this.list.length >= res.total) {
this.status = 'nomore'
} else {
this.select.page++;
this.status = 'loadmore'
}
} catch (err) {
console.error(err);
this.status = 'loadmore'
}
} catch (err) {
console.error(err)
} finally {
uni.hideNavigationBarLoading()
}
}
},
onPullDownRefresh() {
this.getList(true)
},
created() {
this.getList(true)
},
}
</script>

Loading…
Cancel
Save