|
|
@@ -1,5 +1,6 @@
|
|
|
//播放音频图片地址
|
|
|
var PicInfo = {
|
|
|
+ answerPointImgUrl: "file:///android_asset/js/update-answer.png", //../Images/update-answer.png
|
|
|
yaoshiShowImgUrl: "file:///android_asset/js/yaoshi-show.png",
|
|
|
yaoshiHideImgUrl: "file:///android_asset/js/yaoshi-hide.png",
|
|
|
recordPlayImgUrl: "file:///android_asset/js/play.png",
|
|
|
@@ -80,6 +81,7 @@ function bindEventTeaOrignalYS() {
|
|
|
//$(this).nextUntil(".yaoshi").find(".underlineContent").hide();
|
|
|
$(this).nextUntil(".yaoshi").find(".underlineContent").css("color", "#ffffff");
|
|
|
//添加回调
|
|
|
+ onClickKeyHide();
|
|
|
}
|
|
|
});
|
|
|
//处理答题点
|
|
|
@@ -138,8 +140,6 @@ function bindEventTeaOrignalYS() {
|
|
|
});
|
|
|
//处理表格样式
|
|
|
$("td").attr("style", "");
|
|
|
- //处理文章标题的样式(目前资料源已处理)
|
|
|
- //$("p").eq(2).addClass("p-title-top");
|
|
|
}
|
|
|
|
|
|
//页面加载完,课件 绑定事件
|
|
|
@@ -206,6 +206,7 @@ function bindEventYS() {
|
|
|
$(this).attr("src", PicInfo.yaoshiHideImgUrl);
|
|
|
$(this).nextUntil(".yaoshi").filter(".underlineContent").css("color", "#ffffff");
|
|
|
//添加回调
|
|
|
+ onClickKeyHide();
|
|
|
}
|
|
|
});
|
|
|
//点击喇叭事件,音频播放
|
|
|
@@ -264,9 +265,6 @@ function handleAnswerRange() {
|
|
|
}
|
|
|
|
|
|
info.AnsText = $(item).text();
|
|
|
- if (info.AnsText == "") {
|
|
|
-
|
|
|
- }
|
|
|
tempJson.push(info);
|
|
|
|
|
|
var prev = $(item).prev();
|
|
|
@@ -345,7 +343,7 @@ function handleAnswerRange() {
|
|
|
if (answerData.length > 0) {
|
|
|
//Num = Number.parseInt(answerData[answerData.length - 1].Id);
|
|
|
Num = Number.parseInt($(".yaoshi:last").attr('answer-id'));
|
|
|
- for (var i = 0; i < Num+1; i++) {
|
|
|
+ for (var i = 0; i < Num + 1; i++) {
|
|
|
if (i < answerData.length) {
|
|
|
var index = Number(answerData[i].Id) - i;
|
|
|
for (var j = 0; j < index; j++) {
|
|
|
@@ -376,7 +374,7 @@ function handleAnswerRange() {
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- $(item).prop("outerHTML", "<buttom answer-id='" + answerid + "' answer-anstext='" + answerText + "' answer-isky='" + isky + "' class='answertext btn-bgimg'>点击作答</buttom>");
|
|
|
+ $(item).prop("outerHTML", "<div class='answer-range' answer-id='" + answerid + "' answer-anstext='" + answerText + "' answer-isky='" + isky + "'><img src='" + PicInfo.answerPointImgUrl + "'/><span class='answertext'>答题点</span></div>");
|
|
|
//删除钥匙节点
|
|
|
var prev = $("img[answer-id='" + answerid + "']");
|
|
|
if (prev.length > 0) {
|
|
|
@@ -385,7 +383,7 @@ function handleAnswerRange() {
|
|
|
});
|
|
|
|
|
|
//添加点击事件
|
|
|
- $(".answertext").on("click", function () {
|
|
|
+ $(".answer-range").on("click", function () {
|
|
|
var curObj = new Object();
|
|
|
curObj.Id = $(this).attr("answer-id");//答题点ID
|
|
|
curObj.IsKY = $(this).attr("answer-isky");//是否是口语试题,0-不是口语题,1-是口语题
|
|
|
@@ -394,7 +392,7 @@ function handleAnswerRange() {
|
|
|
curObj.AnsText = $(this).attr("answer-anstext");//参考答案
|
|
|
curObj.Comment = $(this).attr("answer-comment");//评语
|
|
|
|
|
|
- $(".answertext").removeClass("select-answer");
|
|
|
+ $(".answer-range").removeClass("select-answer");
|
|
|
$(this).addClass("select-answer");
|
|
|
|
|
|
//已作答,弹出作答答案
|
|
|
@@ -422,16 +420,12 @@ function handleAnswerRange() {
|
|
|
|
|
|
//接收学生的作答
|
|
|
function reviewAnswer(answerJson) {
|
|
|
- //测试数据
|
|
|
- //answerJson = "{\"AudioLength\":0,\"Id\":\"2\",\"Text\":\"i am how i know\",\"Type\":1}";
|
|
|
- //answerJson = "{\"AudioLength\":3,\"AudioUrl\":\"http://172.16.41.241:10103/http_TBookEditor51/exerciseAnswerAudio/2020-11-06_09-31-19.wav\",\"Id\":\"4\",\"Text\":\"i know how i know \",\"Type\":3}";
|
|
|
-
|
|
|
if (answerJson != "" && answerJson) {
|
|
|
var answerObj = JSON.parse(answerJson);
|
|
|
- var selectElement = $(".answertext[answer-id='" + answerObj.Id + "']");
|
|
|
- var audioElement = $(".btn-play[answer-id='" + answerObj.Id + "']>span");
|
|
|
+ var selectElement = $(".answer-range[answer-id='" + answerObj.Id + "']");
|
|
|
+ var audioElement = $(selectElement).children("img").eq(0);
|
|
|
answerObj.IsKY = $(selectElement).attr("answer-isky");//是否是口语试题,0-不是口语题,1-是口语题
|
|
|
-
|
|
|
+
|
|
|
//有内容时,要动态处理单词长度
|
|
|
if (answerObj.Text != "") {
|
|
|
$(selectElement).addClass("break-word");
|
|
|
@@ -442,52 +436,41 @@ function reviewAnswer(answerJson) {
|
|
|
|
|
|
//是否是音频作答
|
|
|
if ((answerObj.Type == 3 || answerObj.Type == 4) && answerObj.AudioUrl != "") {
|
|
|
- answerObj.Text = answerObj.Text == "" ? answerObj.Text : "(" + answerObj.Text + ")";
|
|
|
- $(selectElement).text(answerObj.Text);
|
|
|
$(selectElement).attr("answer-text", answerObj.Text);//填充作答内容
|
|
|
- //移除作答样式
|
|
|
- if ($(selectElement).hasClass("btn-bgimg")) {
|
|
|
- $(selectElement).removeClass("btn-bgimg");
|
|
|
- }
|
|
|
+ answerObj.Text = answerObj.Text == "" ? "作答音频[" + answerObj.AudioLength + "s]" : "作答音频[" + answerObj.AudioLength + "s]" + "(" + answerObj.Text + ")";
|
|
|
+ $(selectElement).children("span").text(answerObj.Text);
|
|
|
|
|
|
//是否之前存在作答音频
|
|
|
- if (audioElement.length > 0) {
|
|
|
- $(audioElement).text("作答音频(" + answerObj.AudioLength + "s)");
|
|
|
- $(audioElement).parent().attr("answer-url", answerObj.AudioUrl);
|
|
|
- }
|
|
|
- else {
|
|
|
- var divHtml = document.createElement("div");
|
|
|
- divHtml.className = "btn-play";
|
|
|
- divHtml.innerHTML = "<img src='file:///android_asset/js/play.png'/><span>作答音频(" + answerObj.AudioLength + "s)</span>";
|
|
|
- divHtml.setAttribute("answer-id", answerObj.Id);
|
|
|
- divHtml.setAttribute("answer-url", answerObj.AudioUrl);
|
|
|
- divHtml.setAttribute("play-status", "0");
|
|
|
-
|
|
|
- //增加节点
|
|
|
- $(selectElement).before(divHtml);
|
|
|
- //独立绑定事件
|
|
|
- $(selectElement).prev().children("img").on("click", function () {
|
|
|
- recordAudioClick(this, answerObj.Id, answerObj.AudioUrl);
|
|
|
- });
|
|
|
- $(selectElement).prev().children("span").on("click", function () {
|
|
|
- //移动端的修改
|
|
|
- onClickAnswerPoint(JSON.stringify(answerObj));
|
|
|
- });
|
|
|
+ $(selectElement).attr("play-status", "0");
|
|
|
+ $(audioElement).attr("src", PicInfo.recordPlayImgUrl);
|
|
|
+ var curDisplay = $(audioElement).css("display");
|
|
|
+ if (curDisplay == "none") {
|
|
|
+ $(audioElement).show();
|
|
|
}
|
|
|
+
|
|
|
+ $(selectElement).attr("answer-url", answerObj.AudioUrl);
|
|
|
+ //独立绑定事件
|
|
|
+ $(audioElement).on("click", function () {
|
|
|
+ recordAudioClick(this, answerObj.Id, answerObj.AudioUrl);
|
|
|
+ });
|
|
|
+ $(selectElement).children("span").on("click", function () {
|
|
|
+ $(".answer-range").removeClass("select-answer");
|
|
|
+ $(item).addClass("select-answer");
|
|
|
+ onClickAnswerPoint(JSON.stringify(answerObj));
|
|
|
+ });
|
|
|
}
|
|
|
else {
|
|
|
- answerObj.Text = answerObj.Text == "" ? "点击作答" : answerObj.Text;
|
|
|
- $(selectElement).text(answerObj.Text);
|
|
|
$(selectElement).attr("answer-text", answerObj.Text);//填充作答内容
|
|
|
- //之前作答存在音频,但是现在没有音频传入,要删除音频节点
|
|
|
- if (audioElement.length > 0) {
|
|
|
- $(".btn-play[answer-id='" + answerObj.Id + "']").unbind('click');
|
|
|
- $(".btn-play[answer-id='" + answerObj.Id + "']").remove();
|
|
|
+ if (answerObj.Text == "") {
|
|
|
+ answerObj.Text = "答题点";
|
|
|
+ $(audioElement).show();
|
|
|
+ $(audioElement).attr("src", PicInfo.answerPointImgUrl);
|
|
|
}
|
|
|
- //增加作答样式
|
|
|
- if (!$(selectElement).hasClass("btn-bgimg")) {
|
|
|
- $(selectElement).addClass("btn-bgimg");
|
|
|
+ else {
|
|
|
+ //之前作答存在音频,但是现在没有音频传入,要隐藏音频节点
|
|
|
+ $(audioElement).hide();
|
|
|
}
|
|
|
+ $(selectElement).children("span").text(answerObj.Text);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -495,20 +478,17 @@ function reviewAnswer(answerJson) {
|
|
|
//提交,获取所有作答答案及参考答案
|
|
|
function getAllAnswer() {
|
|
|
//处理作答
|
|
|
- $.each($(".answertext"), function (index, item) {
|
|
|
- var mytext = $(item).text();
|
|
|
- if (mytext == "点击作答") {
|
|
|
+ $.each($(".answer-range"), function (index, item) {
|
|
|
+ var mytext = $(item).children("span").text();
|
|
|
+ if (mytext == "答题点") {
|
|
|
mytext = "未作答";
|
|
|
- $(item).text(mytext);
|
|
|
$(item).addClass("no-answer");
|
|
|
- }
|
|
|
- //移除作答样式
|
|
|
- if ($(item).hasClass("btn-bgimg")) {
|
|
|
- $(item).removeClass("btn-bgimg");
|
|
|
+ $(item).children("img").hide();
|
|
|
+ $(item).children("span").text(mytext);
|
|
|
}
|
|
|
});
|
|
|
- $(".answertext").unbind('click');//取消点击绑定事件
|
|
|
- $(".btn-play>span").unbind('click');//取消点击绑定事件
|
|
|
+ $(".answer-range").unbind('click');//取消点击绑定事件
|
|
|
+ $(".answer-range>span").unbind('click');//取消点击绑定事件
|
|
|
|
|
|
return answerData;
|
|
|
}
|
|
|
@@ -519,7 +499,7 @@ function backupAllAnswer(answerJson, statusType) {
|
|
|
var answerList = JSON.parse(answerJson);
|
|
|
//answerList = JSON.parse(answerList);
|
|
|
//获取Dom一个个回填
|
|
|
- $.each($(".answertext"), function (index, item) {
|
|
|
+ $.each($(".answer-range"), function (index, item) {
|
|
|
//提交直接还原作答现场
|
|
|
var mytext = answerList[index].Text;//我的答案
|
|
|
answerList[index].IsKY = $(item).attr("answer-isky");//是否是口语试题,0-不是口语题,1-是口语题
|
|
|
@@ -528,126 +508,95 @@ function backupAllAnswer(answerJson, statusType) {
|
|
|
$(item).addClass("break-word");
|
|
|
}
|
|
|
|
|
|
+ //添加音频控制
|
|
|
+ var audioElement = $(item).children("img").eq(0);
|
|
|
+ if ((answerList[index].Type == 3 || answerList[index].Type == 4) && answerList[index].AudioUrl != "") {
|
|
|
+ $(item).attr("answer-text", mytext);//填充作答内容
|
|
|
+ mytext = mytext == "" ? "作答音频[" + answerList[index].AudioLength + "s]" : "作答音频[" + answerList[index].AudioLength + "s]" + "(" + mytext + ")";
|
|
|
+ $(item).children("span").text(mytext);
|
|
|
+
|
|
|
+ $(item).attr("play-status", "0");
|
|
|
+ $(item).attr("answer-url", answerList[index].AudioUrl);
|
|
|
+ $(audioElement).attr("src", PicInfo.recordPlayImgUrl);
|
|
|
+ }
|
|
|
+
|
|
|
//可作答状态,作答还原
|
|
|
if (statusType == 0) {
|
|
|
//已作答过,还原作答,增加作答后的UI节点
|
|
|
if ((answerList[index].Type == 3 || answerList[index].Type == 4) && answerList[index].AudioUrl != "") {
|
|
|
- mytext = mytext == "" ? mytext : "(" + mytext + ")";
|
|
|
- $(item).text(mytext);
|
|
|
- $(item).attr("answer-text", mytext);//填充作答内容
|
|
|
- //移除作答样式
|
|
|
- if ($(item).hasClass("btn-bgimg")) {
|
|
|
- $(item).removeClass("btn-bgimg");
|
|
|
- }
|
|
|
-
|
|
|
- //添加音频节点
|
|
|
- var divHtml = document.createElement("div");
|
|
|
- divHtml.className = "btn-play";
|
|
|
- divHtml.innerHTML = "<img src='" + PicInfo.recordPlayImgUrl + "'/><span>作答音频(" + answerList[index].AudioLength + "s)</span>";
|
|
|
- divHtml.setAttribute("answer-id", answerList[index].Id);
|
|
|
- divHtml.setAttribute("answer-url", answerList[index].AudioUrl);
|
|
|
- divHtml.setAttribute("play-status", "0");
|
|
|
- //增加节点
|
|
|
- $(item).before(divHtml);
|
|
|
//独立绑定事件
|
|
|
- $(item).prev().children("img").on("click", function () {
|
|
|
+ $(item).children("img").on("click", function () {
|
|
|
recordAudioClick(this, answerList[index].Id, answerList[index].AudioUrl);
|
|
|
});
|
|
|
- $(item).prev().children("span").on("click", function () {
|
|
|
+ $(item).children("span").on("click", function () {
|
|
|
+ $(".answer-range").removeClass("select-answer");
|
|
|
+ $(item).addClass("select-answer");
|
|
|
onClickAnswerPoint(JSON.stringify(answerList[index]));
|
|
|
});
|
|
|
}
|
|
|
else {
|
|
|
- //文本作答
|
|
|
- mytext = mytext == "" ? "点击作答" : mytext;//我的答案
|
|
|
- $(item).text(mytext);
|
|
|
$(item).attr("answer-text", mytext);//填充作答内容
|
|
|
+ if (mytext == "") {
|
|
|
+ mytext = "答题点";
|
|
|
+ $(audioElement).attr("src", PicInfo.answerPointImgUrl);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ //之前作答存在音频,但是现在没有音频传入,要隐藏音频节点
|
|
|
+ $(audioElement).hide();
|
|
|
+ }
|
|
|
+ $(item).children("span").text(mytext);
|
|
|
}
|
|
|
}
|
|
|
//已提交,作答还原
|
|
|
if (statusType == 1) {
|
|
|
- $(item).unbind('click');//取消点击绑定事件
|
|
|
+ //取消点击绑定事件
|
|
|
+ $(item).unbind('click');
|
|
|
//添加音频控制
|
|
|
if ((answerList[index].Type == 3 || answerList[index].Type == 4) && answerList[index].AudioUrl != "") {
|
|
|
- mytext = mytext == "" ? mytext : "(" + mytext + ")";
|
|
|
- $(item).text(mytext);
|
|
|
- $(item).attr("answer-text", mytext);//填充作答内容
|
|
|
- //移除作答样式
|
|
|
- if ($(item).hasClass("btn-bgimg")) {
|
|
|
- $(item).removeClass("btn-bgimg");
|
|
|
- }
|
|
|
-
|
|
|
- //添加音频节点
|
|
|
- var divHtml = document.createElement("div");
|
|
|
- divHtml.className = "btn-play";
|
|
|
- divHtml.innerHTML = "<img src='" + PicInfo.recordPlayImgUrl + "'/><span>作答音频(" + answerList[index].AudioLength + "s)</span>";
|
|
|
- divHtml.setAttribute("answer-id", answerList[index].Id);
|
|
|
- divHtml.setAttribute("answer-url", answerList[index].AudioUrl);
|
|
|
- divHtml.setAttribute("play-status", "0");
|
|
|
- //增加节点
|
|
|
- $(item).before(divHtml);
|
|
|
//独立绑定事件
|
|
|
- $(item).prev().children("img").on("click", function () {
|
|
|
+ $(item).children("img").on("click", function () {
|
|
|
recordAudioClick(this, answerList[index].Id, answerList[index].AudioUrl);
|
|
|
});
|
|
|
}
|
|
|
else {
|
|
|
+ $(item).attr("answer-text", mytext);//填充作答内容
|
|
|
if (mytext == "") {
|
|
|
mytext = "未作答";
|
|
|
- $(item).addClass("no-answer");
|
|
|
+ $(item).children("span").addClass("no-answer");
|
|
|
}
|
|
|
- //移除作答样式
|
|
|
- if ($(item).hasClass("btn-bgimg")) {
|
|
|
- $(item).removeClass("btn-bgimg");
|
|
|
- }
|
|
|
- $(item).text(mytext);
|
|
|
- $(item).attr("answer-text", mytext);//填充作答内容
|
|
|
+ $(audioElement).hide();
|
|
|
+ $(item).children("span").text(mytext);
|
|
|
}
|
|
|
}
|
|
|
//已评阅,查看评阅详情
|
|
|
if (statusType == 2) {
|
|
|
//添加音频控制
|
|
|
if ((answerList[index].Type == 3 || answerList[index].Type == 4) && answerList[index].AudioUrl != "") {
|
|
|
- mytext = mytext == "" ? mytext : "(" + mytext + ")";
|
|
|
- $(item).text(mytext);
|
|
|
- $(item).attr("answer-text", mytext);//填充作答内容
|
|
|
-
|
|
|
- //添加音频节点
|
|
|
- var divHtml = document.createElement("div");
|
|
|
- divHtml.className = "btn-play";
|
|
|
- divHtml.innerHTML = "<img src='" + PicInfo.recordPlayImgUrl + "'/><span>作答音频(" + answerList[index].AudioLength + "s)</span>";
|
|
|
- divHtml.setAttribute("answer-id", answerList[index].Id);
|
|
|
- divHtml.setAttribute("answer-url", answerList[index].AudioUrl);
|
|
|
- divHtml.setAttribute("play-status", "0");
|
|
|
- //增加节点
|
|
|
- $(item).before(divHtml);
|
|
|
//独立绑定事件
|
|
|
- $(item).prev().children("img").on("click", function () {
|
|
|
+ $(item).children("img").on("click", function () {
|
|
|
recordAudioClick(this, answerList[index].Id, answerList[index].AudioUrl);
|
|
|
});
|
|
|
- $(item).prev().children("span").on("click", function () {
|
|
|
+ $(item).children("span").on("click", function () {
|
|
|
+ $(".answer-range").removeClass("select-answer");
|
|
|
+ $(item).addClass("select-answer");
|
|
|
onClickAnswerPoint(JSON.stringify(answerList[index]));
|
|
|
});
|
|
|
}
|
|
|
else {
|
|
|
+ $(item).attr("answer-text", mytext);//填充作答内容
|
|
|
if (mytext == "") {
|
|
|
mytext = "未作答";
|
|
|
- $(item).addClass("no-answer");
|
|
|
+ $(item).children("span").addClass("no-answer");
|
|
|
}
|
|
|
- $(item).text(mytext);
|
|
|
- $(item).attr("answer-text", mytext);//填充作答内容
|
|
|
+ $(audioElement).hide();
|
|
|
+ $(item).children("span").text(mytext);
|
|
|
}
|
|
|
-
|
|
|
//评阅样式
|
|
|
if (answerList[index].Score == 0 && answerList[index].Text != "") {
|
|
|
- $(item).addClass("bad-answer");
|
|
|
+ $(item).children("span").addClass("bad-answer");
|
|
|
}
|
|
|
if (answerList[index].Score > 0) {
|
|
|
- $(item).addClass("good-answer");
|
|
|
- }
|
|
|
- //移除作答样式
|
|
|
- if ($(item).hasClass("btn-bgimg")) {
|
|
|
- $(item).removeClass("btn-bgimg");
|
|
|
+ $(item).children("span").addClass("good-answer");
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
@@ -658,7 +607,7 @@ function backupAllAnswer(answerJson, statusType) {
|
|
|
function reviewStuAnswer(answerJson) {
|
|
|
if (answerJson != "" && answerJson) {
|
|
|
var answerObj = JSON.parse(answerJson);
|
|
|
- var selectElement = $(".answertext[answer-id='" + answerObj.Id + "']");
|
|
|
+ var selectElement = $(".answer-range[answer-id='" + answerObj.Id + "']");
|
|
|
|
|
|
//$(selectElement).attr("answer-text", answerObj.Text);//用户作答内容
|
|
|
$(selectElement).attr("answer-score", answerObj.Score);//作答评分
|
|
|
@@ -678,14 +627,9 @@ function reviewStuAnswer(answerJson) {
|
|
|
|
|
|
//回填所有评阅信息,answerJson:所有作答及参考答案评阅信息List
|
|
|
function backupAllReview(answerJson) {
|
|
|
- //测试数据
|
|
|
- //answerJson = "[{\"AudioLength\":11,\"AudioUrl\":\"http://172.16.41.241:10103/http_TBookEditor51/exerciseAnswerAudio/2020-11-10_11-18-54.mp3\",\"Id\":\"2\",\"Text\":\"\",\"Type\":3}]";
|
|
|
-
|
|
|
if (answerJson != "" && answerJson) {
|
|
|
var answerList = JSON.parse(answerJson);
|
|
|
- //answerList = JSON.parse(answerList);
|
|
|
- //获取Dom一个个回填
|
|
|
- $.each($(".answertext"), function (index, item) {
|
|
|
+ $.each($(".answer-range"), function (index, item) {
|
|
|
//$(item).attr("answer-id", answerList[index].Id);//答题点ID
|
|
|
//$(item).attr("answer-text", answerList[index].Text);//用户作答内容
|
|
|
$(item).attr("answer-score", answerList[index].Score);//作答评分
|
|
|
@@ -694,34 +638,35 @@ function backupAllReview(answerJson) {
|
|
|
|
|
|
//提交直接还原作答现场
|
|
|
var mytext = answerList[index].Text;//我的答案
|
|
|
+ var audioElement = $(item).children("img").eq(0);
|
|
|
if ((answerList[index].Type == 3 || answerList[index].Type == 4) && answerList[index].AudioUrl != "") {
|
|
|
- mytext = mytext == "" ? mytext : "(" + mytext + ")";
|
|
|
- $(item).text(mytext);
|
|
|
-
|
|
|
- //添加音频节点
|
|
|
- var divHtml = document.createElement("div");
|
|
|
- divHtml.className = "btn-play";
|
|
|
- divHtml.innerHTML = "<img src='" + PicInfo.recordPlayImgUrl + "'/><span>作答音频(" + answerList[index].AudioLength + "s)</span>";
|
|
|
- divHtml.setAttribute("answer-id", answerList[index].Id);
|
|
|
- divHtml.setAttribute("answer-url", answerList[index].AudioUrl);
|
|
|
- divHtml.setAttribute("play-status", "0");
|
|
|
- //增加节点
|
|
|
- $(item).before(divHtml);
|
|
|
+ $(item).attr("answer-text", mytext);//填充作答内容
|
|
|
+ mytext = mytext == "" ? "作答音频[" + answerList[index].AudioLength + "s]" : "作答音频[" + answerList[index].AudioLength + "s]" + "(" + mytext + ")";
|
|
|
+ $(item).children("span").text(mytext);
|
|
|
+
|
|
|
+ $(item).attr("play-status", "0");
|
|
|
+ $(item).attr("answer-url", answerList[index].AudioUrl);
|
|
|
+ $(audioElement).attr("src", PicInfo.recordPlayImgUrl);
|
|
|
//独立绑定事件
|
|
|
- $(item).prev().children("img").on("click", function () {
|
|
|
+ $(item).children("img").on("click", function () {
|
|
|
recordAudioClick(this, answerList[index].Id, answerList[index].AudioUrl);
|
|
|
});
|
|
|
- $(item).prev().children("span").on("click", function () {
|
|
|
+ $(item).children("span").on("click", function () {
|
|
|
+ $(".answer-range").removeClass("select-answer");
|
|
|
+ $(item).addClass("select-answer");
|
|
|
onClickAnswerPoint(JSON.stringify(answerList[index]));//移动端的修改
|
|
|
});
|
|
|
}
|
|
|
else {
|
|
|
+ $(item).attr("answer-text", mytext);//填充作答内容
|
|
|
if (mytext == "") {
|
|
|
mytext = "未作答";
|
|
|
- $(item).addClass("no-answer");
|
|
|
+ $(item).children("span").addClass("no-answer");
|
|
|
}
|
|
|
- $(item).text(mytext);
|
|
|
+ $(audioElement).hide();
|
|
|
+ $(item).children("span").text(mytext);
|
|
|
}
|
|
|
+
|
|
|
//评阅样式
|
|
|
if (answerList[index].Score == 0) {
|
|
|
$(item).addClass("bad-answer");
|
|
|
@@ -729,10 +674,6 @@ function backupAllReview(answerJson) {
|
|
|
if (answerList[index].Score > 0) {
|
|
|
$(item).addClass("good-answer");
|
|
|
}
|
|
|
- //移除作答样式
|
|
|
- if ($(item).hasClass("btn-bgimg")) {
|
|
|
- $(item).removeClass("btn-bgimg");
|
|
|
- }
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
@@ -740,7 +681,7 @@ function backupAllReview(answerJson) {
|
|
|
//处理播放录音,answerid:答题点ID,isPlay:是否播放(0-暂停,1-播放)
|
|
|
function playRecordAudio(answerid, isPlay) {
|
|
|
//获取其他正在播放的音频
|
|
|
- var playing = $(".btn-play[answer-id='" + answerid + "']");
|
|
|
+ var playing = $(".answer-range[answer-id='" + answerid + "']");
|
|
|
if (playing.length > 0) {
|
|
|
if (isPlay == "1") {
|
|
|
$(playing).attr("play-status", "1");
|
|
|
@@ -755,8 +696,8 @@ function playRecordAudio(answerid, isPlay) {
|
|
|
|
|
|
//滚动到相应DIV
|
|
|
function scrollAnswer(answerid) {
|
|
|
- $(".answertext").removeClass("select-answer");
|
|
|
- var ansDom = $(".answertext[answer-id='" + answerid + "']");
|
|
|
+ $(".answer-range").removeClass("select-answer");
|
|
|
+ var ansDom = $(".answer-range[answer-id='" + answerid + "']");
|
|
|
$(ansDom).addClass("select-answer");
|
|
|
var scroll_offset = $(ansDom).offset(); //得到box这个div层的offset,包含两个值,top和left
|
|
|
|
|
|
@@ -786,7 +727,7 @@ function audioPlayClick(myobj) {
|
|
|
}
|
|
|
else {
|
|
|
//停止其他作答音频播放
|
|
|
- var isRecordPlaying = $(".btn-play[play-status='1']");
|
|
|
+ var isRecordPlaying = $(".answer-range[play-status='1']");
|
|
|
if (isRecordPlaying.length > 0) {
|
|
|
$(isRecordPlaying).attr("play-status", "0");
|
|
|
$(isRecordPlaying).find("img").attr("src", PicInfo.recordPlayImgUrl);//移动端要根据本地路径替换
|
|
|
@@ -814,7 +755,7 @@ function recordAudioClick(myobj, id, url) {
|
|
|
//处理当前按钮的状态
|
|
|
if ($(myobj).parent().attr("play-status") == "0") {
|
|
|
//停止其他作答音频播放
|
|
|
- var isRecordPlaying = $(".btn-play[play-status='1']");
|
|
|
+ var isRecordPlaying = $(".answer-range[play-status='1']");
|
|
|
if (isRecordPlaying.length > 0) {
|
|
|
$(isRecordPlaying).attr("play-status", "0");
|
|
|
$(isRecordPlaying).find("img").attr("src", PicInfo.recordPlayImgUrl);//移动端要根据本地路径替换
|
|
|
@@ -854,11 +795,29 @@ function onClickAnswerPoint(data) {
|
|
|
//plugin.onClickAnswerPoint(data);
|
|
|
}
|
|
|
|
|
|
+function onClickKeyHide() {
|
|
|
+ //alert(JSON.stringify(data));
|
|
|
+ cancelBubble();
|
|
|
+ plugin.onClickKeyHide();
|
|
|
+}
|
|
|
+
|
|
|
function cancelBubble(e) {
|
|
|
var evt = e ? e : window.event;
|
|
|
- if(evt.stopPropagation) { //W3C
|
|
|
+ if (evt.stopPropagation) { //W3C
|
|
|
evt.stopPropagation();
|
|
|
} else { //IE
|
|
|
evt.cancelBubble = true;
|
|
|
}
|
|
|
+}
|
|
|
+
|
|
|
+function getSelectedText(title) {
|
|
|
+ var txt;
|
|
|
+ if (window.getSelection) {
|
|
|
+ txt = window.getSelection().toString();
|
|
|
+ } else if (window.document.getSelection) {
|
|
|
+ txt = window.document.getSelection().toString();
|
|
|
+ } else if (window.document.selection) {
|
|
|
+ txt = window.document.selection.createRange().text;
|
|
|
+ }
|
|
|
+ JSInterface.callback(txt, title);
|
|
|
}
|