123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364 |
- <!--
- * @FileDescription: 选中弹窗
- * @Author: 黄琪勇
- * @Date:2024-03-22 15:21:44
- -->
- <template>
- <div class="chooseDialog">
- <div class="close" @click="close"></div>
- <div class="chooseHeader" v-if="isShowTabs">
- <img
- key="classlist"
- v-if="chooseType === 'classlist'"
- src="@/img/cloudTextbooks/classlist-active.png"
- @click="handleChangeType('classlist')"
- />
- <img v-else src="@/img/cloudTextbooks/classlist.png" @click="handleChangeType('classlist')" />
- <img key="search" v-if="chooseType === 'search'" src="@/img/cloudTextbooks/search-active.png" @click="handleChangeType('search')" />
- <img v-else src="@/img/cloudTextbooks/search.png" @click="handleChangeType('search')" />
- </div>
- <div class="chooseCon" v-loading="loading" v-show="chooseType === 'classlist'">
- <img class="imgMid" src="@/img/cloudTextbooks/shu.png" />
- <div class="chooseBox" v-for="(listDetails, index) in listDetailData" :key="index">
- <div
- class="operate"
- v-show="(index === 0 && pageNum !== 0) || (index === 1 && listData.length > pageNum + 1)"
- @click="handlePage(index === 0 ? 'prev' : 'next')"
- >
- <img :src="require(`@/img/cloudTextbooks/${index === 0 ? 'left' : 'right'}.png`)" />
- </div>
- <div class="chooseList">
- <div class="listItem" v-for="item in listDetails" :key="item.id">
- <div class="img">
- <template v-if="item.lockFlag">
- <img src="@/img/cloudTextbooks/jy.png" />
- </template>
- <template v-else>
- <img src="@/img/cloudTextbooks/bf.png" />
- <!-- <img src="@/img/cloudTextbooks/xm.png" /> -->
- </template>
- </div>
- <div class="nameCon">
- <div class="name">{{ item.name }}</div>
- <div class="text" v-if="item.useNum ?? false">已使用{{ item.useNum }}次</div>
- </div>
- <div class="play" :class="{ disabled: item.lockFlag }" @click="item.lockFlag === true || handlePaly(item.id)">查看</div>
- </div>
- </div>
- </div>
- </div>
- <div class="chooseCon" v-loading="searchLoading" v-show="chooseType === 'search'">
- <div class="chooseBox chooseBoxSearch">
- <div class="chooseList">
- <myInput
- class="queryIpt"
- v-model="queryStr"
- :height="40"
- placeholder="请输入素材关键词"
- clearable
- @handleQuery="handleQuery"
- @keyup.enter="handleQuery"
- />
- <searchCollapse :search="tempSearch" :activeCollapse="activeCollapse" :courseList="listSearchData" @handleClick="handleCourseClick" />
- <el-empty
- class="empty"
- v-if="!listSearchData.length && !searchLoading"
- :image="require('@/img/layout/empty.png')"
- description="暂无搜索结果"
- />
- </div>
- </div>
- </div>
- </div>
- </template>
- <script setup lang="ts">
- import { computed, ref } from "vue"
- import { useDataDetailList } from "./useData"
- import myInput from "@/components/myInput"
- import searchCollapse from "./searchCollapse"
- import userStore from "@/store/modules/user"
- const { handleGetDetailList, loading, searchLoading, listDetailData, listSearchData, activeCollapse, listData, pageNum, handlePage } =
- useDataDetailList()
- import router from "@/router"
- const userStoreHook = userStore()
- const chooseType = ref<"classlist" | "search">("classlist")
- const queryStr = ref("")
- const tempSearch = ref("")
- const props = defineProps<{
- modalData: {
- id: string
- }
- }>()
- const emits = defineEmits<{
- (e: "onClose"): void
- }>()
- handleGetDetailList(props.modalData.id)
- const isShowTabs = computed(() => {
- return userStoreHook.roles === "GYM" ? true : false
- })
- function close() {
- emits("onClose")
- }
- function handlePaly(id: string) {
- // const url = router.resolve({
- // name: "coursewarePlay",
- // params: { id }
- // }).href
- // window.open(url, "_blank")
- router.push({
- name: "coursewarePlay",
- params: {
- id
- }
- })
- }
- function handleCourseClick(value: any) {
- router.push({
- name: "coursewarePlay",
- params: {
- id: props.modalData.id
- },
- query: {
- source: "search",
- search: queryStr.value,
- materialId: value.id
- }
- })
- }
- function handleChangeType(type: "classlist" | "search") {
- chooseType.value = type
- }
- function handleQuery() {
- tempSearch.value = queryStr.value
- handleGetDetailList(props.modalData.id, true, queryStr.value)
- }
- </script>
- <style lang="scss" scoped>
- .chooseDialog {
- width: 100%;
- height: 100%;
- padding: 40px;
- .close {
- position: absolute;
- top: -14px;
- right: -16px;
- width: 42px;
- height: 44px;
- cursor: pointer;
- background: url("@/img/useDialogConfirm/close.png") no-repeat;
- background-size: cover;
- &:hover {
- background: url("@/img/useDialogConfirm/closeHover.png") no-repeat;
- background-size: cover;
- }
- }
- .chooseHeader {
- position: absolute;
- top: -7px;
- left: 54px;
- img {
- width: 131px;
- height: 49px;
- margin-right: 12px;
- }
- }
- .chooseCon {
- width: 100%;
- height: 100%;
- display: flex;
- position: relative;
- & > :deep(.el-loading-mask) {
- border-radius: 17px;
- }
- .imgMid {
- width: 68px;
- height: 518px;
- position: absolute;
- left: 50%;
- top: 50%;
- transform: translate(-50%, -50%);
- z-index: 1;
- }
- .chooseBox {
- width: 50%;
- height: 100%;
- background: #f6d7c1;
- box-shadow: 0px 2px 3px 0px #a05400;
- border-radius: 17px;
- padding: 5px;
- position: relative;
- &:nth-child(2) {
- .operate {
- left: -30px;
- border-radius: 6px 0px 0px 6px;
- }
- &:hover .operate {
- opacity: 1;
- }
- }
- &:nth-child(3) {
- margin-left: 10px;
- .operate {
- right: -30px;
- border-radius: 0px 6px 6px 0px;
- }
- &:hover .operate {
- opacity: 1;
- }
- }
- .operate {
- width: 30px;
- height: 68px;
- background: #fffefb;
- position: absolute;
- top: 50%;
- transform: translate(0, -50%);
- cursor: pointer;
- display: flex;
- align-items: center;
- justify-content: center;
- transition: opacity 0.28s;
- opacity: 0;
- &:hover {
- background-color: #edeff0;
- }
- > img {
- width: 13px;
- height: 21px;
- }
- }
- .chooseList {
- width: 100%;
- height: 100%;
- background: #fdf7f0;
- border-radius: 17px;
- padding: 0 40px 0 30px;
- overflow: hidden;
- .listItem {
- margin-top: 12px;
- padding: 10px 0;
- display: flex;
- justify-content: space-between;
- align-items: center;
- border-bottom: 1px solid #eaeaea;
- &:first-child {
- margin-top: 32px;
- }
- &:last-child {
- border-bottom: none;
- }
- .img {
- flex-shrink: 0;
- width: 35px;
- height: 40%;
- position: relative;
- & > img:nth-child(1) {
- width: 100%;
- }
- & > img:nth-child(2) {
- position: absolute;
- left: 0;
- top: 0;
- z-index: 1;
- }
- }
- .nameCon {
- margin-left: 7px;
- flex-grow: 1;
- .name {
- font-weight: 600;
- font-size: 16px;
- color: #333333;
- padding: 3px 0;
- }
- .text {
- font-weight: 400;
- font-size: 12px;
- color: #777777;
- padding: 2px 0;
- }
- }
- .play {
- flex-shrink: 0;
- background: linear-gradient(180deg, #ffab71 0%, #ff6e45 100%);
- border-radius: 12px;
- text-align: center;
- font-weight: 500;
- font-size: 12px;
- padding: 6px 18px;
- color: #ffffff;
- letter-spacing: 1px;
- cursor: pointer;
- &:hover {
- opacity: $opacity-hover;
- }
- &.disabled {
- background: linear-gradient(180deg, #d3d3d3 0%, #b5b5b5 100%);
- cursor: not-allowed;
- &:hover {
- opacity: 1;
- }
- }
- }
- }
- }
- }
- .chooseBoxSearch {
- width: 100%;
- .chooseList {
- padding: 20px 80px;
- display: flex;
- flex-direction: column;
- .courseCollapse {
- margin-top: 16px;
- flex: 1;
- overflow-y: auto;
- overflow-x: hidden;
- &::-webkit-scrollbar {
- display: none;
- }
- }
- &:deep(.empty) {
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- .el-empty__image {
- width: 360px;
- }
- }
- }
- }
- }
- }
- </style>
- <style lang="scss">
- .h-modalFrame.chooseDialog {
- /* prettier-ignore */
- --modalFrameTitHeight: 0PX;
- .modalFrameBox {
- background: url("@/img/cloudTextbooks/bg.png") no-repeat;
- background-size: cover;
- box-shadow: none;
- .modalFrameTitle {
- display: none;
- }
- }
- }
- </style>
|