|
|
@@ -1,10 +1,10 @@
|
|
|
<template>
|
|
|
<uv-popup ref="popup" mode="bottom" round="16" closeable>
|
|
|
- <view class="h-[50px] px-40 fx-row fx-bet-cen text-main text-lg font-bold">
|
|
|
+ <view class="h-100 px-40 flex justify-between items-center text-main text-lg font-bold">
|
|
|
<template v-if="!id">
|
|
|
志愿表预览
|
|
|
</template>
|
|
|
- <view v-else class="fx-row flex-1 pr-30">
|
|
|
+ <view v-else class="flex flex-1 pr-30">
|
|
|
<text v-if="!nameEditing">{{ name }}</text>
|
|
|
<uv-input v-else v-model="name" placeholder="志愿表名称"/>
|
|
|
<uv-icon name="edit-pen" size="18" class="ml-10" @click="nameEditing=!nameEditing"/>
|
|
|
@@ -14,26 +14,26 @@
|
|
|
<scroll-view :scroll-y="!anyDragging" class="bg-bg" style="height: 50vh" lower-threshold="100"
|
|
|
@scrolltolower="handleGroupScroll">
|
|
|
<uv-sticky v-if="firedSorts.length" :offsetTop="-44">
|
|
|
- <view class="px-20 pb-20 fx-row bg-white">
|
|
|
+ <view class="px-20 pb-20 flex bg-white">
|
|
|
<uv-tags v-for="s in firedSorts" :key="s.name" :text="s.short" :icon="s.icon" size="mini"
|
|
|
type="success" closable plain-fill @close="handleSortRemove(s)"/>
|
|
|
</view>
|
|
|
</uv-sticky>
|
|
|
- <view class="p-20 fx-col gap-20">
|
|
|
- <view v-for="(college,index) in pagedSelectedList" class="fx-row fx-bet-sta bg-white mx-card">
|
|
|
+ <view class="p-20 flex flex-col gap-20">
|
|
|
+ <view v-for="(college,index) in pagedSelectedList" :key="index" class="flex justify-between items-start bg-white shadow-card">
|
|
|
<view class="ml-10 mb-10 text-sm">
|
|
|
- <text class="fx-row rounded-b-full px-15 pt-5 pb-10 text-white bg-primary">
|
|
|
+ <text class="flex rounded-b-full px-15 pt-5 pb-10 text-white bg-primary">
|
|
|
{{ generateSeq(index) }}
|
|
|
</text>
|
|
|
</view>
|
|
|
- <view class="flex-1 p-20 fx-col">
|
|
|
+ <view class="flex-1 p-20 flex flex-col">
|
|
|
<view class="font-bold">
|
|
|
{{ college.university.name }}
|
|
|
<!-- TODO:志愿表还未保存group信息,所以这里显示会在编辑时表现不一致 -->
|
|
|
<template v-if="false">({{ college.recruitPlan.group }})</template>
|
|
|
({{ college.recruitPlan.collegeCode }})
|
|
|
</view>
|
|
|
- <view class="fx-row fx-bet-cen mt-10 text-content text-2xs gap-20">
|
|
|
+ <view class="flex justify-between items-center mt-10 text-content text-2xs gap-20">
|
|
|
<view>录取概率:
|
|
|
<view class="font-bold text-main">
|
|
|
{{ college.enrollRatio || '-' }}%
|
|
|
@@ -50,7 +50,7 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="fx-row gap-20 my-20">
|
|
|
+ <view class="flex gap-20 my-20">
|
|
|
<uv-button :disabled="selectedList.length<2" type="primary" size="mini" plain
|
|
|
shape="circle" icon="arrow-down-fill" :text="generateSeq(index)"
|
|
|
icon-color="primary" @click="openSeqSelect(index)"/>
|
|
|
@@ -62,32 +62,15 @@
|
|
|
<uv-button type="primary" size="mini" plain shape="circle" icon="trash"
|
|
|
icon-color="primary" @click="handleRemoveAll(college)"/>
|
|
|
</view>
|
|
|
- <m-drag ref="drag" :list="getSelectedSortedMajors(college)" :item-height="44"
|
|
|
- @change="handleDragComplete">
|
|
|
- <template #default="{item:major,index:majorIndex}">
|
|
|
- <view class="fx-row items-center text-xs text-content h-[44px] box-border mx-border-b">
|
|
|
- <view class="flex-1 truncate">
|
|
|
- <text v-if="majorIndex>-1" class="mr-20">{{ majorIndex + 1 }}</text>
|
|
|
- <text :class="{'highlight-major': isFormedMajorFired(major)}">
|
|
|
- {{ major.marjorName }}[{{ major.marjorBelongs }}]
|
|
|
- </text>
|
|
|
- </view>
|
|
|
- <!-- 因为手机上区域比较小,只保留了拖拽排序 -->
|
|
|
- <uv-icon v-if="false" name="arrow-up" size="20px" class="mr10"
|
|
|
- @click="handleMajorUp(major, college)"></uv-icon>
|
|
|
- <uv-icon v-if="false" name="arrow-down" size="20px" class="mr10"
|
|
|
- @click="handleMajorDown(major, college)"></uv-icon>
|
|
|
- <uv-icon name="trash" size="20px" class="mr10"
|
|
|
- @click="handleMajorDelete(major, college)"></uv-icon>
|
|
|
- </view>
|
|
|
- </template>
|
|
|
- </m-drag>
|
|
|
+ <vhs-majors-draggable-list :majors="getSelectedSortedMajors(college)"
|
|
|
+ @delete="handleMajorDelete($event, college)"
|
|
|
+ @change="handleDragComplete($event, college)" />
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</scroll-view>
|
|
|
- <view class="h-[50px] px-40 fx-row items-center mx-border-t">
|
|
|
- <uv-button type="primary" text="保存志愿表" shape="circle" :loading="locking"
|
|
|
+ <view class="h-100 px-40 flex items-center ie-border-t">
|
|
|
+ <uv-button type="primary" text="保存志愿表" shape="circle" :loading="locking" custom-class="w-full"
|
|
|
@click="handleSave"></uv-button>
|
|
|
</view>
|
|
|
<uv-action-sheet ref="actionSheet" :actions="sortList" :cancel-text="cancelSortText" @select="handleSort"
|
|
|
@@ -99,14 +82,13 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import {ref, computed, watch} from 'vue';
|
|
|
-import {useInjectVoluntaryCart} from "@/pagesOther/pages/voluntary/hooks/useVoluntaryCartInjection";
|
|
|
-import {toValue} from "@vueuse/core";
|
|
|
-import {useVoluntarySortService} from "@/pagesOther/pages/voluntary/hooks/useVoluntarySortService";
|
|
|
-import {useInjectVoluntaryMajorHighlight} from "@/pagesOther/pages/voluntary/hooks/useVoluntaryMajorHighlightInjection";
|
|
|
import {confirmAsync} from "@/utils/uni-helper";
|
|
|
-import {useInjectVoluntaryAssistant} from "@/pagesOther/pages/voluntary/hooks/useVoluntaryAssistantInjection";
|
|
|
-import {useInjectVoluntaryHeader} from "@/pagesOther/pages/voluntary/hooks/useVoluntaryHeaderInjection";
|
|
|
+import {useInjectVoluntaryCart} from "@/pagesOther/pages/vhs/hooks/useVoluntaryCartInjection";
|
|
|
+import {useInjectVoluntaryMajorHighlight} from "@/pagesOther/pages/vhs/hooks/useVoluntaryMajorHighlightInjection";
|
|
|
+import {useVoluntarySortService} from "@/pagesOther/pages/vhs/hooks/useVoluntarySortService";
|
|
|
+import {useInjectVoluntaryHeader} from "@/pagesOther/pages/vhs/hooks/useVoluntaryHeaderInjection";
|
|
|
+import {useInjectVoluntaryAssistant} from "@/pagesOther/pages/vhs/hooks/useVoluntaryAssistantInjection";
|
|
|
+import VhsMajorsDraggableList from "@/pagesOther/pages/vhs/index/components/vhs-majors-draggable-list.vue";
|
|
|
|
|
|
const popup = ref(null)
|
|
|
const drag = ref(null)
|
|
|
@@ -141,14 +123,16 @@ const openSortList = () => {
|
|
|
actionSheet.value.open()
|
|
|
}
|
|
|
|
|
|
-const handleDragComplete = (newList, oldList) => {
|
|
|
+const handleDragComplete = (newList, college) => {
|
|
|
// make localPriority exchange when drag complete.
|
|
|
+ const oldList = getSelectedSortedMajors(college)
|
|
|
const copyPriorities = oldList.map(i => i.localPriority)
|
|
|
copyPriorities.forEach((p, i) => newList[i].localPriority = p)
|
|
|
}
|
|
|
|
|
|
const handleRemoveAll = async (college) => {
|
|
|
- await confirmAsync('确认删除该专业组下的全部专业?')
|
|
|
+ const confirm = await confirmAsync('确认删除该专业组下的全部专业?')
|
|
|
+ if (!confirm) return
|
|
|
college.majors.forEach(m => {
|
|
|
m.selected = false
|
|
|
snapshotSearchingMajorWhenApply(m)
|
|
|
@@ -188,9 +172,10 @@ const handleMajorDown = (major, majorGroup) => {
|
|
|
targetMajor.localPriority = temp
|
|
|
}
|
|
|
}
|
|
|
-const handleMajorDelete = (major) => {
|
|
|
- major.selected = false
|
|
|
- snapshotSearchingMajorWhenApply(major)
|
|
|
+const handleMajorDelete = (major, majorGroup) => {
|
|
|
+ const rawMajor = getSelectedSortedMajors(majorGroup).find(m => m.id == major.id)
|
|
|
+ rawMajor.selected = false
|
|
|
+ snapshotSearchingMajorWhenApply(rawMajor)
|
|
|
if (recalculatePureSelectedList()) sortInterrupt()
|
|
|
}
|
|
|
|
|
|
@@ -223,147 +208,6 @@ const close = () => {
|
|
|
}
|
|
|
|
|
|
defineExpose({open, close})
|
|
|
-// export default {
|
|
|
-// props: {
|
|
|
-// id: {
|
|
|
-// type: String | Number,
|
|
|
-// default: 0
|
|
|
-// },
|
|
|
-// name: {
|
|
|
-// type: String,
|
|
|
-// default: ''
|
|
|
-// },
|
|
|
-// show: {
|
|
|
-// type: Boolean,
|
|
|
-// default: false
|
|
|
-// },
|
|
|
-// selectedList: {
|
|
|
-// type: Array,
|
|
|
-// default: () => []
|
|
|
-// },
|
|
|
-// defaultSort: {
|
|
|
-// type: Array,
|
|
|
-// default: () => []
|
|
|
-// },
|
|
|
-// locking: {
|
|
|
-// type: Boolean,
|
|
|
-// default: false
|
|
|
-// }
|
|
|
-// },
|
|
|
-// data() {
|
|
|
-// return {
|
|
|
-// nameEditing: false,
|
|
|
-// confirmGroup: null,
|
|
|
-// showConfirm: false,
|
|
|
-// showSort: false,
|
|
|
-// showSeq: false,
|
|
|
-// seqIndex: 0,
|
|
|
-// }
|
|
|
-// },
|
|
|
-// watch: {
|
|
|
-// show: function (val) {
|
|
|
-// // u-popup will release dom elements when not showing
|
|
|
-// // so reset the current page number here
|
|
|
-// if (val) this.localPageNum = 1
|
|
|
-// }
|
|
|
-// },
|
|
|
-// methods: {
|
|
|
-// getSelectedSortedMajors(group) {
|
|
|
-// return group.majors.filter(m => m.selected).sort(MxConst.recommendMajorSortFn)
|
|
|
-// },
|
|
|
-// getGroupHeight(group) {
|
|
|
-// const majors = this.getSelectedSortedMajors(group)
|
|
|
-// return majors.length * 45
|
|
|
-// },
|
|
|
-// openSeqSelect(groupIndex) {
|
|
|
-// this.seqIndex = groupIndex
|
|
|
-// this.showSeq = true
|
|
|
-// },
|
|
|
-// handleSeq({indexs}) {
|
|
|
-// const oldIndex = this.seqIndex
|
|
|
-// const newIndex = indexs[0]
|
|
|
-// if (oldIndex != newIndex) {
|
|
|
-// const seqGroup = this.selectedList[oldIndex]
|
|
|
-// this.selectedList.splice(oldIndex, 1)
|
|
|
-// this.selectedList.splice(newIndex, 0, seqGroup)
|
|
|
-// this.sortInterrupt()
|
|
|
-// }
|
|
|
-// this.showSeq = false
|
|
|
-// },
|
|
|
-// close() {
|
|
|
-// this.$emit('closeVolunteer')
|
|
|
-// },
|
|
|
-// open() {
|
|
|
-//
|
|
|
-// },
|
|
|
-// save() {
|
|
|
-// this.$emit('save')
|
|
|
-// },
|
|
|
-// handleRemoveAll() {
|
|
|
-// this.confirmGroup.majors.forEach(m => {
|
|
|
-// m.selected = false
|
|
|
-// this.snapshotSearchingMajorWhenApply(m)
|
|
|
-// })
|
|
|
-// this.$emit('change')
|
|
|
-// this.showConfirm = false
|
|
|
-// },
|
|
|
-// // sort for major item
|
|
|
-// handleMajorUp(major, majorGroup) {
|
|
|
-// const source = this.getSelectedSortedMajors(majorGroup)
|
|
|
-// // HM-DragSorts clone element will cause index error
|
|
|
-// const index = source.findIndex(s => s.marjorBelongs == major.marjorBelongs)
|
|
|
-// const targetIndex = index - 1
|
|
|
-// // exchange two majors' localPriority
|
|
|
-// if (targetIndex >= 0) {
|
|
|
-// major = source[index] // this is the original major
|
|
|
-// const targetMajor = source[targetIndex]
|
|
|
-// const temp = major.localPriority
|
|
|
-// major.localPriority = targetMajor.localPriority
|
|
|
-// targetMajor.localPriority = temp
|
|
|
-// }
|
|
|
-// },
|
|
|
-// handleMajorDown(major, majorGroup) {
|
|
|
-// const source = this.getSelectedSortedMajors(majorGroup)
|
|
|
-// // HM-DragSorts clone element will cause index error
|
|
|
-// const index = source.findIndex(s => s.marjorBelongs == major.marjorBelongs)
|
|
|
-// const targetIndex = index + 1
|
|
|
-// // exchange two majors' localPriority
|
|
|
-// if (targetIndex < source.length) {
|
|
|
-// major = source[index] // this is the original major
|
|
|
-// const targetMajor = source[targetIndex]
|
|
|
-// const temp = major.localPriority
|
|
|
-// major.localPriority = targetMajor.localPriority
|
|
|
-// targetMajor.localPriority = temp
|
|
|
-// }
|
|
|
-// },
|
|
|
-// deleteMajor(major, majorGroup) {
|
|
|
-// const source = this.getSelectedSortedMajors(majorGroup)
|
|
|
-// // HM-DragSorts clone element will cause index error
|
|
|
-// const index = source.findIndex(s => s.marjorBelongs == major.marjorBelongs)
|
|
|
-// major = source[index] // this is the original major
|
|
|
-// major.selected = false
|
|
|
-// this.snapshotSearchingMajorWhenApply(major)
|
|
|
-// this.$emit('change')
|
|
|
-// },
|
|
|
-// handleMajorDrag(group, event) {
|
|
|
-// const source = this.getSelectedSortedMajors(group)
|
|
|
-// const oldIndex = event.index * 1
|
|
|
-// const newIndex = event.moveTo * 1
|
|
|
-// if (oldIndex == newIndex) return
|
|
|
-// // get localPriority one by one
|
|
|
-// const oldSeq = source.map(m => m.localPriority)
|
|
|
-// const oldMajor = source[oldIndex]
|
|
|
-// const newMajor = source[newIndex]
|
|
|
-// const newSource = [...source]
|
|
|
-// newSource.splice(oldIndex, 1)
|
|
|
-// newSource.splice(newIndex, 0, oldMajor)
|
|
|
-// // assign oldSeq to newSource one by one
|
|
|
-// newSource.forEach((m, idx) => {
|
|
|
-// m.localPriority = oldSeq[idx]
|
|
|
-// })
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|