linwu 1 week ago
parent
commit
e7f3d1f124

+ 5 - 1
app/admin/controller/Officer.php

@@ -48,12 +48,15 @@ class Officer extends AdminBaseController
     {
         $id    = input('id', 0);
         $list  = OfficerAnswerModel::where('rid', $id)
+            ->where('status', 2)
             ->order('id', 'desc')
             ->limit(input('limit'))
             ->page(input('page'))
             ->append(['status_text'])
             ->select();
-        $count = OfficerAnswerModel::count();
+        $count = OfficerAnswerModel::where('rid', $id)
+            ->where('status', 2)
+            ->count();
         if ($count == 0) {
             ajax_return(1, '未查询到数据');
         }
@@ -65,6 +68,7 @@ class Officer extends AdminBaseController
         $id   = input('id', 0);
         $list = OfficerAnswerModel::with(['detail'])
             ->where('rid', $id)
+            ->where('status', 2)
             ->order('id', 'desc')
             ->append(['status_text'])
             ->select();

+ 5 - 5
app/admin/view/company/info.html

@@ -24,13 +24,13 @@
                             </thead>
                             <tbody>
                                 <tr>
-                                    <td onclick="copyMobileUrl('https://59.57.98.130:32890/91c2ce74');">外网面板地址: https://59.57.98.130:32890/91c2ce74</td>
-                                    <td onclick="copyMobileUrl('https://192.168.1.76:32890/91c2ce74');"> 内网面板地址:https://192.168.1.76:32890/91c2ce74</td>
-                                    <td onclick="copyMobileUrl('il1wq9qb');">帐号:il1wq9qb</td>
-                                    <td onclick="copyMobileUrl('e1ce223a');">密码:e1ce223a</td>
+                                    <td onclick="copyMobileUrl('https://59.57.98.130:20661/d88b8988');">外网面板地址:https://59.57.98.130:20661/d88b8988</td>
+                                    <td onclick="copyMobileUrl('https://192.168.1.77:20661/d88b8988');"> 内网面板地址:https://192.168.1.77:20661/d88b8988</td>
+                                    <td onclick="copyMobileUrl('vskpybca');">帐号:vskpybca</td>
+                                    <td onclick="copyMobileUrl('c9a4dbb5');">密码:c9a4dbb5</td>
                                 </tr>
                                 <tr>
-                                    <td colspan="2" onclick="copyMobileUrl('root');">服务器帐号:root</td>
+                                    <td colspan="2" onclick="copyMobileUrl('jinjianghc');">服务器帐号:jinjianghc</td>
                                     <td colspan="2" onclick="copyMobileUrl('20190515Hc#');">服务器密码:20190515Hc#</td>
                                 </tr>
                             </tbody>

+ 57 - 22
app/home/controller/Officer.php

@@ -36,8 +36,8 @@ class Officer extends MobileBaseController
             return '该题库不存在或已删除';
         }
 
-        $section_list = OfficerReviewSectionModel::where('rid', $id)->column('name','id');
-        $list = OfficerReviewTitleModel::where('rid', $id)->order('no', 'asc')->select()->toArray();
+        $section_list = OfficerReviewSectionModel::where('rid', $id)->column('name', 'id');
+        $list         = OfficerReviewTitleModel::where('rid', $id)->order('no', 'asc')->select()->toArray();
         if (empty($list)) {
             return '该题库不存在或已删除';
         }
@@ -55,31 +55,66 @@ class Officer extends MobileBaseController
 
     public function answerPost()
     {
-        sleep(3);
-        $id            = input('id');
-        $answer        = input('answer');
-        $answer_detail = input('answer_detail');
-
+        $answer         = input('answer');
+        $answer['rid']  = input('rid');
         $officer_answer = OfficerAnswerModel::create($answer);
-        $review_title   = OfficerReviewTitleModel::where('rid', $id)->column('option,title', 'no');
-        $score_sum      = 0;
-        foreach ($answer_detail as $k => $v) {
-            $options = json_decode($review_title[$k]['option'], true);
-            $option  = $options[$v];
-            OfficerAnswerDetailModel::create([
-                'aid'          => $officer_answer['id'],
-                'no'           => $k,
-                'title'        => $review_title[$k]['title'],
-                'score'        => $option['score'],
-                'option_title' => $option['title'],
-            ]);
-            $score_sum += $option['score'];
-        }
-        OfficerAnswerModel::update(['score' => $score_sum], ['id' => $officer_answer['id']]);
 
+        ajax_return(0, '', $officer_answer['id']);
+    }
+
+    public function answerDetailPost()
+    {
+        $id    = input('id');
+        $aid   = input('aid');
+        $no    = input('no');
+        $index = input('index');
+
+        $review_title = OfficerReviewTitleModel::where('rid', $id)->where('no', $no)->find();
+        $option       = $review_title['option'][$index - 1];
+        OfficerAnswerDetailModel::create([
+            'aid'          => $aid,
+            'no'           => $no,
+            'title'        => $review_title['title'],
+            'score'        => $option['score'],
+            'option_title' => $option['title'],
+        ]);
+        ajax_return();
+    }
+
+    public function answerFinish()
+    {
+        $aid   = input('aid');
+        $score = OfficerAnswerDetailModel::where('aid', $aid)->sum('score');
+        OfficerAnswerModel::update(['score' => $score, 'status' => 2], ['id' => $aid]);
         ajax_return();
     }
 
+//    public function answerPost()
+//    {
+//        $id            = input('id');
+//        $answer        = input('answer');
+//        $answer_detail = input('answer_detail');
+//
+//        $officer_answer = OfficerAnswerModel::create($answer);
+//        $review_title   = OfficerReviewTitleModel::where('rid', $id)->column('option,title', 'no');
+//        $score_sum      = 0;
+//        foreach ($answer_detail as $k => $v) {
+//            $options = json_decode($review_title[$k]['option'], true);
+//            $option  = $options[$v];
+//            OfficerAnswerDetailModel::create([
+//                'aid'          => $officer_answer['id'],
+//                'no'           => $k,
+//                'title'        => $review_title[$k]['title'],
+//                'score'        => $option['score'],
+//                'option_title' => $option['title'],
+//            ]);
+//            $score_sum += $option['score'];
+//        }
+//        OfficerAnswerModel::update(['score' => $score_sum], ['id' => $officer_answer['id']]);
+//
+//        ajax_return();
+//    }
+
     public function finish()
     {
         return view();

+ 71 - 35
app/home/view/officer/answer.html

@@ -21,7 +21,9 @@
         text-indent: 2em;
         background: white;
         padding-top: 20px;
-        font-size: 14px;
+        font-size: 18px;
+        font-weight: 700;
+        font-family: "楷体";
     }
 
     .info-btn {
@@ -34,7 +36,7 @@
         display: flex;
         flex-direction: column;
         justify-content: center;
-        align-items: flex-start;
+        align-items: center;
     }
 
     .evaluate .el-radio-group .el-radio {
@@ -52,6 +54,7 @@
     .evaluate .detail-title {
         padding-top: 50px;
         padding-right: 50px;
+        text-align: center;
     }
 
     .mt-50 {
@@ -93,6 +96,9 @@
         color: white;
         background: #1D6BD0;
     }
+    .el-radio:last-child {
+        margin-right:32px;
+    }
 </style>
 {/block}
 {block name="body"}
@@ -112,9 +118,9 @@
     </div>
     <div class="content">
         <el-row>
-            <el-col :span="17">
+            <el-col :span="24">
                 <fieldset style="height:600px;box-sizing: border-box;">
-                    <legend>考试题目</legend>
+                    <legend>测评条目</legend>
                     <div class="detail-title">{{list[index].no}}、{{list[index].title}}</div>
                     <el-radio-group v-model="answer_detail[list[index].no]">
                         <el-radio
@@ -123,30 +129,30 @@
                                 border
                                 :key="list[index].no + '_' + option.score"
                                 v-for="option in list[index].option"
-                                @change="selectTile"
                         >{{option.title}}
                         </el-radio>
                     </el-radio-group>
                 </fieldset>
             </el-col>
-            <el-col :span="7" style="height:600px;">
-                <div class="title-list">
-                    <ul>
-                        <li
-                                class="num"
-                                :class="{finish:answer_detail[item.no] > 0,current:i==index}"
-                                :key="item.id"
-                                v-for="(item,i) in list"
-                                @click="changeTitle(i)"
-                        >{{item.no}}
-                        </li>
-                    </ul>
-                </div>
-            </el-col>
+<!--            <el-col :span="7" style="height:600px;">-->
+<!--                <div class="title-list">-->
+<!--                    <ul>-->
+<!--                        <li-->
+<!--                                class="num"-->
+<!--                                :class="{finish:answer_detail[item.no] > 0,current:i==index}"-->
+<!--                                :key="item.id"-->
+<!--                                v-for="(item,i) in list"-->
+<!--                                @click="changeTitle(i)"-->
+<!--                        >{{item.no}}-->
+<!--                        </li>-->
+<!--                    </ul>-->
+<!--                </div>-->
+<!--            </el-col>-->
         </el-row>
     </div>
     <div class="info-btn mt-50">
-        <el-button type="primary" size="large" @click="onSubmit" v-loading="loading">提交</el-button>
+        <el-button type="primary" size="large" @click="onNext" v-show="index + 1 != list.length">下一题</el-button>
+        <el-button type="primary" size="large" @click="onSubmit" v-loading="loading" v-show="index + 1 == list.length">提交</el-button>
     </div>
 </div>
 {/block}
@@ -169,28 +175,58 @@
             base.index.value = i;
         }
         base.loading = Vue.ref(false);
+        base.onNext = () => {
+            postJson("{:url('officer/answerDetailPost')}", {
+                id: {$id},
+                index: base.answer_detail.value[base.list[base.index.value].no],
+                aid: base.aid.value,
+                no: base.list[base.index.value].no,
+            })
+            base.index.value++;
+        }
         base.onSubmit = () => {
             if (base.loading.value) {
                 return false;
             }
-            for (let i = 0; i < base.list.length; i++) {
-                if (base.answer_detail.value[i + 1] === undefined) {
-                    ElementPlus.ElMessage.error(`第${i + 1}题未填写`);
-                    return false;
-                }
-            }
-            base.answer.value.rid = {$id};
-            base.loading.value = true;
-            postJson("{:url('officer/answerPost')}", {
+
+            postJson("{:url('officer/answerDetailPost')}", {
                 id: {$id},
-                answer: base.answer.value,
-                answer_detail: base.answer_detail.value
-            }).then((data) => {
-                base.loading.value = false;
-                ElementPlus.ElMessage.success('提交成功');
-                location.href = "{:url('officer/finish')}";
+                index: base.answer_detail.value[base.list[base.index.value].no],
+                aid: base.aid.value,
+                no: base.list[base.index.value].no,
+            }).then(() => {
+                postJson("{:url('officer/answerFinish')}", {
+                    aid: base.aid.value,
+                }).then((data) => {
+                    base.loading.value = false;
+                    ElementPlus.ElMessage.success('提交成功');
+                    location.href = "{:url('officer/finish')}";
+                })
             })
+
         }
+        // base.onSubmit = () => {
+        //     if (base.loading.value) {
+        //         return false;
+        //     }
+        //     for (let i = 0; i < base.list.length; i++) {
+        //         if (base.answer_detail.value[i + 1] === undefined) {
+        //             ElementPlus.ElMessage.error(`第${i + 1}题未填写`);
+        //             return false;
+        //         }
+        //     }
+        //     base.answer.value.rid = {$id};
+        //     base.loading.value = true;
+        //     postJson("{:url('officer/answerPost')}", {
+        //         id: {$id},
+        //         answer: base.answer.value,
+        //         answer_detail: base.answer_detail.value
+        //     }).then((data) => {
+        //         base.loading.value = false;
+        //         ElementPlus.ElMessage.success('提交成功');
+        //         location.href = "{:url('officer/finish')}";
+        //     })
+        // }
 
         return base;
     }

+ 24 - 2
app/home/view/officer/answer_base.html

@@ -107,7 +107,7 @@
         </el-col>
     </el-row>
     <div class="info-btn">
-        <el-button type="primary" size="large" @click="baseSubmit">下一步</el-button>
+        <el-button type="primary" size="large"  @click="baseSubmit" v-loading="baseLoading">下一步</el-button>
     </div>
 </el-form>
 <script>
@@ -213,7 +213,13 @@
             }
         }
 
+        base.baseLoading = Vue.ref(false);
+        base.aid = Vue.ref(0);
         base.baseSubmit = () => {
+            if (base.baseLoading.value) {
+                return false;
+            }
+
             const required_field = [
                 {field:'name',tip:'请输入姓名'},
                 {field:'mobile',tip:'请输入手机号'},
@@ -230,21 +236,25 @@
             for (let item of required_field) {
                 if (base.answer.value[item.field] === undefined || base.answer.value[item.field] === '') {
                     ElementPlus.ElMessage.error(item.tip);
+                    base.baseLoading.value = true;
                     return false;
                 }
             }
             if (base.answer.value.company == '党政机关') {
                 if (base.answer.value.company_text === undefined || base.answer.value.company_text === '') {
                     ElementPlus.ElMessage.error('请输入具体部门');
+                    base.baseLoading.value = true;
                     return false;
                 }
                 if (base.answer.value.job === undefined || base.answer.value.job === '') {
                     ElementPlus.ElMessage.error('请选择职位');
+                    base.baseLoading.value = true;
                     return false;
                 } else {
                     if (base.answer.value.job == '其他') {
                         if (base.answer.value.job_text === undefined || base.answer.value.job_text === '') {
                             ElementPlus.ElMessage.error('请输入具体职位');
+                            base.baseLoading.value = true;
                             return false;
                         }
                     }
@@ -253,15 +263,18 @@
             if (base.answer.value.company == '事业单位') {
                 if (base.answer.value.company_text === undefined || base.answer.value.company_text === '') {
                     ElementPlus.ElMessage.error('请输入具体领域');
+                    base.baseLoading.value = true;
                     return false;
                 }
                 if (base.answer.value.job === undefined || base.answer.value.job === '') {
                     ElementPlus.ElMessage.error('请选择职位');
+                    base.baseLoading.value = true;
                     return false;
                 } else {
                     if (base.answer.value.job == '其他') {
                         if (base.answer.value.job_text === undefined || base.answer.value.job_text === '') {
                             ElementPlus.ElMessage.error('请输入具体职位');
+                            base.baseLoading.value = true;
                             return false;
                         }
                     }
@@ -270,10 +283,19 @@
             if (base.answer.value.company == '其他') {
                 if (base.answer.value.company_text === undefined || base.answer.value.company_text === '') {
                     ElementPlus.ElMessage.error('请输入单位补充');
+                    base.baseLoading.value = true;
                     return false;
                 }
             }
-            base.active.value = 1;
+
+            postJson("{:url('officer/answerPost')}", {
+                rid: {$id},
+                answer: base.answer.value,
+            }).then((data) => {
+                base.baseLoading.value = false;
+                base.aid.value = data.data;
+                base.active.value = 1;
+            })
         }
 
         return base;