Просмотр исходного кода

fix: 调整最近学习(学习记录)相关页面

wenxingxing 2 дней назад
Родитель
Сommit
7a5f09f688
3 измененных файлов с 37 добавлено и 51 удалено
  1. 2 2
      common/request.js
  2. 18 25
      pages/index/course.vue
  3. 17 24
      pages/index/video.vue

+ 2 - 2
common/request.js

@@ -3,8 +3,8 @@ export default class Request {
 	http(router, data = {}, method, contentType) {
 		let that = this;
 		// let path2 = 'https://userapp.klbycp.com'; //百域承品
-	    // let path = 'https://userapp.klbycp.com'; //百域承品
-	    let path = 'http://vab6e976.natappfree.cc'; //百域承品
+	    let path = 'https://userapp.klbycp.com'; //百域承品
+	    // let path = 'http://vab6e976.natappfree.cc'; //百域承品
 		// let path2 = 'https://userapp.zkhj6.com';
 		// let path = 'https://userapp.zkhj6.com';
 		let token = uni.getStorageSync('AppToken');

+ 18 - 25
pages/index/course.vue

@@ -66,12 +66,12 @@
 						<image class="date-icon" src="@/static/images/new/time.png"></image>
 						<text class="date-text">{{ group.date }}</text>
 					</view>
-					<view v-for="(item, i) in group.list" :key="i" class="recent-card" @click="onCourseClick(item)">
+					<view v-for="(item, i) in group.courses" :key="i" class="recent-card" @click="onCourseClick(item)">
 						<view class="recent-thumb">
-							<image :src="item.cover || '/static/logo.jpg'" mode="aspectFill" class="thumb-img"></image>
+							<image :src="item.imgUrl || '/static/logo.jpg'" mode="aspectFill" class="thumb-img"></image>
 						</view>
 						<view class="recent-info">
-							<text class="recent-title">{{ item.title }}</text>
+							<text class="recent-title">{{ item.courseName }}</text>
 							<text class="recent-progress">已学: {{ item.progress }}%</text>
 							<view class="y-end">
 								<view class="btn-watch" @click.stop="onCourseClick(item)">立即观看</view>
@@ -139,21 +139,7 @@ export default {
 				pageSize: 10,
 				total: 0,
 			},
-			recentList: [
-				// {
-				// 	date: '2026-02-08',
-				// 	list: [
-				// 		{ title: '歌唱家刘金的《0基础金曲演唱速练课》', progress: 87, cover: '' },
-				// 		{ title: '资深编辑邹方斌讲《毛笔书法修心课》', progress: 56, cover: '' }
-				// 	]
-				// },
-				// {
-				// 	date: '2026-02-01',
-				// 	list: [
-				// 		{ title: '张斌《元气八段锦》系列课', progress: 56, cover: '' }
-				// 	]
-				// }
-			],
+			recentList: [],
 			recentPage: {
 				pageNum: 1,
 				pageSize: 10,
@@ -173,8 +159,12 @@ export default {
 	},
 	methods: {
 		onCourseClick(e) {
+			let newUrl = `/pages/course/info?courseId=${e.courseId}`
+			if (e.videoId) {
+				newUrl = `${newUrl}&videoId=${e.videoId}`
+			}
 			uni.navigateTo({
-				url: `/pages/course/info?courseId=${e.courseId}`
+				url: newUrl
 			})
 		},
 		// 切换顶部 Tab
@@ -187,7 +177,10 @@ export default {
 
 		// 获取学习记录课程列表
 		async getCourseStudyListMethos() {
-			const res = await getCourseStudyList({});
+			const res = await getCourseStudyList({},
+				this.recentPage.pageNum,
+				this.recentPage.pageSize,
+			);
 			if (res.code === 200 && res.data.list.length > 0) {
 				this.recentPage.total = res.data.total;
 				this.recentList = [...this.recentList, ...res.data.list];
@@ -259,12 +252,7 @@ export default {
 				cateType: 1,
 				yxxTag: 0
 			};
-			uni.showLoading({
-				title: "加载中...",
-				mask: true,
-			})
 			const res = await courseTypeDataApi(params);
-			uni.hideLoading()
 			if (res.code === 200) {
 				this.categories = [...this.categories, ...res.data.list];
 			}
@@ -280,7 +268,12 @@ export default {
 			if (params.subCateId === 0) {
 				delete params.subCateId;
 			}
+			uni.showLoading({
+				title: "加载中...",
+				mask: true,
+			})
 			const res = await courseListDataApi(params);
+			uni.hideLoading()
 			if (res.code === 200 && res.data.list.length > 0) {
 				this.jpPage.total = res.data.total;
 				this.courseList = [...this.courseList, ...res.data.list];

+ 17 - 24
pages/index/video.vue

@@ -64,9 +64,9 @@
 						<image class="date-icon" src="@/static/images/new/time.png"></image>
 						<text class="date-text">{{ group.date }}</text>
 					</view>
-					<view v-for="(item, i) in group.list" :key="i" class="recent-card" @click="onCourseClick(item)">
+					<view v-for="(item, i) in group.courses" :key="i" class="recent-card" @click="onCourseClick(item)">
 						<view class="recent-thumb">
-							<image :src="item.cover || '/static/logo.jpg'" mode="aspectFill" class="thumb-img"></image>
+							<image :src="item.imgUrl || '/static/logo.jpg'" mode="aspectFill" class="thumb-img"></image>
 						</view>
 						<view class="recent-info">
 							<text class="recent-title">{{ item.courseName }}</text>
@@ -136,21 +136,7 @@ export default {
 				pageSize: 10,
 				total: 0,
 			},
-			recentList: [
-				// {
-				// 	date: '2026-02-08',
-				// 	list: [
-				// 		{ title: '歌唱家刘金的《0基础金曲演唱速练课》', progress: 87, cover: '' },
-				// 		{ title: '资深编辑邹方斌讲《毛笔书法修心课》', progress: 56, cover: '' }
-				// 	]
-				// },
-				// {
-				// 	date: '2026-02-01',
-				// 	list: [
-				// 		{ title: '张斌《元气八段锦》系列课', progress: 56, cover: '' }
-				// 	]
-				// }
-			],
+			recentList: [],
 			recentPage: {
 				pageNum: 1,
 				pageSize: 10,
@@ -170,8 +156,12 @@ export default {
 	},
 	methods: {
 		onCourseClick(e) {
+			let newUrl = `/pages/course/info?courseId=${e.courseId}`
+			if (e.videoId) {
+				newUrl = `${newUrl}&videoId=${e.videoId}`
+			}
 			uni.navigateTo({
-				url: `/pages/course/info?courseId=${e.courseId}`
+				url: newUrl
 			})
 		},
 		// 切换顶部 Tab
@@ -184,7 +174,10 @@ export default {
 
 		// 获取学习记录课程列表
 		async getCourseStudyListMethos() {
-			const res = await getCourseStudyList({});
+			const res = await getCourseStudyList({},
+				this.recentPage.pageNum,
+				this.recentPage.pageSize,
+			);
 			if (res.code === 200 && res.data.list.length > 0) {
 				this.recentPage.total = res.data.total;
 				this.recentList = [...this.recentList, ...res.data.list];
@@ -256,12 +249,7 @@ export default {
 				cateType: 1,
 				yxxTag: 1
 			};
-			uni.showLoading({
-				title: "加载中...",
-				mask: true,
-			})
 			const res = await courseTypeDataApi(params);
-			uni.hideLoading()
 			if (res.code === 200) {
 				this.categories = [...this.categories, ...res.data.list];
 			}
@@ -278,7 +266,12 @@ export default {
 			if (params.subCateId === 0) {
 				delete params.subCateId;
 			}
+			uni.showLoading({
+				title: "加载中...",
+				mask: true,
+			})
 			const res = await courseListDataApi(params);
+			uni.hideLoading()
 			if (res.code === 200 && res.data.list.length > 0) {
 				this.yxxPage.total = res.data.total;
 				this.courseList = [...this.courseList, ...res.data.list];