Tang il y a 4 ans
Parent
commit
4a5a8a8f8a
5 fichiers modifiés avec 255 ajouts et 49 suppressions
  1. 3 1
      common/api.js
  2. 39 0
      common/httpList/chapter.js
  3. 21 0
      common/httpList/face.js
  4. 159 23
      pages2/course/detail.vue
  5. 33 25
      pages2/wd/info.vue

+ 3 - 1
common/api.js

@@ -7,6 +7,7 @@ import note from './httpList/note.js'
 import face from './httpList/face.js'
 import userInfo from './httpList/userInfo.js'
 import teacher from './httpList/teacher.js'
+import chapter from './httpList/chapter.js'
 export default {
 	...login,
 	...polyvVideo,
@@ -16,5 +17,6 @@ export default {
 	...note,
 	...face,
 	...userInfo,
-	...teacher
+	...teacher,
+	...chapter
 }

+ 39 - 0
common/httpList/chapter.js

@@ -0,0 +1,39 @@
+import {
+	myRequest
+} from '../request.js'
+export default {
+	//查询课程大章列表
+	coursechapterlist(data) {
+		return myRequest({
+			url: '/app/common/course/chapter/list',
+			method: 'get',
+			data: data,
+			noToken:true
+		})
+	},
+	//获取课程大章详细信息
+	coursechapter(data) {
+		return myRequest({
+			url: '/app/common/course/chapter/' + data,
+			method: 'get',
+			noToken: true
+		})
+	},
+	//查询课程小节列表
+	coursesectionlist(data) {
+		return myRequest({
+			url:'/app/common/course/section/list',
+			method: 'get',
+			data: data,
+			noToken:true
+		})
+	},
+	//获取课程小节详细信息
+	coursesection(data) {
+		return myRequest({
+			url: '/app/common/course/section/' + data,
+			method: 'get',
+			noToken: true
+		})
+	},
+}

+ 21 - 0
common/httpList/face.js

@@ -9,4 +9,25 @@ export default {
 			method: 'get',
 		})
 	},
+	//获取识别结果
+	facecertification(data) {
+		return myRequest({
+			url: '/face/certification/DetectInfo/' + data,
+			method: 'get',
+		})
+	},
+	//获取人照识别凭证
+	facecertificationPicBizToken() {
+		return myRequest({
+			url: '/face/certification/PicBizToken',
+			method: 'get',
+		})
+	},
+	//获取人照识别结果
+	facecertificationPicDetectInfo(data) {
+		return myRequest({
+			url: '/face/certification/PicDetectInfo/' + data,
+			method: 'get',
+		})
+	},
 }

+ 159 - 23
pages2/course/detail.vue

@@ -18,7 +18,9 @@
 			</view>
 			<view>
 				<u-row>
-					<u-col span="8" offset="1"><view class="video_t1">2020年二级建造师教育选修</view></u-col>
+					<u-col span="8" offset="1">
+						<view class="video_t1">{{ pageData.courseName }}</view>
+					</u-col>
 					<u-col span="3"><view class="video_t1">共60课时</view></u-col>
 				</u-row>
 			</view>
@@ -37,16 +39,28 @@
 							</view>
 						</u-col>
 						<u-col span="3" text-align="right">
-							<view class="video_t2">
+							<view class="video_t2" @click="activeStatus = !activeStatus">
 								共60节课
-								<u-icon name="arrow-right" size="28"></u-icon>
+								<u-icon name="arrow-right" size="28" style="transition: all 0.2s;margin-left:10rpx" :class="activeStatus ? 'rotoct' : ''"></u-icon>
 							</view>
 						</u-col>
 					</u-row>
-					<view class="scroll_box">
+					<!-- <view class="scroll_box">
 						<scroll-view class="r_sliper" scroll-x="true">
-							<view v-for="(item, index) in list" :key="index" style="margin-right: 20rpx;display:inline-block"><view class="r_t2">二级建造师市政..</view></view>
+							<view v-for="(item, index) in chapterList" :key="index" style="margin-right: 20rpx;display:inline-block"><view class="r_t2">{{item.name}}</view></view>
 						</scroll-view>
+					</view> -->
+					<view class="catalogBox" :class="activeStatus ? 'changeCatalogBox' : ''">
+						<view
+							class="catalogA"
+							v-for="(item, index) in chapterList"
+							:key="index"
+							:class="activeStatusCata === index ? 'activesq' : ''"
+							@click="activeList(item, index)"
+						>
+							{{ item.name }}
+							<span style="color: #1677FF;">试看</span>
+						</view>
 					</view>
 				</view>
 				<u-line color="#D6D6DB" />
@@ -63,7 +77,7 @@
 						</u-col>
 					</u-row>
 				</view>
-				<view class="t2">这是一段课程介绍文本,课程介绍内容可在后台设置编辑,以富 文本形式呈现,常见的由图片和文本组成。</view>
+				<view class="t2" v-html="pageData.introduction"></view>
 				<u-line color="#D6D6DB" />
 			</view>
 			<!-- 出题名师-->
@@ -79,9 +93,10 @@
 					</u-row>
 					<u-row>
 						<view style="margin: 25rpx;display: flex;">
-							<view><image src="/static/avatar1.png" class="teacher_img"></image></view>
+							<view><image :src="$method.splitImgHost(teacherInfo.avatar)" class="teacher_img"></image></view>
 							<view class="teacher_t">
-								建工学院名誉院长,建造师建筑资深导师,北京工业大学教授,建造师考试大纲编委会编委。参与过国家一级注册建造师考试大纲、考试辅导书、习题集等书的编写。
+								<view>{{ teacherInfo.teacherName }}</view>
+								<view>{{ teacherInfo.introduce }}</view>
 							</view>
 						</view>
 					</u-row>
@@ -128,7 +143,7 @@
 					<view class="sc_t">收藏</view>
 				</view>
 				<view style="text-align: center;margin-left: 30rpx;">
-					<view class="price_t1">¥699</view>
+					<view class="price_t1">¥{{ pageData.price }}</view>
 					<view class="price_t2">¥699</view>
 				</view>
 				<view class="buy" @click="jumpBuy">立即购买</view>
@@ -155,6 +170,8 @@ export default {
 					name: '相关推荐'
 				}
 			],
+			activeStatus: false, //课程目录下拉样式变化是否开启
+			activeStatusCata: 0, //当前选中章节
 			current: 0,
 			h1: 0,
 			h2: 0,
@@ -174,10 +191,14 @@ export default {
 			ts: '',
 			startStatus: false,
 			queryData: {},
-			pageData: {}
+			pageData: {},
+			chapterList: [],
+			teacherInfo: {}
 		};
 	},
 	onLoad(options) {
+		const Verify = require('@/wxcomponents/verify_mpsdk/main.js');
+		Verify.init();
 		this.queryData = options;
 		this.getCourseInfo();
 	},
@@ -247,15 +268,87 @@ export default {
 		}
 	},
 	methods: {
+		activeList(item, index) {
+			this.activeStatusCata = index;
+			this.$navTo.togo('/pages2/course/detail', item);
+		},
+		async certification() {
+			var self = this;
+			const faceBiz = await self.$api.facecertificationPicBizToken();
+			self.BizToken = faceBiz.data.data.bizToken;
+			wx.startVerify({
+				data: {
+					token: self.BizToken
+				},
+				success: result => {
+					setTimeout(() => {
+						console.log(999,result)
+						self.$api.facecertificationPicDetectInfo(self.BizToken).then(faceRec => {
+							if(faceRec.data.data === 0){
+								uni.showToast({
+									title: '识别成功',
+									icon: 'none',
+									duration: 2000
+								})  
+							}else{
+								uni.showToast({
+									title: '识别失败',
+									icon: 'none',
+									duration: 2000
+								})
+								console.log('识别失败')
+							}
+						});
+					}, 500);
+				},
+				fail: err => {
+					setTimeout(() => {
+						console.log('识别功能失败')
+						uni.showModal({
+							title: '提示',
+							content: err,
+							showCancel: false
+						});
+					}, 500);
+				}
+			});
+		},
 		getCourseInfo() {
-			var self = this
+			var self = this;
 			this.$api.courseInfo(this.queryData.courseId).then(res => {
 				console.log(res.data.data);
 				if (res.data.code === 200) {
 					self.pageData = res.data.data;
+					self.getChapter(res.data.data.courseId);
+					self.getTeacher(res.data.data.teacherIds);
 				}
 			});
 		},
+		getChapter(v) {
+			var self = this;
+			var data = {
+				courseId: v
+			};
+			this.$api.coursechapterlist(data).then(res => {
+				this.chapterList = res.data.rows;
+				res.data.rows.forEach((item, index) => {
+					var dataset = {
+						chapterId: item.chapterId
+					};
+					self.$api.coursesectionlist(dataset).then(result => {
+						console.log(result);
+					});
+				});
+			});
+		},
+		getTeacher(v) {
+			var data = {
+				teacherIds: v
+			};
+			this.$api.teacherList(data).then(res => {
+				this.teacherInfo = res.data.rows[0];
+			});
+		},
 		startVideo() {
 			uni.getStorageSync('union_id');
 			if (!uni.getStorageSync('union_id')) {
@@ -263,17 +356,18 @@ export default {
 					url: '/pages/login/login'
 				});
 			} else {
-				this.$api
-					.polyvVideoSign(this.vid)
-					.then(res => {
-						console.log(res);
-						this.startStatus = true;
-						// this.sign = res.data.data.sign;
-						// this.ts = res.data.data.ts;
-					})
-					.catch(err => {
-						console.log('报错');
-					});
+				this.certification();
+				// this.$api
+				// 	.polyvVideoSign(this.vid)
+				// 	.then(res => {
+				// 		console.log(res);
+				// 		this.startStatus = true;
+				// 		// this.sign = res.data.data.sign;
+				// 		// this.ts = res.data.data.ts;
+				// 	})
+				// 	.catch(err => {
+				// 		console.log('报错');
+				// 	});
 			}
 		},
 		touchMove(e) {
@@ -341,6 +435,46 @@ export default {
 }
 </style>
 <style scope>
+.catalogBox {
+	display: flex;
+	align-items: center;
+	flex-wrap: nowrap;
+	overflow-x: auto;
+	padding-left: 38rpx;
+	max-height: 305rpx;
+	overflow-y: auto;
+	transition: all 0.4s;
+}
+.catalogBox > .catalogA {
+	min-width: 200rpx;
+	height: 48rpx;
+	line-height: 48rpx;
+	// text-align: center;
+	border: 2rpx solid transparent;
+	white-space: nowrap;
+	text-overflow: ellipsis;
+	overflow: hidden;
+	word-break: break-all;
+	border-radius: 10rpx;
+	background: rgba(22, 119, 255, 0.05);
+	padding-left: 19rpx;
+	box-sizing: border-box;
+	padding-right: 15rpx;
+	margin-right: 16rpx;
+	margin-bottom: 20rpx;
+	margin-top: 15rpx;
+	font-size: 24rpx;
+	color: #666;
+}
+.catalogBox > .activesq {
+	border-color: #1677ff;
+}
+.changeCatalogBox {
+	display: block;
+}
+.catalogBox::-webkit-scrollbar {
+	display: none; /* Chrome Safari */
+}
 .box {
 	position: relative;
 	top: 600rpx;
@@ -471,7 +605,9 @@ export default {
 .video_box {
 	position: relative;
 }
-
+.rotoct {
+	transform: rotate(90deg);
+}
 page {
 	background: #ffffff;
 }

+ 33 - 25
pages2/wd/info.vue

@@ -7,7 +7,9 @@
 				个人职业成长定制服务!
 			</view>
 			<view style="display: flex;align-items: center;">
-				<view class="btn" style="margin-right: 5rpx;" :style="form.certified === 1 ? isStatus : ''" @click="form.certified === 0 ? certification() : iscertification()">{{form.certified === 0?'认证':'已认证'}}</view>
+				<view class="btn" style="margin-right: 5rpx;" :style="form.certified === 1 ? isStatus : ''" @click="form.certified === 0 ? certification() : iscertification()">
+					{{ form.certified === 0 ? '认证' : '已认证' }}
+				</view>
 				<view class="btn">编辑</view>
 			</view>
 		</view>
@@ -42,7 +44,7 @@
 					<pick-regions :defaultRegion="defaultRegionCode" @getRegion="handleGetRegion2">
 						<view class="picker">{{ form.province }} {{ form.city }} {{ form.district }}</view>
 					</pick-regions>
-				</u-form-item> 
+				</u-form-item>
 				<u-form-item label="政治面貌" :label-width="auto" prop="politic">
 					<picker @change="bindPickerChangePolitic" :value="form.politic" :range="array_politic">
 						<view class="picker">{{ array_politic[form.politic] }}</view>
@@ -192,9 +194,7 @@ export default {
 				}
 			});
 		},
-		iscertification(){
-			
-		},
+		iscertification() {},
 		async certification() {
 			var self = this;
 			const faceBiz = await self.$api.faceBizToken();
@@ -219,30 +219,38 @@ export default {
 				}
 			});
 		},
-		async submitForm() {
-			var self = this;
-			if (this.fileList.length > 0) {
+		imageInfos() {
+			var self = this
+			return new Promise((resolve, reject) => {
 				uni.getImageInfo({
-					src:self.fileList[0].url,
-					success(res) {
-						let canvasWidth = res.width //图片原始长宽
-						let canvasHeight = res.height
-						if(canvasWidth>1000||canvasHeight>1000){
+					src: self.fileList[0].url,
+					success: async res => {
+						let canvasWidth = res.width; //图片原始长宽
+						let canvasHeight = res.height;
+						if (canvasWidth > 1000 || canvasHeight > 1000) {
 							uni.compressImage({
-							  src: self.fileList[0].url,
-							  quality: 75,
-							  width:"50%",
-							  height:"50%",
-							  success: res => {
-							    console.log(res.tempFilePath,66)
-							  }
-							})
-						}else{
-							//无需压缩
+								src: self.fileList[0].url,
+								quality: 75,
+								width: '50%',
+								height: '50%',
+								success: async rest => {
+									const waitUpload = await self.uploadFile(rest.tempFilePath, 0);
+									resolve()
+								} 
+							});
+						} else {
+							console.log('无需压缩');
+							const waitUpload = await self.uploadFile(self.fileList[0].url, 0);
+							resolve()
 						}
 					}
-					})
-			//	const waitUpload = await self.uploadFile(dataURL, 0);
+				});
+			});
+		},
+		async submitForm() {
+			var self = this;
+			if (this.fileList.length > 0) {
+				const waitYS = await this.imageInfos();
 			}
 			var data = {
 				userId: this.form.userId,