|
|
@@ -4,60 +4,31 @@
|
|
|
<view class="p-32 bg-white flex items-center justify-between">
|
|
|
<view class="">
|
|
|
<text class="text-32 text-fore-title font-bold">添加定向院校</text>
|
|
|
- <text class="ml-10 text-32 text-fore-light">({{ directedSchoolList.length }}/3)</text>
|
|
|
+ <text class="ml-10 text-32 text-fore-title font-bold">({{ directedSchoolList.length }}/3)</text>
|
|
|
</view>
|
|
|
- <view class="text-24 text-fore-light">添加后无法更改</view>
|
|
|
</view>
|
|
|
- <view class="px-48 pt-52 pb-32 flex items-center justify-between">
|
|
|
- <view class="text-32 text-fore-title font-bold">我的定向院校</view>
|
|
|
+ <view class="px-48 pt-52 pb-20 flex items-center justify-between">
|
|
|
+ <view class="text-28 text-fore-title font-bold">当前学习目标</view>
|
|
|
</view>
|
|
|
- <view class="relative">
|
|
|
+ <template v-if="directedSchoolList.length > 0">
|
|
|
<view class="px-30">
|
|
|
- <l-drag ref="dragRef" :list="sortList" :column="1" gridHeight="104px" :touchHandle="touchHandle" ghost handle
|
|
|
- @change="changeSort">
|
|
|
- <!-- // 每一项的插槽 grid 的 content 您传入的数据 -->
|
|
|
- <template #grid="{ active, content, index }">
|
|
|
- <!-- // grid.active 是否为当前拖拽项目 根据自己需要写样式 -->
|
|
|
- <view class="bg-white rounded-10 py-28 pl-30 pr-20 relative flex items-center gap-x-16 mb-20"
|
|
|
- :class="{ 'border border-solid border-primary': active }">
|
|
|
- <view
|
|
|
- class="w-44 text-64 text-primary font-bold absolute top-6 left-14 italic leading-[1] opacity-30 z-1">
|
|
|
- {{ index + 1 }}
|
|
|
- </view>
|
|
|
- <view slot="handle" @touchstart="touchHandle = true" @touchend="touchHandle = false">
|
|
|
- <ie-image src="/pagesStudy/static/image/icon-drag.png" custom-class="w-46 h-46" mode="aspectFill" />
|
|
|
- </view>
|
|
|
- <view class="flex-1 min-w-1 flex items-center gap-x-20">
|
|
|
- <ie-image :src="content.universityLogo" custom-class="w-96 h-96" mode="aspectFill" />
|
|
|
- <view class="flex-1 min-w-1">
|
|
|
- <view class="text-28 text-fore-title font-bold">{{ content.universityName }}</view>
|
|
|
- <view class="mt-8 w-fit text-20 text-primary border border-solid border-primary rounded-4 px-10 py-4">
|
|
|
- {{ content.majorName }}
|
|
|
- </view>
|
|
|
- <view class="flex items-center justify-between text-20">
|
|
|
- <view class="mt-8 text-fore-light">{{ content.majorAncestors }}</view>
|
|
|
- <view v-if="index === 0"
|
|
|
- class="flex items-center gap-x-4 text-white bg-gradient-to-r from-[#FED448] to-[#F9942F] rounded-full px-12 py-4">
|
|
|
- <ie-image src="/pagesStudy/static/image/icon-check-white.png" custom-class="w-24 h-24" />
|
|
|
- <text>定向学习中</text>
|
|
|
- </view>
|
|
|
- <view v-else class="flex items-center gap-x-4 text-22 text-primary px-12 py-4"
|
|
|
- @click="handleSetDirectedSchool(content, index)">
|
|
|
- <text>设置定向</text>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- </template>
|
|
|
- <template #ghots></template>
|
|
|
- </l-drag>
|
|
|
+ <directed-school-item :data="currentDirectedSchool" :active="true" @choose="handleChoose"
|
|
|
+ @delete="handleDelete" />
|
|
|
</view>
|
|
|
- <view v-if="sortList.length === 0" class="flex-1 flex flex-col items-center justify-center gap-y-50">
|
|
|
- <ie-image src="/pagesStudy/static/image/icon-empty.png" custom-class="w-364 h-252 mx-auto" mode="aspectFill" />
|
|
|
- <text class="text-30 text-fore-light text-center">目前暂无定向院校~</text>
|
|
|
+ <view v-if="directedSchoolList.length > 1" class="px-48 pt-40 pb-30">
|
|
|
+ <view class="text-28 text-fore-title font-bold">其他备选目标</view>
|
|
|
+ <view class="mt-4 text-24 text-fore-light">切换定向学习院校后将影响为你推荐的学习内容和题目!</view>
|
|
|
</view>
|
|
|
+ <view class="px-30">
|
|
|
+ <directed-school-item v-for="(item, index) in otherDirectedSchoolList" :key="index" :data="item"
|
|
|
+ :active="false" @choose="handleChoose" @delete="handleDelete" />
|
|
|
+ </view>
|
|
|
+ </template>
|
|
|
+ <view v-if="sortList.length === 0" class="flex-1 flex flex-col items-center justify-center gap-y-50">
|
|
|
+ <ie-image src="/pagesStudy/static/image/icon-empty.png" custom-class="w-364 h-252 mx-auto" mode="aspectFill" />
|
|
|
+ <text class="text-30 text-fore-light text-center">目前暂无定向院校~</text>
|
|
|
</view>
|
|
|
+
|
|
|
<ie-safe-toolbar v-if="directedSchoolList.length < 3" :height="84" :shadow="false">
|
|
|
<view class="px-46 pt-24">
|
|
|
<ie-button type="primary" @click="handleAdd">添加</ie-button>
|
|
|
@@ -67,6 +38,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
+import DirectedSchoolItem from './components/directed-school-item.vue';
|
|
|
import { useTransferPage } from '@/hooks/useTransferPage';
|
|
|
import { DirectedSchool } from '@/types/study';
|
|
|
import { useUserStore } from '@/store/userStore';
|
|
|
@@ -75,26 +47,35 @@ const userStore = useUserStore();
|
|
|
const { transferTo } = useTransferPage();
|
|
|
const loading = ref(true);
|
|
|
const sortList = ref<DirectedSchool[]>([]);
|
|
|
-const touchHandle = ref(false)
|
|
|
const { directedSchoolList } = toRefs(userStore);
|
|
|
-const handleSetDirectedSchool = async (item: DirectedSchool, index: number) => {
|
|
|
- // 将该院校设置为第一个
|
|
|
- const list = [...directedSchoolList.value];
|
|
|
- list.splice(index, 1);
|
|
|
- list.unshift(item);
|
|
|
- save(list);
|
|
|
-}
|
|
|
-const dragRef = ref();
|
|
|
+const currentDirectedSchool = computed(() => directedSchoolList.value[0]);
|
|
|
+const otherDirectedSchoolList = computed(() => directedSchoolList.value.slice(1));
|
|
|
+
|
|
|
const handleAdd = () => {
|
|
|
transferTo('/pagesStudy/pages/targeted-add/targeted-add', {
|
|
|
data: {}
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
-const changeSort = (e: any) => {
|
|
|
- const list = e.map((item: any) => item.content);
|
|
|
+const handleChoose = (data: DirectedSchool) => {
|
|
|
+ const otherList = directedSchoolList.value.filter(item => item.code !== data.code);
|
|
|
+ const list = [data, ...otherList];
|
|
|
save(list);
|
|
|
}
|
|
|
+const handleDelete = (data: DirectedSchool) => {
|
|
|
+ uni.$ie.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '如删除该定向记录,关联的数据有变化,是否继续?',
|
|
|
+ showCancel: true,
|
|
|
+ confirmText: '确定',
|
|
|
+ cancelText: '取消'
|
|
|
+ }).then((confirm: boolean) => {
|
|
|
+ if (confirm) {
|
|
|
+ const list = [...directedSchoolList.value];
|
|
|
+ list.splice(list.indexOf(data), 1);
|
|
|
+ save(list);
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
const save = async (list: DirectedSchool[]) => {
|
|
|
uni.$ie.showLoading();
|
|
|
await userStore.saveDirectedSchoolList(list);
|