|
@@ -15,7 +15,6 @@ let totalPages = ref(1); // 總頁數
|
|
|
|
|
|
let loading = ref(false);
|
|
|
let searchInput = ref("");
|
|
|
-let searchError = ref(false);
|
|
|
|
|
|
const courseAll = reactive({
|
|
|
classes: [],
|
|
@@ -26,6 +25,7 @@ const courseData = reactive({
|
|
|
|
|
|
const listLocation = ref(null);
|
|
|
let isInternal = ref(false); // 是否選取學習時數課程(只顯示內課)
|
|
|
+let isOvertime = ref(false); // 課程是否過期(過期 is_overtime = 1)
|
|
|
let isFilter = ref(false); // 篩選狀態
|
|
|
let searchList = reactive([]); // 篩選條件
|
|
|
let totalNum = ref(0); // 資料總筆數
|
|
@@ -47,6 +47,11 @@ async function getClass() {
|
|
|
url += "&is_inner=1";
|
|
|
}
|
|
|
|
|
|
+ // 篩選過期課程
|
|
|
+ if (isOvertime.value) {
|
|
|
+ url += "&is_overtime=1";
|
|
|
+ }
|
|
|
+
|
|
|
// 判斷篩選
|
|
|
if (isFilter.value) {
|
|
|
console.log("searchList", searchList);
|
|
@@ -93,13 +98,8 @@ async function search() {
|
|
|
totalPages.value = store.getTotalPages(response.data.total_num, 18);
|
|
|
courseData.classes = response.data.classes;
|
|
|
loading.value = false;
|
|
|
+ courseCategory.value = "";
|
|
|
console.log("搜尋 response", response);
|
|
|
-
|
|
|
- if (!response.data.total_num) {
|
|
|
- searchError.value = true;
|
|
|
- } else {
|
|
|
- searchError.value = false;
|
|
|
- }
|
|
|
} catch (error) {
|
|
|
loading.value = false;
|
|
|
console.error(error);
|
|
@@ -123,24 +123,29 @@ let assignTag = ref("all");
|
|
|
watch(assignTag, (val) => {
|
|
|
if (val === "all") {
|
|
|
isInternal.value = false;
|
|
|
- } else {
|
|
|
+ isOvertime.value = false;
|
|
|
+ } else if (val === "hours") {
|
|
|
isInternal.value = true;
|
|
|
+ isOvertime.value = false;
|
|
|
+ } else if (val === "over") {
|
|
|
+ isInternal.value = false;
|
|
|
+ isOvertime.value = true;
|
|
|
}
|
|
|
pageNum.value = 1;
|
|
|
getClass();
|
|
|
});
|
|
|
|
|
|
function selectTag(btn) {
|
|
|
- if (btn === "all") {
|
|
|
- assignTag.value = "all";
|
|
|
- } else {
|
|
|
- assignTag.value = "hours";
|
|
|
- }
|
|
|
+ assignTag.value = btn;
|
|
|
+ // if (btn === "all") {
|
|
|
+ // assignTag.value = "all";
|
|
|
+ // } else if (btn === "hours") {
|
|
|
+ // assignTag.value = "hours";
|
|
|
+ // } else if (btn === "over") {
|
|
|
+ // assignTag.value = "over";
|
|
|
+ // }
|
|
|
}
|
|
|
|
|
|
-let selectSort = ref();
|
|
|
-let selectLocation = ref();
|
|
|
-let selectYear = ref();
|
|
|
let selectCategory = ref([]);
|
|
|
|
|
|
// 篩選課程
|
|
@@ -197,9 +202,12 @@ watch(selectedCounty, (newValue) => {
|
|
|
// 清除重填(取得全部課程)
|
|
|
function searchClear() {
|
|
|
selectCategory.value = [];
|
|
|
+ selectCollege.value = null;
|
|
|
selectedCounty.value = null;
|
|
|
selectedDistrict.value = null;
|
|
|
isFilter.value = false;
|
|
|
+ courseCategory.value = "";
|
|
|
+ locationKeyword.value = "";
|
|
|
pageNum.value = 1;
|
|
|
getClass();
|
|
|
}
|
|
@@ -208,12 +216,24 @@ async function searchClass() {
|
|
|
isFilter.value = true;
|
|
|
pageNum.value = 1; // 篩選時返回第一頁
|
|
|
searchList.splice(0, searchList.length); // 清空陣列
|
|
|
-
|
|
|
+ console.log("selectCategory", selectCategory.value);
|
|
|
let categoryVal = selectCategory.value;
|
|
|
if (categoryVal.length) {
|
|
|
+ if (courseCategory.value !== "") {
|
|
|
+ courseCategory.value = "";
|
|
|
+ }
|
|
|
searchList.push(`&category=${categoryVal}`);
|
|
|
}
|
|
|
|
|
|
+ if (courseCategory.value !== "" && !categoryVal.length) {
|
|
|
+ searchList.push(`&category=${courseCategory.value}`);
|
|
|
+ }
|
|
|
+
|
|
|
+ console.log("selectCollege.value", selectCollege.value);
|
|
|
+ if (selectCollege.value) {
|
|
|
+ searchList.push(`&group_id=${selectCollege.value}`);
|
|
|
+ }
|
|
|
+
|
|
|
if (selectedCounty.value && selectedDistrict.value) {
|
|
|
locationKeyword.value = `${selectedCounty.value}${selectedDistrict.value}`;
|
|
|
} else if (selectedCounty.value && !selectedDistrict.value) {
|
|
@@ -226,6 +246,44 @@ async function searchClass() {
|
|
|
onMounted(() => {
|
|
|
store.getFavoriteClass();
|
|
|
});
|
|
|
+
|
|
|
+const collegeList = reactive([
|
|
|
+ {
|
|
|
+ id: 1,
|
|
|
+ title: t("college_group_1"),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 2,
|
|
|
+ title: t("college_group_2"),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 7,
|
|
|
+ title: t("college_group_3"),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 8,
|
|
|
+ title: t("college_group_4"),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 9,
|
|
|
+ title: t("college_group_5"),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 3,
|
|
|
+ title: t("college_group_6"),
|
|
|
+ },
|
|
|
+]);
|
|
|
+
|
|
|
+let selectCollege = ref(null);
|
|
|
+
|
|
|
+const courseCategory = ref("");
|
|
|
+
|
|
|
+const setCategory = (newCategory) => {
|
|
|
+ courseCategory.value = newCategory;
|
|
|
+ selectCategory.value = [];
|
|
|
+ searchClass();
|
|
|
+ console.log("courseCategory", courseCategory.value);
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
@@ -289,6 +347,17 @@ onMounted(() => {
|
|
|
></v-select>
|
|
|
</v-col>
|
|
|
|
|
|
+ <v-col cols="12" sm="6" md="12" class="pb-0">
|
|
|
+ <v-select
|
|
|
+ v-model="selectCollege"
|
|
|
+ label="學群"
|
|
|
+ :items="collegeList"
|
|
|
+ item-title="title"
|
|
|
+ item-value="id"
|
|
|
+ hide-details
|
|
|
+ ></v-select>
|
|
|
+ </v-col>
|
|
|
+
|
|
|
<v-col cols="12">
|
|
|
<v-btn
|
|
|
@click="searchClass()"
|
|
@@ -318,7 +387,7 @@ onMounted(() => {
|
|
|
<v-col cols="12" md="9" lg="10">
|
|
|
<div>
|
|
|
<div
|
|
|
- class="d-flex flex-column flex-md-row align-center justify-space-between mb-14"
|
|
|
+ class="d-flex flex-column flex-md-row align-center justify-space-between mb-14 position-relative"
|
|
|
ref="listLocation"
|
|
|
>
|
|
|
<div class="d-flex tab-btn mb-8 mb-md-0">
|
|
@@ -329,6 +398,7 @@ onMounted(() => {
|
|
|
>
|
|
|
{{ t("all_courses") }}
|
|
|
</v-btn>
|
|
|
+
|
|
|
<v-btn
|
|
|
variant="text"
|
|
|
@click="selectTag('hours')"
|
|
@@ -336,7 +406,14 @@ onMounted(() => {
|
|
|
>
|
|
|
{{ t("learning_hours_courses") }}
|
|
|
</v-btn>
|
|
|
- <!-- <h2 class="me-5">課程清單</h2> -->
|
|
|
+
|
|
|
+ <v-btn
|
|
|
+ variant="text"
|
|
|
+ @click="selectTag('over')"
|
|
|
+ :class="{ active: assignTag === 'over' }"
|
|
|
+ >
|
|
|
+ 過往課程
|
|
|
+ </v-btn>
|
|
|
</div>
|
|
|
<div class="search">
|
|
|
<span>
|
|
@@ -354,6 +431,25 @@ onMounted(() => {
|
|
|
</button>
|
|
|
</span>
|
|
|
</div>
|
|
|
+
|
|
|
+ <div class="position-absolute" style="top: 42px; left: 10px">
|
|
|
+ <v-chip
|
|
|
+ v-if="courseCategory !== ''"
|
|
|
+ class="ms-2 my-5"
|
|
|
+ color="primary"
|
|
|
+ label
|
|
|
+ >
|
|
|
+ {{ courseCategory }}
|
|
|
+ <button>
|
|
|
+ <v-icon
|
|
|
+ @click="searchClear()"
|
|
|
+ color="primary"
|
|
|
+ icon="mdi-close-circle"
|
|
|
+ class="ms-2"
|
|
|
+ ></v-icon>
|
|
|
+ </button>
|
|
|
+ </v-chip>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
|
|
|
<div class="d-flex justify-center mb-10" v-if="loading">
|
|
@@ -372,20 +468,20 @@ onMounted(() => {
|
|
|
:key="index"
|
|
|
class="pa-5"
|
|
|
>
|
|
|
- <CourseCard :data="item" />
|
|
|
+ <CourseCard :data="item" @set-category="setCategory" />
|
|
|
</v-col>
|
|
|
</v-row>
|
|
|
|
|
|
<div
|
|
|
- v-if="searchError"
|
|
|
- class="d-flex justify-center align-center pt-12 me-4"
|
|
|
+ v-if="!totalNum"
|
|
|
+ class="d-flex justify-center align-center pt-12 me-4 mb-10"
|
|
|
>
|
|
|
<v-icon color="primary" icon="mdi-alert" class="me-2"></v-icon>
|
|
|
{{ t("no_found") }}
|
|
|
</div>
|
|
|
|
|
|
<v-pagination
|
|
|
- v-if="!searchError"
|
|
|
+ v-if="totalNum"
|
|
|
v-model="pageNum"
|
|
|
:length="totalPages"
|
|
|
rounded="circle"
|
|
@@ -398,10 +494,7 @@ onMounted(() => {
|
|
|
</div>
|
|
|
</v-col>
|
|
|
<v-col cols="12" class="my-16">
|
|
|
- <img
|
|
|
- src="@/assets/img/course/banner.webp"
|
|
|
- alt="臺灣工藝學習平台"
|
|
|
- />
|
|
|
+ <img src="@/assets/img/course/banner.webp" alt="臺灣工藝學習平台" />
|
|
|
</v-col>
|
|
|
</v-row>
|
|
|
</v-container>
|