feat: 志愿表编写中
parent
7c0357b67d
commit
2a44fe0747
|
|
@ -95,7 +95,7 @@ onLoad(() => {
|
||||||
|
|
||||||
const navigatorTo = () => {
|
const navigatorTo = () => {
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: '/pages-sub/home/wishesList/index',
|
url: '/pages-sub/home/wishesList/index?typeName=智能填报&editType=add',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -46,8 +46,6 @@ export default {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
padding: 10px;
|
|
||||||
border-radius: 4px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.collapse-icon {
|
.collapse-icon {
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,8 @@
|
||||||
:style="[
|
:style="[
|
||||||
{ 'z-index': activeIndex === index ? 9 : 1 },
|
{ 'z-index': activeIndex === index ? 9 : 1 },
|
||||||
{ top: activeIndex === index ? scrollInfo.y + 'px' : 0 },
|
{ top: activeIndex === index ? scrollInfo.y + 'px' : 0 },
|
||||||
getItemStyle,
|
|
||||||
isList ? { height: item.height + 'px' } : {},
|
isList ? { height: item.height + 'px' } : getItemStyle,
|
||||||
]"
|
]"
|
||||||
class="base-drag-wrapper"
|
class="base-drag-wrapper"
|
||||||
>
|
>
|
||||||
|
|
@ -57,8 +57,7 @@
|
||||||
:style="[
|
:style="[
|
||||||
{ 'z-index': activeIndex === index ? 9 : 1 },
|
{ 'z-index': activeIndex === index ? 9 : 1 },
|
||||||
{ top: activeIndex === index ? scrollInfo.y + 'px' : 0 },
|
{ top: activeIndex === index ? scrollInfo.y + 'px' : 0 },
|
||||||
getItemStyle,
|
isList ? { height: item.height + 'px' } : getItemStyle,
|
||||||
isList ? { height: item.height + 'px' } : {},
|
|
||||||
]"
|
]"
|
||||||
class="base-drag-wrapper"
|
class="base-drag-wrapper"
|
||||||
>
|
>
|
||||||
|
|
@ -331,7 +330,8 @@ const getPosition = (index: number, list = cloneList.value): [number, number] =>
|
||||||
}
|
}
|
||||||
|
|
||||||
// 初始化
|
// 初始化
|
||||||
const initList = (list: ItemType[] = [], changeheight: boolean = false) => {
|
const initList = (list: ItemType[] = [], changeheight: boolean = false): Promise<void> => {
|
||||||
|
return new Promise((resolve) => {
|
||||||
const newList = deepCopy(list)
|
const newList = deepCopy(list)
|
||||||
// 给每个item添加一x,y和key
|
// 给每个item添加一x,y和key
|
||||||
showList.value = newList.map((item, index) => {
|
showList.value = newList.map((item, index) => {
|
||||||
|
|
@ -361,19 +361,20 @@ const initList = (list: ItemType[] = [], changeheight: boolean = false) => {
|
||||||
|
|
||||||
if (changeheight && props.itemHeight === 'auto') {
|
if (changeheight && props.itemHeight === 'auto') {
|
||||||
// 获取到最高的item
|
// 获取到最高的item
|
||||||
nextTick(() => {
|
|
||||||
setTimeout(async () => {
|
setTimeout(async () => {
|
||||||
// #ifdef APP-NVUE
|
// #ifdef APP-NVUE
|
||||||
showArea.value = false
|
showArea.value = false
|
||||||
|
|
||||||
|
const calculateHeights = async () => {
|
||||||
let max = 0
|
let max = 0
|
||||||
for (let i = 0; i < slotContent.value.length; i++) {
|
|
||||||
// 循环 需要异步处理
|
|
||||||
await new Promise<void>((resolve) => {
|
|
||||||
let viewMaxHeightVal = 0
|
let viewMaxHeightVal = 0
|
||||||
dom.getComponentRect(slotContent.value[i], (res: any) => {
|
|
||||||
|
const promises = slotContent.value.map((content, index) => {
|
||||||
|
return new Promise<void>((resolve) => {
|
||||||
|
dom.getComponentRect(content, (res: any) => {
|
||||||
let size = res.size
|
let size = res.size
|
||||||
if (isList.value) {
|
if (isList.value) {
|
||||||
cloneList.value[i].height = size.height
|
cloneList.value[index].height = size.height
|
||||||
}
|
}
|
||||||
viewMaxHeightVal += size.height
|
viewMaxHeightVal += size.height
|
||||||
if (size.height > max) {
|
if (size.height > max) {
|
||||||
|
|
@ -381,17 +382,21 @@ const initList = (list: ItemType[] = [], changeheight: boolean = false) => {
|
||||||
}
|
}
|
||||||
resolve()
|
resolve()
|
||||||
})
|
})
|
||||||
viewMaxHeight.value = viewMaxHeightVal
|
|
||||||
})
|
})
|
||||||
}
|
})
|
||||||
|
|
||||||
|
await Promise.all(promises)
|
||||||
|
viewMaxHeight.value = viewMaxHeightVal
|
||||||
itemMaxHeight.value = max + 'px'
|
itemMaxHeight.value = max + 'px'
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
initList(cloneList.value)
|
initList(cloneList.value).then(resolve)
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
await calculateHeights()
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifndef APP-NVUE
|
// #ifndef APP-NVUE
|
||||||
|
|
||||||
const query = uni.createSelectorQuery().in(instance.proxy)
|
const query = uni.createSelectorQuery().in(instance.proxy)
|
||||||
query
|
query
|
||||||
.selectAll('.slotContent')
|
.selectAll('.slotContent')
|
||||||
|
|
@ -412,13 +417,15 @@ const initList = (list: ItemType[] = [], changeheight: boolean = false) => {
|
||||||
}
|
}
|
||||||
viewMaxHeight.value = viewMaxHeightVal // 内容区域总高度
|
viewMaxHeight.value = viewMaxHeightVal // 内容区域总高度
|
||||||
itemMaxHeight.value = max + 'px'
|
itemMaxHeight.value = max + 'px'
|
||||||
initList(cloneList.value)
|
initList(cloneList.value).then(resolve)
|
||||||
})
|
})
|
||||||
.exec()
|
.exec()
|
||||||
// #endif
|
// #endif
|
||||||
}, 0)
|
}, 0)
|
||||||
})
|
} else {
|
||||||
|
resolve()
|
||||||
}
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 方法
|
// 方法
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import Overlay from '@/pages-sub/components/Overlay.vue'
|
import Overlay from '@/pages-sub/components/overlay/Overlay.vue'
|
||||||
|
|
||||||
defineProps({
|
defineProps({
|
||||||
show: {
|
show: {
|
||||||
|
|
@ -31,6 +31,8 @@
|
||||||
<image
|
<image
|
||||||
class="w-[286rpx] h-[286rpx] mt-[134rpx] mix-blend-multiply"
|
class="w-[286rpx] h-[286rpx] mt-[134rpx] mix-blend-multiply"
|
||||||
src="@/pages-sub/static/images/autoFill/auto-fill.jpg"
|
src="@/pages-sub/static/images/autoFill/auto-fill.jpg"
|
||||||
|
mode="widthFix"
|
||||||
|
@click="show = true"
|
||||||
></image>
|
></image>
|
||||||
</view>
|
</view>
|
||||||
<ActionSheet
|
<ActionSheet
|
||||||
|
|
@ -39,7 +41,7 @@
|
||||||
@close="close"
|
@close="close"
|
||||||
custom-header-class="text-[36rpx]! text-[#303030]! font-medium!"
|
custom-header-class="text-[36rpx]! text-[#303030]! font-medium!"
|
||||||
>
|
>
|
||||||
<FilterMenu />
|
<FilterMenu ref="filterMenuRef" />
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<view class="flex items-center">
|
<view class="flex items-center">
|
||||||
<button
|
<button
|
||||||
|
|
@ -67,22 +69,74 @@ import Navbar from '@/pages-sub/components/navbar/Navbar.vue'
|
||||||
import Badge from '@/pages-sub/components/badge/Badge.vue'
|
import Badge from '@/pages-sub/components/badge/Badge.vue'
|
||||||
import ActionSheet from '@/pages-sub/components/ActionSheet.vue'
|
import ActionSheet from '@/pages-sub/components/ActionSheet.vue'
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
|
import { getUniversityListByFilter } from '@/service/index/api'
|
||||||
|
import { useUserStore } from '@/store/user'
|
||||||
|
|
||||||
|
const userStore = useUserStore()
|
||||||
|
|
||||||
const navigatorBack = () => {
|
const navigatorBack = () => {
|
||||||
uni.navigateBack()
|
uni.navigateBack()
|
||||||
}
|
}
|
||||||
|
|
||||||
const show = ref(false)
|
const show = ref(false)
|
||||||
const badgeValue = ref(12)
|
const badgeValue = ref(1)
|
||||||
|
|
||||||
const close = () => {
|
const close = () => {
|
||||||
show.value = false
|
show.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const filterMenuRef = ref()
|
||||||
|
|
||||||
const handleResult = () => {
|
const handleResult = () => {
|
||||||
uni.navigateTo({
|
let _params = filterMenuRef.value.handleConfirm()
|
||||||
url: `/pages-sub/home/wishesList/index`,
|
countBadgeValue(_params)
|
||||||
|
|
||||||
|
let params = {
|
||||||
|
p: userStore.userInfo.estimatedAchievement.sp,
|
||||||
|
location: userStore.userInfo.estimatedAchievement.provinceCode,
|
||||||
|
subjects: userStore.userInfo.estimatedAchievement.subjectGroup.split(','),
|
||||||
|
score: +userStore.userInfo.estimatedAchievement.expectedScore,
|
||||||
|
batchname: _params.choosePhase,
|
||||||
|
nature: _params.chooseNature,
|
||||||
|
province: _params.chooseRegion,
|
||||||
|
subjectType: _params.chooseUniType,
|
||||||
|
}
|
||||||
|
|
||||||
|
getUniversityListByFilter(params).then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
let collegeList = (res.result as { rows: any[] }).rows
|
||||||
|
let wishList = collegeList.map((item) => {
|
||||||
|
let _major = {
|
||||||
|
...item,
|
||||||
|
name: item.universityName,
|
||||||
|
vItems: item.majorItems.map((majorItem) => ({
|
||||||
|
...majorItem,
|
||||||
|
name: majorItem.majorName,
|
||||||
|
items: majorItem.planItems,
|
||||||
|
})),
|
||||||
|
}
|
||||||
|
|
||||||
|
return _major
|
||||||
})
|
})
|
||||||
|
userStore.sortWishCollegeList({ list: wishList })
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages-sub/home/wishesList/wishesList?typeName=一键填报&editType=add`,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const countBadgeValue = (params) => {
|
||||||
|
badgeValue.value = 0
|
||||||
|
for (let key in params) {
|
||||||
|
let value = params[key]
|
||||||
|
|
||||||
|
if (value instanceof Object) {
|
||||||
|
badgeValue.value += value ? Object.keys(value).length : 0
|
||||||
|
} else if (typeof value === 'string' && value.trim() !== '') {
|
||||||
|
badgeValue.value += 1
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import MessageBox from '../../components/MessageBox.vue'
|
import MessageBox from '@/pages-sub/components/messageBox/MessageBox.vue'
|
||||||
import WXXTable from '@/pages-sub/components/table/Table.vue'
|
import WXXTable from '@/pages-sub/components/table/Table.vue'
|
||||||
import WXXTableCol from '@/pages-sub/components/table/TableCol.vue'
|
import WXXTableCol from '@/pages-sub/components/table/TableCol.vue'
|
||||||
import { getUniversityListByProvince } from '@/service/index/api'
|
import { getUniversityListByProvince } from '@/service/index/api'
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { getSubjectIntroduceList } from '@/service/index/api'
|
import { getSubjectIntroduceList } from '@/service/index/api'
|
||||||
import MessageBox from '../../components/MessageBox.vue'
|
import MessageBox from '@/pages-sub/components/messageBox/MessageBox.vue'
|
||||||
|
|
||||||
const subjectIntroduceList = ref([])
|
const subjectIntroduceList = ref([])
|
||||||
const assessmentSubjectList = ref([])
|
const assessmentSubjectList = ref([])
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { UniversityResult } from '@/types/app-type'
|
import { UniversityResult } from '@/types/app-type'
|
||||||
import MessageBox from '../../components/MessageBox.vue'
|
import MessageBox from '@/pages-sub/components/messageBox/MessageBox.vue'
|
||||||
|
|
||||||
defineProps({
|
defineProps({
|
||||||
universityResult: {
|
universityResult: {
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,7 @@ const fetchBatchData = () => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
choosePhase.value = userStore.userInfo.batchName
|
choosePhase.value = userStore.userInfo.batchName
|
||||||
|
handleChange(choosePhase.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
onLoad(() => {
|
onLoad(() => {
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import MessageBox from '@/pages-sub/home/components/MessageBox.vue'
|
import MessageBox from '@/pages-sub/components/messageBox/MessageBox.vue'
|
||||||
import { getCareerProspects } from '@/service/index/api'
|
import { getCareerProspects } from '@/service/index/api'
|
||||||
import ProgressBar from '../../components/ProgressBar.vue'
|
import ProgressBar from '../../components/ProgressBar.vue'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import MessageBox from '@/pages-sub/home/components/MessageBox.vue'
|
import MessageBox from '@/pages-sub/components/messageBox/MessageBox.vue'
|
||||||
import WXXTable from '@/pages-sub/components/table/Table.vue'
|
import WXXTable from '@/pages-sub/components/table/Table.vue'
|
||||||
import WXXTableCol from '@/pages-sub/components/table/TableCol.vue'
|
import WXXTableCol from '@/pages-sub/components/table/TableCol.vue'
|
||||||
import { getMajorCourse } from '@/service/index/api'
|
import { getMajorCourse } from '@/service/index/api'
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,9 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
|
defineOptions({
|
||||||
|
inheritAttrs: true,
|
||||||
|
})
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
data: {
|
data: {
|
||||||
type: Array,
|
type: Array,
|
||||||
|
|
@ -85,13 +88,13 @@ const rankDiff = (index: number, item) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const recompileData = computed(() => {
|
const recompileData = computed(() => {
|
||||||
const _data = Object.create(props.data)
|
let _data = props.data.map((item, index) => {
|
||||||
|
console.log(props.score)
|
||||||
|
|
||||||
_data.forEach((item, index) => {
|
|
||||||
item['rankDiff'] = rankDiff(index, item)
|
item['rankDiff'] = rankDiff(index, item)
|
||||||
item['lineDiff'] = item['score'] - props.score
|
item['lineDiff'] = item['score'] - props.score
|
||||||
|
return item
|
||||||
})
|
})
|
||||||
|
|
||||||
return _data
|
return _data
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,21 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="h-[16rpx] bg-[#f8f8f8]"></view>
|
<view class="h-[16rpx] bg-[#f8f8f8]"></view>
|
||||||
|
|
||||||
<Collapse
|
<view
|
||||||
:default-collapsed="false"
|
|
||||||
class="flex flex-col items-center gap-[16rpx] custom-background px-[32rpx]"
|
class="flex flex-col items-center gap-[16rpx] custom-background px-[32rpx]"
|
||||||
:style="`--background-color:${calcTypeName(college.type).style.backgroundColor}`"
|
:style="`--background-color:${calcTypeName(college.type).style.backgroundColor}`"
|
||||||
>
|
>
|
||||||
<template #header>
|
|
||||||
<view class="flex py-[32rpx] gap-[30rpx]">
|
<view class="flex py-[32rpx] gap-[30rpx]">
|
||||||
<view class="flex flex-col items-center gap-[16rpx]">
|
<view class="flex flex-col items-center gap-[16rpx]">
|
||||||
<view class="flex items-center gap-[8rpx] text-[#303030] text-[28rpx]">
|
<view
|
||||||
|
class="flex items-center gap-[8rpx] text-[#303030] text-[28rpx]"
|
||||||
|
@click.stop="toggleCollapse"
|
||||||
|
>
|
||||||
{{ collegeIndex }}
|
{{ collegeIndex }}
|
||||||
<view class="i-carbon-chevron-down text-[16rpx]"></view>
|
<view
|
||||||
|
class="i-carbon-chevron-down text-[16rpx] transition-transform duration-300"
|
||||||
|
:class="{ 'rotate-180': !isCollapsed }"
|
||||||
|
></view>
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view
|
||||||
class="w-[52rpx] h-[52rpx] rounded-[8rpx] font-semibold text-[28rpx] flex items-center justify-center"
|
class="w-[52rpx] h-[52rpx] rounded-[8rpx] font-semibold text-[28rpx] flex items-center justify-center"
|
||||||
|
|
@ -33,7 +37,7 @@
|
||||||
<view class="flex justify-between flex-col gap-[6rpx]">
|
<view class="flex justify-between flex-col gap-[6rpx]">
|
||||||
<text class="text-[32rpx] font-semibold">{{ college.name }}</text>
|
<text class="text-[32rpx] font-semibold">{{ college.name }}</text>
|
||||||
<text class="text-[22rpx] text-[#505050]">
|
<text class="text-[22rpx] text-[#505050]">
|
||||||
{{ college.city }}·{{ college.educationCategory }}
|
{{ college.ownership }}·{{ college.educationCategory }}
|
||||||
</text>
|
</text>
|
||||||
<view class="text-[22rpx] text-[#8F959E] flex items-center">
|
<view class="text-[22rpx] text-[#8F959E] flex items-center">
|
||||||
<text class="truncate max-w-[300rpx]" v-show="college.features.length > 0">
|
<text class="truncate max-w-[300rpx]" v-show="college.features.length > 0">
|
||||||
|
|
@ -48,60 +52,101 @@
|
||||||
</text>
|
</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="flex gap-[40rpx]">
|
||||||
|
<view class="i-carbon-move" @touchstart="handleMove"></view>
|
||||||
|
<view class="i-carbon-trash-can" @click="handleDelete"></view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<DataTable :data="college.childItems" v-bind="$attrs" />
|
<DataTable :data="college.childItems" :score="score" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
|
||||||
<view class="h-[2rpx] bg-[#EDEDED] w-full"></view>
|
<view class="h-[2rpx] bg-[#EDEDED] w-full"></view>
|
||||||
<view
|
<view
|
||||||
v-for="major in college.vItems"
|
class="overflow-hidden transition-all duration-300"
|
||||||
:key="major.planId"
|
:style="{ maxHeight: isCollapsed ? '0' : '2000px' }"
|
||||||
class="pt-[32rpx] pb-[30rpx] flex gap-[30rpx] not-last:border-b border-[#EDEDED]"
|
|
||||||
>
|
>
|
||||||
<view class="flex flex-col gap-[16rpx]">
|
<DragSort v-model:list="college.vItems" ref="majorDrop" @get-list="getMajorList">
|
||||||
<text class="text-[32rpx] font-semibold text-[#000]">{{ major.percentAge || '0%' }}</text>
|
<template #content="{ data }">
|
||||||
|
<view
|
||||||
|
:style="[{ transform: data.index === data.activeIndex ? 'scale(1.05)' : 'scale(1)' }]"
|
||||||
|
>
|
||||||
|
<SortMajor
|
||||||
|
:major="data"
|
||||||
|
:score="score"
|
||||||
|
:year="college.year"
|
||||||
|
:major-index="data.index"
|
||||||
|
@move="handleMajorMove(data.index)"
|
||||||
|
@delete="handleMajorDelete(data.index)"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex flex-col gap-[16rpx]">
|
</template>
|
||||||
<view class="flex justify-between flex-auto">
|
</DragSort>
|
||||||
<view class="flex flex-col">
|
|
||||||
<text class="text-[32rpx] text-[#000] font-semibold truncate max-w-[400rpx]">
|
|
||||||
{{ major.major.replace(/(\r\n|\n|\r)/g, '') }}
|
|
||||||
</text>
|
|
||||||
<text class="text-[22rpx] text-[#1F2329] mt-[14rpx]">{{ major.remark }}</text>
|
|
||||||
<view class="flex justify-between text-[22rpx] text-[#1F2329] mt-[14rpx]">
|
|
||||||
<view class="flex flex-col gap-[6rpx]">
|
|
||||||
<text>代码{{ major.majorCode }}</text>
|
|
||||||
<text>{{ college.year }}计划{{ major.planCount }}人</text>
|
|
||||||
</view>
|
|
||||||
<view class="flex flex-col gap-[6rpx]">
|
|
||||||
<text>选科:{{ major.subjectClam }}</text>
|
|
||||||
<text>学费/学制:{{ major.fee }}/{{ major.academic }}</text>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<DataTable :data="major.items" :score="score" />
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</Collapse>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { calcTypeName } from '../composable/useWishesList'
|
import { calcTypeName } from '../composable/useWishesList'
|
||||||
import DataTable from './DataTable.vue'
|
import DataTable from './DataTable.vue'
|
||||||
import Collapse from '@/pages-sub/components/collapse/Collapse.vue'
|
import SortMajor from './SortMajor.vue'
|
||||||
|
import DragSort from '@/pages-sub/components/dragSort/DragSort.vue'
|
||||||
|
import { useUserStore } from '@/store/user'
|
||||||
|
|
||||||
defineProps<{
|
const userStore = useUserStore()
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
college: any
|
college: any
|
||||||
score: number
|
score: number
|
||||||
collegeIndex: number
|
collegeIndex: number
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits(['toggleCollapse', 'updateHeight', 'move', 'delete', 'deleteMajor'])
|
||||||
|
|
||||||
|
// 默认展开第一个大学的专业
|
||||||
|
const isCollapsed = ref(true)
|
||||||
|
const toggleCollapse = () => {
|
||||||
|
isCollapsed.value = !isCollapsed.value
|
||||||
|
emit('toggleCollapse', props.collegeIndex)
|
||||||
|
// 等待 DOM 更新后重新计算高度
|
||||||
|
nextTick(() => {
|
||||||
|
// 触发父组件的重新计算
|
||||||
|
emit('updateHeight')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleMove = () => {
|
||||||
|
emit('move')
|
||||||
|
}
|
||||||
|
const handleDelete = () => {
|
||||||
|
emit('delete')
|
||||||
|
}
|
||||||
|
|
||||||
|
const majorDrop = ref()
|
||||||
|
|
||||||
|
const handleMajorMove = (index) => {
|
||||||
|
majorDrop.value.handleLongpress(index)
|
||||||
|
}
|
||||||
|
|
||||||
|
const getMajorList = (list) => {
|
||||||
|
userStore.sortWishMajorList({ list, uIndex: props.collegeIndex - 1 })
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleMajorDelete = (index) => {
|
||||||
|
majorDrop.value.initList(props.college.vItems, true).then(() => {
|
||||||
|
emit('deleteMajor', index)
|
||||||
|
})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.custom-background {
|
.custom-background {
|
||||||
background: linear-gradient(180deg, var(--background-color) 0%, #fff 30%, #fff 100%);
|
background: linear-gradient(180deg, var(--background-color) 0%, #fff 30%, #fff 100%);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 添加过渡效果
|
||||||
|
.transition-all {
|
||||||
|
transition-property: all;
|
||||||
|
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
<template>
|
||||||
|
<view
|
||||||
|
class="pt-[32rpx] pb-[30rpx] flex justify-center gap-[30rpx] not-last:border-b border-[#EDEDED]"
|
||||||
|
>
|
||||||
|
<view class="flex flex-col gap-[16rpx]">
|
||||||
|
<text class="text-[32rpx] font-semibold text-[#000]">{{ major.percentAge || '0%' }}</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex flex-col gap-[16rpx]">
|
||||||
|
<view class="flex justify-between flex-auto">
|
||||||
|
<view class="flex flex-col">
|
||||||
|
<text class="text-[32rpx] text-[#000] font-semibold truncate max-w-[400rpx]">
|
||||||
|
{{ major.major.replace(/(\r\n|\n|\r)/g, '') }}
|
||||||
|
</text>
|
||||||
|
<text class="text-[22rpx] text-[#1F2329] mt-[14rpx]">{{ major.remark }}</text>
|
||||||
|
<view class="flex justify-between text-[22rpx] text-[#1F2329] mt-[14rpx]">
|
||||||
|
<view class="flex flex-col gap-[6rpx]">
|
||||||
|
<text>代码{{ major.majorCode }}</text>
|
||||||
|
<text>{{ year }}计划{{ major.planCount }}人</text>
|
||||||
|
</view>
|
||||||
|
<view class="flex flex-col gap-[6rpx]">
|
||||||
|
<text>选科:{{ major.subjectClam }}</text>
|
||||||
|
<text>学费/学制:{{ major.fee }}/{{ major.academic }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="flex gap-[40rpx]">
|
||||||
|
<view class="i-carbon-move" @touchstart="handleMove"></view>
|
||||||
|
<view class="i-carbon-trash-can" @click="handleDelete"></view>
|
||||||
|
{{ score }}
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<DataTable :data="major.items" :score="score" />
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import DataTable from './DataTable.vue'
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
major: any
|
||||||
|
score: number
|
||||||
|
year: string
|
||||||
|
majorIndex: number
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits(['move', 'delete'])
|
||||||
|
|
||||||
|
const handleMove = () => {
|
||||||
|
emit('move')
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleDelete = () => {
|
||||||
|
emit('delete')
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped></style>
|
||||||
|
|
@ -261,7 +261,7 @@ const handlePreview = () => {
|
||||||
if (majorCount.value === 0) {
|
if (majorCount.value === 0) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
uni.navigateTo({ url: '/pages-sub/home/wishesList/wishesList' })
|
uni.navigateTo({ url: '/pages-sub/home/wishesList/wishesList?editType=add&typeName=智能填报' })
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,26 +9,73 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="h-screen flex flex-col">
|
<view class="h-screen flex flex-col">
|
||||||
<HeaderTip :user-info="userStore.userInfo" :type="1" />
|
<HeaderTip :user-info="userStore.userInfo" :type="1" />
|
||||||
<DragSortList v-model:list="wishList" class="flex-auto pb-safe overflow-auto" ref="myDrop">
|
<DragSortList
|
||||||
|
v-model:list="wishList"
|
||||||
|
class="flex-auto overflow-auto"
|
||||||
|
ref="myDrop"
|
||||||
|
@get-list="getDropList"
|
||||||
|
>
|
||||||
<template #content="{ data }">
|
<template #content="{ data }">
|
||||||
<view
|
<view
|
||||||
class="drop"
|
class="drop"
|
||||||
:style="[{ transform: data.index === data.activeIndex ? 'scale(1.05)' : 'scale(1)' }]"
|
:style="[{ transform: data.index === data.activeIndex ? 'scale(1.05)' : 'scale(1)' }]"
|
||||||
>
|
>
|
||||||
<SortCollege :college="data" :score="score" :college-index="data.index + 1" />
|
<SortCollege
|
||||||
|
:college="data"
|
||||||
|
:score="score"
|
||||||
|
:college-index="data.index + 1"
|
||||||
|
@move="handleMove(data.index)"
|
||||||
|
@update-height="handleUpdateHeight"
|
||||||
|
@delete="handleDelete(data.index)"
|
||||||
|
@delete-major="(majorIndex) => handleDeleteMajor(data.index, majorIndex)"
|
||||||
|
/>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
</DragSortList>
|
</DragSortList>
|
||||||
|
<view class="flex items-center pb-safe button-group px-[32rpx] pt-[32rpx]">
|
||||||
|
<button
|
||||||
|
plain
|
||||||
|
class="border-[#f5f5f5]! flex-auto bg-[#f5f5f5]! rounded-[8rpx]! text-[#1580FF]! text-[32rpx]! font-normal! mr-[22rpx]"
|
||||||
|
>
|
||||||
|
下载PDF
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="border-[#1580FF]! flex-auto bg-[#1580FF]! rounded-[8rpx]! text-[#fff]! text-[32rpx]! font-normal!"
|
||||||
|
@click="messageBoxShow = true"
|
||||||
|
>
|
||||||
|
保存
|
||||||
|
</button>
|
||||||
</view>
|
</view>
|
||||||
|
</view>
|
||||||
|
<MessageBox v-model:show="messageBoxShow" title="志愿表名字">
|
||||||
|
<template>
|
||||||
|
<input
|
||||||
|
type="text"
|
||||||
|
class="w-auto p-[20rpx] text-center input-border mb-[16rpx]"
|
||||||
|
v-model="wishListName"
|
||||||
|
placeholder="请输入志愿表名字"
|
||||||
|
confirm-type="done"
|
||||||
|
@confirm="handleSave"
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
class="border-[#1580FF]! flex-auto bg-[#1580FF]! rounded-[8rpx]! text-[#fff]! text-[32rpx]! font-normal!"
|
||||||
|
@click="handleSave"
|
||||||
|
>
|
||||||
|
保存
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
|
</MessageBox>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import HeaderTip from './components/HeaderTip.vue'
|
import HeaderTip from './components/HeaderTip.vue'
|
||||||
import DragSortList from '@/pages-sub/components/dragSort/DragSort.vue'
|
import DragSortList from '@/pages-sub/components/dragSort/DragSort.vue'
|
||||||
import SortCollege from './components/SortCollege.vue'
|
import SortCollege from './components/SortCollege.vue'
|
||||||
|
import MessageBox from '@/pages-sub/components/messageBox/MessageBox.vue'
|
||||||
|
|
||||||
import { useUserStore } from '@/store/user'
|
import { useUserStore } from '@/store/user'
|
||||||
import { useScore } from './composable/useWishesList'
|
import { useScore } from './composable/useWishesList'
|
||||||
|
import { saveWishList } from '@/service/index/api'
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
|
|
||||||
const { score } = useScore(
|
const { score } = useScore(
|
||||||
|
|
@ -36,23 +83,113 @@ const { score } = useScore(
|
||||||
userStore.userInfo.batchName,
|
userStore.userInfo.batchName,
|
||||||
)
|
)
|
||||||
|
|
||||||
const wishList = ref(userStore.userInfo.wishList)
|
const messageBoxShow = ref(false)
|
||||||
|
const wishListName = ref('')
|
||||||
|
|
||||||
|
const wishList = ref(JSON.parse(JSON.stringify(userStore.userInfo.wishList)))
|
||||||
const myDrop = ref()
|
const myDrop = ref()
|
||||||
|
|
||||||
const getDropList = (list) => {
|
const getDropList = (list) => {
|
||||||
// 拖拽完毕后获取到的数据
|
// 拖拽完毕后获取到的数据
|
||||||
console.log(list, 'eeee')
|
userStore.sortWishCollegeList({ list })
|
||||||
}
|
}
|
||||||
const touchstart = (i) => {
|
|
||||||
// 默认是长按才能拖动,可根据需求,通过触摸拖动元素
|
|
||||||
console.log(myDrop.value)
|
|
||||||
|
|
||||||
myDrop.value.handleLongpress(i)
|
const handleMove = (index) => {
|
||||||
|
myDrop.value.handleLongpress(index)
|
||||||
}
|
}
|
||||||
const changeList = () => {
|
|
||||||
|
const handleDelete = async (index) => {
|
||||||
// 如果新增或者删除了数据,请调用此函数
|
// 如果新增或者删除了数据,请调用此函数
|
||||||
let list = wishList
|
wishList.value.splice(index, 1)
|
||||||
myDrop.value.initList(list, true)
|
await myDrop.value.initList(wishList.value, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleUpdateHeight = async () => {
|
||||||
|
// 调用 DragSort 组件的重新计算高度方法
|
||||||
|
await myDrop.value?.initList(wishList.value, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleDeleteMajor = async (index, majorIndex) => {
|
||||||
|
wishList.value[index].vItems.splice(majorIndex, 1)
|
||||||
|
userStore.sortWishMajorList({ list: wishList.value[index].vItems, uIndex: index })
|
||||||
|
myDrop.value?.initList(wishList.value, true).then(() => {
|
||||||
|
handleUpdateHeight()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleSave = () => {
|
||||||
|
if (editType === 'add') {
|
||||||
|
addWishList()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const addWishList = () => {
|
||||||
|
let _wishList = userStore.userInfo.wishList
|
||||||
|
let _vTbDetails = _wishList.map((item, index) => {
|
||||||
|
return {
|
||||||
|
unId: item.unId,
|
||||||
|
unName: item.unName,
|
||||||
|
unCode: item.unCode,
|
||||||
|
type: item.type,
|
||||||
|
sort: index + 1,
|
||||||
|
vItems: item.vItems.map((vItem, vIndex) => {
|
||||||
|
return {
|
||||||
|
sort: vIndex + 1,
|
||||||
|
_pId: vItem.planId,
|
||||||
|
major: vItem.major,
|
||||||
|
majorCode: vItem.majorCode,
|
||||||
|
majorGroup: vItem.majorGroup,
|
||||||
|
type: vItem.type,
|
||||||
|
percentAge: vItem.percentAge,
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
})
|
||||||
|
let params = {
|
||||||
|
cId: userStore.userInfo.estimatedAchievement.id,
|
||||||
|
tableName: wishListName.value,
|
||||||
|
batchName: userStore.userInfo.batchName,
|
||||||
|
type: typeName,
|
||||||
|
subjectClaim: userStore.userInfo.estimatedAchievement.subjectGroup,
|
||||||
|
score: +userStore.userInfo.estimatedAchievement.expectedScore,
|
||||||
|
vTbDetails: _vTbDetails,
|
||||||
|
}
|
||||||
|
saveWishList(params).then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '保存成功',
|
||||||
|
icon: 'success',
|
||||||
|
})
|
||||||
|
userStore.clearWishList()
|
||||||
|
uni.switchTab({
|
||||||
|
url: '/pages/home/index/index',
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: res.message || '保存失败',
|
||||||
|
icon: 'none',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
let typeName = ''
|
||||||
|
let editType = ''
|
||||||
|
|
||||||
|
onLoad((options) => {
|
||||||
|
typeName = options.typeName
|
||||||
|
editType = options.editType
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.button-group {
|
||||||
|
box-shadow: 0rpx -8rpx 8rpx 0rpx rgba(225, 225, 225, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-border {
|
||||||
|
border: 1rpx solid #ccc;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
padding: 20rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -280,3 +280,32 @@ export const getPlanProListByFilter = (params: AutoFillParams) => {
|
||||||
export const getBatchBase = (params: { locationCode: string }) => {
|
export const getBatchBase = (params: { locationCode: string }) => {
|
||||||
return http.get('/api/busBatchBase/batch', params)
|
return http.get('/api/busBatchBase/batch', params)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type WishListParams = {
|
||||||
|
vId?: number
|
||||||
|
cId: number
|
||||||
|
tableName?: string
|
||||||
|
batchName: string
|
||||||
|
type: string
|
||||||
|
subjectClaim: string
|
||||||
|
score: number
|
||||||
|
vTbDetails: {
|
||||||
|
unId: number
|
||||||
|
unName: string
|
||||||
|
unCode: string
|
||||||
|
type: number
|
||||||
|
sort: number
|
||||||
|
vItems: {
|
||||||
|
sort: number
|
||||||
|
_pId: number
|
||||||
|
major: string
|
||||||
|
majorCode: string
|
||||||
|
majorGroup: string
|
||||||
|
type: number
|
||||||
|
percentAge: string
|
||||||
|
}[]
|
||||||
|
}[]
|
||||||
|
}
|
||||||
|
export const saveWishList = (params: WishListParams) => {
|
||||||
|
return http.post('/api/volunTb/post', params)
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -155,6 +155,18 @@ export const useUserStore = defineStore(
|
||||||
const setWishListMajorWithUn = (val) => {
|
const setWishListMajorWithUn = (val) => {
|
||||||
userInfo.value.wishList.push({ ...val, sort: userInfo.value.wishList.length + 1 })
|
userInfo.value.wishList.push({ ...val, sort: userInfo.value.wishList.length + 1 })
|
||||||
}
|
}
|
||||||
|
// 排序专业
|
||||||
|
const sortWishMajorList = ({ list, uIndex }: { list: any[]; uIndex: number }) => {
|
||||||
|
userInfo.value.wishList[uIndex].vItems = [...list]
|
||||||
|
if (userInfo.value.wishList[uIndex].vItems.length === 0) {
|
||||||
|
userInfo.value.wishList.splice(uIndex, 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 排序大学
|
||||||
|
const sortWishCollegeList = ({ list }: { list: any[] }) => {
|
||||||
|
userInfo.value.wishList = list
|
||||||
|
}
|
||||||
|
|
||||||
// 清除志愿表
|
// 清除志愿表
|
||||||
const clearWishList = () => {
|
const clearWishList = () => {
|
||||||
|
|
@ -191,6 +203,8 @@ export const useUserStore = defineStore(
|
||||||
setWishListMajor,
|
setWishListMajor,
|
||||||
setWishListMajorWithUn,
|
setWishListMajorWithUn,
|
||||||
deleteWishListMajor,
|
deleteWishListMajor,
|
||||||
|
sortWishMajorList,
|
||||||
|
sortWishCollegeList,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
declare global {
|
declare global {
|
||||||
type IResData<T> = {
|
type IResData<T> = {
|
||||||
code: number
|
code: number
|
||||||
msg: string
|
message: string
|
||||||
result: T
|
result: T
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ export const http = <T>(options: CustomRequestOptions) => {
|
||||||
!options.hideErrorToast &&
|
!options.hideErrorToast &&
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
title: (res.data as IResData<T>).msg || '请求错误',
|
title: (res.data as IResData<T>).message || '请求错误',
|
||||||
})
|
})
|
||||||
reject(res)
|
reject(res)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ const http = <T>(options: CustomRequestOptions) => {
|
||||||
!options.hideErrorToast &&
|
!options.hideErrorToast &&
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
title: (res.data as T & { msg?: string })?.msg || '请求错误',
|
title: (res.data as T & { message?: string })?.message || '请求错误',
|
||||||
})
|
})
|
||||||
reject(res)
|
reject(res)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue