wangguoyu 5 hónapja
szülő
commit
00bc8fffb6
6 módosított fájl, 289 hozzáadás és 224 törlés
  1. 0 41
      api/exam.js
  2. 11 11
      api/learnPlan.js
  3. 1 1
      pages/selectGradesTerms/index.vue
  4. 101 55
      pages/study/index.vue
  5. 93 52
      pages/study/lookShipin.vue
  6. 83 64
      utils/request.js

+ 0 - 41
api/exam.js

@@ -1,41 +0,0 @@
-import request from '@/utils/request'
-export function getExamList(data = {}) {
-  return request({
-    'url': '/app/shiti/list',
-    headers: {
-      isToken: true
-    },
-    method: 'post',
-    data,
-    timeout: 20000
-  })
-}
-
-export function getExamAnswerList(data = {}) {
-  return request({
-    'url': '/app/shiti/answer/list',
-    headers: {
-      isToken: true
-    },
-    method: 'post',
-    data,
-    timeout: 20000
-  })
-}
-
-
-function initScript() {
-	// 动态加载第三方JS文件
-	const script = document.createElement('script');
-	script.src = 'https://cdn.example.com/third-party-library.js';
-	script.onload = () => {
-		// JS文件加载完成后的回调
-		console.log('Third-party library loaded.');
-		// 你可以在这里调用第三方库的方法
-	};
-	script.onerror = () => {
-		// 处理加载错误
-		console.error('Failed to load third-party library.');
-	};
-	document.head.appendChild(script); // 或者使用 document.body.appendChild(script);
-}

+ 11 - 11
api/index.js → api/learnPlan.js

@@ -1,7 +1,7 @@
 import request from '@/utils/request'
-export function getExamList(data = {}) {
+export function userLocate(data = {}) {
   return request({
-    'url': '/app/kaoshi/list',
+    'url': '/app/user/locate',
     headers: {
       isToken: true
     },
@@ -9,11 +9,11 @@ export function getExamList(data = {}) {
     data,
     timeout: 20000
   })
-}
-
-export function getCourseList(data = {}) {
+}
+
+export function userZhangFirstInfo(data = {}) {
   return request({
-    'url': '/app/kecheng/list',
+    'url': '/app/user/zhang/firstInfo',
     headers: {
       isToken: true
     },
@@ -21,11 +21,11 @@ export function getCourseList(data = {}) {
     data,
     timeout: 20000
   })
-}
-
-export function getNoticeCount(data = {}) {
+}
+
+export function userZhangInfo(data = {}) {
   return request({
-    'url': '/app/index',
+    'url': '/app/user/zhang/info',
     headers: {
       isToken: true
     },
@@ -33,4 +33,4 @@ export function getNoticeCount(data = {}) {
     data,
     timeout: 20000
   })
-}
+}

+ 1 - 1
pages/selectGradesTerms/index.vue

@@ -81,7 +81,7 @@
 			text
 		}) {
 			uni.navigateTo({
-				url: `/pages/study/index?xueqi=${data.activeXueqi}&nianji=${data.activeNianji}`
+				url: `/pages/study/index?xueqi=${data.activeXueqi}&nianji=${data.activeNianji}&flag=selectGrades`
 			})
 		}
 

+ 101 - 55
pages/study/index.vue

@@ -1,32 +1,20 @@
 <template>
 	<view class="ezy-study-page">
-		<!-- <view class="study-school-year">一年级上</view>
+		<view class="study-school-year">一年级上</view>
 		<view class="ezy-study-wrap">
-			<view class="chapter-box"></view>
-			<view class="chapter-title-box"></view>
-			<view class="brand"></view>
-		</view> -->
-		<view @click="goBack">{{gradeTerm.text}}</view>
-		<view>
-			<view v-for="item in data.list" :key="item.index" @click="listClick"> {{item.index}} {{item.label}} </view>
-		</view>
-		<view>
-			<uni-button @click="handleCheckCatalogue">go catalogue</uni-button>
-			<uni-button @click="goKaoshi">goKaoshi</uni-button>
-			<navigator :url="`/pages/study/catalogue?gradeId=1&termId=1&text=一年级上册`" hover-class="navigator-hover">
-				<button type="default">学习计划</button>
-			</navigator>
-			<navigator url="/pages/unitTest/index" hover-class="navigator-hover">
-				<button type="default">成长</button>
-			</navigator>
-			<navigator url="navigate/navigate?title=navigate" hover-class="navigator-hover">
-				<button type="default">伙伴</button>
-			</navigator>
-			<navigator url="navigate/navigate?title=navigate" hover-class="navigator-hover">
-				<button type="default">我的</button>
-			</navigator>
-		</view>
-
+			<view class="chapter-box" @click="handleCheckCatalogue">
+				第二章
+			</view>
+			<view class="chapter-title-box">
+				小标题
+			</view>
+			<view class="brand" v-for="(item,index) in infoData.jieList" :key="index" @click="listClick(item)">aaaaaaaa</view>
+		</view>
+		
+		<!-- <uni-button  style="margin-top: 200px;display: block;" @click="goKaoshi">goKaoshi</uni-button>
+	 -->
+		<!-- <uni-button @click="handleCheckCatalogue">go catalogue</uni-button>
+		<uni-button @click="goKaoshi">goKaoshi</uni-button>
 		<!-- 蛋 -->
 		<egg-dialog ref="eggDialogRef" @eggBtn="eggBtn"></egg-dialog>
 		
@@ -36,7 +24,12 @@
   </view>
 </template>
 
-<script setup>
+<script setup>
+	import {
+		userZhangFirstInfo,
+		userZhangInfo,
+		userLocate
+	} from "@/api/learnPlan.js"
 	import {
 		reactive,
 		ref,
@@ -52,39 +45,49 @@
 	
 	const catalogueRef = ref(null);
 	const gradeTerm = ref('');
-	const selectZhang = ref(null);
+	const selectZhang = ref(null);
+	 let infoData = reactive({
+	      jieList: [],
+		  haveFlag:'',
+		  nianji:'',
+		  number:'',
+		  xueqi:'',
+		  zhangId:'',
+		  zhangName:'',
+	    });
 	// 来自单元测试的路由参数缓存
 	const routeParams = ref(null);
 
-	onLoad((options) => {
+	onLoad((options) => {
+		console.log(options)
 		// 获取路由参数
-		routeParams.value = options;
-		// 赋值 ?
-		gradeTerm.value = options;
+		routeParams.value = options;
+		// 选择年级进入调用此接口
+		if(options.flag =='selectGrades'){
+			getZhangFirst()
+		}else{
+			
+		}
 		// 蛋
 		// eggDialogRef.value.eggShow();
 	})
-
-	const data = reactive({
-		list: [{
-				label: '长度中的隐含条件问题',
-				id: 1,
-			},
-			{
-				label: '解决重叠问题',
-				id: 2,
-			},
-			{
-				label: '列表法解决方案问题',
-				id: 3,
-			},
-			{
-				label: '真题测试',
-				id: 4,
-			},
-		]
-	})
-
+	function getZhangFirst(){
+		let req = {
+			nianji: routeParams.value.nianji,
+			xueqi: routeParams.value.xueqi,
+		
+		}
+		userZhangFirstInfo(req).then(res => {
+				infoData.jieList = res.data.jieList
+				infoData.haveFlag = res.data.haveFlag
+				infoData.nianji = res.data.nianji
+				infoData.number = res.data.number
+				infoData.xueqi = res.data.xueqi
+				infoData.zhangId = res.data.zhangId
+				infoData.zhangName = res.data.zhangName
+				console.log(infoData)
+		})
+	}
 	function handleChangeZhang(data) {
 		console.log("章", data);
 		selectZhang.value = data;
@@ -99,9 +102,52 @@
 		})
 	}
 
-	function listClick(data) {
+	function listClick(data) {
+		
+		
+		const pageData = {
+		//	videoId:data.videoId,
+			videoId:'b997f16cb9cb474cb93526cff77d8801',
+			progressMarkers: [{
+						offset: 30,
+						isCustomized: true,
+						coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/9A3F562E595E4764AD1DD546FA52C6E5-6-2.png',
+						title: 'test title',
+						describe: 'test string',
+					}, {
+						offset: 150,
+						isCustomized: true,
+						coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/1E7F402241CD4C0F94AD2BBB5CCC3EC7-6-2.png',
+						title: 'test title',
+						describe: 'test string',
+					}, {
+						offset: 250,
+						isCustomized: true,
+						coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/553AEA01161342C8A2B1756E83B69B5B-6-2.png',
+						title: 'test title',
+						describe: 'test string',
+					}, {
+						offset: 550,
+						isCustomized: true,
+						coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/553AEA01161342C8A2B1756E83B69B5B-6-2.png',
+						title: 'test title',
+						describe: 'test string',
+					}, {
+						offset: 320,
+						isCustomized: true,
+						coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/553AEA01161342C8A2B1756E83B69B5B-6-2.png',
+						title: 'test title',
+						describe: 'test string',
+					}, {
+						offset: 650,
+						isCustomized: true,
+						coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/553AEA01161342C8A2B1756E83B69B5B-6-2.png',
+						title: 'test title',
+						describe: 'test string',
+					}],
+		}
 		uni.navigateTo({
-			url: '/pages/study/lookShipin'
+			url: '/pages/study/lookShipin?studyData='+JSON.stringify(pageData)
 		})
 	}
 

+ 93 - 52
pages/study/lookShipin.vue

@@ -1,6 +1,18 @@
 <template>
-	<view ref="videoContent" id="wgy-player-test" :playAuth="playAuth" :change:playAuth="renderScript.receiveMsg">
+	<view @click="goUpPage">
+		视频播放
 	</view>
+	<view ref="videoContent" id="wgy-player-test" :playAuth="playAuth" :change:playAuth="renderScript.receiveMsg"
+		:progressMarkers="progressMarkers" :change:progressMarkers="renderScript.progressMarkersMsg"
+		:seekTime="seekTime" :change:seekTime="renderScript.seekTimeFun">
+	</view>
+	<view>
+		第一节 时间的计算
+	</view>
+	<view>
+		第一单元 时、分、秒
+	</view>
+	<view v-for="(item,index) in progressMarkers" :key="index" @click="markersClick(item)">标点</view>
 </template>
 
 <script>
@@ -18,29 +30,42 @@
 			return {
 				options: {}, //上个页面获取的视频参数(视频id)
 				playAuth: "", //播放凭证
+				progressMarkers: [],
 				videoId: "", //阿里云视频id
-				videoData: {
-					playauth: '',
-					videoId: 'b997f16cb9cb474cb93526cff77d8801',
-				}, //阿里云视频其他参数
+				seekTime: ''
+
 			}
 		},
+		onLoad(options) {
+			let data = JSON.parse(options.studyData)
+			this.videoId = data.videoId
+			this.progressMarkers = data.progressMarkers
+			this.getLive(); //获取播放凭证
+		},
 		methods: {
 			getLive() {
 				let req = {
-					videoId: this.videoData.videoId
+					videoId: this.videoId
 				}
 				getVideoAuth(req).then(res => {
 					this.playAuth = res.data
-					//	console.log(this.videoData)
-					//this.playAli()
 				})
 			},
+			markersClick(data) {
+				console.log(data)
+				this.seekTime = data.offset
+			},
+			goUpPage(){
+				uni.navigateTo({
+				//	url: `/pages/study/index?xueqi=${data.activeXueqi}&nianji=${data.activeNianji}&flag=selectGrades`
+					url: `/pages/study/index`
+				})
+			}
 
 		},
 		created() {
-			console.log("getLive")
-			this.getLive(); //获取播放凭证
+			// console.log("getLive")
+			// this.getLive(); //获取播放凭证
 
 		},
 
@@ -60,6 +85,8 @@
 			return {
 				player: null,
 				playAuth: '',
+				progressMarkers: [],
+				seekTime: ''
 
 			}
 		},
@@ -77,6 +104,60 @@
 					this.playAli()
 				}
 			},
+			progressMarkersMsg(newValue, oldValue, ownerInstance, instance) {
+				console.log('service层中的options发生变化222222222222')
+				console.log('新值', newValue)
+				console.log('旧值', oldValue)
+				// ownerInstance和this.$ownerInstance一样,可用来向service层通信
+				// instance和ownerInstance的区别是:
+				// instance.$el指向的是触发事件的那个节点;ownerInstance.$el指向当前vue文件中的根节点;
+				// instance的作用目前尚不明确,官方没有给出用法
+				if (newValue) {
+					this.progressMarkers = newValue
+				}
+			},
+			seekTimeFun(newValue, oldValue, ownerInstance, instance) {
+				console.log('service层中的options发生变化3333333')
+				console.log('新值', newValue)
+				console.log('旧值', oldValue)
+				// ownerInstance和this.$ownerInstance一样,可用来向service层通信
+				// instance和ownerInstance的区别是:
+				// instance.$el指向的是触发事件的那个节点;ownerInstance.$el指向当前vue文件中的根节点;
+				// instance的作用目前尚不明确,官方没有给出用法
+				if (newValue) {
+					console.log(newValue, 'newValuenewValuenewValuenewValuenewValue')
+					console.log(this.player.getStatus(), 'newValuenewValuenewValuenewValuenewValue')
+					switch (this.player.getStatus()) {
+						case 'init':
+							break;
+						case 'ready':
+							break;
+						case 'loading':
+						this.player.play()
+						this.player.seek(newValue)
+							break;
+						case 'play':
+							this.player.seek(newValue)
+							break;
+						case 'pause':
+						this.player.play()
+						this.player.seek(newValue)
+							break;
+						case 'playing':
+						this.player.seek(newValue)
+							break;
+						case 'waiting':
+							break;
+						case 'error':
+							break;
+						case 'ended':
+							break;
+						default:
+							break;
+					}
+					//	this.player.seek(newValue)
+				}
+			},
 			playAli() {
 				//配置播放器
 				var player = new Aliplayer({
@@ -90,37 +171,7 @@
 					"format": "m3u8",
 					"mediaType": "video",
 					"encryptType": 1,
-					"progressMarkers": [{
-						offset: 30,
-						isCustomized: true,
-						coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/9A3F562E595E4764AD1DD546FA52C6E5-6-2.png',
-						title: 'test title',
-						describe: 'test string',
-					}, {
-						offset: 150,
-						isCustomized: true,
-						coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/1E7F402241CD4C0F94AD2BBB5CCC3EC7-6-2.png',
-						title: 'test title',
-						describe: 'test string',
-					}, {
-						offset: 250,
-						isCustomized: true,
-						coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/553AEA01161342C8A2B1756E83B69B5B-6-2.png',
-						title: 'test title',
-						describe: 'test string',
-					}, {
-						offset: 550,
-						isCustomized: true,
-						coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/553AEA01161342C8A2B1756E83B69B5B-6-2.png',
-						title: 'test title',
-						describe: 'test string',
-					}, {
-						offset: 320,
-						isCustomized: true,
-						coverUrl: 'https://alivc-demo-vod.aliyuncs.com/image/cover/553AEA01161342C8A2B1756E83B69B5B-6-2.png',
-						title: 'test title',
-						describe: 'test string',
-					}],
+					"progressMarkers": this.progressMarkers,
 					"width": '100%',
 					"height": '500px',
 					"autoplay": false,
@@ -139,17 +190,7 @@
 
 				});
 			},
-			//监听获取播放凭证的方法
-			checkValue() {
-				console.log(this.videoId, this.authId, "1111888888")
-				if (!this.videoData.playAuth) {
-					setTimeout(() => {
-						this.checkValue();
-					}, 1000);
-				} else {
-					this.getLive();
-				}
-			},
+
 
 			loadWebPlayerSDK() {
 				return new Promise((resolve, reject) => {

+ 83 - 64
utils/request.js

@@ -1,76 +1,95 @@
 //import store from '@/store'
 import config from '../config.js'
-import { getAuth } from '@/utils/auth'
-import { Md5 }   from 'ts-md5/dist/md5';
+import {
+	getAuth
+} from '@/utils/auth'
+import {
+	Md5
+} from 'ts-md5/dist/md5';
 import errorCode from '@/utils/errorCode'
-import { toast, showConfirm, tansParams } from '@/utils/common'
+import {
+	toast,
+	showConfirm,
+	tansParams
+} from '@/utils/common'
 
 let timeout = 10000
 const baseUrl = config.baseUrl
 const request = config => {
 
-  // 是否需要设置 token
- // const isToken = (config.headers || {}).isToken === false
-  config.header = config.header || {}
-  
-  
- //  if (getToken() && !isToken) {
+	// 是否需要设置 token
+	// const isToken = (config.headers || {}).isToken === false
+	config.header = config.header || {}
+
+
+	//  if (getToken() && !isToken) {
 	// config.headers['X-AUTH-SIGN'] = Md5.hashStr(JSON.stringify(config.data) +auth.secret);
 	// config.headers['X-AUTH-TOKEN'] = auth.token;
- //  }
-  if (getAuth()) {
-	config.headers['X-AUTH-SIGN'] = Md5.hashStr(JSON.stringify(config.data) +JSON.parse(getAuth()).secret);
-	config.headers['X-AUTH-TOKEN'] = JSON.parse(getAuth()).token;
-  }
-  return new Promise((resolve, reject) => {
-	//  debugger
-    uni.request({
-        method: config.method || 'get',
-        timeout: config.timeout ||  timeout,
-        url: config.baseUrl || baseUrl + config.url,
-        data: config.data,
-        header: config.headers,
-        dataType: 'json'
-      }).then(response => {
-         const res = response.data;
-        // if (error) {
-        //   toast('后端接口连接异常')
-        //   reject('后端接口连接异常')
-        //   return
-        // }
-        const code = res.code 
-       // const msg = errorCode[code] || res.data.msg || errorCode['default']
-        if (code === 401) {
-          showConfirm('登录状态已过期,您可以继续留在该页面,或者重新登录?').then(res => {
-            // if (res.confirm) {
-            //   store.dispatch('LogOut').then(res => {
-            //     uni.reLaunch({ url: '/pages/login' })
-            //   })
-            // }
-			  uni.reLaunch({ url: '/pages/login' })
-          })
-          reject('无效的会话,或者会话已过期,请重新登录。')
-        } else if (code === 500) {
-          reject('500')
-        } else if (code !== 0) {
-       //   toast(msg)
-          reject(code)
-        }
-        resolve(res)
-      })
-      .catch(error => {
-        let { message } = error
-        if (message === 'Network Error') {
-          message = '后端接口连接异常'
-        } else if (message.includes('timeout')) {
-          message = '系统接口请求超时'
-        } else if (message.includes('Request failed with status code')) {
-          message = '系统接口' + message.substr(message.length - 3) + '异常'
-        }
-        toast(message)
-        reject(error)
-      })
-  })
+	//  }
+	if (getAuth()) {
+		config.headers['X-AUTH-SIGN'] = Md5.hashStr(JSON.stringify(config.data) + JSON.parse(getAuth()).secret);
+		config.headers['X-AUTH-TOKEN'] = JSON.parse(getAuth()).token;
+	}
+	return new Promise((resolve, reject) => {
+		//  debugger
+		uni.request({
+				method: config.method || 'get',
+				timeout: config.timeout || timeout,
+				url: config.baseUrl || baseUrl + config.url,
+				data: config.data,
+				header: config.headers,
+				dataType: 'json'
+			}).then(response => {
+				const res = response.data;
+				// if (error) {
+				//   toast('后端接口连接异常')
+				//   reject('后端接口连接异常')
+				//   return
+				// }
+				const code = res.code
+				// const msg = errorCode[code] || res.data.msg || errorCode['default']
+				if (code === 401) {
+					showConfirm('登录状态已过期,您可以继续留在该页面,或者重新登录?').then(res => {
+						if (res.confirm) {
+							uni.reLaunch({
+								url: '/pages/login/index'
+							})
+						}
+					})
+					reject('无效的会话,或者会话已过期,请重新登录。')
+				} else if (code === 405) {
+					showConfirm('登录状态已过期,您可以继续留在该页面,或者重新登录?').then(res => {
+						if (res.confirm) {
+							uni.reLaunch({
+								url: '/pages/login/index'
+							})
+						}
+
+					})
+					reject('无效的会话,或者会话已过期,请重新登录。')
+				} else if (code === 500) {
+					reject('500')
+				} else if (code !== 0) {
+					//   toast(msg)
+					reject(code)
+				}
+				resolve(res)
+			})
+			.catch(error => {
+				let {
+					message
+				} = error
+				if (message === 'Network Error') {
+					message = '后端接口连接异常'
+				} else if (message.includes('timeout')) {
+					message = '系统接口请求超时'
+				} else if (message.includes('Request failed with status code')) {
+					message = '系统接口' + message.substr(message.length - 3) + '异常'
+				}
+				toast(message)
+				reject(error)
+			})
+	})
 }
 
-export default request
+export default request