From e9031caf4d168d26b6a693f80c04351ef84660fd Mon Sep 17 00:00:00 2001
From: xy <271556543@qq.com>
Date: Mon, 10 Mar 2025 18:02:56 +0800
Subject: [PATCH] init
---
common/http.api.js | 8 +-
package_sub/pages/BatchForm/BatchForm.vue | 168 +++++++++++++++++++---
pages/list/list.vue | 26 +++-
3 files changed, 183 insertions(+), 19 deletions(-)
diff --git a/common/http.api.js b/common/http.api.js
index 6a2c14b..d1eb5a9 100644
--- a/common/http.api.js
+++ b/common/http.api.js
@@ -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,
};
}
diff --git a/package_sub/pages/BatchForm/BatchForm.vue b/package_sub/pages/BatchForm/BatchForm.vue
index c0e5975..74125d1 100644
--- a/package_sub/pages/BatchForm/BatchForm.vue
+++ b/package_sub/pages/BatchForm/BatchForm.vue
@@ -16,6 +16,21 @@
}"
@click="isShowTime = true">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
所在区域
@@ -78,10 +93,10 @@
-
+
-
+
@@ -99,15 +114,15 @@
-
+
{{ spec.number }}
-
+
-
+
@@ -116,9 +131,9 @@
其他专业是否服从
-
- 是
- 否
+
+ 是
+ 否
@@ -127,9 +142,9 @@
其他院校是否服从
-
- 是
- 否
+
+ 是
+ 否
@@ -176,7 +191,7 @@
'color': '#fff',
'margin-left': '64rpx'
}"
- @click="">提交
+ @click="isShowModal = true">提交
@@ -193,6 +208,7 @@
second: false
}"
@confirm="e => form.year = e.year">
+
@@ -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;
diff --git a/pages/list/list.vue b/pages/list/list.vue
index ed80ca0..121baa8 100644
--- a/pages/list/list.vue
+++ b/pages/list/list.vue
@@ -3,10 +3,10 @@
-
+
- 填报时间:2025-02-06 18:00
+ 填报时间:{{ item.created_at }}
规划师已查看
@@ -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)
+ },
}