feat: 删除无用代码
parent
67a0662493
commit
e1f725393e
|
|
@ -1,152 +0,0 @@
|
|||
<template>
|
||||
<view class="h-[16rpx] bg-[#f8f8f8]"></view>
|
||||
|
||||
<view
|
||||
class="flex flex-col items-center gap-[16rpx] custom-background px-[32rpx]"
|
||||
:style="`--background-color:${calcTypeName(college.type).style.backgroundColor}`"
|
||||
>
|
||||
<view class="flex py-[32rpx] gap-[30rpx]">
|
||||
<view class="flex flex-col items-center gap-[16rpx]">
|
||||
<view
|
||||
class="flex items-center gap-[8rpx] text-[#303030] text-[28rpx]"
|
||||
@click.stop="toggleCollapse"
|
||||
>
|
||||
{{ collegeIndex }}
|
||||
<view
|
||||
class="i-carbon-chevron-down text-[16rpx] transition-transform duration-300"
|
||||
:class="{ 'rotate-180': !isCollapsed }"
|
||||
></view>
|
||||
</view>
|
||||
<view
|
||||
class="w-[52rpx] h-[52rpx] rounded-[8rpx] font-semibold text-[28rpx] flex items-center justify-center"
|
||||
:style="calcTypeName(college.type).style"
|
||||
>
|
||||
{{ calcTypeName(college.type).text }}
|
||||
</view>
|
||||
<text class="text-[32rpx] font-semibold">
|
||||
{{
|
||||
Math.round(
|
||||
college.vItems.reduce((a, b) => a + Number(b.percentAge.replace('%', '')), 0) /
|
||||
college.vItems.length,
|
||||
)
|
||||
}}%
|
||||
</text>
|
||||
</view>
|
||||
<view class="flex flex-col justify-between flex-1">
|
||||
<view class="flex justify-between mb-[14rpx]">
|
||||
<view class="flex justify-between flex-col gap-[6rpx]">
|
||||
<text class="text-[32rpx] font-semibold">{{ college.name }}</text>
|
||||
<text class="text-[22rpx] text-[#505050]">
|
||||
{{ college.ownership }}·{{ college.educationCategory }}
|
||||
</text>
|
||||
<view class="text-[22rpx] text-[#8F959E] flex items-center">
|
||||
<text class="truncate max-w-[300rpx]" v-show="college.features.length > 0">
|
||||
{{ college.features.slice(0, 3).join('/') }}/
|
||||
</text>
|
||||
<text>排名{{ college.rank }}</text>
|
||||
</view>
|
||||
<view class="text-[22rpx] text-[#1F2329] mt-[8rpx] flex gap-[10rpx]">
|
||||
<text class="">代码{{ college.collegeCode }}</text>
|
||||
<text>
|
||||
{{ college.year }}计划{{ college.vItems.reduce((a, b) => a + b.planCount, 0) }}人
|
||||
</text>
|
||||
</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>
|
||||
|
||||
<DataTable :data="college.childItems" :score="score" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="h-[2rpx] bg-[#EDEDED] w-full"></view>
|
||||
<view
|
||||
class="overflow-auto transition-all duration-300"
|
||||
:style="{ maxHeight: isCollapsed ? '0' : '100vh' }"
|
||||
>
|
||||
<DragSort v-model:list="college.vItems" ref="majorDrop" @get-list="getMajorList">
|
||||
<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>
|
||||
</template>
|
||||
</DragSort>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { calcTypeName } from '../composable/useWishesList'
|
||||
import DataTable from './DataTable.vue'
|
||||
import SortMajor from './SortMajor.vue'
|
||||
import DragSort from '@/pages-sub/components/dragSort/DragSort.vue'
|
||||
import { useUserStore } from '@/store/user'
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
const props = defineProps<{
|
||||
college: any
|
||||
score: 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>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.custom-background {
|
||||
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>
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
<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>
|
||||
</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>
|
||||
|
|
@ -9,116 +9,17 @@
|
|||
<template>
|
||||
<view class="h-screen flex flex-col">
|
||||
<web-view :src="webUrl" :update-title="false" @message="handleMessage" />
|
||||
<!-- <HeaderTip :user-info="userStore.userInfo" :type="1" /> -->
|
||||
<!-- <DragSortList
|
||||
:list="list"
|
||||
class="flex-auto overflow-auto"
|
||||
ref="myDrop"
|
||||
@get-list="getDropList"
|
||||
>
|
||||
<template #content="{ data }">
|
||||
<view
|
||||
class="drop"
|
||||
id="wishListContainer"
|
||||
:style="[{ transform: data.index === data.activeIndex ? 'scale(1.05)' : 'scale(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>
|
||||
</template>
|
||||
</DragSortList> -->
|
||||
<!-- <view class="flex items-center pb-safe button-group px-[32rpx] pt-[32rpx]">
|
||||
<button
|
||||
class="border-[#1580FF]! flex-auto bg-[#1580FF]! rounded-[8rpx]! text-[#fff]! text-[32rpx]! font-normal!"
|
||||
@click="messageBoxShow = true"
|
||||
>
|
||||
保存
|
||||
</button>
|
||||
</view> -->
|
||||
</view>
|
||||
<!-- <MessageBox v-model:show="messageBoxShow" title="志愿表名字">
|
||||
<template>
|
||||
<input
|
||||
type="text"
|
||||
class="w-auto p-[20rpx] text-center input-border mb-[16rpx] z-[-1]"
|
||||
v-model="wishListName"
|
||||
:placeholder="messageBoxShow ? '请输入志愿表名字' : ''"
|
||||
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>
|
||||
|
||||
<script setup lang="ts">
|
||||
// import HeaderTip from './components/HeaderTip.vue'
|
||||
// import DragSortList from '@/pages-sub/components/dragSort/DragSort.vue'
|
||||
// import SortCollege from './components/SortCollege.vue'
|
||||
// import MessageBox from '@/pages-sub/components/messageBox/MessageBox.vue'
|
||||
|
||||
import { useUserStore } from '@/store/user'
|
||||
// import { useScore } from './composable/useWishesList'
|
||||
|
||||
import { putWishList, saveWishList } from '@/service/index/api'
|
||||
const userStore = useUserStore()
|
||||
|
||||
// const { score } = useScore(
|
||||
// userStore.userInfo.estimatedAchievement.provinceCode,
|
||||
// userStore.userInfo.batchName,
|
||||
// )
|
||||
|
||||
// const messageBoxShow = ref(false)
|
||||
const wishListName = ref('')
|
||||
|
||||
// const wishList = ref(JSON.parse(JSON.stringify(userStore.userInfo.wishList)))
|
||||
// const myDrop = ref()
|
||||
|
||||
// const getDropList = (list) => {
|
||||
// // 拖拽完毕后获取到的数据
|
||||
// userStore.sortWishCollegeList({ list })
|
||||
// }
|
||||
|
||||
// const handleMove = (index) => {
|
||||
// myDrop.value.handleLongpress(index)
|
||||
// }
|
||||
|
||||
// const handleDelete = async (index) => {
|
||||
// // 如果新增或者删除了数据,请调用此函数
|
||||
// wishList.value.splice(index, 1)
|
||||
// await myDrop.value.initList(wishList.value)
|
||||
// }
|
||||
|
||||
// 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(() => {
|
||||
// myDrop.value?.initList(wishList.value, true)
|
||||
// })
|
||||
// }
|
||||
|
||||
// const handleSave = () => {
|
||||
// if (vTbId.value === 0) {
|
||||
// addWishList()
|
||||
// }
|
||||
// }
|
||||
|
||||
const editWishList = (_wishList: any[]) => {
|
||||
let _vTbDetails = _wishList.map((item, index) => {
|
||||
return {
|
||||
|
|
@ -152,7 +53,6 @@ const editWishList = (_wishList: any[]) => {
|
|||
vTbDetails: _vTbDetails,
|
||||
LocationCode: userStore.userInfo.estimatedAchievement.provinceCode,
|
||||
}
|
||||
console.log(params)
|
||||
|
||||
putWishList(params).then((res) => {
|
||||
if (res.code === 200) {
|
||||
|
|
@ -227,7 +127,6 @@ const handleMessage = (evt) => {
|
|||
// let saveItem = JSON.parse(evt.message)
|
||||
let data = JSON.parse(evt.detail.data[0].message)
|
||||
editWishList(data)
|
||||
console.log(JSON.stringify(data))
|
||||
}
|
||||
|
||||
onLoad((options) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue