Merge remote-tracking branch 'origin/master'

This commit is contained in:
yujicun
2023-01-12 17:50:34 +08:00
12 changed files with 288 additions and 71 deletions

View File

@@ -94,9 +94,11 @@
this.loadRecord();
},
watch:{
studyId(newVal){
content(newObj){
this.loadExamInfo();
this.loadRecord();
}
},
deep:true
},
methods: {
loadExamInfo(){
@@ -125,24 +127,25 @@
if(this.studyId==''){
return;
}
this.loadExamContent();
if(this.records.length==0){
let params={
studyId:this.studyId,
contentId:this.content.id
}
apiStudy.myExamList2(params).then(examRs=>{
if(examRs.status==200){
this.records=examRs.result;
let len=examRs.result.length;
if(this.info.times>len){
this.allowSubmit=true;
}else{
this.allowSubmit=false;
this.records=[];
this.loadExamContent();
//if(this.records.length==0){
let params={
studyId:this.studyId,
contentId:this.content.id
}
}
})
}
apiStudy.myExamList2(params).then(examRs=>{
if(examRs.status==200){
this.records=examRs.result;
let len=examRs.result.length;
if(this.info.times>len){
this.allowSubmit=true;
}else{
this.allowSubmit=false;
}
}
})
//}
},
startTest(){
//转向详细页面

View File

@@ -92,14 +92,12 @@
this.loadHomeworkInfo();
},
watch:{
studyId(newVal){
this.loadHomeworkInfo();
},
content(newVal,oldVal){
if(newVal.id!=oldVal.id){
this.loadHomeworkInfo();
}
}
},
deep:true
},
methods: {
loadHomeworkInfo(){

View File

@@ -9,6 +9,7 @@ let tokenName='';
let appId=''
let fileUrl='';
let version=1;
let scormPlayer='';
if(process.env.NODE_ENV === 'development'){
//本地开发环境
@@ -16,8 +17,9 @@ if(process.env.NODE_ENV === 'development'){
oldApiBaseUrl = '/uboeApi';
statApiBaseUrl='/statApi';
socialApiBaseUrl='/socialApi';
fileUrl = 'http://192.168.0.11:9090/cdn/upload';
fileUrl = 'http://127.0.0.1:9090/cdn/upload';
loginPath='/pages/login/login';
scormPlayer='http://localhost:9083/scorm-player';
}else if(process.env.ENV_TYPE === 'preview'){
// 预发布环境,当前配置未使用上
context='/mobile-release';
@@ -27,6 +29,7 @@ if(process.env.NODE_ENV === 'development'){
socialApiBaseUrl='/socialApi';
fileUrl = 'https://u.boe.com/upload';
loginPath='https://u.boe.com/m/loginuser';
scormPlayer='https://u.boe.com/newscorm/scorm-player';
}else if(process.env.ENV_TYPE === 'testing'){
// 测试环境
apiBaseUrl = '/systemapi';
@@ -35,6 +38,7 @@ if(process.env.NODE_ENV === 'development'){
socialApiBaseUrl='/socialApi';
fileUrl = 'https://u-pre.boe.com/upload';
loginPath='https://u-pre.boe.com/m/loginuser';
scormPlayer='https://u-pre.boe.com/newscorm/scorm-player';
}else{
// 生产环境
apiBaseUrl = '/systemapi';
@@ -43,6 +47,7 @@ if(process.env.NODE_ENV === 'development'){
socialApiBaseUrl='/socialApi';
fileUrl = 'https://u.boe.com/upload';
loginPath='https://u.boe.com/m/loginuser';
scormPlayer='https://u.boe.com/newscorm/scorm-player';
}
export default {
@@ -55,4 +60,5 @@ export default {
loginPath:loginPath,
fileUrl:fileUrl,
version:version,
scormPlayer:scormPlayer
}

View File

@@ -21,8 +21,11 @@
<view v-if="tipText!=''" style="text-align: center;color:red">
<text>{{tipText}}</text>
</view>
<view v-else>
<u-button type="primary" :disabled="startButton" v-if="testStatus == 1" @click="startTest()">{{btnText}}</u-button>
<view v-else style="text-align: center;">
<view v-if="testPaper.enabled">
<u-button type="primary" :disabled="startButton" v-if="testStatus == 1" @click="startTest()">{{btnText}}</u-button>
</view>
<view v-else style="color: #666666;">此考试已下架</view>
</view>
</view>
<view v-if="examStatus==2" style="text-align: center;color:#6d6d6d; ">考试已结束</view>
@@ -62,7 +65,12 @@
</view>
<!--试题内容-->
<view class="qitem">
<view class="qitem-info">[{{getQuestionType(curItem.type)}}]{{curItem.title}}</view>
<view class="qitem-info">
<view>[{{getQuestionType(curItem.type)}}]{{curItem.title}}</view>
<view v-if="curItem.images" class="qimg">
<img class="qimg-fit" :src="imageBaseUrl+curItem.images"/>
</view>
</view>
<view v-if="curItem.type == 3">
<view class="qitem-opts">
<view class="qitem-opt" :class="{check:curItem.userAnswer == 'true'}"
@@ -84,12 +92,18 @@
{{toLetter(optIdx+1)}}.{{opt.content}}
<u-icon v-if="opt.id==curItem.userAnswer" name="checkbox-mark" color="#00aa00"></u-icon>
</view>
<view v-if="opt.images" class="qimg">
<img class="qimg-fit" :src="imageBaseUrl+opt.images"/>
</view>
</view>
<view class="qitem-opts" v-if="curItem.type == 2">
<view class="qitem-opt" :class="{check:(curItem.userAnswer && curItem.userAnswer.indexOf(opt.id) > -1)}" @click="chooseOption(opt)">
{{toLetter(optIdx+1)}}.{{opt.content}}
<u-icon v-if="curItem.userAnswer && curItem.userAnswer.indexOf(opt.id) > -1" name="checkbox-mark" color="#00aa00"></u-icon>
</view>
<view v-if="opt.images" class="qimg">
<img class="qimg-fit" :src="imageBaseUrl+opt.images"/>
</view>
</view>
</view>
</view>
@@ -123,6 +137,7 @@
</template>
<script>
import config from '@/config/index.js'
import apiTestPaper from '@/api/modules/testPaper.js'
import { correctJudgment, numberToLetter, examType,toScoreTow } from '@/utils/tools.js';
import { formatDate, formatSeconds } from '@/utils/index.js';
@@ -132,6 +147,7 @@
return {
toScoreTow,
startButton: false,
imageBaseUrl:config.fileUrl,
examId: '', //考试的id
taskId: '', //考试任务的id
lastId: '', //最后一次提交的答卷
@@ -817,4 +833,11 @@
// display: flex;
// justify-content: space-around;
}
.qimg{
width:100%;
.qimg-fit{
width:100%;
object-fit:scale-down
}
}
</style>

View File

@@ -1,5 +1,5 @@
<template>
<!--考试页面用户在此页面一个试题一个试题的回答-->
<!--考试页面此页面是备份 未使用到-->
<view>
<u-toast ref="messager"></u-toast>
<view style="text-align: center;padding: 10px;"><text class="title-name">{{testPaper.testName}}</text></view>

View File

@@ -179,11 +179,13 @@
import apiMessage from '@/api/system/message.js'
import {toScore} from '@/utils/tools.js'
import apiBoeCourse from '@/api/boe/course.js'
import apiUserGroup from "@/api/modules/usergroup.js";
import apiYearMedal from '@/api/phase2/yearMedal.js'
import { mapGetters,mapActions} from 'vuex';
export default {
data(){
return {
audiences:[],
noPageList: true,//判断接口是否还有数据
noDataList: true,//判断接口是否还有数据
msgNum:0,

View File

@@ -37,7 +37,7 @@
</view>
<view class="medal-list-index" v-if="year2023" >
<view class="medal-img-index">
<image style="width:136upx;height:152upx" src="/static/images/medal//medal2023.png" mode=""></image>
<image style="width:136upx;height:152upx" src="/static/images/medal//medal20231.png" mode=""></image>
<text class="img-name">元旦勋章 </text>
<text class="img-level"></text>
</view>

View File

@@ -277,6 +277,8 @@
import {toScore} from '@/utils/tools.js'
import apiArticle from '@/api/modules/article.js'
import apiBoeCourse from '@/api/boe/course.js'
import apiUserGroup from "@/api/modules/usergroup.js";
import { mapGetters } from 'vuex'
export default{
data(){
return{
@@ -336,9 +338,32 @@
this.conType=1;
}
this.loadSeachWords();
if(this.audiences.length==0){
//let hasIds;
// let hasIds=sessionStorage.getItem(localKey);
// if(hasIds && hasIds.length>0){
// this.audiences=hasIds.split(",");
// this.search();
// }else{
//console.log(this.userInfo,'this.userInfo')
Promise.all([apiBoeCourse.audience(this.userInfo.sysId),apiUserGroup.userGroupIds()]).then(rs=>{
//console.log(rs,'rs');
let aids=[];
if(rs[0].status==200){
aids.push(rs[0].result);
}
if(rs[1].status==200){
aids.push(rs[1].result);
}
this.audiences=aids;
//sessionStorage.setItem(localKey,this.audiences);
//this.search();
})
//}
}
},
computed:{
...mapGetters(['userInfo'])
},
onPullDownRefresh() {
this.onReachBottom();
@@ -452,16 +477,16 @@
this.qa.params.keyword=this.keyword;
if(this.keyword!=''){
if(this.conType==1){
if(this.course.loadStatus=='more'){
if(this.course.loadStatus=='more' && this.course.list.length==0){
this.loadCourseData();
}
}else if(this.conType==2){
if(this.article.loadStatus=='more'){
if(this.article.loadStatus=='more' && this.article.list.length==0){
this.loadArticleData();
}
}else if(this.conType==4){
if(this.qa.loadStatus=='more'){
if(this.qa.loadStatus=='more' && this.qa.list.length==0){
this.loadQaData();
}
}
@@ -497,23 +522,29 @@
resetFilters(){
this.stepIndex=2;
this.filterTags=[];
this.course.filters=[];
this.course.list=[];
this.course.params.pageIndex=1;
this.course.loadStatus='more';
this.article.filters=[];
this.article.list=[];
this.article.params.pageIndex=1;
this.article.loadStatus='more';
this.qa.filters=[];
this.qa.list=[];
this.qa.params.pageIndex=1;
this.qa.loadStatus='more';
if(this.conType==1){
this.course.filters=[];
this.course.list=[];
this.course.params.pageIndex=1;
this.course.loadStatus='more';
this.loadCourseData();
}else if(this.conType==2){
this.article.filters=[];
this.article.list=[];
this.article.params.pageIndex=1;
this.article.loadStatus='more';
this.loadArticleData();
}else if(this.conType==4){
this.qa.filters=[];
this.qa.list=[];
this.qa.params.pageIndex=1;
this.qa.loadStatus='more';
this.loadQaData();
}
if(this.keyword!=''){
@@ -553,6 +584,7 @@
async loadCourseData(){
uni.showLoading({title:'加载中...'});
this.course.params.keyword=this.keyword;
this.course.params.audiences=this.audiences.join(',');
//查询课程
let $this=this;
let dataList = [];

View File

@@ -82,6 +82,10 @@
</view>
<view v-if="articleMore" @click="showMore" style="text-align: center;color: #387DF7;"><text>查看更多</text> </view>
</view>
<div v-if="curContent.contentType == 50" style="min-height: 500px;">
<!--因为web-view 动态切换地址不好用所以这里先使用iframe-->
<iframe v-if="scormUrl" :src="scormUrl" frameborder="0" scrolling="no" border="0px" style="width:100%;height:500px;border:0px;"></iframe>
</div>
<view v-if="curContent.contentType==52">
<!--外连接-->
<view v-if="conLink.url!=''" style="min-height: 400px;position: relative;">
@@ -395,6 +399,7 @@
</template>
<script>
import config from '@/config/index.js'
import apiCoursePortal from '@/api/modules/coursePortal.js'
import apiCourseStudy from '@/api/modules/courseStudy.js'
import apiVideoStudy from "@/api/modules/videoStudy.js";
@@ -473,7 +478,8 @@
localTimeKey:'boeu-study-time' ,//本地存储的学习时长的key json格式
localTimeValue:0,//计算的时间
appendStudyOtherHandle:null,
articleMore:true
articleMore:true,
scormUrl:'',
}
},
computed: {
@@ -704,7 +710,20 @@
this.playContent(this.curContent,0);
//this.curSection=this.sectionList[0];
}else{
this.curContent=this.contentList[0];
let treelist=this.catalogTree;
this.curSection=treelist[0].sec;
this.curContent=treelist[0].children[0];
// this.curContent=this.contentList[0];
// this.curSection=this.sectionList[0];
//要不要在这里处理?
// if(this.curContent.contentType==10 || this.curContent.contentType==20){
// if(this.contentList[0].content.startsWith('\{')){
// this.curriculumData=JSON.parse(this.contentList[0].content);
// }else{
// this.curriculumData.url=this.contentList[0].content;
// }
// }
//this.curContent=this.contentList[0];
this.playContent(this.curContent,0);
}
uni.hideLoading();
@@ -813,8 +832,10 @@
},
//更换播放内容
changePlayRes(con){
this.scormUrl='';//清空地址
this.articleMore=true;
this.clearTimeHandle();
//this.curContent=0;
// console.log(con,'con');
this.playerBoxShow=false;
if(con.contentType==40){
@@ -831,6 +852,31 @@
}
});
}
}else if(con.contentType==50){ //scorm课件的内容
apiCourseFile.detail(con.contentRefId).then(cfrs => {
if(cfrs.status==200){
//this.curCFile = cfrs.result;
//this.scormUrl=cfrs
let pars='?mode=normal&r='+Math.random();
pars+='&scormId='+cfrs.result.id;
pars+='&courseId='+this.courseId;
pars+='&contentId='+con.id;
pars+='&studentId='+this.userInfo.aid;
pars+='&studentName='+encodeURIComponent(this.userInfo.name);
pars+='&lmsId='+this.studyId;
pars+='&scoId=';//不指定scorm模块自动根据学习记录定位
pars+='&r='+Math.random();//加一个随机数,以便重新加载
let urlPre=window.location.protocol;
let configUrl=config.scormPlayer;
configUrl=urlPre+configUrl.substring(configUrl.indexOf(':')+1);
this.scormUrl=configUrl+pars;//播放的首页
console.log(this.scormUrl,'this.scormUrl')
}
});
}else if(con.contentType==52){
if(con.content.startsWith('\{')){
this.conLink=JSON.parse(con.content);
@@ -848,6 +894,7 @@
this.blobUrl=this.fileBaseUrl+this.curriculumData.url;
//console.log(this.blobUrl,'this.blobUrl');
}
//console.log(con.contentType,'con.contentType');
this.curContent=con;
this.catalogShow=false;
this.scoreInfo.itemId=con.id;

View File

@@ -12,13 +12,19 @@
</view>
<!--试题内容-->
<view class="qitem">
<view class="qitem-info">[{{getTypeName(curItem.type)}}]{{curItem.content}}</view>
<view class="qitem-info">
<view> [{{getTypeName(curItem.type)}}]{{curItem.content}}</view>
<view class="qimg" v-if="curItem.images"><img class="qimg-fit" :src="imageBaseUrl+curItem.images"/></view>
</view>
<view v-for="(opt,optIdx) in curItem.options" :key="optIdx">
<view class="qitem-opts">
<view class="qitem-opt" :class="{check:opt.checked}" @click="chooseOption(opt)">
{{toLetter(optIdx+1)}}.{{opt.content}}
<u-icon v-if="opt.checked" name="checkbox-mark" color="#00aa00"></u-icon>
</view>
<view v-if="opt.images" class="qimg">
<img class="qimg-fit" :src="imageBaseUrl+opt.images"/>
</view>
</view>
</view>
</view>
@@ -51,8 +57,10 @@
</template>
<script>
import config from '@/config/index.js'
import apiCourseStudy from '@/api/modules/courseStudy.js'
import apiCourse from '@/api/modules/course.js';
import apiExamPaper from '@/api/modules/paper.js';
import {formatDate,getQuestionType,correctJudgment,numberToLetter} from '@/utils/tools.js';
export default {
data() {
@@ -63,6 +71,7 @@
startTime:null,
toLetter:numberToLetter,
getTypeName:getQuestionType,
imageBaseUrl:config.fileUrl,
info:{},
stop:false,
paper:[],
@@ -100,28 +109,48 @@
apiCourse.getExam(this.examId).then(res=>{
if(res.status==200){
this.info=res.result;
let paper= JSON.parse(this.info.paperContent);
paper.items.forEach(item=>{
//console.log(item);
if(item.type==101){
item.userAnswer='';
}else if(item.type==102){
item.userAnswer=[];
}else{
item.userAnswer=''
}
item.options.forEach(opt=>{
opt.checked=false;
})
})
this.total=paper.items.length;
this.paper =paper;
//console.log(this.paper);
this.curItem=paper.items[this.curIndex];
this.startTime=new Date();//记录开始时间
this.timerValue=res.result.testDuration;
this.timer=setInterval(this.changeTimer,60000);
this.loadStudyItemId();
if(this.info.paperType==2){
apiExamPaper.getPaperContent(this.info.paperId).then(rs=>{
if(rs.status==200){
//console.log(rs.result)
let paperItems=JSON.parse(rs.result);
//console.log(this.examPaper.json,'this.examPaper.json');
let qitems=this.convertToItems(paperItems);
this.paper ={items:qitems};
this.total=qitems.length;
this.curItem=qitems[this.curIndex];
this.startTime=new Date();//记录开始时间
this.timerValue=this.info.testDuration;
this.timer=setInterval(this.changeTimer,60000);
}else{
this.$message.error('加载试卷内容失败,请与管理员联系,试卷是否已删除');
}
})
}else{
let paper= JSON.parse(this.info.paperContent);
paper.items.forEach(item=>{
//console.log(item);
if(item.type==101){
item.userAnswer='';
}else if(item.type==102){
item.userAnswer=[];
}else{
item.userAnswer=''
}
item.options.forEach(opt=>{
opt.checked=false;
})
})
this.total=paper.items.length;
this.paper =paper;
//console.log(this.paper);
this.curItem=paper.items[this.curIndex];
this.startTime=new Date();//记录开始时间
this.timerValue=res.result.testDuration;
this.timer=setInterval(this.changeTimer,60000);
}
}else if(res.status==404){
//没有找到考试信息
}else{
@@ -129,6 +158,56 @@
}
})
},
//独立考试的试题转化为课内考试的试题
convertToItems(questions){
let qitems=[];
questions.forEach(item=>{
let q={
id:item.id,
type:item.type==1? 101:item.type==2? 102:103,
score:item.defaultScore,
checked:false,
userAnswer:'',
optShow:true,
content:item.title,
images:item.images,
options:[]
}
if(item.type==3){
q.options.push({
id:item.id+'1',
images:'',
content:"正确",
answer:item.answer=='true'? true:false,
checked:false
});
q.options.push({
id:item.id+'2',
images:'',
content:"错误",
answer:item.answer=='true'? false:true,
checked:false
})
}else{
item.optionList.forEach(opt=>{
q.options.push({
id:opt.id,
images:opt.images,
content:opt.content,
answer:opt.isAnswer,
checked:false
})
});
}
if(q.type==102){
q.userAnswer=[];
}
qitems.push(q);
});
console.log(qitems,'qitems')
return qitems;
},
loadStudyItemId(){
//获取studyItemId;
apiCourseStudy.getStudyContentItem(this.studyId,this.info.contentId).then(rs=>{
@@ -363,5 +442,14 @@
display: flex;
justify-content: space-around;
}
.qimg{
//padding-left: 30px;
width:100%;
text-align: left;
.qimg-fit{
width:100%;
object-fit:scale-down
}
}
</style>

View File

@@ -1,6 +1,6 @@
<template>
<!--考试试卷详细信息考试过的试卷内容-->
<view>
<view style="padding-bottom: 60px;">
<u-toast ref="messager"></u-toast>
<page-title :showBack="true">查看我的答卷</page-title>
<view style="background-color: #FFFFFF;">
@@ -14,10 +14,16 @@
<view style="padding-top: 10upx;color: #757575; ">{{curIndex+1}} / {{total}}</view>
</view>
<view class="qitem">
<view class="qitem-content">[{{getTypeName(curItem.type)}}]{{curItem.content}}</view>
<view class="qitem-content">
<view>[{{getTypeName(curItem.type)}}]{{curItem.content}}</view>
<view class="qimg" v-if="curItem.images"><img class="qimg-fit" :src="imageBaseUrl+curItem.images"/></view>
</view>
<view v-for="(opt,optIdx) in curItem.options" :key="optIdx" class="qitem-opt" :class="{'qitem-opt-user':userOptIdxs.indexOf(optIdx)>-1}">
<view>
<view>{{toLetter(optIdx+1)}}, {{opt.content}}</view>
<view v-if="opt.images" class="qimg">
<img class="qimg-fit" :src="imageBaseUrl+opt.images"/>
</view>
</view>
<view>
<text v-if="userOptIdxs.indexOf(optIdx)>-1 && correctOptIdxs.indexOf(optIdx)>-1" style="color: #00aa00; "></text>
@@ -56,6 +62,7 @@
</template>
<script>
import config from '@/config/index.js'
import apiCourseStudy from '@/api/modules/courseStudy.js'
import {formatDate,getQuestionType,correctJudgment,numberToLetter} from '@/utils/tools.js';
export default {
@@ -64,6 +71,7 @@
recordId:'',//保存的考试记录的id
toLetter:numberToLetter,
getTypeName:getQuestionType,
imageBaseUrl:config.fileUrl,
paper:{
items:[]
},
@@ -392,4 +400,14 @@
text-align: center;
line-height: 52px;
}
.qimg{
//padding-left: 30px;
width:100%;
text-align: left;
.qimg-fit{
width:100%;
object-fit:scale-down
}
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB