|
@@ -8,33 +8,41 @@
|
|
<div class="cloudTextbooks">
|
|
<div class="cloudTextbooks">
|
|
<div class="headCon">
|
|
<div class="headCon">
|
|
<div class="operate">
|
|
<div class="operate">
|
|
- <dictionary
|
|
|
|
- class="classTypes"
|
|
|
|
- v-model="value"
|
|
|
|
- :options="options"
|
|
|
|
- :propsOpt="{ label: 'label', value: 'value' }"
|
|
|
|
- placeholder="课程类型"
|
|
|
|
- />
|
|
|
|
- <el-input v-model="input3" style="max-width: 600px" placeholder="请输入教材名称" clearable class="iptSelect">
|
|
|
|
|
|
+ <dictionary class="classTypes" v-model="classType" :options="classTypeOpt" placeholder="课程类型" @change="handleQuery" />
|
|
|
|
+ <el-input
|
|
|
|
+ @keyup.enter="handleQuery"
|
|
|
|
+ @input="handleInputQuery"
|
|
|
|
+ v-model="queryStr"
|
|
|
|
+ style="max-width: 600px"
|
|
|
|
+ placeholder="请输入教材名称"
|
|
|
|
+ clearable
|
|
|
|
+ class="iptSelect"
|
|
|
|
+ >
|
|
<template #prepend>
|
|
<template #prepend>
|
|
<img src="@/img/cloudTextbooks/ss.png" />
|
|
<img src="@/img/cloudTextbooks/ss.png" />
|
|
</template>
|
|
</template>
|
|
<template #append>
|
|
<template #append>
|
|
- <div class="btnSelect">搜索</div>
|
|
|
|
|
|
+ <div class="btnSelect" @click="handleQuery">搜索</div>
|
|
</template>
|
|
</template>
|
|
</el-input>
|
|
</el-input>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="cloudTextbooksCon">
|
|
<div class="cloudTextbooksCon">
|
|
- <ElScrollbar class="elScrollbar">
|
|
|
|
|
|
+ <ElScrollbar class="elScrollbar" v-loading="loading">
|
|
<div class="cloudTextbooksBox">
|
|
<div class="cloudTextbooksBox">
|
|
- <div class="bookshelf" v-for="(books, index) in []" :key="index">
|
|
|
|
- <div class="book" v-for="item in books" :key="item.id">
|
|
|
|
- <ElImage class="img" :src="item.cover" @click="handleClick(item.lessonCoursewareId)" />
|
|
|
|
|
|
+ <div class="bookshelf" v-for="(list, index) in listData" :key="index">
|
|
|
|
+ <div class="book" v-for="item in list" :key="item.id">
|
|
|
|
+ <ElImage class="img" :src="item.img" @click="handleClick(item.id)" />
|
|
<div class="name">{{ item.name }}</div>
|
|
<div class="name">{{ item.name }}</div>
|
|
|
|
+ <div class="courseNum">共{{ item.courseNum }}课</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- <el-empty :image-size="360" :image="require('@/img/layout/empty.png')" description="暂无搜索结果" />
|
|
|
|
|
|
+ <el-empty
|
|
|
|
+ v-if="!listData.length && !loading"
|
|
|
|
+ :image-size="360"
|
|
|
|
+ :image="require('@/img/layout/empty.png')"
|
|
|
|
+ description="暂无搜索结果"
|
|
|
|
+ />
|
|
</div>
|
|
</div>
|
|
</ElScrollbar>
|
|
</ElScrollbar>
|
|
</div>
|
|
</div>
|
|
@@ -44,14 +52,17 @@
|
|
|
|
|
|
<script setup lang="ts">
|
|
<script setup lang="ts">
|
|
import navContainer from "@/views/homePage/components/navContainer"
|
|
import navContainer from "@/views/homePage/components/navContainer"
|
|
-import { queryLessonCourseware_gym, getLessonCoursewareCourseList_gym } from "@/api/cloudTextbooks.api"
|
|
|
|
-import { ref } from "vue"
|
|
|
|
-import { httpAjax } from "@/plugin/httpAjax"
|
|
|
|
|
|
+import { ref, shallowRef } from "vue"
|
|
import modalFrame from "@/plugin/modalFrame"
|
|
import modalFrame from "@/plugin/modalFrame"
|
|
import chooseDialog from "./chooseDialog.vue"
|
|
import chooseDialog from "./chooseDialog.vue"
|
|
import userStore from "@/store/modules/user"
|
|
import userStore from "@/store/modules/user"
|
|
|
|
+import { useDataList } from "./useData"
|
|
|
|
+import { debounce } from "@/libs/tools"
|
|
|
|
+import { getLessonCoursewareSubjectList_gym } from "@/api/cloudTextbooks.api"
|
|
|
|
+import { httpAjax } from "@/plugin/httpAjax"
|
|
|
|
|
|
const userStoreHook = userStore()
|
|
const userStoreHook = userStore()
|
|
|
|
+const { handleGetList, listData, loading, handleListQuery } = useDataList()
|
|
|
|
|
|
const headImg = {
|
|
const headImg = {
|
|
img: require("@/img/homePage/back.png"),
|
|
img: require("@/img/homePage/back.png"),
|
|
@@ -66,25 +77,58 @@ const navs = [
|
|
name: userStoreHook.roles === "GYM" ? "云教程" : "云教材"
|
|
name: userStoreHook.roles === "GYM" ? "云教程" : "云教材"
|
|
}
|
|
}
|
|
]
|
|
]
|
|
-const data = ref<any[]>([])
|
|
|
|
|
|
+const classType = ref("")
|
|
|
|
+const classTypeOpt = shallowRef<{ value: string; label: string }[]>([])
|
|
|
|
+const queryStr = ref("")
|
|
|
|
|
|
-const value = ref()
|
|
|
|
-const options = ref([
|
|
|
|
- {
|
|
|
|
- value: "guide",
|
|
|
|
- label: "Guide"
|
|
|
|
- }
|
|
|
|
-])
|
|
|
|
|
|
+handleGetClassTypeOpt()
|
|
|
|
+handleGetList()
|
|
|
|
|
|
-const input3 = ref()
|
|
|
|
|
|
+enum courseEmnu {
|
|
|
|
+ PERCUSSION_SINGLE = "打击乐",
|
|
|
|
+ FLUTE_SINGLE = "长笛",
|
|
|
|
+ SAX_SINGLE = "萨克斯",
|
|
|
|
+ CLARINET_SINGLE = "单簧管",
|
|
|
|
+ TRUMPET_SINGLE = "小号",
|
|
|
|
+ TROMBONE_SINGLE = "长号",
|
|
|
|
+ HORN_SINGLE = "圆号",
|
|
|
|
+ BARITONE_TUBA_SINGLE = "上低音号-大号",
|
|
|
|
+ MUSIC_THEORY = "乐理",
|
|
|
|
+ INSTRUMENTAL_ENSEMBLE = "合奏",
|
|
|
|
+ EUPHONIUM_SINGLE = "上低音号",
|
|
|
|
+ TUBA_SINGLE = "大号"
|
|
|
|
+}
|
|
|
|
+function handleGetClassTypeOpt() {
|
|
|
|
+ // 区分管乐团和管乐迷课程类型
|
|
|
|
+ if (userStoreHook.roles === "GYM") {
|
|
|
|
+ httpAjax(getLessonCoursewareSubjectList_gym).then(res => {
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
+ classTypeOpt.value = res.data.map((item: any) => {
|
|
|
|
+ return {
|
|
|
|
+ value: item.id,
|
|
|
|
+ label: item.name
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ classTypeOpt.value = Object.keys(courseEmnu).map(type => {
|
|
|
|
+ return {
|
|
|
|
+ value: type,
|
|
|
|
+ label: courseEmnu[type as keyof typeof courseEmnu]
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
|
|
-httpAjax(queryLessonCourseware_gym).then(res => {
|
|
|
|
- console.log(res)
|
|
|
|
- data.value = chunkArray([...res.data.rows, ...res.data.rows], 5)
|
|
|
|
-})
|
|
|
|
|
|
+// 查询
|
|
|
|
+function handleQuery() {
|
|
|
|
+ handleListQuery(classType.value, queryStr.value)
|
|
|
|
+}
|
|
|
|
+const handleInputQuery = debounce(handleQuery)
|
|
|
|
|
|
-function handleClick(id: number) {
|
|
|
|
- console.log(id)
|
|
|
|
|
|
+//点击跳转详情
|
|
|
|
+function handleClick(id: string) {
|
|
modalFrame({
|
|
modalFrame({
|
|
template: chooseDialog,
|
|
template: chooseDialog,
|
|
width: 1110,
|
|
width: 1110,
|
|
@@ -96,18 +140,6 @@ function handleClick(id: number) {
|
|
maskClose: true,
|
|
maskClose: true,
|
|
className: "chooseDialog"
|
|
className: "chooseDialog"
|
|
})
|
|
})
|
|
- return
|
|
|
|
- httpAjax(getLessonCoursewareCourseList_gym, id).then(res => {
|
|
|
|
- console.log(res)
|
|
|
|
- })
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-function chunkArray(array: any[], size: number) {
|
|
|
|
- const result = []
|
|
|
|
- for (let i = 0; i < array.length; i += size) {
|
|
|
|
- result.push(array.slice(i, i + size))
|
|
|
|
- }
|
|
|
|
- return result
|
|
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
|
|
|
|
@@ -199,6 +231,7 @@ function chunkArray(array: any[], size: number) {
|
|
display: flex;
|
|
display: flex;
|
|
flex-direction: column;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
align-items: center;
|
|
|
|
+ min-width: 1500px;
|
|
.bookshelf {
|
|
.bookshelf {
|
|
width: 1500px;
|
|
width: 1500px;
|
|
padding: 0 116px;
|
|
padding: 0 116px;
|
|
@@ -214,6 +247,7 @@ function chunkArray(array: any[], size: number) {
|
|
.book {
|
|
.book {
|
|
width: 20%;
|
|
width: 20%;
|
|
text-align: center;
|
|
text-align: center;
|
|
|
|
+ position: relative;
|
|
.img {
|
|
.img {
|
|
cursor: pointer;
|
|
cursor: pointer;
|
|
width: 172px;
|
|
width: 172px;
|
|
@@ -229,6 +263,20 @@ function chunkArray(array: any[], size: number) {
|
|
color: #393939;
|
|
color: #393939;
|
|
line-height: 26px;
|
|
line-height: 26px;
|
|
}
|
|
}
|
|
|
|
+ .courseNum {
|
|
|
|
+ position: absolute;
|
|
|
|
+ left: 50%;
|
|
|
|
+ top: 176px;
|
|
|
|
+ transform: translateX(-50%);
|
|
|
|
+ background: #ffffff;
|
|
|
|
+ padding: 0 10px;
|
|
|
|
+ border-radius: 13px;
|
|
|
|
+ opacity: 0.83;
|
|
|
|
+ line-height: 25px;
|
|
|
|
+ font-weight: 400;
|
|
|
|
+ font-size: 16px;
|
|
|
|
+ color: #6b3c2d;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|