| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255 | 
							- <template>
 
- 	<view class="phone-list-page">
 
- 		<view class="phone-navBar-box">
 
- 			<view @click="goUpPage" class="nav-bar-icon"></view>
 
- 			<text class="nav-bar-title">课程管理</text>
 
- 			<uni-icons class="nav-bar-right-icon" type="search" size="22" color="#666" @click="searchBtn"></uni-icons>
 
- 		</view>
 
- 		<!-- 查询职业 -->
 
- 		<view class="jiazheng-search-box">
 
- 			<view @click.stop="clickAlltype" class="select-item-box">
 
- 				<text class="kc-select-text">{{data.leixing}}</text>
 
- 				<icon class="select-jt-default" />
 
- 			</view>
 
- 		<!-- 	<input class="search-input" placeholder="请输入课程名称" v-model="data.name" />
 
- 			<view class="search-icon" @click="handleSearch">
 
- 				<uni-icons type="search" size="24" color="#fff"></uni-icons>
 
- 			</view> -->
 
- 		</view>
 
- 		<!-- 课程列表 -->
 
- 		<scroll-view scroll-y="true" refresher-enabled="true" :refresher-triggered="data.loading"
 
- 			:refresher-threshold="50" refresher-background="transparent" @refresherrefresh="onRefresh" @scrolltolower="onScrolltolower"
 
- 			class="phone-scroll-saixuan-view scroll-top-border">
 
- 			<uni-list class="admin-list-box">
 
- 				<uni-list-item v-for="item in data.list" class="admin-list-item-box">
 
- 					<template v-slot:body>
 
- 						<view class="kecheng-list-card">
 
- 							<img :src="item.pic">
 
- 							<view class="item-card-row">
 
- 								<!-- 数量 -->
 
- 								<view class="ks-item-top">
 
- 									<view class="kc-name">{{item.name}}</view>
 
- 								</view>
 
- 								<view class="ks-totalTm kc-fenlei">
 
- 									<icon class="phone-fenlei-icon" />分类:{{item.kcClassifyName}}
 
- 								</view>
 
- 								<view class="ks-totalTm kc-totalTm">
 
- 									<icon class="phone-time-icon" />时间:{{formatDuration(item.period)}}分钟
 
- 								</view>
 
- 								<button @click="checkKecheng(item)" type="primary" size="mini"
 
- 									class="item-view-btn">查看内容</button>
 
- 							</view>
 
- 						</view>
 
- 					</template>
 
- 				</uni-list-item>
 
- 				<uni-load-more :status="data.state" @click="getMore(0)" :contentText="data.contentText"></uni-load-more>
 
- 			</uni-list>
 
- 		</scroll-view>
 
- 		<!-- 页面底端 -->
 
- 		<customTabbarAdminVue :current-tab="2"></customTabbarAdminVue>
 
- 		
 
- 		<searchVue ref="searchRef" @search-btn="handleSearchFromBtn"></searchVue>
 
- 		
 
- 		<kechengLeixingVue ref="kclxRef" @select="handleSelectLeixing" @reset="handleResetLeixing"></kechengLeixingVue>
 
- 	</view>
 
- </template>
 
- <script setup>
 
- 	import customTabbarAdminVue from "@/components/custom-tabbar/custom-tabbar-admin.vue";
 
- 	import kechengLeixingVue from "@/pages/admin/Kecheng/components/kechengLeixing.vue";
 
- 	import searchVue from "./components/search.vue";
 
- 	import {
 
- 		ref,
 
- 		reactive
 
- 	} from "vue";
 
- 	import {
 
- 		onLoad
 
- 	} from "@dcloudio/uni-app";
 
- 	import * as kechengApi from "@/api/kecheng.js"
 
- 	import {
 
- 		formatDuration
 
- 	} from "@/utils/common.js"
 
- 	
 
- 	const kclxRef = ref(null)
 
- 	
 
- 	const selectClassify = ref(null)
 
- 	const searchRef = ref(null)
 
- 	const data = reactive({
 
- 		leixing: '全部类型',
 
- 		leixingList: [],
 
- 		name: '',
 
- 		list: [], // 考试列表
 
- 		loading: false,
 
- 		page: 0,
 
- 		size: 10,
 
- 		state: 'more',
 
- 		contentText: {
 
- 			contentdown: '查看更多',
 
- 			contentrefresh: '加载中',
 
- 			contentnomore: '没有更多'
 
- 		}
 
- 	})
 
- 	
 
- 	function onScrolltolower() {
 
- 		getMore()
 
- 	}
 
- 	
 
- 	function searchBtn() {
 
- 		searchRef.value.handleShow()
 
- 	}
 
- 	
 
- 	function handleSearchFromBtn(textD) {
 
- 		data.name = textD;
 
- 		handleSearch()
 
- 	}
 
- 	
 
- 	function handleSelectLeixing(item) {
 
- 		data.leixing = item.lable;
 
- 		selectClassify.value = item;
 
- 		handleSearch();
 
- 	}
 
- 	
 
- 	function handleResetLeixing() {
 
- 		selectClassify.value = null;
 
- 		data.leixing = '全部类型';
 
- 		handleSearch();
 
- 	}
 
- 	function clickAlltype() {
 
- 		kclxRef.value.showPopup({
 
- 			data: data.leixingList 
 
- 		})
 
- 	}
 
- 	function goUpPage() {
 
- 		uni.redirectTo({
 
- 			url: '/pages/admin/ShouYe/shouye'
 
- 		})
 
- 	}
 
- 	function handleSearch() {
 
- 		data.page = 0;
 
- 		refreshData();
 
- 	}
 
- 	function checkKecheng(item) {
 
- 		uni.navigateTo({
 
- 			url: `/pages/admin/Kecheng/study?kcId=${item.kcId}`
 
- 		})
 
- 	}
 
- 	function onRefresh() {
 
- 		data.page = 0;
 
- 		data.list = [];
 
- 		data.loading = true;
 
- 		refreshData();
 
- 	}
 
- 	function refreshData() {
 
- 		const opt = {
 
- 			page: 1,
 
- 			size: 10, // 固定查询10条
 
- 			name: data.name,
 
- 			kcClassifyId: selectClassify.value && selectClassify.value.id || null,
 
- 		}
 
- 		data.list = [];
 
- 		// 数学
 
- 		data.state = 'loading';
 
- 		data.page++;
 
- 		opt.page = data.page;
 
- 		kechengApi.getKechengGlList(opt).then(res => {
 
- 			data.list = data.list.concat(res.data.data);
 
- 			data.loading = false;
 
- 			if (res.data.total > data.list.length) {
 
- 				data.state = 'more';
 
- 				data.loading = false;
 
- 			} else {
 
- 				data.state = 'no-more';
 
- 				data.loading = false;
 
- 			}
 
- 		}).catch(err => {
 
- 			data.state = 'more';
 
- 			data.loading = false;
 
- 		})
 
- 	}
 
- 	function getMore() {
 
- 		const opt = {
 
- 			page: 1,
 
- 			size: 10, // 固定查询10条
 
- 			name: data.name,
 
- 			kcClassifyId: selectClassify.value && selectClassify.value.id || null,
 
- 		}
 
- 		if (data.state == 'no-more') return;
 
- 		data.state = 'loading';
 
- 		data.page++;
 
- 		opt.page = data.page;
 
- 		kechengApi.getKechengGlList(opt).then(res => {
 
- 			data.list = data.list.concat(res.data.data);
 
- 			data.loading = false;
 
- 			if (res.data.total > data.list.length) {
 
- 				data.state = 'more';
 
- 				data.loading = false;
 
- 			} else {
 
- 				data.state = 'no-more';
 
- 				data.loading = false;
 
- 			}
 
- 		}).catch(err => {
 
- 			data.state = 'more';
 
- 			data.loading = false;
 
- 		})
 
- 	}
 
- 	function getKechengClassify() {
 
- 		kechengApi.getAdminClassify().then(res => {
 
- 			
 
- 			res.data.children.forEach(item => {
 
- 				item.checked = false;
 
- 			})
 
- 			
 
- 			data.leixingList = res.data.children || [];
 
- 		})
 
- 	}
 
- 	onLoad(() => {
 
- 		getMore()
 
- 		getKechengClassify();
 
- 	})
 
- </script>
 
- <style lang="scss" scoped>
 
- 	.phone-kecheng-page {
 
- 		background-color: #ccc;
 
- 		box-sizing: border-box;
 
- 	}
 
- 	.phone-search-content {
 
- 		position: relative;
 
- 		background-color: #fff;
 
- 		height: 42px;
 
- 		.search-input {
 
- 			height: 42px;
 
- 			line-height: 40px;
 
- 			border-radius: 20px;
 
- 			border: 1px solid #ccc;
 
- 			padding: 0 70px 0 20px;
 
- 		}
 
- 		.search-icon {
 
- 			position: absolute;
 
- 			right: 5px;
 
- 			top: 4px;
 
- 			padding: 6px;
 
- 			background-color: #ccc;
 
- 			border-radius: 20px;
 
- 			width: 50px;
 
- 			text-align: center;
 
- 		}
 
- 	}
 
- </style>
 
 
  |