فهرست منبع

对接凭证列表接口

chenxiong 3 سال پیش
والد
کامیت
f9ad75dd56
3فایلهای تغییر یافته به همراه69 افزوده شده و 18 حذف شده
  1. 11 0
      common/httpList/myStudent.js
  2. 3 0
      pages2/bank/questionBankTest.vue
  3. 55 18
      pages2/learn/my_learn.vue

+ 11 - 0
common/httpList/myStudent.js

@@ -26,4 +26,15 @@ export default {
 			data: data
 		})
 	},
+	/**
+	 * @param {Object} data
+	 * 查询用户证书列表
+	 */
+	getUserCertificateList(data) {
+		return myRequest({
+			url: '/user/certificate/list',
+			method: 'get',
+			data: data
+		})
+	},
 }

+ 3 - 0
pages2/bank/questionBankTest.vue

@@ -474,6 +474,7 @@ export default {
 							})
 							item.ans = arr;
 							item.analysisContent && (item.analysisContent = item.analysisContent.replace(/<img/gi, '<img style="max-width:100%;"'));
+							item.content && (item.content = item.content.replace(/<img/gi, '<img style="max-width:100%;"'));
 							return;
 						} else if(item.type == 5) { //简答题
 							item.ansText = {
@@ -481,6 +482,7 @@ export default {
 								imageList: []
 							}
 							item.analysisContent && (item.analysisContent = item.analysisContent.replace(/<img/gi, '<img style="max-width:100%;"'));
+							item.content && (item.content = item.content.replace(/<img/gi, '<img style="max-width:100%;"'));
 							
 						} else if(item.type == 4) { //案例题
 							console.log(item.jsonStr)
@@ -522,6 +524,7 @@ export default {
 							
 						}
 						item.analysisContent && (item.analysisContent = item.analysisContent.replace(/<img/gi, '<img style="max-width:100%;"'));
+						item.content && (item.content = item.content.replace(/<img/gi, '<img style="max-width:100%;"'));
 						item.ans = item.answerQuestion
 					}
 					

+ 55 - 18
pages2/learn/my_learn.vue

@@ -5,7 +5,7 @@
 		</view>
 		<view class="learnWrap">
 			<template v-if="current === 0">
-				<!-- <view class="noData">您暂无相关学时审核记录哦~</view> -->
+				<view class="noData" v-if="listData.length == 0">您暂无相关学时审核记录哦~</view>
 				<view class="learnItem" v-for="(item, index) in listData" :key="index">
 					<view class="title">{{ item.goodsName }}</view>
 					<view class="status">
@@ -75,18 +75,18 @@
 				</view>
 			</template>
 			<template v-if="current === 1">
-				<view class="noData">您暂无相关学习凭证记录哦~</view>
-				<!-- <view class="learnItem card">
-					<view class="title">2020年二建建筑工程管理与实补这是商品名称</view>
+				<view class="noData" v-if="listData.length == 0">您暂无相关学习凭证记录哦~</view>
+				<view class="learnItem card" v-for="(item,index) in listData" :key="index">
+					<view class="title">{{item.title}}</view>
 					<view class="number">
 						<text class="label">编号:</text>
-						GZXY123456789
+						{{item.certificateCode}}
 					</view>
 					<view class="btnBox">
-						<view class="btn" @click="showPhoto">电子照片</view>
-						<view class="btn" @click="downloadCard">下载凭证</view>
+						<view class="btn" @click="showPhoto(item)">电子照片</view>
+						<!-- <view class="btn" @click="downloadCard(item)">下载凭证</view> -->
 					</view>
-				</view> -->
+				</view>
 			</template>
 		</view>
 	</view>
@@ -98,6 +98,7 @@ export default {
 	components: {},
 	data() {
 		return {
+			loading:false,
 			current: 0,
 			list: [
 				{
@@ -121,15 +122,20 @@ export default {
 	},
 	onShow() {
 		if(this.itemIndex !== '') {
-			this.refreshByIndex();
+			if(this.current == 0) {
+				this.refreshByIndex();
+			}
+			
 		}
 	},
 	onReachBottom() {
-		console.log(111)
 		if(this.listData.length < this.total) {
 			this.param.pageNum++;
-			this.getcourseperiodlistGoods();
-			
+			if(this.current == 0) {
+				this.getcourseperiodlistGoods();
+			} else if(this.current == 1){
+				this.getUserCertificateList();
+			}
 		}
 	},
 	methods: {
@@ -174,13 +180,29 @@ export default {
 				this.$navTo.togo(`/pages2/wd/course?id=${v.goodsId}&gid=${v.gradeId}`);
 			}
 		},
+		getUserCertificateList() {
+			this.loading = true;
+			this.$api.getUserCertificateList(this.param).then(res => {
+				this.loading = false;
+				if (res.data.code === 200) {
+					this.listData = [...this.listData,...res.data.rows];
+					this.total = res.data.total;
+				}
+			}).catch(err => {
+				this.loading = false;
+			})
+		},
 		getcourseperiodlistGoods() {
+			this.loading = true;
 			this.$api.getcourseperiodlistGoods(this.param).then(res => {
+				this.loading = false;
 				if (res.data.code === 200) {
 					this.listData = [...this.listData,...res.data.rows];
 					this.total = res.data.total;
 				}
-			});
+			}).catch(err => {
+				this.loading = false;
+			})
 		},
 		appBeforeAddress(goodsId) {
 			this.$api.appBeforeAddress({
@@ -202,12 +224,26 @@ export default {
 			})
 		},
 		change(index) {
+			if(this.loading) {
+				return;
+			}
 			this.current = index;
+			this.listData = [];
+			this.total = 0;
+			this.param = {
+				pageNum:1,
+				pageSize:10
+			};
+			if(this.current == 0) {
+				this.getcourseperiodlistGoods();
+			} else if(this.current == 1){
+				this.getUserCertificateList();
+			}
 		},
-		showPhoto() {
+		showPhoto(item) {
 			// 预览图片
 			uni.previewImage({
-				urls: ['https://file.xyyxt.net/oss/images/file/20220111.jpg'],
+				urls: [this.$method.splitImgHost(item.certificatePath,true)],
 				longPressActions: {
 					itemList: ['发送给朋友', '保存图片', '收藏'],
 					success: function(data) {
@@ -219,11 +255,12 @@ export default {
 				}
 			});
 		},
-		downloadCard() {
+		downloadCard(item) {
+			console.log(this.$method.splitImgHost(item.certificatePath,true))
 			uni.downloadFile({
-			  url: 'https://gw.alipayobjects.com/os/bmw-prod/c134022a-1088-47e2-bb76-a33ec0519101.pdf?spm=a2c4g.11186623.0.0.cf863d1fUcFiPN&file=c134022a-1088-47e2-bb76-a33ec0519101.pdf',
+			  url: this.$method.splitImgHost(item.certificatePath,true),
 			  success: function (res) {
-				  console.log(999)
+				  console.log(res,'res')
 			    var filePath = res.tempFilePath;
 			    uni.openDocument({
 			      filePath: filePath,