Browse Source

Merge branch '2024鹅状元' of https://gogs.mtavip.com/wangguoyu/uniProject into 2024鹅状元

tanxue 6 months ago
parent
commit
55089c6350
3 changed files with 111 additions and 36 deletions
  1. 24 0
      api/learnPlan.js
  2. 84 35
      pages/study/index.vue
  3. 3 1
      pages/study/lookShipin.vue

+ 24 - 0
api/learnPlan.js

@@ -11,6 +11,18 @@ export function userLocate(data = {}) {
   })
 }
 
+export function getCommonZhangFirstInfo(data = {}) {
+  return request({
+    'url': '/common/zhang/firstInfo',
+    headers: {
+      isToken: true
+    },
+    method: 'post',
+    data,
+    timeout: 20000
+  })
+}
+
 export function userZhangFirstInfo(data = {}) {
   return request({
     'url': '/app/user/zhang/firstInfo',
@@ -34,3 +46,15 @@ export function userZhangInfo(data = {}) {
     timeout: 20000
   })
 }
+
+export function getCommonZhangInfo(data = {}) {
+  return request({
+    'url': '/common/zhang/firstInfo',
+    headers: {
+      isToken: true
+    },
+    method: 'post',
+    data,
+    timeout: 20000
+  })
+}

+ 84 - 35
pages/study/index.vue

@@ -35,9 +35,11 @@
 
 <script setup>
 	import {
-		userZhangFirstInfo,
+		userZhangFirstInfo,
+		getCommonZhangFirstInfo,
 		userZhangInfo,
-		userLocate
+		userLocate,
+		getCommonZhangInfo
 	} from "@/api/learnPlan.js"
 	import {
 		reactive,
@@ -57,6 +59,8 @@
 		useTabBarHistory
 	} from '@/utils/emitEvents.js';
 	import eggDialog from './eggDialog.vue'
+import { toast } from "../../utils/common";
+	
 	const eggDialogRef = ref(null);
 
 	const catalogueRef = ref(null);
@@ -95,17 +99,55 @@
 		console.log(options)
 		// 获取路由参数
 		routeParams.value = options;
-		// 选择年级进入调用此接口
-		if (options.flag == 'selectGrades') {
-			getZhangFirst()
-		} else {
-			getZhangInfo()
+		
+		if (getAuth()) {
+			// 已登录
+			// 选择年级进入调用此接口
+			if (options.flag == 'selectGrades') {
+				getZhangFirst()
+			} else {
+				getZhangInfo()
+			}
+			// 设置全局变量
+				
+			// 蛋
+			// eggDialogRef.value.eggShow();
+			
+		} else {
+			if (options.flag == 'selectGrades') {
+				getCommonZhangFirst()
+			} else {
+				getCommonZhang();
+			}
+			// 未登录
+		
 		}
-		// 设置全局变量
-	
-		// 蛋
-		// eggDialogRef.value.eggShow();
 	})
+	function getCommonZhang(data) {
+		let req = data ? {
+			nianji: selectZhang.value.nianji,
+			xueqi: selectZhang.value.xueqi,
+			zhangId: selectZhang.value.zhangId,
+		} : {
+			nianji: routeParams.value.nianji,
+			xueqi: routeParams.value.xueqi,
+			zhangId: routeParams.value.zhangId,
+		};
+		getCommonZhangInfo(req).then(res => {
+			infoData.jieList = res.data.jieList
+			infoData.haveFlag = res.data.haveFlag
+			infoData.nianji = res.data.nianji
+			infoData.number = res.data.number
+			infoData.numberStr = res.data.numberStr
+			infoData.xueqi = res.data.xueqi
+			infoData.zhangId = res.data.zhangId
+			infoData.zhangName = res.data.zhangName
+			gradeTerm.value = translateData(res.data);
+			useTabBarHistory().setTabBarStorage({nianji:res.data.nianji,zhangId:res.data.zhangId,xueqi:res.data.xueqi})
+		})
+	}
+	
+	
 	function recordZhangJie() {
 		let req = {
 			nianji: routeParams.value.nianji,
@@ -119,6 +161,25 @@
 		})
 	}
 
+	function getCommonZhangFirst() {
+		let req = {
+			nianji: routeParams.value.nianji,
+			xueqi: routeParams.value.xueqi,
+
+		}
+		getCommonZhangFirstInfo(req).then(res => {
+			infoData.jieList = res.data.jieList
+			infoData.haveFlag = res.data.haveFlag
+			infoData.nianji = res.data.nianji
+			infoData.number = res.data.number
+			infoData.numberStr = res.data.numberStr
+			infoData.xueqi = res.data.xueqi
+			infoData.zhangId = res.data.zhangId
+			infoData.zhangName = res.data.zhangName
+			gradeTerm.value = translateData(res.data);
+			useTabBarHistory().setTabBarStorage({nianji:res.data.nianji,zhangId:res.data.zhangId,xueqi:res.data.xueqi})
+		})
+	}
 	function getZhangFirst() {
 		let req = {
 			nianji: routeParams.value.nianji,
@@ -190,44 +251,23 @@
 		    offset: 30,
 		    isCustomized: true,
 		    coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/9A3F562E595E4764AD1DD546FA52C6E5-6-2.png',
-		    title: 'test title',
+		    title: '变式1',
 		    time: '04:01-07:50',
 		    describe: 'test string',
 		   }, {
 		    offset: 150,
 		    isCustomized: true,
 		    coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/1E7F402241CD4C0F94AD2BBB5CCC3EC7-6-2.png',
-		    title: 'test title',
+		    title: '变式2',
 		    time: '04:05-07:50',
 		    describe: 'test string',
 		   }, {
 		    offset: 250,
 		    isCustomized: true,
 		    coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/553AEA01161342C8A2B1756E83B69B5B-6-2.png',
-		    title: 'test title',
+		    title: '变式3',
 		    time: '04:07-07:50',
 		    describe: 'test string',
-		   }, {
-		    offset: 550,
-		    isCustomized: true,
-		    coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/553AEA01161342C8A2B1756E83B69B5B-6-2.png',
-		    title: 'test title',
-		    time: '04:09-07:50',
-		    describe: 'test string',
-		   }, {
-		    offset: 320,
-		    isCustomized: true,
-		    coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/553AEA01161342C8A2B1756E83B69B5B-6-2.png',
-		    title: 'test title',
-		    time: '04:11-07:50',
-		    describe: 'test string',
-		   }, {
-		    offset: 650,
-		    isCustomized: true,
-		    coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/553AEA01161342C8A2B1756E83B69B5B-6-2.png',
-		    title: 'test title',
-		    time: '04:15-07:50',
-		    describe: 'test string',
 		   }]
 		data.zhangId = infoData.zhangId
 		data.nianji = infoData.nianji
@@ -281,6 +321,15 @@
 	
 
 	function listClick(data,index) {
+		if (!getAuth()) {
+			toast("当前为游客模式请登录!")
+			uni.redirectTo({
+				url: '/pages/login/index'
+			})
+			return;
+		}
+		
+		
 		if(index ==infoData.jieList.length-1){
 			// 最后一项
 			goKaoshi(data)

+ 3 - 1
pages/study/lookShipin.vue

@@ -10,7 +10,7 @@
 		</view>
 		<view class="course-content-border">
 			<view class="course-content-box">
-				<view class="course-title">第一节 时间的计算</view>
+				<view class="course-title">{{jieName}}</view>
 				<view v-for="(item,index) in progressMarkers" :key="index" @click="markersClick(item)"
 					class="course-content-item">
 					<view class="course-play-btn"></view>
@@ -58,6 +58,7 @@
 				pageData: null, //上个页面获取的视频参数(视频id)
 				playAuth: "", //播放凭证
 				progressMarkers: [],
+				jieName: '',
 				videoId: "", //阿里云视频id
 				seekTime: ''
 			}
@@ -70,6 +71,7 @@
 			}
 			console.log(this.pageData);
 			this.videoId = data.videoId
+			this.jieName = data.jieName
 			this.progressMarkers = data.progressMarkers
 			this.getLive(); //获取播放凭证
 			//uni.$on('playEnd', this.playEnd);