@@ -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.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);
- },
- );
- };