Ver código fonte

Merge remote-tracking branch 'origin/master'

liu tao 3 anos atrás
pai
commit
1f0865a464

+ 131 - 0
uis/admin/examquestion/details.html

@@ -0,0 +1,131 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8">
+    <title>试题管理详情</title>
+    <meta name="renderer" content="webkit">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
+    <meta name="viewport"
+          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
+    <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
+    <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
+    <style type="text/css">
+        .title {
+            width: 140px;
+            background: #efefef;
+        }
+    </style>
+</head>
+<body>
+
+<div class="layui-fluid">
+    <div class="layui-card">
+        <div class="layui-card-body" pad15>
+            <div class="layui-row layui-col-space15">
+                <div class="layui-col-md12">
+
+                    <div id="print_div">
+                        <table class="layui-table">
+
+                            <tr>
+                                <td class="title">科目:</td>
+                                <td id="subject_text" class="cell"></td>
+                                <td class="title">章节:</td>
+                                <td id="chapter_text" class="cell"></td>
+                            </tr>
+
+                            <tr>
+                                <td class="title">题型:</td>
+                                <td id="type_text" class="cell"></td>
+                                <td class="title">难度:</td>
+                                <td id="difficulty_text" class="cell"></td>
+                            </tr>
+                            <tr>
+                                <td class="title">分数:</td>
+                                <td id="scores" class="cell"></td>
+                                <td class="title"></td>
+                                <td class="cell"></td>
+                            </tr>
+                            <tr>
+                                <td class="title">录入人:</td>
+                                <td id="create_user_text" class="cell"></td>
+                                <td class="title">录入时间:</td>
+                                <td id="create_time" class="cell"></td>
+                            </tr>
+                            <tr>
+                                <td class="title">题目:</td>
+                                <td colspan="3" id="title" class="cell"></td>
+                            </tr>
+
+                            <tr id="id_analysis">
+                                <td class="title">解析:</td>
+                                <td colspan="3" id="analysis" class="cell"></td>
+                            </tr>
+                        </table>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+
+<script src="../../layuiadmin/layui/layui.js?t=1"></script>
+<script>
+    layui.config({
+        base: '../../../layuiadmin/' //静态资源所在路径
+    }).extend({
+        index: 'lib/index' //主入口模块
+    }).use(['index', 'table'], function () {
+        var $ = layui.$;
+        var editdata = JSON.parse(JSON.stringify(parent.layui.table.editdata)); // 框架有Bug所以这么转换
+        $('.cell').each(function (index, element) {
+            element.innerHTML += (editdata[element.id] || '')
+        });
+        var answer = ''
+        if (editdata.type < 4) {
+            // 单选、多选、填空
+            var answers = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
+                'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
+            var items = editdata.items, answer_title = '', right = ''
+            for (var i = 0; i < items.length; i++) {
+                if (editdata.type === 3) {
+                    answer_title = '空白' + (i + 1)
+                } else {
+                    answer_title = answers[i]
+                }
+
+                if (items[i].right) {
+                    right = '<img src="../right.png" width="15px" height="15px" style="margin-right: 3px">'
+                } else {
+                    right = '<span style="margin-right: 17px"></span>'
+                }
+                if (i === 0) {
+                    answer = "<tr>\n" +
+                        "<td class=\"title\">选项/答案:</td>\n" +
+                        "<td colspan=\"3\" class=\"cell\">" + right + answer_title + "、" + items[i].content + "</td>\n" +
+                        "</tr>"
+                } else {
+                    answer = "<tr>\n" +
+                        "<td></td>\n" +
+                        "<td colspan=\"3\" class=\"cell\">" + right + answer_title + "、" + items[i].content + "</td>\n" +
+                        "</tr>"
+                }
+                $('#id_analysis').before(answer)
+            }
+        } else {
+            // 判断
+            if (editdata.judgment === "1") {
+                right = '<img src="../right.png" width="15px" height="15px" style="margin-right: 3px">正确'
+            } else {
+                right = '<img src="../wrong.png" style="margin-right: 3px">错误'
+            }
+            answer = "<tr>\n" +
+                "<td class=\"title\">选项/答案:</td>\n" +
+                "<td colspan=\"3\" class=\"cell\">" + right + "</td>\n" +
+                "</tr>"
+            $('#id_analysis').before(answer)
+        }
+    });
+</script>
+</body>
+</html>

+ 8 - 9
uis/admin/examquestion/edit.html

@@ -204,7 +204,7 @@
                 layer.msg(error_msg, {icon: 2});
                 return false
             }
-            if (!checked && id_type < 4) {
+            if (!checked && id_type < 3) {
                 layer.msg('请选择一个正确答案!', {icon: 2});
                 return false
             }
@@ -272,7 +272,7 @@
                 for (var i = 0; i < oldData.length; i++) {
                     if (id_type === "1" || id_type === "2") {
                         //单选题、多选
-                        oldData[i].answer = aswers[i]
+                        oldData[i].answer = answers[i]
                     }
                     else if (id_type === "3") {
                         //填空题
@@ -303,7 +303,7 @@
                     break;
             }
         });
-        var aswers = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
+        var answers = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
             'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
         form.on('select(typeChange)', function (data) {
             // 更换题型,重新加载table
@@ -322,7 +322,7 @@
                             {
                                 id: items[i].id,
                                 LAY_CHECKED: items[i].right,
-                                answer: aswers[i],
+                                answer: answers[i],
                                 content: items[i].content,
                             }
                         )
@@ -332,7 +332,7 @@
                         oldData.push(
                             {
                                 id: '',
-                                answer: aswers[i],
+                                answer: answers[i],
                                 content: '',
                             }
                         )
@@ -348,7 +348,7 @@
                             {
                                 id: items[i].id,
                                 LAY_CHECKED: items[i].right,
-                                answer: aswers[i],
+                                answer: answers[i],
                                 content: items[i].content,
                             }
                         )
@@ -358,7 +358,7 @@
                         oldData.push(
                             {
                                 id: '',
-                                answer: aswers[i],
+                                answer: answers[i],
                                 content: '',
                             }
                         )
@@ -385,7 +385,6 @@
                 layui.$('#id_panduan').removeClass('layui-hide')
                 layui.$('#id_table').addClass('layui-hide')
             }
-            console.log(111111111, _cols)
             tableIns.reload({
                 data: oldData,
                 cols: [_cols],
@@ -405,7 +404,7 @@
                 oldData.push(
                     {
                         id: '',
-                        answer: aswers[oldData_len],
+                        answer: answers[oldData_len],
                         content: '',
                     }
                 )

+ 3 - 11
uis/admin/examquestion/index.html

@@ -173,20 +173,12 @@
                     type: 2,
                     title: '查看详情',
                     shadeClose: false,
-                    area: ['80%', '80%'],
-                    btn: ['保存', '取消'],
+                    area: ['70%', '80%'],
+                    btn: ['关闭'],
                     yes: function (index, dom) {
-                        layui.onSubmitChild = function (res) {
-                            layer.close(index);
-                            table.reload('exam_question_datagrid', {});
-                        };
-                        layui.submitChild();
-                    },
-                    btn2: function (index, layero) {
                         layer.close(index);//关闭当前按钮
-                        table.reload('exam_question_datagrid', {});
                     },
-                    content: 'uploadDetailImg.html?id=' + data.id + '&type=' + obj.event
+                    content: 'details.html'
                 });
             }
         });

BIN
uis/admin/right.png


BIN
uis/admin/wrong.png