feat: 拖动排序
parent
b74e480946
commit
67a0662493
|
|
@ -82,6 +82,7 @@ const show = ref(false)
|
||||||
const badgeValue = ref(1)
|
const badgeValue = ref(1)
|
||||||
|
|
||||||
const close = () => {
|
const close = () => {
|
||||||
|
filterMenuRef.value.clearForm()
|
||||||
show.value = false
|
show.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -140,8 +140,16 @@ const handleConfirm = () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const clearForm = () => {
|
||||||
|
defaultCollegeFeature.value = []
|
||||||
|
defaultUniType.value = []
|
||||||
|
defaultNature.value = []
|
||||||
|
defaultRegion.value = []
|
||||||
|
}
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
handleConfirm,
|
handleConfirm,
|
||||||
|
clearForm,
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@
|
||||||
<view class="flex gap-[40rpx]">
|
<view class="flex gap-[40rpx]">
|
||||||
<view class="i-carbon-move" @touchstart="handleMove"></view>
|
<view class="i-carbon-move" @touchstart="handleMove"></view>
|
||||||
<view class="i-carbon-trash-can" @click="handleDelete"></view>
|
<view class="i-carbon-trash-can" @click="handleDelete"></view>
|
||||||
{{ score }}
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<DataTable :data="major.items" :score="score" />
|
<DataTable :data="major.items" :score="score" />
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
<template></template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
onShow(() => {
|
||||||
|
uni.navigateBack()
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
@ -8,9 +8,8 @@
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<view class="h-screen flex flex-col">
|
<view class="h-screen flex flex-col">
|
||||||
<web-view :src="webUrl" :fullscreen="false" :update-title="false" @message="handleMessage" />
|
<web-view :src="webUrl" :update-title="false" @message="handleMessage" />
|
||||||
<!-- <HeaderTip :user-info="userStore.userInfo" :type="1" /> -->
|
<!-- <HeaderTip :user-info="userStore.userInfo" :type="1" /> -->
|
||||||
|
|
||||||
<!-- <DragSortList
|
<!-- <DragSortList
|
||||||
:list="list"
|
:list="list"
|
||||||
class="flex-auto overflow-auto"
|
class="flex-auto overflow-auto"
|
||||||
|
|
@ -35,22 +34,16 @@
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
</DragSortList> -->
|
</DragSortList> -->
|
||||||
<view class="flex items-center pb-safe button-group px-[32rpx] pt-[32rpx]">
|
<!-- <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
|
<button
|
||||||
class="border-[#1580FF]! flex-auto bg-[#1580FF]! rounded-[8rpx]! text-[#fff]! text-[32rpx]! font-normal!"
|
class="border-[#1580FF]! flex-auto bg-[#1580FF]! rounded-[8rpx]! text-[#fff]! text-[32rpx]! font-normal!"
|
||||||
@click="messageBoxShow = true"
|
@click="messageBoxShow = true"
|
||||||
>
|
>
|
||||||
保存
|
保存
|
||||||
</button>
|
</button>
|
||||||
</view>
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
<MessageBox v-model:show="messageBoxShow" title="志愿表名字">
|
<!-- <MessageBox v-model:show="messageBoxShow" title="志愿表名字">
|
||||||
<template>
|
<template>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
|
|
@ -67,72 +60,120 @@
|
||||||
保存
|
保存
|
||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
||||||
</MessageBox>
|
</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 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'
|
import { putWishList, saveWishList } from '@/service/index/api'
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
|
|
||||||
const { score } = useScore(
|
// const { score } = useScore(
|
||||||
userStore.userInfo.estimatedAchievement.provinceCode,
|
// userStore.userInfo.estimatedAchievement.provinceCode,
|
||||||
userStore.userInfo.batchName,
|
// userStore.userInfo.batchName,
|
||||||
)
|
// )
|
||||||
|
|
||||||
const messageBoxShow = ref(false)
|
// const messageBoxShow = ref(false)
|
||||||
const wishListName = ref('')
|
const wishListName = ref('')
|
||||||
|
|
||||||
const wishList = ref(JSON.parse(JSON.stringify(userStore.userInfo.wishList)))
|
// const wishList = ref(JSON.parse(JSON.stringify(userStore.userInfo.wishList)))
|
||||||
const myDrop = ref()
|
// const myDrop = ref()
|
||||||
|
|
||||||
const getDropList = (list) => {
|
// const getDropList = (list) => {
|
||||||
// 拖拽完毕后获取到的数据
|
// // 拖拽完毕后获取到的数据
|
||||||
userStore.sortWishCollegeList({ list })
|
// userStore.sortWishCollegeList({ list })
|
||||||
}
|
// }
|
||||||
|
|
||||||
const handleMove = (index) => {
|
// const handleMove = (index) => {
|
||||||
myDrop.value.handleLongpress(index)
|
// myDrop.value.handleLongpress(index)
|
||||||
}
|
// }
|
||||||
|
|
||||||
const handleDelete = async (index) => {
|
// const handleDelete = async (index) => {
|
||||||
// 如果新增或者删除了数据,请调用此函数
|
// // 如果新增或者删除了数据,请调用此函数
|
||||||
wishList.value.splice(index, 1)
|
// wishList.value.splice(index, 1)
|
||||||
await myDrop.value.initList(wishList.value)
|
// await myDrop.value.initList(wishList.value)
|
||||||
}
|
// }
|
||||||
|
|
||||||
const handleUpdateHeight = async () => {
|
// const handleUpdateHeight = async () => {
|
||||||
// 调用 DragSort 组件的重新计算高度方法
|
// // 调用 DragSort 组件的重新计算高度方法
|
||||||
await myDrop.value?.initList(wishList.value, true)
|
// await myDrop.value?.initList(wishList.value, true)
|
||||||
}
|
// }
|
||||||
|
|
||||||
const handleDeleteMajor = async (index, majorIndex) => {
|
// const handleDeleteMajor = async (index, majorIndex) => {
|
||||||
wishList.value[index].vItems.splice(majorIndex, 1)
|
// wishList.value[index].vItems.splice(majorIndex, 1)
|
||||||
userStore.sortWishMajorList({ list: wishList.value[index].vItems, uIndex: index })
|
// userStore.sortWishMajorList({ list: wishList.value[index].vItems, uIndex: index })
|
||||||
myDrop.value?.initList(wishList.value, true).then(() => {
|
// myDrop.value?.initList(wishList.value, true).then(() => {
|
||||||
myDrop.value?.initList(wishList.value, true)
|
// myDrop.value?.initList(wishList.value, true)
|
||||||
|
// })
|
||||||
|
// }
|
||||||
|
|
||||||
|
// const handleSave = () => {
|
||||||
|
// if (vTbId.value === 0) {
|
||||||
|
// addWishList()
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
const editWishList = (_wishList: any[]) => {
|
||||||
|
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._pId,
|
||||||
|
major: vItem.major,
|
||||||
|
majorCode: vItem.majorCode,
|
||||||
|
majorGroup: vItem.majorGroup,
|
||||||
|
type: vItem.type,
|
||||||
|
percentAge: vItem.percentAge,
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
|
||||||
|
|
||||||
const handleSave = () => {
|
let params = {
|
||||||
if (editType === 'add') {
|
vId: vTbId.value,
|
||||||
addWishList()
|
cId: userStore.userInfo.estimatedAchievement.wxId,
|
||||||
|
tableName: wishListName.value,
|
||||||
|
batchName: userStore.userInfo.batchName,
|
||||||
|
type: typeName,
|
||||||
|
subjectClaim: userStore.userInfo.estimatedAchievement.subjectGroup,
|
||||||
|
score: +userStore.userInfo.estimatedAchievement.expectedScore,
|
||||||
|
vTbDetails: _vTbDetails,
|
||||||
|
LocationCode: userStore.userInfo.estimatedAchievement.provinceCode,
|
||||||
}
|
}
|
||||||
|
console.log(params)
|
||||||
|
|
||||||
|
putWishList(params).then((res) => {
|
||||||
|
if (res.code === 200) {
|
||||||
|
userStore.clearWishList()
|
||||||
|
vTbId.value = res.result as number
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: res.message || '保存失败',
|
||||||
|
icon: 'none',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const addWishList = () => {
|
const addWishList = () => {
|
||||||
let _wishList = userStore.userInfo.wishList
|
let _wishList = userStore.userInfo.wishList
|
||||||
let _vTbDetails = _wishList.map((item, index) => {
|
let _vTbDetails = _wishList.map((item, index) => {
|
||||||
return {
|
return {
|
||||||
unId: item.unId,
|
unId: item.unId || item.uId,
|
||||||
unName: item.unName,
|
unName: item.unName || item.universityName,
|
||||||
unCode: item.unCode,
|
unCode: item.unCode || item.collegeCode,
|
||||||
type: item.type,
|
type: item.type,
|
||||||
sort: index + 1,
|
sort: index + 1,
|
||||||
vItems: item.vItems.map((vItem, vIndex) => {
|
vItems: item.vItems.map((vItem, vIndex) => {
|
||||||
|
|
@ -176,14 +217,27 @@ let editType = ''
|
||||||
|
|
||||||
let vTbId = ref(0)
|
let vTbId = ref(0)
|
||||||
let webUrl = computed(() => {
|
let webUrl = computed(() => {
|
||||||
return `http://localhost:3001/sort-college?id=${vTbId.value}&token=${userStore.userInfo.token}&score=${userStore.userInfo.estimatedAchievement.expectedScore}&batchName=${userStore.userInfo.batchName}&subjectGroup=${userStore.userInfo.estimatedAchievement.subjectGroup}&location=${userStore.userInfo.estimatedAchievement.provinceCode}`
|
if (vTbId.value !== 0) {
|
||||||
|
return `http://localhost:3001/sort-college?id=${vTbId.value}&token=${userStore.userInfo.token}&score=${userStore.userInfo.estimatedAchievement.expectedScore}&batchName=${userStore.userInfo.batchName}&subjectGroup=${userStore.userInfo.estimatedAchievement.subjectGroup}&location=${userStore.userInfo.estimatedAchievement.provinceCode}`
|
||||||
|
}
|
||||||
|
return ''
|
||||||
})
|
})
|
||||||
const handleMessage = () => {}
|
|
||||||
|
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) => {
|
onLoad((options) => {
|
||||||
typeName = options.typeName
|
typeName = options.typeName
|
||||||
editType = options.editType
|
editType = options.editType
|
||||||
addWishList()
|
if (editType === 'edit') {
|
||||||
|
vTbId.value = options.id
|
||||||
|
} else {
|
||||||
|
addWishList()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,13 @@
|
||||||
</route>
|
</route>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<scroll-view scroll-y class="pb-safe bg-[#f8f8f8]">
|
<scroll-view scroll-y class="bg-[#f8f8f8] h-screen">
|
||||||
<view class="px-[32rpx] mt-[32rpx] flex flex-col gap-[16rpx]">
|
<view class="px-[32rpx] mt-[32rpx] flex flex-col gap-[16rpx]">
|
||||||
<view
|
<view
|
||||||
class="flex gap-[24rpx] wish-border justify-between p-[32rpx] rounded-[8rpx]"
|
class="flex gap-[24rpx] wish-border justify-between p-[32rpx] rounded-[8rpx]"
|
||||||
v-for="(item, index) in wishList"
|
v-for="(item, index) in wishList"
|
||||||
:key="index"
|
:key="index"
|
||||||
|
@click="toWishPage(item)"
|
||||||
>
|
>
|
||||||
<view>
|
<view>
|
||||||
<view class="flex gap-[18rpx] items-center">
|
<view class="flex gap-[18rpx] items-center">
|
||||||
|
|
@ -30,8 +31,8 @@
|
||||||
<text class="text-[22rpx] text-[#303030]">{{ item.createTime || '时间消失了' }}</text>
|
<text class="text-[22rpx] text-[#303030]">{{ item.createTime || '时间消失了' }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="flex flex-col justify-between items-end">
|
<view class="flex flex-col justify-between items-end">
|
||||||
<view class="i-carbon-trash-can" @click="handleDelete(item, index)"></view>
|
<view class="i-carbon-trash-can" @click.stop="handleDelete(item, index)"></view>
|
||||||
<button class="download-btn" @click="handleDownload(item)">下载PDF</button>
|
<button class="download-btn" @click.stop="handleDownload(item)">下载PDF</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -95,6 +96,12 @@ const handleDownload = (item) => {
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const toWishPage = (item: any) => {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: `/pages-sub/home/wishesList/wishesList?typeName=${item.type}&editType=edit&id=${item.vId}`,
|
||||||
|
})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
||||||
|
|
@ -254,6 +254,10 @@
|
||||||
"navigationBarTitleText": "我的志愿表"
|
"navigationBarTitleText": "我的志愿表"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"path": "home/wishesList/temp",
|
||||||
|
"type": "page"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"path": "home/wishesList/wishesList",
|
"path": "home/wishesList/wishesList",
|
||||||
"type": "page",
|
"type": "page",
|
||||||
|
|
|
||||||
|
|
@ -311,6 +311,10 @@ export const saveWishList = (params: WishListParams) => {
|
||||||
return http.post('/api/volunTb/post', params)
|
return http.post('/api/volunTb/post', params)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const putWishList = (params: WishListParams) => {
|
||||||
|
return http.post('/api/volunTb/put', params)
|
||||||
|
}
|
||||||
|
|
||||||
export const getProductionList = (params: { Id: string }) => {
|
export const getProductionList = (params: { Id: string }) => {
|
||||||
return http.get('/api/busProduct/detail', params)
|
return http.get('/api/busProduct/detail', params)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ interface NavigateToOptions {
|
||||||
"/pages-sub/home/news/newsList" |
|
"/pages-sub/home/news/newsList" |
|
||||||
"/pages-sub/home/schoolRank/index" |
|
"/pages-sub/home/schoolRank/index" |
|
||||||
"/pages-sub/home/wishesList/index" |
|
"/pages-sub/home/wishesList/index" |
|
||||||
|
"/pages-sub/home/wishesList/temp" |
|
||||||
"/pages-sub/home/wishesList/wishesList" |
|
"/pages-sub/home/wishesList/wishesList" |
|
||||||
"/pages-sub/ucenter/active/activePage" |
|
"/pages-sub/ucenter/active/activePage" |
|
||||||
"/pages-sub/ucenter/appointment/appointment" |
|
"/pages-sub/ucenter/appointment/appointment" |
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue