StudentAudiovisual.js 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929
  1. $(function () {
  2. document.onkeydown = function (e) {
  3. var theEvent = window.event || e;
  4. var code = theEvent.keyCode || theEvent.which;
  5. if (code == 13) {
  6. return false;
  7. }
  8. }
  9. //音频播放
  10. $(".audioImg").on("click",function(){
  11. var curHtml = $(this).parent().find(".audioUrl").html();
  12. var curAlt = $(this).attr("alt");
  13. window.external.AudiovisualPlay(curAlt);
  14. });
  15. //视频播放
  16. $(".videoImg").on("click",function(){
  17. var curHtml = $(this).parent().find(".videoUrl").html();
  18. var curAlt = $(this).attr("alt");
  19. window.external.AudiovisualPlay(curAlt);
  20. });
  21. $(".oralLanguageHide").hide();
  22. try {
  23. var tempJson=new Array();
  24. $.each($(".yaoshi").parent().find(".underlineContent"), function (index, item) {
  25. tempJson[index]=$(item).text();
  26. })
  27. var isStu=window.external.IsStudent();
  28. if(!isStu){
  29. $('.underline').css("color","#fff");
  30. $('.underline').css("border-bottom-color","rgb(151, 151, 151)");
  31. $('.underline').css("border-bottom-width","1px");
  32. $('.underline').css("border-bottom-style","solid");
  33. $('.underline').css("word-break","break-all");
  34. //答案控制
  35. $('.yaoshi').on("click", function () {
  36. try{
  37. var curDisplay = $(this).nextUntil(".yaoshi").filter(".underlineContent").eq(0).css("display");
  38. if(curDisplay == "undefined"||curDisplay == undefined) return;
  39. if(curDisplay == "none"){
  40. $(this).nextUntil(".yaoshi").filter(".underlineContent").show()
  41. }else{
  42. $(this).nextUntil(".yaoshi").filter(".underlineContent").hide();
  43. }
  44. }catch (e) {
  45. }
  46. })
  47. $(".yaoshi").on("mouseenter", function () {
  48. $(this).css("cursor", "pointer!important");
  49. var curDis = $(this).nextUntil(".yaoshi").filter(".underlineContent").css("display");
  50. if (curDis == "inline") {
  51. $(this).attr("title", "隐藏答案");
  52. } else if (curDis == "none") {
  53. $(this).attr("title", "显示答案");
  54. }
  55. })
  56. $(".audioImg").on("mouseenter", function () {
  57. $(this).css("cursor", "pointer");
  58. $(this).attr("title", "播放音频");
  59. })
  60. $(".videoImg").on("mouseenter", function () {
  61. $(this).css("cursor", "pointer");
  62. $(this).attr("title", "播放视频");
  63. })
  64. return;
  65. }
  66. $("body").click(function(event){
  67. var $this = event.target;
  68. if($this.className != "yaoshi"){
  69. $(".yaoshi1").hide();
  70. $(".yaoshi2").hide();
  71. }
  72. });
  73. //修改钥匙图片css
  74. var innerHTML1 = "<input type='file' class='btn_file' id='btn_file' accept='.mp3' style='display:none' >";
  75. //修改钥匙图片css
  76. //var innerHTML2 = "<input type='file' class='btn_fileTwo' id='btn_fileTwo' accept='.mp3' style='display:none' onchange='checkFileTypeTwo(this)'>";
  77. $("body").append(innerHTML1);
  78. //$("body").append(innerHTML2);
  79. $('.yaoshi').attr("src","../../images/second/text-n.png");
  80. $('.yaoshi').css("width","22px");
  81. $('.yaoshi').css("height","24px");
  82. $('.yaoshi').css("margin-left","1px");
  83. $('.yaoshi').css("margin-top","5px");
  84. $('.yaoshi').css("position","absolute");
  85. $('.yaoshi').css("text-indent","0");
  86. $('.yaoshi').css("text-align","left");
  87. $('.underlineContent').css("display","none");
  88. $('.underline').css("display","none");
  89. $('.btn_file').off("change");
  90. $('.btn_file').on("change",function(){
  91. });
  92. //根据父子集关系获取钥匙下放所以元素集合
  93. var unTagName=$('.yaoshi').parent();
  94. var unTagChildName= unTagName.children();
  95. var tempBool = true;
  96. var inpbool= true;
  97. //alert(unTagChildName.length);
  98. for(var i=0; i<unTagChildName.length;i++){
  99. if(unTagChildName[i].tagName=='U'){
  100. //alert(unTagChildName[i].innerHTML);
  101. if(unTagChildName[i].innerHTML=="_"){
  102. unTagChildName[i].innerHTML="";
  103. }
  104. if(unTagChildName[i].innerHTML=="___"){
  105. unTagChildName[i].innerHTML="";
  106. }
  107. if(unTagChildName[i].innerHTML=="—"){
  108. unTagChildName[i].innerHTML="";
  109. }
  110. if(unTagChildName[i].innerHTML=="__"){
  111. unTagChildName[i].innerHTML="";
  112. }
  113. //unTagChildName[i].innerHTML="";
  114. }
  115. if(unTagChildName[i].tagName=='IMG'){
  116. tempBool=true;
  117. var ImgHtml= document.createElement("img");
  118. ImgHtml.style.position="absolute";
  119. //ImgHtml.style.marginLeft="-25px";
  120. ImgHtml.style.marginTop="30px";
  121. ImgHtml.style.zIndex="50";
  122. ImgHtml.style.display="none";
  123. ImgHtml.style.textIndent="0";
  124. ImgHtml.style.textAlign= "left";
  125. ImgHtml.src="../../images/second/recoding-n.png";
  126. ImgHtml.className="yaoshi1";
  127. $(unTagChildName[i]).after(ImgHtml);
  128. var ImgTwoHtml= document.createElement("img");
  129. ImgTwoHtml.style.position="absolute";
  130. //ImgTwoHtml.style.marginLeft="-25px";
  131. ImgTwoHtml.style.marginTop="53px";
  132. ImgTwoHtml.style.zIndex="50";
  133. ImgTwoHtml.style.display="none";
  134. ImgTwoHtml.style.textIndent="0";
  135. ImgTwoHtml.style.textAlign= "left";
  136. ImgTwoHtml.src="../../images/second/audio-n.png";
  137. ImgTwoHtml.className="yaoshi2";
  138. $(unTagChildName[i]).after(ImgTwoHtml);
  139. }
  140. if(unTagChildName[i].tagName=='U'&& tempBool){
  141. var SpanAnswer= document.createElement("u");
  142. //ImgTwoHtml.style.position="absolute";
  143. SpanAnswer.style.marginLeft="15px";
  144. SpanAnswer.style.color="#92D050";
  145. SpanAnswer.style.display="none";
  146. SpanAnswer.style.textIndent="0";
  147. SpanAnswer.style.verticalAlign="bottom";
  148. SpanAnswer.style.textDecoration="none";
  149. //SpanAnswer.style.borderBottom="1px solid #979797"
  150. //SpanTwoHtml.style.lineHeight="5px";
  151. //SpanTwoHtml.style.Height="5px";
  152. //ImgTwoHtml.style.marginTop="46px";
  153. //ImgTwoHtml.style.display="none";
  154. SpanAnswer.innerHTML="参考答案:";
  155. SpanAnswer.className="theAnswer";
  156. $(unTagChildName[i]).after(SpanAnswer);
  157. tempBool=false;
  158. var Uhtml = document.createElement("span");
  159. Uhtml.contentEditable="true";
  160. Uhtml.className="contentAnswer";
  161. Uhtml.style.paddingLeft="20px";
  162. Uhtml.style.paddingRight="20px";
  163. Uhtml.style.textIndent="0";
  164. Uhtml.style.textAlign= "left";
  165. Uhtml.style.color="#13a2ed";
  166. //Uhtml.style.width="100px";
  167. Uhtml.style.maxWidth="400px";
  168. //Uhtml.style.maxHeight="50px";
  169. //Uhtml.style.height="25px";
  170. Uhtml.style.wordBreak="break-all";
  171. Uhtml.style.borderBottom="1px solid rgb(151, 151, 151)";
  172. Uhtml.style.marginLeft="25px";
  173. //Uhtml.style.wordWrap="break-word";
  174. //Uhtml.style.wordBreak="normal";
  175. Uhtml.style.whiteSpace="text-nowrap";
  176. Uhtml.style.overflow="hidden";
  177. Uhtml.style.textOverflow="ellipsis";
  178. $(unTagChildName[i]).after(Uhtml);
  179. //unTagChildName[i].innerHTML="";
  180. //unTagChildName[i].setAttribute("contenteditable", "true");
  181. //unTagChildName[i].style.borderBottom="1px solid rgb(151, 151, 151)";
  182. //unTagChildName[i].style.textDecoration="none";
  183. //unTagChildName[i].style.paddingLeft="20px";
  184. //unTagChildName[i].style.paddingRight="20px";
  185. //unTagChildName[i].style.display="inline";
  186. var SpanHtml= document.createElement("span");
  187. //ImgTwoHtml.style.position="absolute";
  188. SpanHtml.style.marginLeft="8px";
  189. SpanHtml.style.color="#cccccc";
  190. SpanHtml.style.fontSize="12px";
  191. SpanHtml.style.display="none";
  192. SpanHtml.style.textIndent="0";
  193. SpanHtml.style.marginTop="5px";
  194. SpanHtml.style.verticalAlign="top";
  195. //ImgTwoHtml.style.marginTop="46px";
  196. //ImgTwoHtml.style.display="none";
  197. SpanHtml.innerHTML="(作答录音最大时长为3分钟)";
  198. SpanHtml.className="luyinTipLitle";
  199. $(unTagChildName[i]).after(SpanHtml);
  200. var SpanTwoHtml= document.createElement("span");
  201. //ImgTwoHtml.style.position="absolute";
  202. SpanTwoHtml.style.marginLeft="8px";
  203. SpanTwoHtml.style.color="#34ced3";
  204. SpanTwoHtml.style.display="none";
  205. SpanTwoHtml.style.textIndent="0";
  206. SpanTwoHtml.style.verticalAlign="top";
  207. //SpanTwoHtml.style.lineHeight="5px";
  208. //SpanTwoHtml.style.Height="5px";
  209. //ImgTwoHtml.style.marginTop="46px";
  210. //ImgTwoHtml.style.display="none";
  211. SpanTwoHtml.innerHTML="点击按钮开始录音";
  212. SpanTwoHtml.className="luyinTip";
  213. $(unTagChildName[i]).after(SpanTwoHtml);
  214. var ImgLuyinHtml= document.createElement("img");
  215. //ImgTwoHtml.style.position="absolute";
  216. ImgLuyinHtml.style.marginLeft="25px";
  217. ImgLuyinHtml.style.marginTop="5px";
  218. ImgLuyinHtml.style.display="none";
  219. ImgLuyinHtml.style.textIndent="0";
  220. ImgLuyinHtml.style.cursor="pointer";
  221. //ImgTwoHtml.style.marginTop="46px";
  222. //ImgTwoHtml.style.display="none";
  223. ImgLuyinHtml.src="../../images/second/录音按钮-初始.png";
  224. ImgLuyinHtml.className="luyinImg";
  225. ImgLuyinHtml.id="1";
  226. $(unTagChildName[i]).after(ImgLuyinHtml);
  227. var ImgCloseHtml= document.createElement("img");
  228. ImgCloseHtml.style.position="absolute";
  229. ImgCloseHtml.style.marginLeft="-5px";
  230. ImgCloseHtml.style.display="none";
  231. ImgCloseHtml.style.marginTop="-5px";
  232. ImgCloseHtml.style.cursor="pointer";
  233. //ImgTwoHtml.style.display="none";
  234. ImgCloseHtml.src="../../images/second/删除-初始.png";
  235. ImgCloseHtml.id="1";
  236. ImgCloseHtml.className="closeImg";
  237. $(unTagChildName[i]).after(ImgCloseHtml);
  238. var DivHtml= document.createElement("div");
  239. DivHtml.className="audioRequest";
  240. DivHtml.style.display="none";
  241. DivHtml.style.textIndent="0";
  242. DivHtml.style.marginLeft="25px";
  243. DivHtml.style.verticalAlign="top";
  244. //DivHtml.style.position="absolute";
  245. $(unTagChildName[i]).after(DivHtml);
  246. $('.audioRequest').html("");
  247. var wordHTML = "";
  248. var wordHTML = "";
  249. wordHTML+="<div class='audioDiv' voicePath='' style='display:inline-block;text-indent: 0;cursor: pointer;width: 90px;height: 24px;line-height:24px;background-color: #ffffff;border-radius: 4px;border:1px dashed #61d6ff;font-size: 14px;color: #0190ff;'>";
  250. wordHTML+="<img class='audioStuImg' style='height: 12px;width: 12px;margin-left: 9px;margin-right: 6px;vertical-align: middle;' src='../../images/second/addVoice-n.png'>";
  251. //wordHTML+="<img class='closeImg' style='display:none;z-index:50;position: absolute; margin-left: 54px;margin-top: -10px;cursor: pointer;' src='../../images/second/删除-初始.png'>";
  252. wordHTML+="<span class='addMes' style='display:inline-block;vertical-align: middle;'>添加音频</span>";
  253. wordHTML+="</div>";
  254. $('.audioRequest').append(wordHTML);
  255. }
  256. }
  257. //钥匙的点击函数
  258. $('.yaoshi').on("click", function () {
  259. var content=$(this);
  260. var thisSrc=content.attr("src");
  261. var picInt=0;
  262. //根据图片显示左边距
  263. //if($(this).attr("src").indexof("audio-n.png")!=-1){
  264. //}
  265. //if($(this).attr("src").indexof("text-n.png")!=-1){
  266. //}
  267. //前端显示图标
  268. var unTagName=$(this).parent();
  269. var unTagChildName= unTagName.children();
  270. //alert($(this).nextUntil(".yaoshi").filter(".yaoshi1").css("display"));
  271. if($(this).nextUntil(".yaoshi").filter(".yaoshi1").css("display")!="none"){
  272. $(this).nextUntil(".yaoshi").filter(".yaoshi1").css("display","none");
  273. }
  274. else{
  275. $(this).nextUntil(".yaoshi").filter(".yaoshi1").css("display","inline-block");
  276. }
  277. if($(this).nextUntil(".yaoshi").filter(".yaoshi2").css("display")!="none"){
  278. $(this).nextUntil(".yaoshi").filter(".yaoshi2").css("display","none");
  279. }
  280. else{
  281. $(this).nextUntil(".yaoshi").filter(".yaoshi2").css("display","inline-block");
  282. }
  283. if($('.yaoshi2').css("display")=="block"){
  284. //$('.yaoshi1').css("display","none");
  285. //$('.yaoshi2').css("display","none");
  286. }
  287. //第二张图片点击事件
  288. $('.yaoshi1').unbind('click');
  289. $('.yaoshi1').on("click", function () {
  290. var tempImg="";
  291. var yaoshi1Bool=true;
  292. var uName="";
  293. var luyinImgName="";
  294. var luyinTipName="";
  295. var luyinTipLitleName="";
  296. var audioName="";
  297. var closeImgName="";
  298. var thisImg=$(content).attr("src");
  299. for(var i=0; i<unTagChildName.length;i++){
  300. if(unTagChildName[i].className=='contentAnswer'){
  301. //alert(unTagChildName[i].innerHTML);
  302. uName=unTagChildName[i];
  303. }
  304. }
  305. for(var i=0; i<unTagChildName.length;i++){
  306. if(unTagChildName[i].tagName=='IMG'){
  307. //unTagChildName[i].style.display="inline";
  308. if(unTagChildName[i].className=="yaoshi1"){
  309. if(unTagChildName[i].src.indexOf("recoding-h.png")!=-1){
  310. tempImg=unTagChildName[i].src;
  311. unTagChildName[i].src=thisImg;
  312. for(var j=i; j<unTagChildName.length;j++){
  313. if(unTagChildName[j].className=="luyinImg"){
  314. luyinImgName=unTagChildName[j];
  315. }
  316. if(unTagChildName[j].className=="luyinTip"){
  317. luyinTipName=unTagChildName[j];
  318. }
  319. if(unTagChildName[j].className=="audioRequest"){
  320. audioName=unTagChildName[j];
  321. }
  322. if(unTagChildName[j].className=="luyinTipLitle"){
  323. luyinTipLitleName=unTagChildName[j];
  324. }
  325. if(unTagChildName[j].className=="closeImg"){
  326. closeImgName=unTagChildName[j];
  327. }
  328. if(unTagChildName[j].className=='contentAnswer'){
  329. //alert(unTagChildName[i].innerHTML);
  330. uName=unTagChildName[j];
  331. break;
  332. }
  333. }
  334. uName.style.display="none";
  335. audioName.style.display="none";
  336. luyinImgName.style.display="inline-block";
  337. luyinTipName.style.display="inline-block";
  338. luyinTipLitleName.style.display="inline-block";
  339. if($(this).nextUntil(".yaoshi1").filter(".luyinImg").css("display")=="none"){
  340. closeImgName.style.display="inline-block";
  341. }
  342. else{
  343. closeImgName.style.display="none";
  344. }
  345. yaoshi1Bool=false;
  346. }
  347. else if(unTagChildName[i].src.indexOf("text-h.png")!=-1){
  348. tempImg=unTagChildName[i].src;
  349. unTagChildName[i].src=thisImg;
  350. for(var j=i; j<unTagChildName.length;j++){
  351. if(unTagChildName[j].className=="luyinImg"){
  352. luyinImgName=unTagChildName[j];
  353. }
  354. if(unTagChildName[j].className=="luyinTip"){
  355. luyinTipName=unTagChildName[j];
  356. }
  357. if(unTagChildName[j].className=="audioRequest"){
  358. audioName=unTagChildName[j];
  359. }
  360. if(unTagChildName[j].className=="luyinTipLitle"){
  361. luyinTipLitleName=unTagChildName[j];
  362. }
  363. if(unTagChildName[j].className=="closeImg"){
  364. closeImgName=unTagChildName[j];
  365. }
  366. if(unTagChildName[j].className=="closeImg"){
  367. closeImgName=unTagChildName[j];
  368. }
  369. if(unTagChildName[j].className=='contentAnswer'){
  370. //alert(unTagChildName[i].innerHTML);
  371. uName=unTagChildName[j];
  372. break;
  373. }
  374. }
  375. uName.style.display="inline-block";
  376. audioName.style.display="none";
  377. luyinImgName.style.display="none";
  378. luyinTipName.style.display="none";
  379. luyinTipLitleName.style.display="none";
  380. closeImgName.style.display="none";
  381. yaoshi1Bool=false;
  382. }
  383. else if(unTagChildName[i].src.indexOf("audio-h.png")!=-1){
  384. tempImg=unTagChildName[i].src;
  385. unTagChildName[i].src=thisImg;
  386. for(var j=i; j<unTagChildName.length;j++){
  387. if(unTagChildName[j].className=="luyinImg"){
  388. luyinImgName=unTagChildName[j];
  389. }
  390. if(unTagChildName[j].className=="luyinTip"){
  391. luyinTipName=unTagChildName[j];
  392. }
  393. if(unTagChildName[j].className=="audioRequest"){
  394. audioName=unTagChildName[j];
  395. }
  396. if(unTagChildName[j].className=="luyinTipLitle"){
  397. luyinTipLitleName=unTagChildName[j];
  398. }
  399. if(unTagChildName[j].className=="closeImg"){
  400. closeImgName=unTagChildName[j];
  401. }
  402. if(unTagChildName[j].className=='contentAnswer'){
  403. //alert(unTagChildName[i].innerHTML);
  404. uName=unTagChildName[j];
  405. break;
  406. }
  407. }
  408. uName.style.display="none";
  409. audioName.style.display="inline-block";
  410. luyinImgName.style.display="none";
  411. luyinTipName.style.display="none";
  412. luyinTipLitleName.style.display="none";
  413. if($(this).nextUntil(".yaoshi1").find(".addMes").text()=="播放音频"){
  414. closeImgName.style.display="inline-block";
  415. }
  416. else{
  417. closeImgName.style.display="none";
  418. }
  419. yaoshi1Bool=false;
  420. }
  421. //tempImg=unTagChildName[i]
  422. }
  423. }
  424. }
  425. $(content).attr("src",tempImg);
  426. $('.yaoshi1').css("display","none");
  427. $('.yaoshi2').css("display","none");
  428. });
  429. //第三张图片点击事件
  430. $('.yaoshi2').unbind('click');
  431. $('.yaoshi2').on("click", function () {
  432. var tempImg="";
  433. var yaoshi1Bool=true;
  434. var uName="";
  435. var luyinImgName="";
  436. var luyinTipName="";
  437. var luyinTipLitleName="";
  438. var audioName="";
  439. var closeImgName="";
  440. var thisImg=$(content).attr("src");
  441. for(var i=0; i<unTagChildName.length;i++){
  442. if(unTagChildName[i].className=='contentAnswer'){
  443. //alert(unTagChildName[i].innerHTML);
  444. uName=unTagChildName[i];
  445. }
  446. }
  447. for(var i=0; i<unTagChildName.length;i++){
  448. if(unTagChildName[i].tagName=='IMG'){
  449. //unTagChildName[i].style.display="inline";
  450. if(unTagChildName[i].className=="yaoshi2"){
  451. if(unTagChildName[i].src.indexOf("recoding-h.png")!=-1){
  452. tempImg=unTagChildName[i].src;
  453. unTagChildName[i].src=thisImg;
  454. for(var j=i; j<unTagChildName.length;j++){
  455. if(unTagChildName[j].className=="luyinImg"){
  456. luyinImgName=unTagChildName[j];
  457. }
  458. if(unTagChildName[j].className=="luyinTip"){
  459. luyinTipName=unTagChildName[j];
  460. }
  461. if(unTagChildName[j].className=="audioRequest"){
  462. audioName=unTagChildName[j];
  463. }
  464. if(unTagChildName[j].className=="luyinTipLitle"){
  465. luyinTipLitleName=unTagChildName[j];
  466. }
  467. if(unTagChildName[j].className=="closeImg"){
  468. closeImgName=unTagChildName[j];
  469. }
  470. if(unTagChildName[j].className=='contentAnswer'){
  471. //alert(unTagChildName[i].innerHTML);
  472. uName=unTagChildName[j];
  473. break;
  474. }
  475. }
  476. uName.style.display="none";
  477. audioName.style.display="none";
  478. luyinImgName.style.display="inline-block";
  479. luyinTipName.style.display="inline-block";
  480. luyinTipLitleName.style.display="inline-block";
  481. if($(this).nextUntil(".yaoshi2").filter(".luyinImg").css("display")=="none"){
  482. closeImgName.style.display="inline-block";
  483. }
  484. else{
  485. closeImgName.style.display="none";
  486. }
  487. yaoshi1Bool=false;
  488. }
  489. else if(unTagChildName[i].src.indexOf("text-h.png")!=-1){
  490. tempImg=unTagChildName[i].src;
  491. unTagChildName[i].src=thisImg;
  492. for(var j=i; j<unTagChildName.length;j++){
  493. if(unTagChildName[j].className=="luyinImg"){
  494. luyinImgName=unTagChildName[j];
  495. }
  496. if(unTagChildName[j].className=="luyinTip"){
  497. luyinTipName=unTagChildName[j];
  498. }
  499. if(unTagChildName[j].className=="audioRequest"){
  500. audioName=unTagChildName[j];
  501. }
  502. if(unTagChildName[j].className=="luyinTipLitle"){
  503. luyinTipLitleName=unTagChildName[j];
  504. }
  505. if(unTagChildName[j].className=="closeImg"){
  506. closeImgName=unTagChildName[j];
  507. }
  508. if(unTagChildName[j].className=="closeImg"){
  509. closeImgName=unTagChildName[j];
  510. }
  511. if(unTagChildName[j].className=='contentAnswer'){
  512. //alert(unTagChildName[i].innerHTML);
  513. uName=unTagChildName[j];
  514. break;
  515. }
  516. }
  517. uName.style.display="inline-block";
  518. audioName.style.display="none";
  519. luyinImgName.style.display="none";
  520. luyinTipName.style.display="none";
  521. luyinTipLitleName.style.display="none";
  522. closeImgName.style.display="none";
  523. yaoshi1Bool=false;
  524. }
  525. else if(unTagChildName[i].src.indexOf("audio-h.png")!=-1){
  526. tempImg=unTagChildName[i].src;
  527. unTagChildName[i].src=thisImg;
  528. for(var j=i; j<unTagChildName.length;j++){
  529. if(unTagChildName[j].className=="luyinImg"){
  530. luyinImgName=unTagChildName[j];
  531. }
  532. if(unTagChildName[j].className=="luyinTip"){
  533. luyinTipName=unTagChildName[j];
  534. }
  535. if(unTagChildName[j].className=="audioRequest"){
  536. audioName=unTagChildName[j];
  537. }
  538. if(unTagChildName[j].className=="luyinTipLitle"){
  539. luyinTipLitleName=unTagChildName[j];
  540. }
  541. if(unTagChildName[j].className=="closeImg"){
  542. closeImgName=unTagChildName[j];
  543. }
  544. if(unTagChildName[j].className=='contentAnswer'){
  545. //alert(unTagChildName[i].innerHTML);
  546. uName=unTagChildName[j];
  547. break;
  548. }
  549. }
  550. uName.style.display="none";
  551. audioName.style.display="inline-block";
  552. luyinImgName.style.display="none";
  553. luyinTipName.style.display="none";
  554. luyinTipLitleName.style.display="none";
  555. if($(this).nextUntil(".yaoshi2").find(".addMes").text()=="播放音频"){
  556. closeImgName.style.display="inline-block";
  557. }
  558. else{
  559. closeImgName.style.display="none";
  560. }
  561. yaoshi1Bool=false;
  562. }
  563. //tempImg=unTagChildName[i]
  564. }
  565. }
  566. }
  567. $(content).attr("src",tempImg);
  568. $('.yaoshi1').css("display","none");
  569. $('.yaoshi2').css("display","none");
  570. });
  571. });
  572. //钥匙的浮动函数
  573. $('.yaoshi').hover(function(){
  574. var imagePath = $(this).attr("src");
  575. var classNa=$(this).attr("class");
  576. if(imagePath.indexOf("/second/text-n.png")!=-1){
  577. $(this).attr("src", "../../images/second/text-h.png");
  578. }
  579. if(imagePath.indexOf("/second/recoding-n.png")!=-1){
  580. $(this).attr("src", "../../images/second/recoding-h.png");
  581. }
  582. if(imagePath.indexOf("/second/audio-n.png")!=-1){
  583. $(this).attr("src", "../../images/second/audio-h.png");
  584. }
  585. }, function () {
  586. var imagePath = $(this).attr("src");
  587. if(imagePath.indexOf("/second/text-h.png")!=-1){
  588. $(this).attr("src", "../../images/second/text-n.png");
  589. }
  590. if(imagePath.indexOf("/second/recoding-h.png")!=-1){
  591. $(this).attr("src", "../../images/second/recoding-n.png");
  592. }
  593. if(imagePath.indexOf("/second/audio-h.png")!=-1){
  594. $(this).attr("src", "../../images/second/audio-n.png");
  595. }
  596. });
  597. //录音的浮动函数
  598. $('.yaoshi1').hover(function(){
  599. var imagePath = $(this).attr("src");
  600. var classNa=$(this).attr("class");
  601. if(imagePath.indexOf("/second/text-n.png")!=-1){
  602. $(this).attr("src", "../../images/second/text-h.png");
  603. }
  604. if(imagePath.indexOf("/second/recoding-n.png")!=-1){
  605. $(this).attr("src", "../../images/second/recoding-h.png");
  606. }
  607. if(imagePath.indexOf("/second/audio-n.png")!=-1){
  608. $(this).attr("src", "../../images/second/audio-h.png");
  609. }
  610. }, function () {
  611. var imagePath = $(this).attr("src");
  612. if(imagePath.indexOf("/second/text-h.png")!=-1){
  613. $(this).attr("src", "../../images/second/text-n.png");
  614. }
  615. if(imagePath.indexOf("/second/recoding-h.png")!=-1){
  616. $(this).attr("src", "../../images/second/recoding-n.png");
  617. }
  618. if(imagePath.indexOf("/second/audio-h.png")!=-1){
  619. $(this).attr("src", "../../images/second/audio-n.png");
  620. }
  621. });
  622. //添加音频的浮动函数
  623. $('.yaoshi2').hover(function(){
  624. var imagePath = $(this).attr("src");
  625. var classNa=$(this).attr("class");
  626. if(imagePath.indexOf("/second/text-n.png")!=-1){
  627. $(this).attr("src", "../../images/second/text-h.png");
  628. }
  629. if(imagePath.indexOf("/second/recoding-n.png")!=-1){
  630. $(this).attr("src", "../../images/second/recoding-h.png");
  631. }
  632. if(imagePath.indexOf("/second/audio-n.png")!=-1){
  633. $(this).attr("src", "../../images/second/audio-h.png");
  634. }
  635. }, function () {
  636. var imagePath = $(this).attr("src");
  637. if(imagePath.indexOf("/second/text-h.png")!=-1){
  638. $(this).attr("src", "../../images/second/text-n.png");
  639. }
  640. if(imagePath.indexOf("/second/recoding-h.png")!=-1){
  641. $(this).attr("src", "../../images/second/recoding-n.png");
  642. }
  643. if(imagePath.indexOf("/second/audio-h.png")!=-1){
  644. $(this).attr("src", "../../images/second/audio-n.png");
  645. }
  646. });
  647. //var uTagname=$(".docxParagraphs underlinePart").childNodes;
  648. //录音按钮浮动
  649. $('.luyinImg').hover(function(){
  650. var imagePath = $(this).attr("src");
  651. $(this).attr("src", "../../images/second/录音按钮-悬停.png");
  652. }, function () {
  653. var imagePath = $(this).attr("src");
  654. $(this).attr("src", "../../images/second/录音按钮-初始.png");
  655. });
  656. //关闭按钮浮动
  657. $('.closeImg').hover(function(){
  658. var imagePath = $(this).attr("src");
  659. $(this).attr("src", "../../images/second/删除-悬停.png");
  660. }, function () {
  661. var imagePath = $(this).attr("src");
  662. $(this).attr("src", "../../images/second/删除-初始.png");
  663. });
  664. $('.audioDiv').unbind('click');
  665. //添加音频的点击事件
  666. $('.audioDiv').on("click", function () {
  667. if(this.innerHTML.indexOf("添加音频")!=-1){
  668. F_Open_dialog()
  669. //var audioChild=$(this).children();
  670. if (document.getElementById("btn_file").value!="") {
  671. this.innerHTML=this.innerHTML.replace("添加音频","点击播放");
  672. $(this).parent().find(".audioStuImg").attr("src","../../images/second/音频图标-初始.png");
  673. $(this).parent().nextUntil(".audioRequest").filter(".closeImg").css("display","inline-block");
  674. if (document.getElementById("btn_file").value!= "") {
  675. var TempForVociceUrl = document.getElementById("btn_file").value;
  676. var playPath=window.external.UpLocalAudio(TempForVociceUrl);
  677. //alert(TempForVociceUrl);
  678. $(this).attr("voicePath",playPath)
  679. //window.external.changeTheVoiceWay(TempForVociceUrl,"yin");
  680. //window.external.playAudio(TempForVociceUrlNext);
  681. globalBool = false;
  682. globalVoice="";
  683. $(this).attr('voicePlay',playPath);
  684. document.getElementById("btn_file").value="";
  685. //$(this).attr("innerHTML");
  686. }
  687. }
  688. }
  689. else{
  690. if($(this).parent().prevUntil(".audioRequest").filter(".yaoshi").attr("src").indexOf("recoding")!=-1){
  691. window.external.playStuAudio($(this).parent().nextUntil(".yaoshi").filter(".luyinImg").attr("id"));
  692. }
  693. else{
  694. window.external.playStuAudio($(this).attr("voicePath"));
  695. }
  696. }
  697. });
  698. $('.luyinImg').unbind('click');
  699. $('.luyinImg').on("click", function () {
  700. alert($(this).attr("id"));
  701. if($(this).attr("id")!="1"){
  702. window.external.playStuAudio($(this).attr("id"));
  703. return;
  704. }
  705. //开始录音
  706. var unTagName=$('.luyinImg').parent();
  707. var unTagChildName= unTagName.children();
  708. var result = window.external.RedioStartRecoding("");
  709. if(result!=""){
  710. //result = JSON.parse(result);
  711. $(this).nextUntil(".yaoshi").filter(".luyinTip").css("display","none");
  712. $(this).css("display","none");
  713. $(this).nextUntil(".yaoshi").filter(".luyinTipLitle").css("display","none");
  714. //$(this).parent().find(".audioDiv").css("display","inline-block");
  715. $(this).prevUntil(".yaoshi").filter(".audioRequest").css("display","inline-block");
  716. //$(this).parent().find(".audioRequest").children().find("audioDiv").attr("src","../../images/second/音频图标-初始.png");;
  717. $(this).prevUntil(".yaoshi").find(".addMes").html("播放音频");
  718. $(this).prevUntil(".yaoshi").filter(".closeImg").css("display","inline-block");
  719. $(this).prevUntil(".yaoshi").find(".audioStuImg").attr("src","../../images/second/音频图标-初始.png");
  720. //this.innerHTML=this.innerHTML.replace("添加音频","点击播放");
  721. //$(this).parent().attr("src","../../images/second/音频图标-初始.png");
  722. $(this).attr("id", result);
  723. }
  724. //result = JSON.parse(result);
  725. //$(this).parent().find(".luyinTip").html("点击播放录音");
  726. //$(this).parent().find(".luyinImg").attr("id", result);
  727. //for(var i=0; i<unTagChildName.length;i++){
  728. //if($(".luyinImg").eq(i).attr("src").indexOf("录音按钮-悬停")!=-1){
  729. //$(".luyinTip").eq(i).html("点击播放录音");
  730. //$(".luyinImg").eq(i).attr("src", "../../images/second/录音按钮-初始.png");
  731. //$(".luyinImg").eq(i).attr("id", result);
  732. //}
  733. //$(".luyinTip").eq(i).attr("display");
  734. //$(this).css("background-image", "url(./image/录音中.png)");
  735. //}
  736. });
  737. $('.closeImg').mouseup(function (event) {
  738. if($(this).prevUntil(".closeImg").filter(".yaoshi").attr("src").indexOf("audio")!=-1){
  739. $(this).prevUntil(".closeImg").find(".audioDiv").attr("voicePath","")
  740. $(this).prevUntil(".closeImg").find(".addMes").text("添加音频");
  741. $(this).prevUntil(".closeImg").find(".audioStuImg").attr("src","../../images/second/addVoice-n.png");
  742. $(this).css("display","none");
  743. }
  744. if($(this).prevUntil(".closeImg").filter(".yaoshi").attr("src").indexOf("recoding")!=-1){
  745. $(this).nextUntil(".closeImg").filter(".luyinTip").css("display","inline-block");
  746. $(this).nextUntil(".closeImg").filter(".luyinImg").css("display","inline-block");
  747. $(this).nextUntil(".closeImg").filter(".luyinImg").attr("id","1");
  748. $(this).nextUntil(".closeImg").filter(".luyinTipLitle").css("display","inline-block");
  749. $(this).prevUntil(".closeImg").filter(".audioRequest").css("display","none");
  750. $(this).prevUntil(".closeImg").find(".addMes").text("添加音频");
  751. $(this).prevUntil(".closeImg").find(".audioStuImg").attr("src","../../images/second/addVoice-n.png");
  752. $(this).css("display","none");
  753. }
  754. });
  755. //文件打开函数
  756. //第一个替换按钮
  757. function F_Open_dialog() {
  758. document.getElementById("btn_file").click();
  759. }
  760. }
  761. catch (error) {
  762. alert(error);
  763. }
  764. })