1、添加配置视频播放地址 (开发相关,正式环境应该是同一个地址)

2、考试界面 处理 一个课件考完再另一个(添加了一些参数)
3、查看试卷 优化
4、位掩码 根据答案 获取选择项
5、添加 根据附件地址 用公共组件 显示附件 数据装箱方法
This commit is contained in:
wyw 2026-03-06 11:29:24 +08:00
parent 2341cd3197
commit 06539bb26b
3 changed files with 181 additions and 104 deletions

View File

@ -76,7 +76,9 @@ const getServiceHost = api => {
}, { }, {
TL: 5179 TL: 5179
}, },
{ SK: 5180 } {
SK: 5180
}
] ]
let port = 5112 let port = 5112
for (let i = 0; i < apimodules.length; i++) { for (let i = 0; i < apimodules.length; i++) {
@ -105,6 +107,7 @@ if (process.env.CUSTOM_PLATFORM === "dev") {
uni_app_web_url: "", // uni_app_web_url: "", //
uni_app_web_api_url: "http://localhost", // 请求接口的地址 uni_app_web_api_url: "http://localhost", // 请求接口的地址
uni_app_web_source_url: "http://localhost:5199", // 资源地址 uni_app_web_source_url: "http://localhost:5199", // 资源地址
uni_app_web_video_source_url: "http://localhost:5199", // 视频资源地址
uni_app_web_local_api_url: "http://localhost", // 请求接口的地址 uni_app_web_local_api_url: "http://localhost", // 请求接口的地址
} }
} else if (process.env.CUSTOM_PLATFORM === "test") { } else if (process.env.CUSTOM_PLATFORM === "test") {
@ -118,6 +121,7 @@ if (process.env.CUSTOM_PLATFORM === "dev") {
uni_app_web_url: "", // uni_app_web_url: "", //
uni_app_web_api_url: "http://121.41.2.71", // 请求接口的地址 uni_app_web_api_url: "http://121.41.2.71", // 请求接口的地址
uni_app_web_source_url: "http://121.41.2.71:5199", // 资源地址 uni_app_web_source_url: "http://121.41.2.71:5199", // 资源地址
uni_app_web_video_source_url: "http://localhost:5199", // 视频资源地址
uni_app_web_local_api_url: "http://121.41.2.71", // 请求接口的地址 uni_app_web_local_api_url: "http://121.41.2.71", // 请求接口的地址
} }
} else } else
@ -131,8 +135,10 @@ if (process.env.CUSTOM_PLATFORM === "dev") {
uni_app_web_url: "", uni_app_web_url: "",
uni_app_web_api_url: APP_ENV === 'release' ? "http://124.117.209.78" : "http://121.41.2.71", uni_app_web_api_url: APP_ENV === 'release' ? "http://124.117.209.78" : "http://121.41.2.71",
uni_app_web_source_url: APP_ENV === 'release' ? "http://124.117.209.78:5199" : "http://121.41.2.71:5199", uni_app_web_source_url: APP_ENV === 'release' ? "http://124.117.209.78:5199" : "http://121.41.2.71:5199",
uni_app_web_video_source_url: APP_ENV === 'release' ? "http://124.117.209.78:5199" :
"https://sps.cxtc.com:3199", // 视频资源地址
uni_app_web_local_api_url: APP_ENV === 'release' ? "http://124.117.209.78" : uni_app_web_local_api_url: APP_ENV === 'release' ? "http://124.117.209.78" :
"http://121.41.2.71" //打包测试: 121.41.2.71 开发可 localhost "http://localhost" //打包测试: 121.41.2.71 开发可 localhost
} }

View File

@ -44,49 +44,35 @@
<u--input v-model="score" disabled disabledColor="#fff" border="none" <u--input v-model="score" disabled disabledColor="#fff" border="none"
inputAlign="right"></u--input> inputAlign="right"></u--input>
</u-form-item> </u-form-item>
<view class="video" v-if="this.TaskID && this.TaskID.length > 0"> <view class="video" v-if="this.isViedo&& this.isCourEdit&&this.filepath&&this.filepath.length>1">
<uni-card margin="0" :is-shadow="true"> <uni-card margin="0" :is-shadow="true">
<u--form labelPosition="left" labelWidth="auto" labelAlign="center" ref="wForm" <u--form labelPosition="left" labelWidth="auto" labelAlign="center" ref="wForm"
errorType="border-bottom"> errorType="border-bottom">
<video id="myVideo" @ended="onEnd()" @timeupdate="onTimeUpdate" <video id="myVideo" @ended="onEnd()" @timeupdate="onTimeUpdate" :src='this.filepath'
src='https://sps.cxtc.com:3199/BT/VIDEO/20251226/251226100216835841.mp4'
controls></video> controls></video>
</u--form> </u--form>
<u--form labelPosition="left" labelWidth="auto" labelAlign="center" ref="wForm" </uni-card>
errorType="border-bottom"> </view>
<video id="myVideo" @ended="onEnd()" @timeupdate="onTimeUpdate" <u-form-item v-if="this.isViedo==false&& this.isCourEdit&&this.filepath&&this.filepath.length>1"
src='https://sps.cxtc.com:3199/BT/VIDEO/20251226/12345.mp4' controls></video> label="课件附件:" borderBottom>
<full-upload v-model="this.filepathf" :isShowBtn="false"></full-upload>
</u-form-item>
</u--form> </u--form>
</uni-card> </uni-card>
</view> </view>
</u--form> <u-sticky offset-top="20" v-if="isViedoEnd">
</uni-card>
</view>
<u-sticky offset-top="20">
<view class="sub-form"> <view class="sub-form">
<view class="sub-form-wrap"> <view class="sub-form-wrap">
<u--form labelPosition="left" labelWidth="auto" labelAlign="center" errorType="border-bottom" <u--form labelPosition="left" labelWidth="auto" labelAlign="center" errorType="border-bottom"
ref="sForm"> ref="sForm">
<uni-card style="margin-bottom: 16px;" margin="0" spacing="0" :is-shadow="false" <uni-card style="margin-bottom: 16px;" margin="0" spacing="0" :is-shadow="false"
v-for="(item, index) in papers"> v-for="(item, index) in perPaper">
<!-- papers -->
<u-form-item> <u-form-item>
<view class="uni-flex uni-column"> <view class="uni-flex uni-column">
<view>{{(index+1)+'. '+ item.Nav_Test.NAME+getType(item.Nav_Test.TYPE)}}</view> <view>{{(index+1)+'. '+ item.Nav_Test.NAME+getType(item.Nav_Test.TYPE)}}</view>
<view> <view>
<!-- <u-radio-group v-if="item.Nav_Test.TYPE==0" v-model="item.ANSWER1"
placement="column">
<u-radio :customStyle="{marginBottom: '4px',marginTop: '4px'}"
v-for="(item1, index1) in radiolist1" :key="index1" :label="item1.name"
:name="item1.name" @change="doTrueOrFalse(index1,item)"
:disabled="readonly" />
</u-radio-group> -->
<!-- <u-radio-group v-if="item.Nav_Test.TYPE==1" v-model="item.ANSWER2"
placement="column">
<u-radio :customStyle="{marginBottom: '4px',marginTop: '4px'}"
v-for="(item2, index2) in radiolist2[item.ID]" :key="index2"
:label="item2.name" :name="item2.name"
@change="doOptionChange(index2,item)" :disabled="readonly" />
</u-radio-group> -->
<u-radio-group v-if="item.Nav_Test.TYPE==0" v-model="item.ANSWER" <u-radio-group v-if="item.Nav_Test.TYPE==0" v-model="item.ANSWER"
placement="column"> placement="column">
<u-radio :customStyle="{marginBottom: '4px',marginTop: '4px'}" <u-radio :customStyle="{marginBottom: '4px',marginTop: '4px'}"
@ -119,7 +105,7 @@
</view> </view>
</u-sticky> </u-sticky>
<view class="bottom-button"> <view class="bottom-button">
<button type="primary" v-if="tableKey==1" @click="submit">提交</button> <button type="primary" v-if="tableKey==1" @click="submit">{{this.btnText}}</button>
</view> </view>
</view> </view>
</template> </template>
@ -138,7 +124,8 @@
guid, guid,
initFilter, initFilter,
initFilterGroup, initFilterGroup,
getSelectedOptions getSelectedOptions,
getFileShow
} from '../../../../utils/common' } from '../../../../utils/common'
import { import {
getRequest, getRequest,
@ -150,13 +137,13 @@
model: { model: {
ORG_ID: "", ORG_ID: "",
}, },
papers: [], papers: [], //wyw perPaper 20260306
viewAll: false, viewAll: false,
record: null, record: null,
notify: null, notify: null,
UserList: [], UserList: [],
SelUsrID: null, SelUsrID: null,
config: null, configE: null,
score: 0, score: 0,
END_TIME: null, END_TIME: null,
readonly: true, readonly: true,
@ -180,8 +167,19 @@
EDIT_ID: '', EDIT_ID: '',
SelUsrNAME: '', SelUsrNAME: '',
ORG_ID: uni.getStorageSync('orgId'), ORG_ID: uni.getStorageSync('orgId'),
filepath: 'https://sps.cxtc.com:3199/BT/VIDEO/20251226/251226100216835841.mp4' isCourEdit: false, //
isViedo: false,
isViedoEnd: true,
filepath: '',
filepathf: [],
btnText: '提交', //''
perPaper: [], // wyw 20260306
listPath: [],
indexCour: -1 //
} }
// https: //sps.cxtc.com:3199/BT/VIDEO/20251226/251226100216835841.mp4
// https: //sps.cxtc.com:3199/BT/VIDEO/20251226/12345.mp4
}, },
onLoad(option) { onLoad(option) {
this.TaskID = option.taskID ? option.taskID : ''; this.TaskID = option.taskID ? option.taskID : '';
@ -228,7 +226,7 @@
if (!this.TaskID) { if (!this.TaskID) {
scort = 'TEXT_ID' scort = 'TEXT_ID'
} }
const json = initFilter(this.ORG_ID, "", scort, 1) const json = initFilter(this.ORG_ID, this.TaskID, scort, 1)
if (this.TaskID) { if (this.TaskID) {
extendRule(json, 'TEXT_ID', 1, this.model.ID); extendRule(json, 'TEXT_ID', 1, this.model.ID);
} else { } else {
@ -247,13 +245,20 @@
extendInclude(json, 'Nav_User'); extendInclude(json, 'Nav_User');
getRequest(json, "/SE/SETrainRecord/GetUserPapers").then(res => { getRequest(json, "/SE/SETrainRecord/GetUserPapers").then(res => {
this.model = res this.model = res
if (this.tableKey == '1' && res.listPath != null && res.listPath.length > 0) {
this.isCourEdit = true //
this.listPath = res.listPath
}
if (res.listPath.length > 1) {
this.btnText = '下一题'
}
if (res && res.Nav_Papers && res.Nav_Papers.length > 0) { if (res && res.Nav_Papers && res.Nav_Papers.length > 0) {
let papers = res.Nav_Papers.sort((a, b) => { let papers = res.Nav_Papers.sort((a, b) => {
return a.Nav_Test.TYPE - b.Nav_Test.TYPE return a.Nav_Test.TYPE - b.Nav_Test.TYPE
}); });
let config = res.Nav_Config;
let configE = res.Nav_Config;
let record = res.Nav_Papers[0].Nav_Record; let record = res.Nav_Papers[0].Nav_Record;
let notify = record ? record.Nav_Notify : null; let notify = record ? record.Nav_Notify : null;
let hasAnswered = false; let hasAnswered = false;
@ -265,6 +270,7 @@
this.papers = papers; this.papers = papers;
this.papers.forEach(item => { this.papers.forEach(item => {
if (item.Nav_Test.TYPE == 2) { if (item.Nav_Test.TYPE == 2) {
//
item.ANSWER3 = getSelectedOptions(item.ANSWER) item.ANSWER3 = getSelectedOptions(item.ANSWER)
} }
let test = {} let test = {}
@ -280,59 +286,46 @@
name: item.Nav_Test.OPTION_C, name: item.Nav_Test.OPTION_C,
value: 4 value: 4
}, ) }, )
if (item.Nav_Test.OPTION_D != undefined && item.Nav_Test.OPTION_D != "") { if (item.Nav_Test.OPTION_D != undefined && item.Nav_Test.OPTION_D !=
"") {
this.radiolist2[item.ID].push({ this.radiolist2[item.ID].push({
name: item.Nav_Test.OPTION_D, name: item.Nav_Test.OPTION_D,
value: 8 value: 8
}) })
} }
if (item.Nav_Test.OPTION_E != undefined && item.Nav_Test.OPTION_E != "") { if (item.Nav_Test.OPTION_E != undefined && item.Nav_Test.OPTION_E !=
"") {
this.radiolist2[item.ID].push({ this.radiolist2[item.ID].push({
name: item.Nav_Test.OPTION_E, name: item.Nav_Test.OPTION_E,
value: 16 value: 16
}) })
} }
} }
// if (item.Nav_Test.TYPE == 0) {
// if (item.ANSWER == 1) {
// item.ANSWER = "";
// } else if (item.ANSWER == 2) {
// item.ANSWER = "";
// }
// if (item.Nav_Test.ANSWER == 1) {
// item.Nav_Test.ANSWER = "";
// } else if (item.ANSWER == 2) {
// item.Nav_Test.ANSWER = "";
// }
// } else if (item.Nav_Test.TYPE == 1) {
// switch (item.ANSWER) {
// case 1:
// item.ANSWER = item.Nav_Test.OPTION_A;
// break;
// case 2:
// item.ANSWER = item.Nav_Test.OPTION_B;
// break;
// case 4:
// item.ANSWER = item.Nav_Test.OPTION_C;
// break;
// case 8:
// item.ANSWER = item.Nav_Test.OPTION_D;
// break;
// case 16:
// item.ANSWER = item.Nav_Test.OPTION_E;
// break;
// }
// } else if (item.Nav_Test.TYPE == 2) {
// item.ANSWER = this.findSelectedOptions(item.ANSWER, item.Nav_Test.OPTION_A,
// item.Nav_Test.OPTION_B, item.Nav_Test.OPTION_C, item.Nav_Test
// .OPTION_D, item.Nav_Test.OPTION_E);
// }
}) })
this.config = config; this.configE = configE;
this.record = record; this.record = record;
this.notify = notify; this.notify = notify;
this.readonly = hasAnswered; this.readonly = hasAnswered;
this.score = this.papers[0].SCORE; this.score = this.papers[0].SCORE;
if (this.isCourEdit) {
this.submit()
} else {
this.perPaper = this.papers //
}
// this.filepath = res.listPath[0]
// this.perPaper = this.papers.filter(e => e.FILE_PATH == this.filepath)
// //
// if (this.isCourEdit) {
// if (this.filepath.indexOf('/VIDEO/') > -1) {
// this.isViedo = true
// this.isViedoEnd = false
// this.filepath = config.uni_app_web_video_source_url + this.filepath
// this.filepathf = []
// } else {
// this.isViedo = false
// this.filepathf = getFileShow(this.filepath)
// }
// }
} else { } else {
uni.$showMsgFunc('未能成功获取此用户的在线试卷,请稍后重试!', () => {}, 'error', 1000) uni.$showMsgFunc('未能成功获取此用户的在线试卷,请稍后重试!', () => {}, 'error', 1000)
@ -372,16 +365,16 @@
}, },
getType(type) { getType(type) {
let ret = ''; let ret = '';
let config = this.config; let configE = this.configE;
switch (type) { switch (type) {
case 0: case 0:
ret = `【是非题】(${config && config.C_TEST_SCORE || 1}分)`; ret = `【是非题】(${configE && configE.C_TEST_SCORE || 1}分)`;
break; break;
case 1: case 1:
ret = `【单选题】(${config && config.S_TEST_SCORE || 1}分)`; ret = `【单选题】(${configE && configE.S_TEST_SCORE || 1}分)`;
break; break;
case 2: case 2:
ret = `【多选题】(${config && config.M_TEST_SCORE || 1}分)`; ret = `【多选题】(${configE && configE.M_TEST_SCORE || 1}分)`;
break; break;
} }
return ret; return ret;
@ -446,19 +439,36 @@
return commonElements; return commonElements;
}, },
submit() { submit() {
if (this.indexCour > -1) { //
for (let i = 0; i < this.perPaper.length; i++) {
if (this.perPaper[i].ANSWER == 0) {
uni.$showMsgFunc(`${i + 1}题尚未选择答题,请完成所有答题后再进行提交`, () => {}, 'error', 2000)
return;
} else if (this.perPaper[i].Nav_Test.TYPE == 2 && (this.perPaper[i].ANSWER == 1 || this.perPaper[i]
.ANSWER == 2 || this.perPaper[i].ANSWER == 4 || this.perPaper[i].ANSWER == 8 || this
.perPaper[
i].ANSWER == 16)) {
uni.$showMsgFunc(`${i + 1}题为多选题,请完善答题后再进行提交`, () => {}, 'error', 2000)
return;
}
}
var replaceModel = {}
this.papers.forEach(e => {
replaceModel = this.perPaper.filter(ep => e.ID == ep.ID)
if (replaceModel != null) {
e = replaceModel
}
})
}
if (this.btnText == '提交' && this.indexCour > -1) {
//
let data = { let data = {
Nav_Config: JSON.parse(JSON.stringify(this.config)), Nav_Config: JSON.parse(JSON.stringify(this.configE)),
Nav_Papers: JSON.parse(JSON.stringify(this.papers)), Nav_Papers: JSON.parse(JSON.stringify(this.papers)),
TaskID: this.TaskID, TaskID: this.TaskID,
ORG_ID: this.ORG_ID, ORG_ID: this.ORG_ID,
TEXT_ID: this.EDIT_ID, //this.props.data.id TEXT_ID: this.EDIT_ID, //this.props.data.id
} }
for (let i = 0; i < data.Nav_Papers.length; i++) {
if (data.Nav_Papers[i].ANSWER == 0) {
uni.$showMsgFunc(`${i + 1}题尚未选择答题,请完成所有答题后再进行提交`, () => {}, 'error', 2000)
return;
}
}
getRequest(data, "/SE/SETrainRecord/SavePapers").then(res => { getRequest(data, "/SE/SETrainRecord/SavePapers").then(res => {
if (res && res.IsOperateSuccessful) { if (res && res.IsOperateSuccessful) {
var icon = 'success' var icon = 'success'
@ -472,6 +482,36 @@
}, icon, duration) }, icon, duration)
} }
}) })
} else {
this.indexCour++
//
if (this.indexCour == this.listPath.length - 1) {
this.btnText = '提交' //
} else {
this.btnText = '下一题'
}
this.filepath = this.listPath[this.indexCour]
this.perPaper = this.papers.filter(e => e.FILE_PATH == this.filepath)
if (this.filepath.indexOf('/VIDEO/') > -1) {
this.isViedo = true
this.isViedoEnd = false
this.filepath = config.uni_app_web_video_source_url + this.filepath
this.filepathf = []
} else if (this.filepath.indexOf('.mp4') > -1 || this.filepath
.indexOf('.avi') > -1) {
//
this.isViedo = true
this.isViedoEnd = false
this.filepath = config.uni_app_web_source_url + this.filepath
this.filepathf = []
} else {
this.isViedo = false
this.isViedoEnd = true
this.filepath = this.filepath
this.filepathf = getFileShow(this.filepath)
}
}
}, },
onTimeUpdate(e) { onTimeUpdate(e) {
const currentTime = e.detail.currentTime; const currentTime = e.detail.currentTime;
@ -485,7 +525,7 @@
}, },
// //
onEnd() { onEnd() {
this.isVodeoEnd = true this.isViedoEnd = true
}, },
} }
} }

View File

@ -2089,3 +2089,34 @@ export function getArryPropShow(arry, propPath, htmlPerAdd) {
} }
return arryShow; return arryShow;
} }
//位掩码 获取选项
export function getSelectedOptions(answer, maxOption = 32) {
const selected = [];
let value = 1; // 从 2^0 = 1 开始
// 遍历所有可能的选项(直到超过 answer 或达到上限)
while (value <= answer && value <= maxOption) {
if ((answer & value) !== 0) {
selected.push(value);
}
value *= 2; // 下一个 2 的幂1 → 2 → 4 → 8 ...
}
return selected;
}
//适应 组件 对附件的显示
export function getFileShow(FILE_PATH, FILE_NAME) {
const result = []
if (!FILE_NAME) {
var listPath = FILE_PATH.split('/')
FILE_NAME = listPath[listPath.length - 1]
}
result.push({
Nav_ImgFile: {
FILE_PATH: FILE_PATH,
FILE_NAME: FILE_NAME,
}
})
return result;
}