linwu 17 hours ago
parent
commit
a45d49f752

+ 37 - 0
app/home/controller/AiExam.php

@@ -0,0 +1,37 @@
+<?php
+
+
+namespace app\home\controller;
+
+use app\home\HomeBaseController;
+
+class Aiexam extends HomeBaseController
+{
+    public function index()
+    {
+        $date = strtotime('2025-12-25 09:00:00');
+        $now  = time();
+        if ($now < $date) {
+            return view('tip', ['second' => $date - $now + 1]);
+        }
+
+        return view('');
+    }
+
+    public function upload()
+    {
+        $file     = request()->file("file");
+        $savename = \think\facade\Filesystem::disk('public')->putFileAs('files', $file, 'ai_exam/' . $_FILES['file']['name']);
+        if ($file) {
+            $filename = str_replace(strrchr($_FILES['file']['name'], "."), "", $_FILES['file']['name']);
+            ajax_return(0, '', [
+                'src'   => request()->domain() . "/storage/" . str_replace("\\", "/", $savename),
+                'path'  => "./storage/" . str_replace("\\", "/", $savename),
+                'title' => $filename,
+            ]);
+        } else {
+            ajax_return(1, '上传失败,请稍后重试');
+        }
+    }
+
+}

+ 36 - 0
app/home/view/ai_exam/index.html

@@ -0,0 +1,36 @@
+{extend name="public/base_el"/}
+{block name="css"}
+<style>
+    .title {margin-top:100px;}
+    .title p{margin:10px auto;padding:0 20px;text-align: center;font-size:24px;font-weight: 700;}
+</style>
+{/block}
+{block name="body"}
+<div style="margin:0 auto; width:1200px;">
+    <div style="margin: 100px 20px;text-align: center;">
+        <el-upload
+                v-model:file-list="fileList"
+                class="upload-demo"
+                action="{:url('upload')}"
+                multiple
+        >
+            <el-button type="primary">点击上传文件</el-button>
+        </el-upload>
+    </div>
+</div>
+{/block}
+{block name="script"}
+<script>
+    function v_setup() {
+        let base = {};
+
+        base.toStart = () => {
+            location.href = "{:url('officer/answer')}"
+        }
+
+        base.fileList = Vue.ref([]);
+
+        return base;
+    }
+</script>
+{/block}

+ 42 - 0
app/home/view/ai_exam/tip.html

@@ -0,0 +1,42 @@
+{extend name="public/base_el"/}
+{block name="css"}
+<style>
+    .title {margin-top:100px;}
+    .title p{margin:10px auto;padding:0 20px;text-align: center;font-size:24px;font-weight: 700;}
+</style>
+{/block}
+{block name="body"}
+<div style="margin:100px auto; width:1200px;text-align: center;">
+    <h1>比赛将在12月25日9点准时开始,距离开始还剩余{{second}}秒</h1>
+    <h5 style="color:red;">若页面未自动刷新,请点击下方刷新按钮进入比赛</h5>
+    <div style="margin: 100px 20px;text-align: center;">
+        <el-button type="primary" size="large" @click="refresh">刷新</el-button>
+    </div>
+</div>
+{/block}
+{block name="script"}
+<script>
+    function v_setup() {
+        let base = {};
+
+        base.toStart = () => {
+            location.href = "{:url('officer/answer')}"
+        }
+        base.second = Vue.ref({$second});
+        let time = setInterval(function(){
+            if (base.second.value == 0) {
+                location.reload();
+                clearInterval(time);
+                return false;
+            }
+            base.second.value--;
+        },1000);
+
+        base.refresh = () => {
+            location.reload();
+        }
+
+        return base;
+    }
+</script>
+{/block}

+ 1 - 1
app/home/view/public/meta_header_el.html

@@ -1,5 +1,5 @@
 <meta charset="utf-8">
-<title>人资测评系统</title>
+<title>AI竞赛决赛考试</title>
 <meta name="renderer" content="webkit">
 <meta name="viewport"
       content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover"/>