master
xy 1 year ago
parent 304792420e
commit 679318d77e

@ -1,5 +1,5 @@
<template>
<view class="container">
<view class="container safe-area-inset-bottom">
<image class="bkg" src="~@/static/me/wave.png" mode="widthFix"></image>
<view class="wrap" v-if="step === 1">
@ -46,27 +46,139 @@
}">下一步</u-button>
</view>
<view class="wrap" v-if="step === 2">
<view class="wrap" v-if="step > 1 && step <= (1 + batches.length)">
<view class="picked-data">
<view>{{ form.year }}</view>
<view>{{ formArea }}</view>
<view>{{ currentBatch.name }}</view>
</view>
<view class="card" style="margin-top: 28rpx;">
<view class="card" v-for="item in currentBatchSub" :key="item.id">
<view class="card__title">
<scroll-view scroll-x="true" enable-flex style="display: flex;justify-content: center;">
<view class="batch-sub">
<view class="batch-sub-item" v-for="item in currentBatchSub" :key="item.id">
{{ item.name }}
</view>
<scroll-view scroll-x="true" >
<view class="batch-sub__title">
{{ item.name }}
</view>
</scroll-view>
</view>
<view class="card__body">
<view class="batch-sub-school" v-for="school in item.batch_sub_schools" :key="school.id">
<view class="batch-sub-school__name">
志愿序号 {{ school.number }}
</view>
<view class="batch-sub-school__form sub-form1">
<view class="sub-form1__row sub-form1-title">
<view class="sub-form1__col1">
代码
</view>
<view class="sub-form1__col2">
学校
</view>
</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>
</view>
<view class="sub-form1__col2">
<u-input :height="50" border border-color="#e0e0e0" input-align="center" :clearable="false"></u-input>
</view>
</view>
</view>
<view class="batch-sub-school-specialty sub-form2" v-if="school.specialty && school.specialty.length > 0">
<view class="sub-form2__row sub-form2-title">
<view class="sub-form2__col1">
序号
</view>
<view class="sub-form2__col2">
代码
</view>
<view class="sub-form2__col3">
专业
</view>
</view>
<view class="sub-form2__row" v-for="spec 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>
</view>
<view class="sub-form2__col3">
<u-input :height="50" border border-color="#e0e0e0" input-align="center" :clearable="false"></u-input>
</view>
</view>
</view>
<view class="batch-sub-is-obey" v-if="item.show_specialty_obey">
<view>
其他专业是否服从
</view>
<u-radio-group>
<u-radio name="是"></u-radio>
<u-radio name="是"></u-radio>
</u-radio-group>
</view>
</view>
<view class="batch-sub-is-obey" v-if="item.show_school_obey">
<view>
其他院校是否服从
</view>
<u-radio-group>
<u-radio name="是"></u-radio>
<u-radio name="是"></u-radio>
</u-radio-group>
</view>
</view>
</view>
<view class="btns">
<u-button
shape="circle"
ripple
:custom-style="{
'background-image': 'linear-gradient(263deg, rgba(31,142,247,0.9) 0%, rgba(17,100,247,0.9981153777569027) 78%, rgba(17,100,247,0.9999999999999999) 78%)',
height: '76rpx',
'line-height': '76rpx',
'margin-top': '110rpx',
'width': '290rpx',
'color': '#fff'
}"
@click="stepClick('prev')">上一步</u-button>
<template v-if="step < (batches.length)">
<u-button
shape="circle"
ripple
:custom-style="{
'background-image': 'linear-gradient(263deg, rgba(31,142,247,0.9) 0%, rgba(17,100,247,0.9981153777569027) 78%, rgba(17,100,247,0.9999999999999999) 78%)',
height: '76rpx',
'line-height': '76rpx',
'margin-top': '110rpx',
'width': '290rpx',
'color': '#fff',
'margin-left': '64rpx'
}"
@click="stepClick('next')">下一步</u-button>
</template>
<template v-else>
<u-button
shape="circle"
ripple
:custom-style="{
'background-image': 'linear-gradient(263deg, rgba(31,142,247,0.9) 0%, rgba(17,100,247,0.9981153777569027) 78%, rgba(17,100,247,0.9999999999999999) 78%)',
height: '76rpx',
'line-height': '76rpx',
'margin-top': '110rpx',
'width': '290rpx',
'color': '#fff',
'margin-left': '64rpx'
}"
@click="">提交</u-button>
</template>
</view>
</view>
<u-picker
@ -100,22 +212,51 @@ export default {
currentBatchId: "",
aspiration: {},
batchSub: {}
batchSub: {},
subForm: [],
};
},
methods: {
async getBatchSub(batchId) {
this.currentBatchId = batchId
if (!this.subForm.find(i => i.id === batchId)) {
this.subForm.push({
batchId,
name: this.batches.find(j => j.id === batchId)?.name,
batchSubs: []
})
}
if (this.batchSub.hasOwnProperty(batchId) && this.batchSub[batchId]) {
} else {
try {
const { batchSubs } = await this.$u.api.batchDetail({ id: batchId })
this.$set(this.batchSub, batchId, batchSubs)
this.batchSub[batchId] = batchSubs
const formBatch = this.subForm.find(i => i.batchId === batchId)
formBatch.batchSubs = batchSubs.map(resSub => ({
batchSubId: resSub.id,
name: resSub.name,
batchSubSchools: resSub.batch_sub_schools.map(subSchool => ({
batchSubSchoolId: subSchool.id,
name: subSchool.number,
code: "",
value: "",
specialties: subSchool.specialty?.map(spec => ({
code: "",
value: ""
}))
})),
isSpecialtyObey: 1,
isSchoolObey: 1
}))
} catch (err) {
console.error(err)
}
}
this.currentBatchId = batchId
console.log(44, this.subForm)
},
async getConfig () {
try {
@ -128,28 +269,27 @@ export default {
this.aspiration = list[0]
this.setTitle()
if (this.aspiration.batchs[0].id) {
this.getBatchSub(this.aspiration.batchs[0].id)
}
}
} catch (err) {
console.error(err)
}
},
stepClick(type='next') {
async stepClick(type='next') {
if (type === 'next') {
if (true) {
if (this.step === 1 && !this.config) {
await this.getConfig()
}
if (this.step < (1 + this.batches.length)) {
this.step = this.step + 1
if (this.step === 2 && !this.config) {
this.getConfig()
}
}
} else if (type === 'prev') {
if (this.step > 1) {
this.step = this.step - 1
}
}
if (this.step > 1) {
await this.getBatchSub(this.batches[this.step-2]?.id)
}
},
setTitle() {
uni.setNavigationBarTitle({
@ -173,8 +313,10 @@ export default {
return this.aspiration.batchs || []
},
currentBatchSub() {
console.log(33, this.batchSub, this.currentBatchId, this.batchSub[String(this.currentBatchId)])
return this.batchSub[this.currentBatchId]
},
currentBatch() {
return this.batches.find(i => i.id === this.currentBatchId) ?? {}
}
},
watch: {
@ -192,6 +334,7 @@ export default {
</script>
<style lang="scss">
.container {
position: relative;
min-height: 100vh;
@ -324,11 +467,15 @@ export default {
text-transform: uppercase;
color: #333333;
font-weight: bold;
white-space: nowrap;
}
& > view + view {
margin-left: 10rpx;
}
}
.card {
margin: 0 24rpx;
margin: 28rpx 24rpx 0;
border-radius: 20rpx;
filter: drop-shadow(-2.179rpx 3.355rpx 2.5rpx rgba(208,209,209,0.3));
background-color: #ffffff;
@ -336,26 +483,113 @@ export default {
&__title {
background: #fbf1e8;
border-radius: 20rpx 20rpx 0 0;
padding: 30rpx 16rpx;
padding: 0 16rpx;
}
&__body {
padding: 48rpx 30rpx 70rpx 30rpx;
}
}
.batch-sub {
display: flex;
&-item {
&__title {
text-align: center;
font-size: 28rpx;
text-transform: uppercase;
color: #e77817;
font-weight: 500;
padding: 0 20rpx;
padding: 30rpx 20rpx;
word-break: keep-all;
flex-shrink: 0;
white-space: nowrap;
}
&-is-obey {
display: flex;
align-items: center;
margin-top: 40rpx;
& > view:nth-child(1) {
font-size: 24rpx;
text-transform: uppercase;
color: #333333;
font-weight: 500;
margin-right: 110rpx;
}
}
}
}
}
.btns {
display: flex;
align-items: center;
justify-content: center;
}
.batch-sub-school {
margin-top: 40rpx;
&:nth-child(1) {
margin-top: 0;
}
&__name {
font-size: 28rpx;
line-height: 36rpx;
text-transform: uppercase;
color: #333333;
font-weight: 500;
}
.sub-form1 {
&-title {
font-size: 24rpx;
line-height: 36rpx;
text-transform: uppercase;
color: #333333;
font-weight: 500;
margin: 28rpx 0;
text-align: center;
}
&__row {
display: flex;
align-items: center;
justify-content: space-between;
}
&__col1 {
flex-basis: 29%;
}
&__col2 {
flex-basis: 67.5%;
}
}
.sub-form2 {
&-title {
font-size: 24rpx;
line-height: 36rpx;
text-transform: uppercase;
color: #333333;
font-weight: 500;
margin: 28rpx 0;
text-align: center;
}
&__row {
display: flex;
align-items: center;
justify-content: space-between;
}
&__col1 {
flex-basis: 14.8%;
font-size: 28rpx;
text-transform: uppercase;
color: #333333;
}
&__col2 {
flex-basis: 29%;
}
&__col3 {
flex-basis: 48.9%;
}
}
.sub-form2__row + .sub-form2__row {
margin-top: 22rpx;
}
}
</style>

Loading…
Cancel
Save