CourseworView.cshtml 4.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. @using Bowin.Web.Controls.Mvc;
  2. @using EMISOnline.Entities;
  3. @using EMISOnline.Web.Controls;
  4. @{
  5. ViewBag.Title = "PracticeSetting";
  6. }
  7. <div class="easyui-panel" data-options="border:false,fit:true" style="position: relative;">
  8. @Html.Position()
  9. <div class="p_SearchTitle">
  10. <div style="float: left; margin-left: 10px; font-size: 12px; line-height: 30px;">
  11. 查询条件</div>
  12. </div>
  13. <div class="search_list">
  14. <div class="practice-container">
  15. <div class="practice-tip">
  16. <b>温馨提示:</b> 试卷一共有<span class="num"><span id="txtQuestionCount" style="color: Blue">@ViewBag.txtQuestionCount</span></span>
  17. 道, 当前第<span class="num"><span id="txtDone"></span></span>道, 还有<span class="num"> <span
  18. id="txtTodo"></span></span>道 <a href="PracticeSetting.aspx">退出练习</a>
  19. </div>
  20. <div class="practice-contont">
  21. <div id="questionContent">
  22. </div>
  23. </div>
  24. <div class="practice-button">
  25. @Html.Button(new ButtonOptions() { ID = "btnPrev", Text = "上一题" })
  26. @Html.Button(new ButtonOptions() { ID = "btnNext", Text = "下一题" })
  27. @Html.Button(new ButtonOptions() { ID = "btnShowAnswer", Text = "结束作业" })
  28. <input type="hidden" id="hd_right_questionid" runat="server" />
  29. <input type="hidden" id="hd_right_answers" runat="server" />
  30. </div>
  31. <div id="info" style="display: none">
  32. 无法找到对应的题目,请返回<a href="PracticeSetting.aspx">设置页面</a>重设练习条件.</div>
  33. </div>
  34. </div>
  35. </div>
  36. @section scripts{
  37. <script type="text/javascript" src="~/Scripts/Examinee/jquery-jtemplates_uncompressed.js"></script>
  38. <script type="text/javascript" src="~/Scripts/Business/student.parctite.js"></script>
  39. <script type="text/javascript" src="~/Scripts/NewEMIS.Comm.js"></script>
  40. <script type="text/jscript">
  41. var question = @Html.Raw(ViewBag.question);
  42. var currentIndex = @ViewBag.currentIndex;
  43. var fileServerUrl="@Html.Raw(ViewBag.fileServerUrl)";
  44. var QeustionSet=@Html.Raw(ViewBag.QeustionSet);
  45. var right_answers="";
  46. $(function () {
  47. $('#btnSave').click(function () {
  48. $(document.forms[0]).submit();
  49. })
  50. if (typeof (question) != 'undefined') {
  51. var builder = new parctiteBuilder();
  52. builder.buildPaper();
  53. }
  54. else {
  55. var info = $("#info");
  56. var container = $("#questionContent");
  57. container.append(info);
  58. info.show();
  59. }
  60. $('#btnPrev').click(function(){
  61. toggleQuestion( currentIndex-1);
  62. })
  63. $('#btnNext').click(function(){
  64. toggleQuestion(currentIndex+1);
  65. })
  66. $('#btnShowAnswer').click(function(){
  67. var questionid =QeustionSet[currentIndex];
  68. Invoke('@Url.Content("~/MyCoursework/TakePaper")',{workid:"@(ViewBag.Workid)",questionid:questionid,currentIndex:currentIndex,right_answers:right_answers});
  69. self.opener=null;
  70. self.close();
  71. })
  72. showButton();
  73. })
  74. function toggleQuestion(index){
  75. var questionid =QeustionSet[currentIndex];
  76. currentIndex=index;
  77. question = Invoke('@Url.Content("~/MyCoursework/GetQuestion")',{questionid:questionid,currentIndex:currentIndex,right_answers:right_answers});
  78. if (typeof (question) != 'undefined') {
  79. var builder = new parctiteBuilder();
  80. builder.buildPaper();
  81. }
  82. showButton();
  83. }
  84. function showButton(){
  85. $('#btnPrev').show();
  86. $('#btnNext').show();
  87. if(currentIndex==0){
  88. $('#btnPrev').hide();
  89. $('#btnNext').show();
  90. }else if((currentIndex+1)==QeustionSet.length){
  91. $('#btnPrev').show();
  92. $('#btnNext').hide();
  93. }
  94. $('#txtDone').text((currentIndex + 1));
  95. $('#txtTodo').text(QeustionSet.length - currentIndex - 1);
  96. }
  97. </script>
  98. }