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

Signed-off-by: 李妹妹 <1639016684@qq.com>

李妹妹 1 неделя назад
Родитель
Сommit
79635fcb17

+ 19 - 8
api/class.js

@@ -12,31 +12,42 @@ export function courseList() {
  }
 //最新学习
  export function getCourseStudyList(data) {
- 	 return request('/course_auto/app/course/getCourseStudyList',data,'GET');
+ 	 return request('/publicApp/app/course/getCourseStudyList',data,'GET');
  }
  //课程学习详情
  export function getCourseDetail(data) {
- 	 return request('/course_auto/app/course/getCourseById',data,'GET');
+ 	 return request('/publicApp/app/course/getCourseById',data,'GET');
  }
  
  //课程目录
  export function getCourseVideoList(data) {
- 	 return request('/course_auto/app/course/getCourseVideoList',data,'GET');
+ 	 return request('/publicApp/app/course/getCourseVideoList',data,'GET');
  }
  //新增课程记录
  export function addStudyCourse(data) {
- 	 return request('/course_auto/app/course/addStudyCourse',data,'POST','application/json;charset=UTF-8');
+ 	 return request('/publicApp/app/course/addStudyCourse',data,'POST','application/json;charset=UTF-8');
  }
  //课程评论列表
  export function getCommentList(data) {
- 	 return request('/course_auto/store/app/course/comment/list',data,'GET');
+ 	 return request('/publicApp/store/app/course/comment/list',data,'GET');
  }
  //课程题目
  export function videoDetails(data) {
- 	 return request('/course_auto/app/course/videoDetails',data,'GET');
+ 	 return request('/publicApp/app/course/videoDetails',data,'GET');
  }
  //新增评论
  export function addCommentt(data) {
- 	 return request('/course_auto/store/app/course/comment/addComment',data,'POST','application/json;charset=UTF-8');
+ 	 return request('/publicApp/store/app/course/comment/addComment',data,'POST','application/json;charset=UTF-8');
  }
- 
+ //答题状态
+ export function courseAnswerStatus(data) {
+ 	 return request('/publicApp/app/course/publicCourseAnswer/status',data,'GET');
+ }
+ //答题
+ export function courseAnswer(data) {
+ 	 return request('/publicApp/app/course/publicCourseAnswer',data,'POST','application/json;charset=UTF-8');
+ }
+ //答题奖励
+ export function getIntegral(data) {
+ 	 return request('/publicApp/app/course/publicCourseAnswer/claimIntegral',data,'POST','application/json;charset=UTF-8');
+ }

+ 7 - 7
common/request.js

@@ -16,7 +16,8 @@ export default class Request {
 
 		// let path = 'http://jc5cb469.natappfree.cc/store'; //本地
 		// let path2 = 'http://jc5cb469.natappfree.cc'; //本地
-		
+		let token = uni.getStorageSync('AppToken');
+		console.log('token',token)
 		let type = 0
 		uni.setStorageSync('requestPath', path2)
 		// uni.showLoading({
@@ -42,9 +43,12 @@ export default class Request {
 			path = path2
 			router = router.replace('/liveAPP', '')
 			type = 4
-			token = uni.getStorageSync('AppToken');
 		}
-
+         if (router.indexOf("/publicApp") !== -1) {
+			 router = router.replace('/publicApp', '')
+         	// path = 'https://userapp.klbycp.com';
+         	path = path2
+         }
 		if (router.indexOf("/patient/getPatientList") !== -1) {
 			// path = 'https://userapp.klbycp.com';
 			path = path2
@@ -53,8 +57,6 @@ export default class Request {
 			// path = 'https://userapp.klbycp.com/companyapp';
 			path = `${path2}/companyapp`;
 		}
-
-		let token = uni.getStorageSync('AppToken');
 		if (router.indexOf("/companyapp") != -1) {
 			// router =router.replace('/companyapp','')
 			// path = 'https://userapp.klbycp.com' //百域承品
@@ -62,8 +64,6 @@ export default class Request {
 			type = 1
 			token = uni.getStorageSync('ManageToken');
 		}
-
-
 		//积分商城
 		if (router.indexOf("/integral") !== -1) {
 			path = path2

+ 52 - 19
pages_index/courseDetail.vue

@@ -219,7 +219,7 @@
 </template>
 
 <script>
-import { getCourseDetail, addStudyCourse as addStudyCourseApi, getCourseVideoList,addCommentt, getCommentList,videoDetails } from '@/api/class.js'
+import { getCourseDetail, addStudyCourse as addStudyCourseApi, getCourseVideoList,addCommentt, getCommentList,videoDetails ,courseAnswer,courseAnswerStatus,getIntegral} from '@/api/class.js'
 export default {
 	computed: {
 		poster() {
@@ -297,7 +297,7 @@ export default {
 			maxAttempts: 3,
 			attemptsLeft: 3,
 			correctAnswer: "C",
-			awardScore: 20,
+			awardScore:0,
 			hasAward: false,
 			answerQuestion: [],
 			courseInfo: {
@@ -519,6 +519,7 @@ export default {
 				if (resumeInfo && resumeInfo.item) {
 					item = resumeInfo.item;
 					this.activeIndex = item.videoId;
+					this.awardScore = item.integralReward;
 					this.playTime = resumeInfo.seekTime;
 					this.pendingSeekTime = resumeInfo.seekTime;
 					this.hasAppliedInitialStudyLog = true;
@@ -904,29 +905,61 @@ export default {
 			this.selectedAnswer = value;
 		},
 		submitAnswer() {
-			if (!this.answerQuestion.options || this.answerQuestion.options.length === 0) {
-				uni.showToast({
-					title: "当前课时暂无题目",
-					icon: "none"
-				});
-				return;
-			}
+			// if (!this.answerQuestion.options || this.answerQuestion.options.length == 0) {
+			// 	uni.showToast({
+			// 		title: "当前课时暂无题目",
+			// 		icon: "none"
+			// 	});
+			// 	return;
+			// }
 			if (!this.canAnswer || !this.selectedAnswer) {
 				return;
 			}
 			this.attemptsLeft -= 1;
 			this.showAnswerPopup = false;
-			// 无标准答案时(例如满意度问卷)默认按成功处理
-			if (!this.correctAnswer || this.selectedAnswer === this.correctAnswer) {
-				this.answerResultType = "success";
-				this.hasAward = true;
-			} else if (this.attemptsLeft <= 0) {
-				this.answerResultType = "exhausted";
-			} else {
-				this.answerResultType = "fail";
+			const questions = this.answerQuestion.map(obj => {
+				const {
+					options,
+					...rest
+				} = obj;
+				return rest;
+			});
+			const param={
+				courseId:this.activeIndex,
+				videoId:this.videoId,
+				questions:questions
 			}
-			this.showAnswerResultPopup = true;
-			this.selectedAnswer = "";
+			courseAnswer(param).then(
+				res => {
+					if (res.code == 200) {
+						if (res.msg == '答题成功') {
+							this.answerResultType = "success";
+							this.hasAward = true;
+						}else{
+							this.answerResultType = "exhausted";
+						}
+						this.showAnswerResultPopup = true;
+						this.selectedAnswer = "";
+					} else {
+						uni.showToast({
+							icon: 'none',
+							title: res.msg,
+						});
+					}
+				},
+				rej => {}
+			);
+			// 无标准答案时(例如满意度问卷)默认按成功处理
+			// if (!this.correctAnswer || this.selectedAnswer === this.correctAnswer) {
+			// 	this.answerResultType = "success";
+			// 	this.hasAward = true;
+			// } else if (this.attemptsLeft <= 0) {
+			// 	this.answerResultType = "exhausted";
+			// } else {
+			// 	this.answerResultType = "fail";
+			// }
+			// this.showAnswerResultPopup = true;
+			// this.selectedAnswer = "";
 		},
 		goToIntegralMall() {
 			this.showAnswerResultPopup = false;

+ 9 - 4
pages_index/courseSearch.vue

@@ -5,7 +5,7 @@
 			    <view class="search-cont">
 			    	<view class="inner">
 			    		<image class="icon-search" src="https://bjzmky-1323137866.cos.ap-chongqing.myqcloud.com/class/search.png" mode=""></image>
-			    		<input type="text" :value="keyword" placeholder="请输入关键字搜索内容" placeholder-style="font-size:28rpx;color:#BBBBBB;font-family: PingFang SC;"  @input="clearInput"/>
+			    		<input type="text" v-model="keyword" placeholder="请输入关键字搜索内容" placeholder-style="font-size:28rpx;color:#BBBBBB;font-family: PingFang SC;"  @input="clearInput"/>
 			    	</view>
 					<view class="sousuo" @click="goSearch">搜索</view>
 			    	<!-- <view class="icon-search">
@@ -186,9 +186,14 @@ export default {
 				this.recommendList = []
 			}
 		},
-		goSearch(e) {
-			const value = (e && e.detail && e.detail.value) || this.keyword || ''
-			this.keyword = value.trim()
+		goSearch() {
+			 if (!this.keyword.trim()) {
+			        uni.showToast({
+			          icon: 'none',
+			          title: '请输入搜索内容'
+			        });
+			        return;
+			      }
 			this.getCourseList(this.keyword)
 		},
 		onCourseClick(course) {

+ 24 - 8
pages_manage/components/courseIndex.vue

@@ -180,13 +180,19 @@
 			      
 			      // 同步更新列表里的 item 状态(控制星星图标)
 			      item.isFavorite = favoriteStatus ? 1 : 0;
-			      this.gettodaylist('refresh')
-			      // 提示文字
-			      uni.showToast({
-			        icon: 'none',
-			        title: favoriteStatus ? '收藏成功' : '取消收藏',
-					duration:3500
-			      });
+				  this.getFsCourseList('refresh')
+				  if(this.searchbarNav==0){
+					  this.gettodaylist('refresh')
+				  }else{
+					 this.getListInit()
+				  }
+				  setTimeout(() => {
+				  // 提示文字
+				  uni.showToast({
+				    icon: 'none',
+				    title: favoriteStatus ? '收藏成功' : '取消收藏'
+				  });
+				  }, 500);
 			    } else {
 			      // 失败提示
 			      uni.showToast({
@@ -255,9 +261,19 @@
 			},
 			reset() {
 				this.courseId = ''
+				this.actid=''
 				this.keyword =''
 				this.courseList=[]
-				this.getFsCourseList()
+				this.courserIndex=null
+				this.pageNum=1
+				this.getFsCourseList('refresh')
+				if(this.searchbarNav==0){
+					this.filterData[0].name='今日课程'
+					this.gettodaylist('refresh')
+				}else{
+					this.filterData[1].name='我的课程'
+				    this.getListInit()
+				}
 			},
 			handleCourse(item,index) {
 				console.log(index)

+ 1 - 1
pages_user/user/integralOrderList.vue

@@ -197,7 +197,7 @@
 		},
 		pay(item) {
 			 uni.navigateTo({
-			 	url: '/pages_user/integralPayment?orderId='+item.orderId
+			 	url: '/pages_user/user/integralPayment?orderId='+item.orderId
 			 })
 		},
 		cancelPay(item) {