From da24d5ce150f93c12688b988a6969e1e51161075 Mon Sep 17 00:00:00 2001 From: xjs Date: Fri, 28 Mar 2025 18:09:55 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=8C=E5=96=84=E5=90=8E=E7=BB=AD?= =?UTF-8?q?=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/messageBox/MessageBox.vue | 69 ++++++++++++++++++ src/components/overlay/Overlay.vue | 56 +++++++++++++++ src/components/sort-college/CollegeItem.vue | 41 ++++------- src/components/sort-college/MajorItem.vue | 22 +++--- src/views/sort-college.vue | 78 ++++++++++++++------- 5 files changed, 201 insertions(+), 65 deletions(-) create mode 100644 src/components/messageBox/MessageBox.vue create mode 100644 src/components/overlay/Overlay.vue diff --git a/src/components/messageBox/MessageBox.vue b/src/components/messageBox/MessageBox.vue new file mode 100644 index 0000000..cba203b --- /dev/null +++ b/src/components/messageBox/MessageBox.vue @@ -0,0 +1,69 @@ + + + + + diff --git a/src/components/overlay/Overlay.vue b/src/components/overlay/Overlay.vue new file mode 100644 index 0000000..d69ffd7 --- /dev/null +++ b/src/components/overlay/Overlay.vue @@ -0,0 +1,56 @@ + + + + + diff --git a/src/components/sort-college/CollegeItem.vue b/src/components/sort-college/CollegeItem.vue index 6212e74..6f10c8b 100644 --- a/src/components/sort-college/CollegeItem.vue +++ b/src/components/sort-college/CollegeItem.vue @@ -20,20 +20,21 @@
- {{ college.name }} + {{ college.unName }} {{ college.ownership }}·{{ college.educationCategory }}
{{ college.features.slice(0, 3).join("/") }}/ 排名{{ college.rank }}
-
- 代码{{ college.collegeCode }} +
+ 代码{{ college.unCode }} {{ college.year }}计划{{ college.vItems.reduce((a:number, b:any) => a + b.planCount, 0) }}人 + {{ college.subjectType }}
-
-
+
+
@@ -42,9 +43,9 @@
- +
@@ -59,7 +60,7 @@ import VirtualList from "vue-virtual-draglist"; import MajorItem from './MajorItem.vue' import DataTable from './DataTable.vue'; -defineProps<{ +const props = defineProps<{ college: any score: number collegeIndex: number @@ -72,28 +73,12 @@ const toggleCollapse = () => { isCollapsed.value = !isCollapsed.value } -// const handleMove = () => { -// emit('move') -// } -// const handleDelete = () => { -// emit('delete') -// } +const {removeCollege} = inject<{removeCollege: (collegeIndex: any) => void}>("sort")! -// const majorDrop = ref() +const handleDelete = () => { + removeCollege(props.collegeIndex) +} -// const handleMajorMove = (index:number) => { -// majorDrop.value.handleLongpress(index) -// } - -// const getMajorList = (list:any[]) => { - -// } - -// const handleMajorDelete = (index:number) => { -// majorDrop.value.initList(props.college.vItems, true).then(() => { -// emit('deleteMajor', index) -// }) -// } diff --git a/src/components/sort-college/MajorItem.vue b/src/components/sort-college/MajorItem.vue index ebf1db7..089da80 100644 --- a/src/components/sort-college/MajorItem.vue +++ b/src/components/sort-college/MajorItem.vue @@ -10,19 +10,19 @@ {{ major.major.replace(/(\r\n|\n|\r)/g, "") }} {{ major.remark }} -
-
+
+
代码{{ major.majorCode }} {{ year }}计划{{ major.planCount }}人
-
+
选科:{{ major.subjectClam }} 学费/学制:{{ major.fee }}/{{ major.academic }}
-
+
@@ -34,21 +34,23 @@ diff --git a/src/views/sort-college.vue b/src/views/sort-college.vue index 6a293e8..2faadb7 100644 --- a/src/views/sort-college.vue +++ b/src/views/sort-college.vue @@ -2,12 +2,19 @@
+
+ +
+ +
@@ -15,7 +22,8 @@ import HeaderTip from "@/components/sort-college/HeaderTip.vue"; import { useUserStore } from "@/store/user"; import VirtualList from "vue-virtual-draglist"; - import CollegeItem from "@/components/sort-college/CollegeItem.vue" + import CollegeItem from "@/components/sort-college/CollegeItem.vue"; + import api from "@/api/customAxios"; const userStore = useUserStore(); @@ -26,16 +34,47 @@ const subjectGroup = ref(""); const locationCode = ref(""); const wishList = ref([]); - // const handleClick = () => { - // alert(localStorage.getItem("userInfo")); - // uni.postMessage({ - // data: { - // action: "message", - // message: location.search, - // }, - // }); - // getWishList(); - // }; + + + const handleSave = () => { + + // uni.navigateTo({url:'/pages-sub/home/wishesList/temp'}) + uni.postMessage({ + data: { + action: "message", + message: JSON.stringify(wishList.value), + }, + }); + uni.navigateBack({ delta: 1 }) + }; + + const removeCollege = (index:number) => { + wishList.value.splice(index,1) + } + const removeMajor = (index:number,mIndex:number) => { + (wishList.value[index] as {vItems:any[]}).vItems.splice(mIndex,1) + } + + provide("sort",{ + removeCollege, + removeMajor + }) + + + const getWishList = () => { + api.get( + `https://api.v3.ycymedu.com/api/volunTb/get/${locationCode.value}`, + { id: vId.value }, + (resp: any) => { + if (resp.code == 200) { + wishList.value = resp.result.tbDetails; + } + }, + (error: any) => { + console.log(error); + }, + ); + }; onBeforeMount(() => { let _mapParams: { [key: string]: any } = {}; @@ -55,19 +94,4 @@ getWishList(); }); - - const getWishList = () => { - api.get( - `https://api.v3.ycymedu.com/api/volunTb/get/${locationCode.value}`, - { id: vId.value }, - (resp: any) => { - if (resp.code == 200) { - wishList.value = resp.result.tbDetails; - } - }, - (error: any) => { - console.log(error); - }, - ); - };