he2802 преди 4 години
родител
ревизия
93aab765f3
променени са 1 файла, в които са добавени 204 реда и са изтрити 8 реда
  1. 204 8
      pages2/bank/question.vue

+ 204 - 8
pages2/bank/question.vue

@@ -1,15 +1,97 @@
 <template>
 	<view>
-		<view class="contentList">
+		<view v-if="nowPageData.type === 4" class="contentList">
 			<view class="headerTitle">
-				<view class="leftIcon" v-for="(item, index) in titleS" :key="index" v-if="item.value === list[nowPageData].type">
-					<span >{{ item.label }}</span>
+				<view class="leftIcon" v-for="(item, index) in titleS" :key="index" v-if="item.value === nowPageData.type">
+					<span>{{ item.label }}</span>
 				</view>
 				<view class="right">
 					1
 					<span class="lengNum">/10</span>
 				</view>
 			</view>
+			<view class="content">
+				<view class="contentTitle">{{ nowPageData.content }}</view>
+				<view class="imageBox" v-if="nowPageData.imgUrl && nowPageData.imgUrl !== null">
+					<image :src="$method.splitImgHost(nowPageData.imgUrl)" mode="aspectFit"></image>
+				</view>
+			</view>
+			<!---案例内容start -->
+			<view class="contentList" v-for="(itemst, indexst) in nowPageData.jsonStr" :key="indexst">
+				<view class="headerTitle">
+					<view class="leftIcon" v-for="(item, index) in titleS" :key="index" v-if="item.value === itemst.type">
+						<span>{{ item.label }}</span>
+					</view>
+				</view>
+				<!-- <view class="content">
+					<view class="contentTitle">{{ nowPageData.jsonStr[indexst].content }}</view>
+					<view class="imageBox" v-if="nowPageData.jsonStr[indexst].imgUrl && nowPageData.jsonStr[indexst].imgUrl !== null">
+						<image :src="$method.splitImgHost(nowPageData.jsonStr[indexst].imgUrl)" mode="aspectFit"></image>
+					</view>
+				</view>
+				<view
+					class="banksChiList"
+					v-for="(items, indexs) in nowPageData.jsonStr[indexst].answer"
+					:key="indexs"
+					:class="replyL.indexOf(indexs) !== -1 ? 'activeListBt' : ''"
+					@click="activeList(items, indexs)"
+				>
+					<view class="leftIndex">{{ alphabet[indexs] }}.</view>
+					<view class="bankTie">
+						<view>{{ items.content }}</view>
+						<image v-if="items.imgUrl && items.imgUrl !== null" :src="$method.splitImgHost(items.imgUrl)" mode="aspectFit"></image>
+					</view>
+				</view>
+				<view v-if="nowPageData.jsonStr[indexst].type === 3" class="banksChiList" :class="isWrong === 1 ? 'activeListBt' : ''" @click="activePD(1)">正确</view>
+				<view v-if="nowPageData.jsonStr[indexst].type === 3" class="banksChiList" :class="isWrong === 0 ? 'activeListBt' : ''" @click="activePD(0)">错误</view>
+				<view class="jxTit">
+					<span class="jxSpan">查看解析</span>
+					<u-icon name="info-circle" color="#999999" size="40"></u-icon>
+				</view> -->
+			</view>
+			<!-- -案例内容end -->
+			<view class="jxTit">
+				<span class="jxSpan">查看解析</span>
+				<u-icon name="info-circle" color="#999999" size="40"></u-icon>
+			</view>
+			<u-button type="primary" @click="submitChi">提交</u-button>
+		</view>
+		<view v-else class="contentList">
+			<view class="headerTitle">
+				<view class="leftIcon" v-for="(item, index) in titleS" :key="index" v-if="item.value === nowPageData.type">
+					<span>{{ item.label }}</span>
+				</view>
+				<view class="right">
+					1
+					<span class="lengNum">/10</span>
+				</view>
+			</view>
+			<view class="content">
+				<view class="contentTitle">{{ nowPageData.content }}</view>
+				<view class="imageBox" v-if="nowPageData.imgUrl && nowPageData.imgUrl !== null">
+					<image :src="$method.splitImgHost(nowPageData.imgUrl)" mode="aspectFit"></image>
+				</view>
+			</view>
+			<view
+				class="banksChiList"
+				v-for="(items, indexs) in nowPageData.jsonStr"
+				:key="indexs"
+				:class="replyL.indexOf(indexs) !== -1 ? 'activeListBt' : ''"
+				@click="activeList(items, indexs)"
+			>
+				<view class="leftIndex">{{ alphabet[indexs] }}.</view>
+				<view class="bankTie">
+					<view>{{ items.content }}</view>
+					<image v-if="items.imgUrl && items.imgUrl !== null" :src="$method.splitImgHost(items.imgUrl)" mode="aspectFit"></image>
+				</view>
+			</view>
+			<view v-if="nowPageData.type === 3" class="banksChiList" :class="isWrong === 1 ? 'activeListBt' : ''" @click="activePD(1)">正确</view>
+			<view v-if="nowPageData.type === 3" class="banksChiList" :class="isWrong === 0 ? 'activeListBt' : ''" @click="activePD(0)">错误</view>
+			<view class="jxTit">
+				<span class="jxSpan">查看解析</span>
+				<u-icon name="info-circle" color="#999999" size="40"></u-icon>
+			</view>
+			<u-button type="primary" @click="submitChi">提交</u-button>
 		</view>
 		<view class="footer_tab">
 			<u-line color="#D6D6DB" />
@@ -59,17 +141,28 @@ export default {
 			type: 1,
 			show: false,
 			list: [],
-			nowPageData: 0,
+			nowPageData: {},
 			titleS: [
 				{
-					label: '单选',
+					label: '单选',
 					value: 1
 				},
 				{
-					label: '多选',
+					label: '多选',
 					value: 2
+				},
+				{
+					label: '判断',
+					value: 3
+				},
+				{
+					label: '案例',
+					value: 4
 				}
-			]
+			],
+			alphabet: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
+			replyL: [],
+			isWrong: -1
 		};
 	},
 	onLoad(option) {
@@ -77,6 +170,36 @@ export default {
 	},
 	onShow() {},
 	methods: {
+		submitChi() {
+			var yesList = []; //记录正确项索引
+			this.nowPageData.jsonStr.forEach((item, index) => {
+				if (item.optionAnswer === 1) {
+					yesList.push(index);
+				}
+			});
+			var strYesList = yesList.sort().toString();
+			var isRight = strYesList == this.replyL.sort().toString(); //记录是否选择正确
+			if (this.nowPageData.type === 3) {
+				if (this.isWrong === this.nowPageData.answerQuestion) {
+					isRight = 1;
+				} else {
+					isRight = 0;
+				}
+			}
+
+			var objslit = []; //记录选中的选项对象
+			for (let i = 0; i < this.replyL.length; i++) {
+				objslit.push(this.nowPageData.jsonStr[this.replyL[i]]);
+			}
+
+			var objList = {
+				questionId: this.nowPageData.questionId,
+				selectIds: this.replyL.toString(),
+				replays: objslit,
+				isRight: isRight
+			};
+			console.log(objList);
+		},
 		titleListFn(option) {
 			if (option.bankSectionId) {
 				var data = {
@@ -89,9 +212,41 @@ export default {
 				};
 			}
 			this.$api.questiondetailList(data).then(res => {
-				this.list = res.data.rows;
+				if (res.data.rows.length) {
+					res.data.rows.forEach((items, indexs) => {
+						items.jsonStr = JSON.parse(items.jsonStr);
+					});
+					this.nowPageData = res.data.rows[3];
+					console.log(this.nowPageData);
+					this.list = res.data.rows;
+				} else {
+					uni.showToast({
+						title: '没有内容',
+						icon: 'none',
+						duration: 2000
+					});
+				}
 			});
 		},
+		activeList(data, int) {
+			if (this.nowPageData.type === 1) {
+				this.replyL = [int];
+			} else if (this.nowPageData.type === 2) {
+				if (this.replyL.indexOf(int) !== -1) {
+					for (var i = 0; i < this.replyL.length; i++) {
+						if (this.replyL[i] === int) {
+							this.replyL.splice(i, 1);
+						}
+					}
+				} else {
+					this.replyL.push(int);
+				}
+			}
+			console.log(this.replyL);
+		},
+		activePD(int) {
+			this.isWrong = int;
+		},
 		menu() {
 			this.show = true;
 		}
@@ -110,15 +265,36 @@ export default {
 }
 </style>
 <style scope>
+.activeListBt {
+	border: 2rpx solid #32467b !important;
+}
 .contentList {
 	padding: 0rpx 32rpx;
 }
+.contentList > .jxTit {
+	margin-top: 35rpx;
+}
+.contentList > .jxTit > .jxSpan {
+	color: #32467b;
+	font-size: 34rpx;
+	margin-right: 8rpx;
+}
 .contentList > .headerTitle {
 	display: flex;
 	align-items: center;
 	justify-content: space-between;
 	color: #32467b;
 }
+.contentList > .content {
+	margin: 25rpx 0rpx;
+}
+.contentList > .content > .contentTitle {
+	color: #333;
+	font-size: 28rpx;
+}
+.contentList > .content > .imageBox > image {
+	max-height: 300rpx;
+}
 .headerTitle > .leftIcon {
 	padding: 0rpx 10rpx;
 	height: 36rpx;
@@ -132,6 +308,26 @@ export default {
 	font-size: 28rpx;
 	color: #999999;
 }
+.banksChiList {
+	border: 2rpx solid transparent;
+	display: flex;
+	margin-bottom: 8rpx;
+	border-radius: 16rpx;
+	font-size: 34rpx;
+	width: 100%;
+	background-color: #f7fbff;
+	padding: 15rpx 18rpx;
+	box-sizing: border-box;
+}
+.banksChiList > .leftIndex {
+	width: 40rpx;
+}
+.banksChiList > .bankTie {
+	flex: 1;
+}
+.banksChiList > .bankTie > image {
+	max-width: 95%;
+}
 .btn_bac2 {
 	background: #32467b;
 	color: #fff;