123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367 |
- <template>
- <!-- 搜索结果 -->
- <div class="SeekResult" v-loading="loading" v-if="isData">
- <!-- 头部导航及搜索 -->
- <Header />
- <HeaderOne
- :changeKeycode="changeKeycode"
- :keycode="keycode"
- :title="$t('Key248')"
- :classilfyID="classilfyID"
- />
- <!-- <div class="top">
- <div class="title">SEARCH RESULT</div>
- </div> -->
- <div class="main">
- <!-- 搜索结果分类 -->
- <div class="classilfy">
- <div
- v-for="(item, i) in classilfyList"
- :key="i + item"
- @click="cutClassilfy(item, i)"
- :class="classilfyIndex == i ? 'sele' : ''"
- >
- {{ item }}
- </div>
- </div>
- <template v-if="dataList && dataList.total_count !== 0">
- <div class="class_list" v-if="dataList">
- <!-- 根据课程和教材进行分别传值 -->
- <component
- :is="getCurrentQuestionView"
- :classList="
- classilfyIndex == 0 ? dataList.course_list : dataList.book_list
- "
- type="list"
- ></component>
- <!-- <ClassicalCourse
- :classList="
- classilfyIndex == 0 ? dataList.course_list : dataList.book_list
- "
- type="1"
- /> -->
- <div class="paging">
- <el-pagination
- background
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :page-sizes="pageSizes"
- layout="prev, pager, next,total, sizes,jumper"
- :current-page="pageNum"
- :page-size="pageSize"
- :total="dataList.total_count"
- >
- </el-pagination>
- </div>
- </div>
- </template>
- <template v-else>
- <div class="nomore">
- <img src="../../assets/learncenter/noSeekResult.png" alt="" />
- <p class="p1">
- <!-- 抱歉,我找不到相关的内容。 -->
- {{ $t('Key547') }}
- </p>
- <!-- <p class="p2">Try the following keywords</p> -->
- <!-- <div class="keywords">
- <span>live lesson</span>
- <span>live lesson</span>
- <span>live lesson</span>
- </div> -->
- </div>
- </template>
- </div>
- </div>
- </template>
- <script>
- import { cousrseAPI, TextbookAPI } from '@/api/api'
- import Header from '@/components/Header'
- import HeaderOne from '@/components/learnCenter/HeaderOne'
- import ClassicalCourse from '@/components/learnCenter/ClassicalCourse'
- import Course from '@/components/learnCenter/Course'
- import Textbook from '@/components/learnCenter/Textbook'
- import { updateWordPack } from '@/utils/i18n'
- export default {
- props: [],
- components: {
- Header,
- HeaderOne,
- ClassicalCourse,
- Course,
- Textbook,
- },
- data() {
- return {
- CourseList: null, //课程列表
- TextList: null, //教材列表
- dataList: null, //展示列表
- seekContent: '', //搜索内容
- gotoPage: '',
- keycode: '',
- pageNum: 1,
- pageSize: 8,
- targetPage: 1,
- loading: false,
- classilfyList: [],
- classilfyIndex: 0,
- classilfyID: null,
- isData: false,
- pageSizes: [8, 16, 32, 64],
- pageSizes1: [8, 16, 32, 64],
- pageSizes2: [10, 20, 30, 40],
- }
- },
- computed: {
- getCurrentQuestionView() {
- switch (this.classilfyIndex) {
- case 0:
- return Course
- case 1:
- return Textbook
- default:
- return null
- }
- },
- },
- watch: {
- classilfyIndex(newval, oldval) {
- if (newval != oldval) {
- if (newval == 0) {
- this.pageNum = 1
- this.pageSizes = this.pageSizes1
- this.getData('课程')
- } else if (newval == 1) {
- this.pageNum = 1
- this.pageSizes = this.pageSizes2
- this.getData('教材')
- }
- }
- },
- },
- methods: {
- handleSizeChange(val) {
- this.pageNum = 1
- this.pageSize = val
- if (this.classilfyIndex == 0) {
- this.getData('课程')
- } else if (this.classilfyIndex == 1) {
- this.getData('教材')
- }
- },
- // 跳页
- handleCurrentChange(val) {
- this.pageNum = val
- if (this.classilfyIndex == 0) {
- this.getData('课程')
- } else if (this.classilfyIndex == 1) {
- this.getData('教材')
- }
- },
- // 切换分类
- cutClassilfy(item, i) {
- this.classilfyIndex = i
- },
- // 获取子组件传过来的keycode进行查询
- changeKeycode(val) {
- this.keycode = val
- if (this.classilfyIndex == 0) {
- this.getData('课程')
- } else if (this.classilfyIndex == 1) {
- this.getData('教材')
- }
- },
- // 输入目标页 并跳到目标页
- toPageChange() {
- this.gotoPage = this.gotoPage.replace(/[^\d]/g, '') //使用空字符串去替换非数字的字符
- if (this.gotoPage > Math.ceil(this.CourseList.total / 8)) {
- return
- } else if (this.gotoPage != this.targetPage) {
- this.targetPage = this.gotoPage * 1
- this.pageNum = this.gotoPage * 1
- if (this.classilfyIndex == 0) {
- this.getData('课程')
- } else if (this.classilfyIndex == 1) {
- this.getData('教材')
- }
- }
- },
- // 获取数据
- getData(val) {
- this.loading = true
- if (val == '课程') {
- // 获取课程列表
- cousrseAPI('page_query-PageQueryCourseList', {
- page_capacity: this.pageSize,
- cur_page: this.pageNum,
- finish_status: 53,
- release_status: 1,
- name_or_teacher_name: this.keycode,
- }).then((res) => {
- this.dataList = res
- this.dataList.course_list.forEach((item, index) => {
- item.teacherName = item.teacher_name_desc.replace(/;/g, ' ')
- })
- this.CourseList = res
- this.loading = false
- })
- } else {
- TextbookAPI('book-book_manager-PageQueryBookList', {
- cur_page: this.pageNum,
- page_capacity: this.pageSize == 8 ? this.pageSize + 2 : this.pageSize,
- name: this.keycode,
- publish_status: 1,
- is_control_publish_scope: 'true',
- is_enable_book_org_free_license_query: 'true',
- order_column_list: ['name'],
- sys_version_type: -1,
- }).then((res) => {
- this.TextList = res
- if (val == '教材') {
- this.dataList = null
- this.dataList = this.TextList
- this.loading = false
- }
- })
- }
- },
- },
- async created() {
- this.keycode = this.$route.query.keycode
- this.classilfyID = this.$route.query.id
- // classilfyIndex
- // if (this.$route.query.id == "COURSE") {
- this.classilfyIndex = 0
- this.getData('课程')
- // } else {
- // this.getData("教材");
- // this.classilfyIndex = 1;
- // }
- await updateWordPack({
- word_key_list: [
- 'Key8',
- 'Key38',
- 'Key39',
- 'Key573',
- 'Key44',
- 'Key215',
- 'Key248',
- 'Key323',
- 'Key547',
- ],
- })
- this.isData = true
- this.classilfyList = [this.$t('Key215'), this.$t('Key44')]
- },
- }
- </script>
- <style lang="scss" scoped>
- .SeekResult {
- min-height: 100vh;
- background: #f6f6f6;
- .top {
- width: 95%;
- margin: 0 auto;
- display: flex;
- justify-content: space-between;
- align-items: flex-end;
- .title {
- margin-top: 36px;
- font-weight: bold;
- font-size: 30px;
- }
- .title2 {
- margin-top: 36px;
- font-weight: bold;
- font-size: 16px;
- color: rgba(0, 0, 0, 0.5);
- span {
- color: black;
- }
- }
- .more {
- cursor: pointer;
- color: rgba(0, 0, 0, 0.5);
- margin-right: 40px;
- }
- }
- .main {
- min-height: 568px;
- padding-top: 24px;
- background: #f6f6f6;
- padding-bottom: 20px;
- .classilfy {
- display: flex;
- width: 1200px;
- margin: 0 auto;
- margin-top: 16px;
- margin-bottom: 16px;
- > div {
- min-width: 52px;
- height: 32px;
- display: flex;
- justify-content: center;
- align-items: center;
- cursor: pointer;
- padding: 0 10px;
- }
- .sele {
- background: #ff9900;
- border-radius: 53px;
- color: white;
- }
- }
- }
- .paging {
- width: 1200px;
- margin: 0 auto;
- display: flex;
- align-items: center;
- color: darkgrey;
- padding: 32px 0;
- .number {
- color: black;
- }
- span {
- margin-left: 10px;
- }
- .gotoPage {
- width: 40px;
- text-align: center;
- }
- }
- .nomore {
- margin-top: 80px;
- text-align: center;
- .p1 {
- font-weight: 600;
- font-size: 32px;
- color: #2c2c2c;
- margin-top: 20px;
- }
- .p2 {
- font-size: 28px;
- color: #2c2c2c;
- margin-top: 20px;
- }
- .keywords {
- span {
- display: inline-block;
- // width: 129px;
- // height: 55px;
- padding: 16px;
- background: rgba(44, 44, 44, 0.1);
- border-radius: 31px;
- color: rgba(44, 44, 44, 0.5);
- font-size: 18px;
- // line-height: 55px;
- margin: 20px 20px 20px 20px;
- cursor: pointer;
- }
- }
- }
- }
- </style>
|