xy 1 month ago
commit 7bba4f5e05
  1. 6
      src/api/index.ts
  2. 49
      src/layout/index.vue
  3. 326
      src/layout/loginPage.vue
  4. 106
      src/layout/studyPage.vue
  5. 1
      src/store/modules/setting.ts
  6. 25
      src/store/modules/user.ts
  7. 18
      src/utils/request.ts
  8. 6
      src/views/compiler/index.vue
  9. 2
      src/views/designRoute/index.vue
  10. 2
      src/views/experimentalData/index.vue
  11. 85
      src/views/largeDataScreen/home.vue
  12. 17
      src/views/program/index.vue
  13. 575
      src/views/subjectTest/index.vue

@ -81,4 +81,10 @@ export const submitExperiment = (data:any) => {
method:"POST", method:"POST",
data data
}) })
}
// 查看得分
export const getScore = () => {
return request({
url:'/xnRecords/getExperimentaInfo'
})
} }

@ -4,7 +4,7 @@
<div class="loginBtn"> <div class="loginBtn">
<p @click="loginFn">{{ user.token ? "已登录" : "登录/注册" }}</p> <p @click="loginFn">{{ user.token ? "已登录" : "登录/注册" }}</p>
</div> </div>
<div class="title">{{ setting.title }}</div> <div class="title">{{ setting.title }}</div>
</div> </div>
<router-view v-slot="{ Component }"> <router-view v-slot="{ Component }">
@ -13,13 +13,19 @@
</keep-alive> </keep-alive>
</router-view> </router-view>
<keep-alive> </keep-alive> <keep-alive> </keep-alive>
<div class="bottom"></div> <div class="bottom" v-if=" setting.activeStepIndex!=12">
当前实验步骤为第{{ setting.activeStepIndex }}实验名称为:{{
stepData[setting.activeStepIndex]
}}共11步
</div>
<div class="bottom" v-else>全部实验完成</div>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
// import { onMounted, reactive, ref, toRefs, watch } from "vue"; import { watch } from "vue";
import settingStore from "@/store/modules/setting"; import settingStore from "@/store/modules/setting";
import userStore from "@/store/modules/user"; import userStore from "@/store/modules/user";
const user = userStore(); const user = userStore();
@ -30,13 +36,32 @@ console.log(setting.title);
const loginFn = () => { const loginFn = () => {
// user.token ? router.push("/spacePage") : ""; // user.token ? router.push("/spacePage") : "";
if(user.token){ if (user.token) {
router.push("/spacePage");
router.push("/spacePage") return;
return }
}
router.push("/login"); router.push("/login");
}; };
const stepData:any = {
"1": "LabVIEW软件的安装及配置",
"2": "构建温湿度传感器模型",
"3": "编写程序框图程序",
"4": "调试控制测试",
"5": "配置LabVIEW网络通信控件及端口",
"6": "虚拟机安装",
"7": "虚拟Windows 主机",
"8": "编写服务器端程序",
"9": "服务器与LabVIEW模拟终端通信调试",
"10": "服务器端读取LabVIEW模拟传感器的数据",
"11": "实验总结,攥写实验报告",
'12':'全部完成'
};
watch(
() => setting.activeStepIndex,
(newValue: number) => {
localStorage.setItem("activeStepIndex", newValue.toString());
}
);
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -90,4 +115,12 @@ if(user.token){
} }
} }
} }
.bottom {
position: absolute;
top: 120px;
left: 50%;
transform: translateX(-50%);
font-size: 22px;
color: #fff;
}
</style> </style>

@ -8,56 +8,94 @@
<div class="errorBtn" @click="clickErrorBtn"></div> <div class="errorBtn" @click="clickErrorBtn"></div>
<el-row style="display: flex; justify-content: center"> <el-row style="display: flex; justify-content: center">
<el-col> <el-col>
<el-form :rules="rules" :model="formModel" ref="formRef" size="large" autocomplete="off" v-if="isRegister"> <el-form
:rules="rules"
:model="formModel"
ref="formRef"
size="large"
autocomplete="off"
v-if="isRegister"
>
<el-form-item prop="username"> <el-form-item prop="username">
<div style="display: flex; align-items: center;"> <div style="display: flex; align-items: center">
<div class="left" style="display: flex; align-items: center;width: 90px;"> <div
class="left"
style="display: flex; align-items: center; width: 90px"
>
<div style="padding-right: 10px; color: #1084c1"> <div style="padding-right: 10px; color: #1084c1">
<el-icon class="bold-icon"> <el-icon class="bold-icon">
<User /> <User />
</el-icon> </el-icon>
</div> </div>
<div style="padding-right: 10px; color: #2592a1">用户账号</div> <div style="padding-right: 10px; color: #2592a1">
用户账号
</div>
</div> </div>
<div class="right"> <div class="right">
<el-input v-model="formModel.username" placeholder="请输入用户账号"></el-input> <el-input
v-model="formModel.username"
placeholder="请输入用户账号"
></el-input>
</div> </div>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item prop="password"> <el-form-item prop="password">
<div style="display: flex; align-items: center;"> <div style="display: flex; align-items: center">
<div class="left" style="display: flex; align-items: center ;width: 90px;"> <div
class="left"
style="display: flex; align-items: center; width: 90px"
>
<div style="padding-right: 10px; color: #1084c1"> <div style="padding-right: 10px; color: #1084c1">
<el-icon class="bold-icon"> <el-icon class="bold-icon">
<Lock /> <Lock />
</el-icon> </el-icon>
</div> </div>
<div style="padding-right: 10px; color: #2592a1">用户密码</div> <div style="padding-right: 10px; color: #2592a1">
用户密码
</div>
</div> </div>
<div class="right"> <div class="right">
<el-input type="password" v-model="formModel.password" placeholder="请输入密码" show-password></el-input> <el-input
type="password"
v-model="formModel.password"
placeholder="请输入密码"
show-password
></el-input>
</div> </div>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item prop="repassword"> <el-form-item prop="repassword">
<div style="display: flex; align-items: center;"> <div style="display: flex; align-items: center">
<div class="left" style="display: flex; align-items: center ;width: 90px;"> <div
class="left"
style="display: flex; align-items: center; width: 90px"
>
<div style="padding-right: 10px; color: #1084c1"> <div style="padding-right: 10px; color: #1084c1">
<el-icon class="bold-icon"> <el-icon class="bold-icon">
<Lock /> <Lock />
</el-icon> </el-icon>
</div> </div>
<div style="padding-right: 10px; color: #2592a1">确认密码</div> <div style="padding-right: 10px; color: #2592a1">
确认密码
</div>
</div> </div>
<div class="right"> <div class="right">
<el-input type="password" v-model="formModel.repassword" style="border-color: #20bec8" <el-input
placeholder="请再次输入密码" show-password></el-input> type="password"
v-model="formModel.repassword"
style="border-color: #20bec8"
placeholder="请再次输入密码"
show-password
></el-input>
</div> </div>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item prop="name"> <el-form-item prop="name">
<div style="display: flex; align-items: center; color: pink"> <div style="display: flex; align-items: center; color: pink">
<div class="left" style="display: flex; align-items: center;width: 90px;"> <div
class="left"
style="display: flex; align-items: center; width: 90px"
>
<div style="padding-right: 10px; color: #1084c1"> <div style="padding-right: 10px; color: #1084c1">
<el-icon class="bold-icon"> <el-icon class="bold-icon">
<Stamp /> <Stamp />
@ -66,14 +104,21 @@
<div style="padding-right: 10px; color: #2592a1">姓名</div> <div style="padding-right: 10px; color: #2592a1">姓名</div>
</div> </div>
<div class="right"> <div class="right">
<el-input v-model="formModel.name" style="border-color: #20bec8;" placeholder="请输入姓名"></el-input> <el-input
v-model="formModel.name"
style="border-color: #20bec8"
placeholder="请输入姓名"
></el-input>
</div> </div>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item prop="clssid"> <el-form-item prop="clssid">
<div style="display: flex; align-items: center;"> <div style="display: flex; align-items: center">
<div class="left" style="display: flex; align-items: center ;width: 90px;"> <div
class="left"
style="display: flex; align-items: center; width: 90px"
>
<div style="padding-right: 10px; color: #1084c1"> <div style="padding-right: 10px; color: #1084c1">
<el-icon class="bold-icon"> <el-icon class="bold-icon">
<Avatar /> <Avatar />
@ -82,16 +127,23 @@
<div style="padding-right: 10px; color: #2592a1">班级</div> <div style="padding-right: 10px; color: #2592a1">班级</div>
</div> </div>
<div class="right"> <div class="right">
<el-cascader ref="cascader" placeholder="请选择所属班级" :props="props" <el-cascader
style="width: 142%; height: 0.2344rem" v-model="formModel.clssid" @change="handleChange" placeholder="请选择所属班级"
:show-all-levels="false" /> :props="props"
style="width: 142%; height: 0.2344rem"
v-model="formModel.clssid"
@change="handleChange"
/>
</div> </div>
</div> </div>
</el-form-item> </el-form-item>
<!-- <el-cascader :props="props" style="width: 100%; height: 0.2344rem" v-model="formModel.clssid" /> --> <!-- <el-cascader :props="props" style="width: 100%; height: 0.2344rem" v-model="formModel.clssid" /> -->
<el-form-item prop="studentNumb"> <el-form-item prop="studentNumb">
<div style="display: flex; align-items: center;"> <div style="display: flex; align-items: center">
<div class="left" style="display: flex; align-items: center ;width: 90px;"> <div
class="left"
style="display: flex; align-items: center; width: 90px"
>
<div style="padding-right: 10px; color: #1084c1"> <div style="padding-right: 10px; color: #1084c1">
<el-icon class="bold-icon"> <el-icon class="bold-icon">
<Avatar /> <Avatar />
@ -100,39 +152,60 @@
<div style="padding-right: 10px; color: #2592a1">学号</div> <div style="padding-right: 10px; color: #2592a1">学号</div>
</div> </div>
<div class="right"> <div class="right">
<el-input v-model="formModel.studentNumb" style="border-color: #20bec8" <el-input
placeholder="请输入学号"></el-input> v-model="formModel.studentNumb"
style="border-color: #20bec8"
placeholder="请输入学号"
></el-input>
</div> </div>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item prop="mobile"> <el-form-item prop="mobile">
<div style="display: flex; align-items: center;"> <div style="display: flex; align-items: center">
<div class="left" style="display: flex; align-items: center ;width: 90px;"> <div
class="left"
style="display: flex; align-items: center; width: 90px"
>
<div style="padding-right: 10px; color: #1084c1"> <div style="padding-right: 10px; color: #1084c1">
<el-icon class="bold-icon"> <el-icon class="bold-icon">
<Iphone /> <Iphone />
</el-icon> </el-icon>
</div> </div>
<div style="padding-right: 10px; color: #2592a1">手机号</div> <div style="padding-right: 10px; color: #2592a1">
手机号
</div>
</div> </div>
<div class="right"> <div class="right">
<el-input v-model="formModel.mobile" style="border-color: #20bec8" placeholder="请输入手机号"></el-input> <el-input
v-model="formModel.mobile"
style="border-color: #20bec8"
placeholder="请输入手机号"
></el-input>
</div> </div>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<div style="display: flex; align-items: center;"> <div style="display: flex; align-items: center">
<div class="left" style="display: flex; align-items: center ;width: 90px;"> <div
class="left"
style="display: flex; align-items: center; width: 90px"
>
<div style="padding-right: 10px; color: #1084c1"> <div style="padding-right: 10px; color: #1084c1">
<el-icon class="bold-icon"> <el-icon class="bold-icon">
<Grid /> <Grid />
</el-icon> </el-icon>
</div> </div>
<div style="padding-right: 10px; color: #2592a1">验证码</div> <div style="padding-right: 10px; color: #2592a1">
验证码
</div>
</div> </div>
<div class="right"> <div class="right">
<div class="captcha"> <div class="captcha">
<el-input v-model="formModel.captcha" style="height: 0.2344rem" maxlength="4" /> <el-input
v-model="formModel.captcha"
style="height: 0.2344rem"
maxlength="4"
/>
<div class="code" @click="getcodeinfo"> <div class="code" @click="getcodeinfo">
<img :src="codeUrl" alt="" srcset="" /> <img :src="codeUrl" alt="" srcset="" />
</div> </div>
@ -141,12 +214,32 @@
</div> </div>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button style="color: #3ad7e2; background-color: #0e2e5e; width: 152px;margin-top: 10px;" <el-button
class="button" type="primary" auto-insert-space @click="register"> style="
color: #3ad7e2;
background-color: #0e2e5e;
width: 152px;
margin-top: 10px;
"
class="button"
type="primary"
auto-insert-space
@click="register"
>
注册 注册
</el-button> </el-button>
<el-button style="color: #3ad7e2; background-color: #0e2e5e; width: 155px;margin-top: 10px;" <el-button
class="button" type="primary" auto-insert-space @click="toLogin"> style="
color: #3ad7e2;
background-color: #0e2e5e;
width: 155px;
margin-top: 10px;
"
class="button"
type="primary"
auto-insert-space
@click="toLogin"
>
返回到登录页 返回到登录页
</el-button> </el-button>
</el-form-item> </el-form-item>
@ -157,21 +250,37 @@
</el-link> </el-link>
</el-form-item> --> </el-form-item> -->
</el-form> </el-form>
<el-form style="margin-bottom: 80px;" :model="formModel" :rules="rules" ref="formRef" size="large" <el-form
autocomplete="off" v-else class="custom-form"> style="margin-bottom: 80px"
<el-form-item prop="username" style="margin-bottom: 30px;"> :model="formModel"
<div style="display: flex; align-items: center;"> :rules="rules"
<div class="left" style="display: flex; align-items: center;width: 90px;"> ref="formRef"
size="large"
autocomplete="off"
v-else
class="custom-form"
>
<el-form-item prop="username" style="margin-bottom: 30px">
<div style="display: flex; align-items: center">
<div
class="left"
style="display: flex; align-items: center; width: 90px"
>
<div style="padding-right: 10px; color: #1084c1"> <div style="padding-right: 10px; color: #1084c1">
<el-icon class="bold-icon"> <el-icon class="bold-icon">
<User /> <User />
</el-icon> </el-icon>
</div> </div>
<div style="padding-right: 10px; color: #2592a1">用户名</div> <div style="padding-right: 10px; color: #2592a1">
用户名
</div>
</div> </div>
<div class="right"> <div class="right">
<el-input v-model="formModel.username" style="height: 0.2344rem ;width: 250px;" <el-input
placeholder="请输入用户名"></el-input> v-model="formModel.username"
style="height: 0.2344rem; width: 250px"
placeholder="请输入用户名"
></el-input>
</div> </div>
</div> </div>
</el-form-item> </el-form-item>
@ -191,9 +300,12 @@
</div> </div>
</div> </div>
</el-form-item> --> </el-form-item> -->
<el-form-item prop="password" style="margin-bottom: 30px;"> <el-form-item prop="password" style="margin-bottom: 30px">
<div style="display: flex; align-items: center;"> <div style="display: flex; align-items: center">
<div class="left" style="display: flex; align-items: center ;width: 90px;"> <div
class="left"
style="display: flex; align-items: center; width: 90px"
>
<div style="padding-right: 10px; color: #1084c1"> <div style="padding-right: 10px; color: #1084c1">
<el-icon class="bold-icon"> <el-icon class="bold-icon">
<Lock /> <Lock />
@ -202,24 +314,37 @@
<div style="padding-right: 10px; color: #2592a1">密码</div> <div style="padding-right: 10px; color: #2592a1">密码</div>
</div> </div>
<div class="right"> <div class="right">
<el-input type="password" v-model="formModel.password" style="height: 0.2344rem;width: 250px;" <el-input
placeholder="请输入密码"></el-input> type="password"
v-model="formModel.password"
style="height: 0.2344rem; width: 250px"
placeholder="请输入密码"
></el-input>
</div> </div>
</div> </div>
</el-form-item> </el-form-item>
<el-form-item style="margin-bottom: 35px;"> <el-form-item style="margin-bottom: 35px">
<div style="display: flex; align-items: center;"> <div style="display: flex; align-items: center">
<div class="left" style="display: flex; align-items: center ;width: 90px;"> <div
class="left"
style="display: flex; align-items: center; width: 90px"
>
<div style="padding-right: 10px; color: #1084c1"> <div style="padding-right: 10px; color: #1084c1">
<el-icon class="bold-icon"> <el-icon class="bold-icon">
<Grid /> <Grid />
</el-icon> </el-icon>
</div> </div>
<div style="padding-right: 10px; color: #2592a1">验证码</div> <div style="padding-right: 10px; color: #2592a1">
验证码
</div>
</div> </div>
<div class="right"> <div class="right">
<div class="captcha"> <div class="captcha">
<el-input v-model="formModel.captcha" style="height: 0.2344rem;width: 250px;" maxlength="4" /> <el-input
v-model="formModel.captcha"
style="height: 0.2344rem; width: 250px"
maxlength="4"
/>
<div class="code" @click="getcodeinfo"> <div class="code" @click="getcodeinfo">
<img :src="codeUrl" alt="" srcset="" /> <img :src="codeUrl" alt="" srcset="" />
</div> </div>
@ -236,10 +361,22 @@
</div> </div>
</el-form-item> --> </el-form-item> -->
<el-form-item> <el-form-item>
<el-button style="margin:30px 50px 0px 20px;" class="hexagon-button" type="primary" auto-insert-space <el-button
@click="login">登录</el-button> style="margin: 30px 50px 0px 20px"
<el-button style="margin:30px 0px 0px 0;" class="hexagon-button" type="primary" auto-insert-space class="hexagon-button"
@click="toRegister">去注册</el-button> type="primary"
auto-insert-space
@click="login"
>登录</el-button
>
<el-button
style="margin: 30px 0px 0px 0"
class="hexagon-button"
type="primary"
auto-insert-space
@click="toRegister"
>去注册</el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-col> </el-col>
@ -253,14 +390,21 @@
<script setup lang="ts"> <script setup lang="ts">
// import { ref } from "vue" // import { ref } from "vue"
// import { onMounted, reactive, ref, toRefs, watch } from "vue"; // import { onMounted, reactive, ref, toRefs, watch } from "vue";
import { ElMessage } from 'element-plus' import { ElMessage } from "element-plus";
import settingStore from "@/store/modules/setting"; import settingStore from "@/store/modules/setting";
import { User, Lock, Avatar, Stamp, Grid, Iphone } from "@element-plus/icons-vue"; import {
User,
Lock,
Avatar,
Stamp,
Grid,
Iphone,
} from "@element-plus/icons-vue";
import { ref, onMounted } from "vue"; import { ref, onMounted } from "vue";
import userStore from "@/store/modules/user"; import userStore from "@/store/modules/user";
import { getCode, sturegister, getFaculties } from '@/api/user' import { getCode, sturegister, getFaculties } from "@/api/user";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
const router = useRouter() const router = useRouter();
const setting = settingStore(); const setting = settingStore();
const user = userStore(); const user = userStore();
console.log(setting.title); console.log(setting.title);
@ -272,13 +416,13 @@ const formModel = ref({
password: "", password: "",
repassword: "", repassword: "",
name: "", name: "",
clssid: '', clssid: "",
studentNumb: "", studentNumb: "",
mobile: '', mobile: "",
captcha: "", captcha: "",
}); });
const FacultiesList = ref([]) const FacultiesList = ref([]);
const getFacultiesList = async (data: any) => { const getFacultiesList = async (data: any) => {
const res: any = await getFaculties(data) const res: any = await getFaculties(data)
console.log(res, 'res11') console.log(res, 'res11')
@ -310,7 +454,7 @@ const props = {
isLeaf: 'isLeaf', isLeaf: 'isLeaf',
async lazyLoad(node: any, resolve: any) { async lazyLoad(node: any, resolve: any) {
console.log(node); console.log(node);
deepValues.value = node.pathValues deepValues.value = node.pathValues;
await getFacultiesList({ await getFacultiesList({
primaryType: node.level + 1, primaryType: node.level + 1,
pid: node.value, pid: node.value,
@ -393,9 +537,7 @@ const rules = {
trigger: "blur", trigger: "blur",
}, },
], ],
clssid: [ clssid: [{ required: true, message: "请选择所属班级", trigger: "blur" }],
{ required: true, message: "请选择所属班级", trigger: "blur" },
],
mobile: [ mobile: [
{ required: true, message: "请输入手机号", trigger: "blur" }, { required: true, message: "请输入手机号", trigger: "blur" },
{ {
@ -403,7 +545,7 @@ const rules = {
message: "手机号格式不正确", message: "手机号格式不正确",
trigger: ["change", "blur"], trigger: ["change", "blur"],
}, },
] ],
}; };
const register = async () => { const register = async () => {
await formRef.value.validate(); await formRef.value.validate();
@ -417,29 +559,30 @@ const register = async () => {
username: formModel.value.username, username: formModel.value.username,
realname: formModel.value.name, realname: formModel.value.name,
workno: formModel.value.studentNumb, workno: formModel.value.studentNumb,
depid: deepValues.value.slice(0, 2).join(',') depid: deepValues.value.slice(0, 2).join(","),
}; };
try { try {
const res: any = await sturegister(data) const res: any = await sturegister(data);
formModel.value = { formModel.value = {
username: "", username: "",
password: "", password: "",
repassword: "", repassword: "",
name: "", name: "",
clssid: '', clssid: "",
studentNumb: "", studentNumb: "",
mobile: '', mobile: "",
captcha: "", captcha: "",
} }
ElMessage.success(`注册成功`) ElMessage.success(`注册成功`)
isRegister.value = false isRegister.value = false
};
ElMessage.success(`注册成功`);
isRegister.value = false;
} catch (error) { } catch (error) {
console.log(error); console.log(error);
getcodeinfo();
getcodeinfo()
} }
// getcodeinfo() // getcodeinfo()
@ -460,27 +603,30 @@ const login = async () => {
password: formModel.value.password, password: formModel.value.password,
username: formModel.value.username, username: formModel.value.username,
}; };
const res = await user.logIn(data); try {
if (res) { const res = await user.logIn(data);
router.push('/studyPage') if (res) {
router.push("/studyPage");
}
} catch (error) {
getcodeinfo();
} }
}; };
const toRegister = () => { const toRegister = () => {
isRegister.value = true isRegister.value = true;
getcodeinfo(); getcodeinfo();
} };
const toLogin = () => { const toLogin = () => {
isRegister.value = false isRegister.value = false;
getcodeinfo(); getcodeinfo();
} };
const clickErrorBtn = () => { const clickErrorBtn = () => {
console.log('aaa'); console.log("aaa");
} };
onMounted(() => { onMounted(() => {
getcodeinfo(); getcodeinfo();
}) });
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
@ -529,7 +675,6 @@ onMounted(() => {
background-position: 59% -7px; background-position: 59% -7px;
background-size: 75% auto; background-size: 75% auto;
} }
.errorBtn { .errorBtn {
position: absolute; position: absolute;
top: 30px; top: 30px;
@ -591,7 +736,6 @@ onMounted(() => {
.el-input { .el-input {
width: 300px; width: 300px;
height: 36px; height: 36px;
} }
:deep(.el-form-item__error) { :deep(.el-form-item__error) {

@ -26,12 +26,16 @@
}" }"
@click="handleBoxClick(2)" @click="handleBoxClick(2)"
> >
学习 测试
</div> </div>
<div <div
class="box" class="box"
:style="{ :style="{
backgroundImage: isBox3Clicked ? `url(${btn1})` : `url(${btn2})`, backgroundImage: isShowExperiment
? `url(${btn1})`
: isBox2Clicked
? `url(${btn1})`
: `url(${btn2})`,
}" }"
style="margin-bottom: 80px" style="margin-bottom: 80px"
@click="handleBoxClick(3)" @click="handleBoxClick(3)"
@ -40,6 +44,46 @@
</div> </div>
</div> </div>
</div> </div>
<el-dialog v-model="dialogVisible" title="学生成绩详情" width="500px">
<div class="score-info">
<el-descriptions :column="2" border>
<el-descriptions-item label="姓名">{{
studentData.realname
}}</el-descriptions-item>
<el-descriptions-item label="用户名">{{
studentData.username
}}</el-descriptions-item>
<el-descriptions-item label="班级">{{
studentData.className
}}</el-descriptions-item>
<el-descriptions-item label="院系">{{
studentData.depName
}}</el-descriptions-item>
<el-descriptions-item label="总分">{{
studentData.score
}}</el-descriptions-item>
<el-descriptions-item label="完成状态">
{{ studentData.isComplete ? "已完成" : "未完成" }}
</el-descriptions-item>
<el-descriptions-item label="知识点得分">{{
studentData.kpPercentage
}}</el-descriptions-item>
<el-descriptions-item label="题目得分">{{
studentData.qoPercentage
}}</el-descriptions-item>
<el-descriptions-item label="总得分率">{{
studentData.toPercentage
}}</el-descriptions-item>
</el-descriptions>
</div>
<template #footer>
<span class="dialog-footer">
<el-button @click="dialogVisible = false">关闭</el-button>
<el-button type="primary" @click="saveScore">确认提交</el-button>
</span>
</template>
</el-dialog>
</template> </template>
<script setup lang="ts" name="studyPage"> <script setup lang="ts" name="studyPage">
@ -50,8 +94,10 @@ const setting = settingStore();
import userStore from "@/store/modules/user"; import userStore from "@/store/modules/user";
import btn1 from "@/assets/images/btn1.png"; import btn1 from "@/assets/images/btn1.png";
import btn2 from "@/assets/images/btn2.png"; import btn2 from "@/assets/images/btn2.png";
import { submitExperiment } from "@/api"; import { submitExperiment, getScore } from "@/api";
import { ElMessage } from "element-plus"; import { ElMessage, ElMessageBox } from "element-plus";
const isShowExperiment =
Number(localStorage.getItem("activeStepIndex")) == 12 ? true : false;
const router = useRouter(); const router = useRouter();
const user = userStore(); const user = userStore();
const loginFn = () => { const loginFn = () => {
@ -88,18 +134,50 @@ const handleBoxClick = (boxNumber) => {
break; break;
} }
}; };
const dialogVisible = ref(false);
const studentData = ref<any>({
classId: null,
className: "软件工程",
depName: "国际学院-国际学院",
isComplete: 0,
kpPercentage: 0,
phone: null,
qoPercentage: 325,
realname: "无糖",
score: 195,
studyRecords_id: "1903276190361743362",
toPercentage: 195,
username: "test1",
workNo: null,
});
const submit = async () => { const submit = async () => {
await submitExperiment({ getStudyRecords_id: user.userInfo.id }).then( const res: any = await getScore();
(res: any) => { studentData.value = res.result;
console.log(res); dialogVisible.value = true;
if (res.code == 500) { return;
ElMessage.error(res.message); };
} else { const saveScore = async () => {
ElMessage.success(res.message); ElMessageBox.confirm(
} "确定要提交吗?一旦提交任何数据不能更改,请确保已经完成所有项目"
} )
); .then(async () => {
await submitExperiment({
studyRecords_id: studentData.value.studyRecords_id,
}).then((res: any) => {
console.log(res);
if (res.code == 500) {
ElMessage.error(res.message);
} else {
ElMessage.success(res.message);
}
localStorage.setItem("falg", "true");
dialogVisible.value = false;
});
})
.catch(() => {
// catch error
});
}; };
</script> </script>

@ -28,6 +28,7 @@ const settingStore = defineStore("settingStore", {
isRunning: false, isRunning: false,
isRunCode: Boolean(localStorage.getItem("isRunCode")) || false, isRunCode: Boolean(localStorage.getItem("isRunCode")) || false,
shiyanData: [], shiyanData: [],
activeStepIndex:Number(localStorage.getItem('activeStepIndex')) || 0
}; };
}, },
actions: { actions: {

@ -10,17 +10,22 @@ const userStore = defineStore("userStore", {
actions: { actions: {
async logIn(form: any) { async logIn(form: any) {
console.log(form); console.log(form);
const res: any = await login(form); try {
// if(res.code === 500) return ElMessage.error(res.msg) const res: any = await login(form);
if (res.code !== 200) { // if(res.code === 500) return ElMessage.error(res.msg)
ElMessage.error(res.msg); if (res.code !== 200) {
return false; ElMessage.error(res.msg);
return false;
}
this.token = res.result.token;
this.userInfo = res.result.userInfo;
setToken(this.token);
console.log(res);
return true;
} catch (error) {
return Promise.reject(false);
} }
this.token = res.result.token;
this.userInfo = res.result.userInfo;
setToken(this.token);
console.log(res);
return true;
}, },
clearStatus() { clearStatus() {
this.token = ""; this.token = "";

@ -2,9 +2,9 @@
import axios from "axios"; import axios from "axios";
import pinia from "@/store"; import pinia from "@/store";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import {removeToken} from '@/utils/auth' import { removeToken } from "@/utils/auth";
import userStore from "@/store/modules/user"; import userStore from "@/store/modules/user";
import router from '@/router' import router from "@/router";
// 创建axios实例 // 创建axios实例
const server = axios.create({ const server = axios.create({
baseURL: import.meta.env.VITE_APP_BASE_API, baseURL: import.meta.env.VITE_APP_BASE_API,
@ -22,19 +22,23 @@ server.interceptors.request.use((config) => {
// 创建相应拦截器 // 创建相应拦截器
server.interceptors.response.use((response) => { server.interceptors.response.use((response) => {
if (response.data.code === 401) { if (response.data.code === 401) {
const useuserStore = userStore(pinia); const useuserStore = userStore(pinia);
// useuserStore.clearStatus(); // useuserStore.clearStatus();
// return Promise.reject(response); // return Promise.reject(response);
} }
if(response.data.code=== 401){ if (response.data.code != 200 && response.data.code != 0) {
ElMessage.error(response.data.message);
return Promise.reject(response);
}
if (response.data.code === 401) {
ElMessage.error(response.data.message); ElMessage.error(response.data.message);
return Promise.reject(response); return Promise.reject(response);
} }
if (response.data.code === 412) { if (response.data.code === 412) {
ElMessage.error(response.data.message); ElMessage.error(response.data.message);
removeToken() removeToken();
router.push('/login') router.push("/login");
return Promise.reject(response); return Promise.reject(response);
} }
return response.data; return response.data;

@ -8,7 +8,8 @@
</div> </div>
</div> </div>
<div class="setting"> <div class="setting">
<el-button @click="saveCode">保存</el-button> <el-button @click="saveCode" v-if="!isShowStrring">保存</el-button>
<el-button @click="router.back()" v-else>返回</el-button>
</div> </div>
</div> </div>
</template> </template>
@ -21,11 +22,14 @@ import settingStore from "@/store/modules/setting";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
const router = useRouter() const router = useRouter()
const useSettingStore = settingStore(); const useSettingStore = settingStore();
const isShowStrring = Boolean(localStorage.getItem('falg')) || false
const saveCode = () => { const saveCode = () => {
useSettingStore.setValue(true, 'isRunCode'); useSettingStore.setValue(true, 'isRunCode');
localStorage.setItem('isRunCode','true') localStorage.setItem('isRunCode','true')
setStepEvent(8,formatDate(new Date())) setStepEvent(8,formatDate(new Date()))
useSettingStore.activeStepIndex = 9
router.push('/program') router.push('/program')
} }
</script> </script>

@ -841,6 +841,8 @@ const wenduCode = "float a;a=1000000*M*S/W;T+(1-exp(-t/a))*100+T0;if(T>=100){T=1
const shiduCode = "float b;a=10000*S0/W1;R+(1-exp(-t1/b))*100+R0;if(R>=100){R=100;}"; const shiduCode = "float b;a=10000*S0/W1;R+(1-exp(-t1/b))*100+R0;if(R>=100){R=100;}";
const onSave = () => { const onSave = () => {
setStepEvent(3, formatDate(new Date())); setStepEvent(3, formatDate(new Date()));
settingStore.activeStepIndex =4
// console.log(removeDuplicateEdges(formatEdges()), standardData); // console.log(removeDuplicateEdges(formatEdges()), standardData);
// return // return
if (standardData.length !== removeDuplicateEdges(formatEdges()).length) if (standardData.length !== removeDuplicateEdges(formatEdges()).length)

@ -43,6 +43,8 @@ tableData.value = useSettingStore.shiyanData
console.log(tableData.valu); console.log(tableData.valu);
setStepEvent(10,formatDate(new Date())) setStepEvent(10,formatDate(new Date()))
useSettingStore.activeStepIndex = 11
</script> </script>
<style scoped> <style scoped>

@ -495,12 +495,17 @@
<div class="tip">请查看所选配置的相关信息</div> <div class="tip">请查看所选配置的相关信息</div>
<div class="item"> <div class="item">
安装须知本协议具合同效力在你方下载软件和/或完成软件安装过程之前请仔细阅读本协议一旦你方下载和/或点击相应的按钮从而完成软件安装过程即表示你方同意本协议条款并愿意受本协议的约束若你方不愿意成为本协议的当事方并不接受本协议所有条款和条件的约束请点击相应的按钮取消安装过程即不要安装或使用软件并在收到软件之日起三十(30)日内将软件(及所有随附书面材料及其包装)退还至获取该软件的地点所有退还事宜都应遵守退还发生时适用的NI退还政策.com/info并输入信息代码expm69查询 安装须知本协议具合同效力在你方下载软件和/或完成软件安装过程之前请仔细阅读本协议一旦你方下载和/或点击相应的按钮从而完成软件安装过程即表示你方同意本协议条款并愿意受本协议的约束若你方不愿意成为本协议的当事方并不接受本协议所有条款和条件的约束请点击相应的按钮取消安装过程即不要安装或使用软件并在收到软件之日起三十(30)日内将软件(及所有随附书面材料及其包装)退还至获取该软件的地点所有退还事宜都应遵守退还发生时适用的NI退还政策.com/info并输入信息代码expm69查询
<br>定义 在本协议中下列术语的含义如下本National Instruments许可适用于软件LabVIEW 204 <br />定义 在本协议中下列术语的含义如下本National
Instruments许可适用于软件LabVIEW 204
</div> </div>
<div class="radio-container"> <div class="radio-container">
<el-radio-group v-model="radio1"> <el-radio-group v-model="radio1">
<el-radio value="接受" size="large">我接受上述2条许可协议</el-radio> <el-radio value="接受" size="large"
<el-radio value="不接受" size="large">我不接受某些许可协议</el-radio> >我接受上述2条许可协议</el-radio
>
<el-radio value="不接受" size="large"
>我不接受某些许可协议</el-radio
>
</el-radio-group> </el-radio-group>
</div> </div>
</div> </div>
@ -509,7 +514,7 @@
<el-progress <el-progress
:text-inside="true" :text-inside="true"
:stroke-width="20" :stroke-width="20"
:percentage="80" :percentage="100"
style="margin-bottom: 25px" style="margin-bottom: 25px"
/> />
<p class="name">复制新文件</p> <p class="name">复制新文件</p>
@ -520,7 +525,7 @@
<el-progress <el-progress
:text-inside="true" :text-inside="true"
:stroke-width="20" :stroke-width="20"
:percentage="80" :percentage="100"
style="margin-bottom: 25px" style="margin-bottom: 25px"
/> />
<p class="name">复制新文件</p> <p class="name">复制新文件</p>
@ -563,19 +568,24 @@
>磁盘占用</el-button >磁盘占用</el-button
> >
<el-button <el-button
v-show="installationStep === 6||installationStep === 7||installationStep === 8||installationStep === 9" v-show="
installationStep === 6 ||
installationStep === 7 ||
installationStep === 8 ||
installationStep === 9
"
@click="Installation = false" @click="Installation = false"
style="background-color: #f3f3f3; color: #000000; border-color: #ccc" style="background-color: #f3f3f3; color: #000000; border-color: #ccc"
>保存文件</el-button >保存文件</el-button
> >
<el-button <el-button
v-if="installationStep === 11 ==false" v-if="(installationStep === 11) == false"
@click="Installation = false" @click="Installation = false"
style="background-color: #f3f3f3; color: #000000; border-color: #ccc" style="background-color: #f3f3f3; color: #000000; border-color: #ccc"
>上一步</el-button >上一步</el-button
> >
<el-button <el-button
v-if="installationStep === 11 ==false" v-if="(installationStep === 11) == false"
type="primary" type="primary"
@click="setInstallationStep" @click="setInstallationStep"
style="background-color: #0052d9; color: #fff; border: 0" style="background-color: #0052d9; color: #fff; border: 0"
@ -583,7 +593,7 @@
下一步 下一步
</el-button> </el-button>
<el-button <el-button
v-if="installationStep === 11 ==false" v-if="(installationStep === 11) == false"
type="primary" type="primary"
@click="Installation = false" @click="Installation = false"
style="background-color: #f3f3f3; color: #000000; border-color: #ccc" style="background-color: #f3f3f3; color: #000000; border-color: #ccc"
@ -698,13 +708,15 @@
Setup wil guide you through the installation of Inteli] IDEA. It is Setup wil guide you through the installation of Inteli] IDEA. It is
recommended that you dose all other applications befonestarting recommended that you dose all other applications befonestarting
Setup, This will make it possible to update relevantsystem fles Setup, This will make it possible to update relevantsystem fles
wthout having to reboot your computer.<br /> Click Nedt to cantinue. wthout having to reboot your computer.<br />
Click Nedt to cantinue.
</div> </div>
</div> </div>
<div v-if="installationStep === 11"> <div v-if="installationStep === 11">
<div class="title"> Completing inteliJ lDEA Setup </div> <div class="title">Completing inteliJ lDEA Setup</div>
<div class="description"> <div class="description">
lrtel lDEA has been instdlled on your comgarier.Chdk nnish to dose setmp R.n intt3 boEA lrtel lDEA has been instdlled on your comgarier.Chdk nnish to dose
setmp R.n intt3 boEA
</div> </div>
</div> </div>
</div> </div>
@ -745,6 +757,7 @@ import { setStepEvent } from "@/utils/setStep";
import { formatDate } from "@/utils"; import { formatDate } from "@/utils";
import { useRouter, useRoute } from "vue-router"; import { useRouter, useRoute } from "vue-router";
import { onMounted } from "vue"; import { onMounted } from "vue";
import settingStore from "@/store/modules/setting";
type Falg = boolean; type Falg = boolean;
type Step = number; type Step = number;
const falg = ref<Falg>(Boolean(localStorage.getItem("falg")) || false); const falg = ref<Falg>(Boolean(localStorage.getItem("falg")) || false);
@ -752,7 +765,7 @@ const product = ref<Falg>(Boolean(localStorage.getItem("product")) || false);
const step = ref<Step>(0); const step = ref<Step>(0);
const popover1 = ref<any>(null); const popover1 = ref<any>(null);
const popover2 = ref<any>(null); const popover2 = ref<any>(null);
const radio1 = ref<any>('接受') const radio1 = ref<any>("接受");
const dialogVisible = ref<Falg>(false); const dialogVisible = ref<Falg>(false);
const Installation = ref<Falg>(false); const Installation = ref<Falg>(false);
const Popup = ref<Falg>(false); const Popup = ref<Falg>(false);
@ -761,14 +774,18 @@ const installationStep = ref<Step>(
); );
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
const useSettingStore = settingStore();
const isShowIdea = ref<Boolean>(false); const isShowIdea = ref<Boolean>(false);
console.log(route); console.log(route);
onMounted(() => { onMounted(() => {
if (route.query.idea) { if (route.query.idea) {
isShowIdea.value = true; isShowIdea.value = true;
installationStep.value = 10 installationStep.value = 10;
} }
}) if (useSettingStore.activeStepIndex === 0) {
useSettingStore.activeStepIndex = 1;
}
});
const checkList = ref<Step[]>([1, 2]); const checkList = ref<Step[]>([1, 2]);
const unpack = (): void => { const unpack = (): void => {
@ -802,9 +819,9 @@ const setInstallationStep = (): void => {
Installation.value = false; Installation.value = false;
Popup.value = true; Popup.value = true;
} }
if(installationStep.value == 11){ if (installationStep.value == 11) {
// Installation.value = true // Installation.value = true
Popup.value = false Popup.value = false;
} }
}; };
const Completed = (): void => { const Completed = (): void => {
@ -812,21 +829,31 @@ const Completed = (): void => {
product.value = true; product.value = true;
localStorage.setItem("product", "true"); localStorage.setItem("product", "true");
}; };
const isShowStrring = Boolean(localStorage.getItem("falg")) || false;
// labView // labView
const goToLabView = async () => { const goToLabView = async () => {
await setStepEvent(1, formatDate(new Date())); if (!isShowStrring) {
await setStepEvent(1, formatDate(new Date()));
useSettingStore.activeStepIndex = 2;
}
router.push("/program"); router.push("/program");
}; };
const goToLabIdea = async () => { const goToLabIdea = async () => {
await setStepEvent(7,formatDate(new Date())) if (!isShowStrring) {
await setStepEvent(7, formatDate(new Date()));
useSettingStore.activeStepIndex = 8;
}
router.push('/compiler')
} router.push("/compiler");
};
const insatIdea = () => { const insatIdea = () => {
isShowIdea.value = false isShowIdea.value = false;
setStepEvent(6,formatDate(new Date())) setStepEvent(6, formatDate(new Date()));
} useSettingStore.activeStepIndex = 7;
};
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@ -1204,14 +1231,14 @@ const insatIdea = () => {
height: 100%; height: 100%;
background: url("../../assets/images/idealeftbgc.png"); background: url("../../assets/images/idealeftbgc.png");
} }
.right{ .right {
flex: 1; flex: 1;
margin-left: 30px; margin-left: 30px;
.title{ .title {
font-size: 32px; font-size: 32px;
color: #585858; color: #585858;
} }
.description{ .description {
margin-top: 50px; margin-top: 50px;
line-height: 24px; line-height: 24px;
font-weight: 600; font-weight: 600;

@ -39,7 +39,7 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-drawer> </el-drawer>
<div class="setting"> <div class="setting" v-if="!isShowStrring">
<el-button @click="onUndo">撤回</el-button> <el-button @click="onUndo">撤回</el-button>
<el-button @click="onRedo">恢复</el-button> <el-button @click="onRedo">恢复</el-button>
<el-button @click="clearLocalStorage">清除缓存</el-button> <el-button @click="clearLocalStorage">清除缓存</el-button>
@ -53,6 +53,9 @@
<el-button @click="onTip">提示</el-button> <el-button @click="onTip">提示</el-button>
<el-button @click="showDialog">填写实验报告</el-button> <el-button @click="showDialog">填写实验报告</el-button>
</div> </div>
<div class="setting" v-else>
<el-button @click="router.back()">返回</el-button>
</div>
<div class="tip-view"> <div class="tip-view">
<el-image <el-image
style="width: 0; height: 0" style="width: 0; height: 0"
@ -131,7 +134,7 @@ const router = useRouter();
// //
const falg = ref(false); const falg = ref(false);
const isShowStrring = Boolean(localStorage.getItem('falg')) || false
let graph: any = null; let graph: any = null;
const nodeName = ref(""); const nodeName = ref("");
const csedNode = ref<any>(null); const csedNode = ref<any>(null);
@ -233,6 +236,7 @@ onMounted(() => {
// #endregion // #endregion
// //
graph.on("node:click", ({ cell }: any) => { graph.on("node:click", ({ cell }: any) => {
if(isShowStrring) return
// console.log(cell.store.previous.name); // console.log(cell.store.previous.name);
console.log(cell); console.log(cell);
if (!useSettingStore.saveRoute) { if (!useSettingStore.saveRoute) {
@ -1226,6 +1230,8 @@ const sdsz = ref<any>(null);
const onSave = async () => { const onSave = async () => {
if (useSettingStore.isRunCode) { if (useSettingStore.isRunCode) {
await setStepEvent(9, formatDate(new Date())); await setStepEvent(9, formatDate(new Date()));
useSettingStore.activeStepIndex = 10
} }
if ( if (
!hasExactNames(graph.getNodes(), [ !hasExactNames(graph.getNodes(), [
@ -1252,6 +1258,8 @@ const onSave = async () => {
localStorage.setItem("experimentPreservation", "true"); localStorage.setItem("experimentPreservation", "true");
if (!useSettingStore.isRunCode) { if (!useSettingStore.isRunCode) {
await setStepEvent(2, formatDate(new Date())); await setStepEvent(2, formatDate(new Date()));
useSettingStore.activeStepIndex = 3
} }
router.push("/designRoute"); router.push("/designRoute");
@ -1416,6 +1424,8 @@ const onSave = async () => {
if (!useSettingStore.isRunCode) { if (!useSettingStore.isRunCode) {
setStepEvent(4, formatDate(new Date())); setStepEvent(4, formatDate(new Date()));
setStepEvent(5, formatDate(new Date())); setStepEvent(5, formatDate(new Date()));
useSettingStore.activeStepIndex = 6
} }
// const data = graph.toJSON(); // const data = graph.toJSON();
@ -1526,7 +1536,8 @@ const exportWord = async () => {
dialogVisible.value = false; dialogVisible.value = false;
ElMessage.success('保存成功') ElMessage.success('保存成功')
await setStepEvent(11, formatDate(new Date())); await setStepEvent(11, formatDate(new Date()));
useSettingStore.activeStepIndex = 12
router.push('/studyPage')
return return
JSZipUtils.getBinaryContent("template.docx", function (error:any, content:any) { JSZipUtils.getBinaryContent("template.docx", function (error:any, content:any) {
// //

@ -8,37 +8,40 @@
<!-- 左边按钮 --> <!-- 左边按钮 -->
<button class="submit-left" @click="SubLeft"></button> <button class="submit-left" @click="SubLeft"></button>
<div class="question-body"> <div class="question-body">
<div class="question" > <div class="question">
<span class="question-count" >{{ currentSum }}</span> <span class="question-count">{{ currentSum }}</span>
<div class="timer">{{ formattedTime }} </div> <!-- <div class="timer">{{ formattedTime }} </div> -->
</div> </div>
<p class="questions"><span class="questions-count">{{questions.length}}</span></p> <p class="questions"><span class="questions-count">{{ questions.length }}</span></p>
<!-- 遍历题目 --> <!-- 遍历题目 -->
<div v-if="currentQuestionIndex < questions.length" class="txt"> <div v-if="currentQuestionIndex < questions.length" class="txt">
<span>{{ currentQuestion }}</span> <span>{{ currentQuestion }}</span>
</div> </div>
<!-- 遍历选项 --> <!-- 遍历选项 -->
<div class="options"> <div class="options">
<button <button v-for="option in xnOptionsList" :key="option.id"
v-for="option in xnOptionsList" :class="['option', {
:key="option.id" // 'selected': option.hasOwnProperty('isChecked') ? option.isChecked :
:class="['option', { 'selected': selectedOption[currentQuestionIndex] && selectedOption[currentQuestionIndex].oid == option.id }]" // selectedOption[currentQuestionIndex] && selectedOption[currentQuestionIndex].oid == option.id
@click="selectOption(option.id)" // 'selected': option.isChecked || (selectedOption[currentQuestionIndex] && selectedOption[currentQuestionIndex].oid === option.id)
class="option" 'selected':
> complete == true
? option.isChecked
: (selectedOption[currentQuestionIndex] && selectedOption[currentQuestionIndex].oid === option.id)
}]"
@click="selectOption(option.id)" class="option">
<span class="option-letter">{{ option.optionName }}</span> <span class="option-letter">{{ option.optionName }}</span>
{{ option.optionText }} {{ option.optionText }}
</button> </button>
</div> </div>
</div> </div>
<div class="submit-buttons"> <div class="submit-buttons">
<button class="submit-btn" @click="resetAnswers">退出答题</button> <button class="submit-btn" @click="resetAnswers">退出答题</button>
<button class="submit-btn" @click="submitAnswers">提交成绩</button> <button class="submit-btn" @click="submitAnswers" v-if="complete === false">提交成绩</button>
</div> </div>
<el-dialog <el-dialog v-model="isVisible" :close-on-click-modal="false" :show-close="false">
v-model="isVisible" :close-on-click-modal="false" :show-close="false"> <resultsAnnounced :score="score" :formattedTime="formattedTime" @recreate="handleRecreate" />
<resultsAnnounced :score = "score" :formattedTime ="formattedTime "@recreate="handleRecreate"/>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
@ -46,161 +49,170 @@
<script lang="ts" setup> <script lang="ts" setup>
import resultsAnnounced from '@/views/resultsAnnounced/index.vue' import resultsAnnounced from '@/views/resultsAnnounced/index.vue'
import settingStore from "@/store/modules/setting"; import settingStore from "@/store/modules/setting";
import {subTestapi,checkapi} from '@/api/index.ts' import { subTestapi, checkapi } from '@/api/index.ts'
import { ref,computed,onMounted, onUnmounted} from "vue" import { ref, computed, onMounted, onUnmounted } from "vue"
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
const setting = settingStore(); const setting = settingStore();
// //
const SubLeft =()=>{ const SubLeft = () => {
console.log(currentQuestionIndex.value) console.log(currentQuestionIndex.value)
if(currentQuestionIndex.value >= 1){ if (currentQuestionIndex.value >= 1) {
currentQuestionIndex.value = currentQuestionIndex.value - 1 currentQuestionIndex.value = currentQuestionIndex.value - 1
}else{ } else {
ElMessage.warning('无法上翻') ElMessage.warning('无法上翻')
}
} }
// }
const SubRight = async()=>{ //
const SubRight = async () => {
const res:any = await checkapi(selectedOption.value[currentQuestionIndex.value]); console.log(complete.value,'11111111')
// answer.value = res.result; if(complete.value == false){
const res: any = await checkapi(selectedOption.value[currentQuestionIndex.value]);
console.log(selectedOption.value); console.log(selectedOption.value);
console.log(res,'res') console.log(res, 'res')
// //
if (res.result == "success") { if (res.result == "success") {
if(currentSum.value < questions.value.length){ if (currentSum.value < questions.value.length) {
currentQuestionIndex.value++; // currentQuestionIndex.value++; //
} }
else{ else {
ElMessage.success('答题已完成,请提交') ElMessage.success('答题已完成,请提交')
} }
} }
else{ else {
if(selectedOption.value[currentQuestionIndex.value] == null){ if (selectedOption.value[currentQuestionIndex.value] == null) {
ElMessage.warning('请先答题') ElMessage.warning('请先答题')
}else{ } else {
ElMessage.error('回答错误') ElMessage.error('回答错误')
} }
} }
}else{
if (currentSum.value < questions.value.length) {
currentQuestionIndex.value++; //
}
else {
ElMessage.warning('无法下翻')
}
} }
const questions = ref<any[]>([]);
const currentList = async ()=>{ }
const res:any = await subTestapi(); const questions = ref<any[]>([]);
questions.value = res.result const currentList = async () => {
console.log(res.result) const res: any = await subTestapi();
// console.log(questions.value[0].xnOptionsList[0].id) questions.value = res.result
// console.log(questions.value,'questions1.value') console.log(res.result)
// console.log(questions.value[0].xnOptionsList[0].id)
// console.log(questions.value,'questions1.value')
}
//
const currentQuestionIndex = ref(0);
//1
const currentSum = computed(() => currentQuestionIndex.value + 1);
//
const currentQuestion = computed(() => {
// questions.value
if (questions.value.length > 0) {
return questions.value[currentQuestionIndex.value].questionText;
} }
// return '';
const currentQuestionIndex = ref(0); });
//1 const xnOptionsList = computed(() => {
const currentSum = computed(() => currentQuestionIndex.value + 1); if (questions.value.length > 0) {
// return questions.value[currentQuestionIndex.value].xnOptionsList
const currentQuestion = computed(() => { }
// questions.value console.log(selectedOption.value)
if (questions.value.length > 0) { return [];
return questions.value[currentQuestionIndex.value].questionText; })
} //
return ''; // questions.value null
}); const selectedOption = ref<{ oid: any; qid: string }[]>(Array(questions.value.length).fill(null));
const xnOptionsList =computed(() =>{
if (questions.value.length > 0) {
return questions.value[currentQuestionIndex.value].xnOptionsList
}
console.log(selectedOption.value)
return [];
})
//
// questions.value null
const selectedOption = ref<{ oid: any; qid: string }[]>(Array(questions.value.length).fill(null));
//
const selectOption = (option:any) => {
if (questions.value.length > 0) {
//
const selectOption = (option: any) => {
if (complete.value == false) {
if (questions.value.length > 0) {
const currentQuestion = questions.value[currentQuestionIndex.value]; const currentQuestion = questions.value[currentQuestionIndex.value];
selectedOption.value[currentQuestionIndex.value]= { selectedOption.value[currentQuestionIndex.value] = {
oid: option, oid: option,
qid: currentQuestion.id qid: currentQuestion.id
}; };
console.log(selectedOption.value[currentQuestionIndex.value].oid,option); console.log(selectedOption.value[currentQuestionIndex.value].oid, option);
} }
} }
const score = ref(0); // 0 }
const isVisible = ref (false) // const score = ref(0); // 0
// const isVisible = ref(false) //
const submitAnswers = async() => { const complete = ref<boolean>(Boolean(localStorage.getItem("complete"))); //
console.log(selectedOption.value[currentQuestionIndex.value])
//
if(selectedOption.value[questions.value.length - 1] == null){ //
ElMessage.warning('请先完成答题') const submitAnswers = async () => {
}else{
const res:any = await checkapi(selectedOption.value[currentQuestionIndex.value]);
if (res.result !== "success"){
ElMessage.error('回答错误')
}else{
stopTimer(); //
score.value = 100; //
isVisible.value = true;
// for (let i = 0; i < questions.value.length; i++) {
// // 10
// if (res.result == "success") {
// // score.value += 10;
// score.value == 100
// }
// }
}
}
};
// 退
const router = useRouter()
const resetAnswers = () => {
router.push('/studyPage')
};
//
const timer = ref<number | null>(null); // setInterval
const elapsedTime = ref(0); //
//
const formattedTime = computed(() => {
const minutes = Math.floor(elapsedTime.value / 60); //
const seconds = elapsedTime.value % 60; //
return `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
});
//
const startTimer = () => {
timer.value = setInterval(() => {
elapsedTime.value += 1; // 1
}, 1000);
};
//
const stopTimer = () => {
if (timer.value) {
clearInterval(timer.value);
timer.value = null;
}
};
//
onMounted(() => {startTimer();currentList();});
//
onUnmounted(() => {stopTimer();});
//
const handleRecreate = () => {
console.log(timer.value,"子组件触发了重做事件");
isVisible.value = false; //
selectedOption.value = Array(questions.value.length).fill(null); //
currentQuestionIndex.value = 0; //
stopTimer()//
elapsedTime.value = 0
startTimer()
};
console.log(selectedOption.value[currentQuestionIndex.value])
//
if (selectedOption.value[questions.value.length - 1] == null) {
ElMessage.warning('请先完成答题')
}else {
const res: any = await checkapi(selectedOption.value[currentQuestionIndex.value]);
if (res.result !== "success") {
ElMessage.error('回答错误')
} else {
stopTimer(); //
score.value = 100; //
isVisible.value = true;
localStorage.setItem("complete", "true");;
// const display = complete.value
}
}
};
// 退
const router = useRouter()
const resetAnswers = () => {
router.push('/studyPage')
};
//
const timer = ref<number | null>(null); // setInterval
const elapsedTime = ref(0); //
//
const formattedTime = computed(() => {
const minutes = Math.floor(elapsedTime.value / 60); //
const seconds = elapsedTime.value % 60; //
return `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
});
//
const startTimer = () => {
timer.value = setInterval(() => {
elapsedTime.value += 1; // 1
}, 1000);
};
//
const stopTimer = () => {
if (timer.value) {
clearInterval(timer.value);
timer.value = null;
}
};
//
onMounted(() => { startTimer(); currentList();});
//
onUnmounted(() => { stopTimer(); });
//
const handleRecreate = () => {
console.log(timer.value, "子组件触发了重做事件");
isVisible.value = false; //
selectedOption.value = Array(questions.value.length).fill(null); //
currentQuestionIndex.value = 0; //
stopTimer()//
elapsedTime.value = 0
startTimer()
localStorage.setItem("complete", "false");
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -213,27 +225,36 @@ import { useRouter } from 'vue-router';
background: url("@/assets/images/bg3.png") no-repeat; background: url("@/assets/images/bg3.png") no-repeat;
background-size: cover; background-size: cover;
.submit-right{ .submit-right {
background: url("@/assets/images/right.png") no-repeat; background: url("@/assets/images/right.png") no-repeat;
background-size: contain; background-size: contain;
width: 60px; /* 按钮宽度 */ width: 60px;
height: 60px; /* 按钮高度 */ /* 按钮宽度 */
height: 60px;
/* 按钮高度 */
border: none; border: none;
cursor: pointer; cursor: pointer;
position: absolute; position: absolute;
right: 0; /* 紧靠右部 */ right: 0;
top: 40%; /* 垂直居中*/ /* 紧靠右部 */
top: 40%;
/* 垂直居中*/
} }
.submit-left{
.submit-left {
background: url("@/assets/images/left.png") no-repeat; background: url("@/assets/images/left.png") no-repeat;
background-size: contain; background-size: contain;
width: 60px; /* 按钮宽度 */ width: 60px;
height: 60px; /* 按钮高度 */ /* 按钮宽度 */
height: 60px;
/* 按钮高度 */
border: none; border: none;
cursor: pointer; cursor: pointer;
position: absolute; position: absolute;
left: 0; /* 紧靠左部 */ left: 0;
top: 40%; /* 垂直居中*/ /* 紧靠左部 */
top: 40%;
/* 垂直居中*/
} }
.top { .top {
@ -252,10 +273,14 @@ import { useRouter } from 'vue-router';
} }
.question-body { .question-body {
background: url("@/assets/images/FakeAnimateForPrototype.png") no-repeat center center; /* 添加 background-position */ background: url("@/assets/images/FakeAnimateForPrototype.png") no-repeat center center;
background-size: contain; /* 确保背景图片覆盖整个元素 */ /* 添加 background-position */
width: 1100px; /* 100% 宽度以确保背景图片完全显示 */ background-size: contain;
height: 500px; /* 固定高度 */ /* 确保背景图片覆盖整个元素 */
width: 1100px;
/* 100% 宽度以确保背景图片完全显示 */
height: 500px;
/* 固定高度 */
margin-top: 100px; margin-top: 100px;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
@ -263,104 +288,162 @@ import { useRouter } from 'vue-router';
padding-right: 50px; padding-right: 50px;
padding-top: 30px; padding-top: 30px;
.question{ .question {
font-size: 42px; /* 字体大小 */ font-size: 42px;
text-align: center; /* 水平居中 */ /* 字体大小 */
letter-spacing: 3px; /* 字符间距,单位可以是 px、em 等 */ text-align: center;
// margin-top: 50px; /* 水平居中 */
color: #fff; letter-spacing: 3px;
} /* 字符间距,单位可以是 px、em 等 */
.question-count { // margin-top: 50px;
font-weight: bold; /* 数字加粗 */ color: #fff;
color: rgb(165, 144, 95); /* 数字颜色为红色 */ }
font-size: 55px; /* 数字字体大小 */
} .question-count {
.timer{ font-weight: bold;
font-size: 18px; /* 字体大小 */ /* 数字加粗 */
letter-spacing: 3px; /* 字符间距 */ color: rgb(165, 144, 95);
text-align: right; /* 数字颜色为红色 */
position: absolute; /* 使用绝对定位 */ font-size: 55px;
top: 25%; /* 距离顶部 */ /* 数字字体大小 */
left: 71.3%; /* 距离左侧 */ }
}
.questions{ .timer {
font-size: 23px; /* 字体大小 */ font-size: 18px;
letter-spacing: 3px; /* 字符间距 */ /* 字体大小 */
text-align: right; letter-spacing: 3px;
color: #fff; /* 字符间距 */
} text-align: right;
.questions-count { position: absolute;
font-weight: bold; /* 数字加粗 */ /* 使用绝对定位 */
color: rgb(165, 144, 95); /* 数字颜色为红色 */ top: 25%;
font-size: 25px; /* 数字字体大小 */ /* 距离顶部 */
} left: 71.3%;
.txt { /* 距离左侧 */
margin-top: 18px; }
font-size: 22px; /* 字体大小 */
font-family: Consolas, sans-serif; /* 字体样式 */ .questions {
letter-spacing: 1.5px; /* 字符间距,单位可以是 px、em 等 */ font-size: 23px;
line-height: 1.5; /* 行间距,1.5 表示字体大小的 1.5 倍 */ /* 字体大小 */
letter-spacing: 3px;
/* 字符间距 */
text-align: right;
color: #fff;
}
.questions-count {
font-weight: bold;
/* 数字加粗 */
color: rgb(165, 144, 95);
/* 数字颜色为红色 */
font-size: 25px;
/* 数字字体大小 */
}
.txt {
margin-top: 15px;
font-size: 20px;
/* 字体大小 */
font-family: Consolas, sans-serif;
/* 字体样式 */
letter-spacing: 1.5px;
/* 字符间距,单位可以是 px、em 等 */
line-height: 1.5;
/* 行间距,1.5 表示字体大小的 1.5 倍 */
color: #9b9a9a; color: #9b9a9a;
} }
/* 选项容器样式 */
.options {
margin-top: 10px;
color: #9b9a9a;
display: flex; /* 使用 Flexbox 布局 */
flex-direction: column; /* 垂直排列按钮 */
}
/* 单个选项样式 */ /* 选项容器样式 */
.option { .options {
padding: 5px 10px; /* 内边距,让按钮看起来更舒适 */ margin-top: 10px;
font-size: 20px; /* 字体大小 */ color: #9b9a9a;
letter-spacing: 1.5px; /* 字符间距,单位可以是 px、em 等 */ display: flex;
text-align: left; /* 设置文字左对齐 */ /* 使用 Flexbox 布局 */
margin-top: 5px; flex-direction: column;
background-color: transparent; /* 背景颜色设置为透明 */ /* 垂直排列按钮 */
border: none; /* 移除边框 */ }
cursor: pointer; /* 鼠标悬停时显示手型 */
transition: background-color 0.3s ease; /* 平滑过渡效果 */ /* 单个选项样式 */
} .option {
.option:hover { padding: 5px 10px;
color: #e7e2e2; /* 鼠标悬停时的字体颜色 */ /* 内边距,让按钮看起来更舒适 */
} font-size: 19px;
.option.selected{ /* 字体大小 */
color: #d4cb48; /* 按钮按下或获得焦点时的背景颜色 */ letter-spacing: 1.5px;
} /* 字符间距,单位可以是 px、em 等 */
.option-letter{ text-align: left;
font-size: 30px; /* 设置文字左对齐 */
font-weight: bold; /* 字母加粗 */ margin-top: 5px;
margin-right: 5px; /* 字母与后面文字的间距 */ background-color: transparent;
color: rgb(165, 144, 95); /* 背景颜色设置为透明 */
} border: none;
/* 移除边框 */
cursor: pointer;
/* 鼠标悬停时显示手型 */
transition: background-color 0.3s ease;
/* 平滑过渡效果 */
}
.option:hover {
color: #e7e2e2;
/* 鼠标悬停时的字体颜色 */
}
.option.selected {
color: #d4cb48;
/* 按钮按下或获得焦点时的背景颜色 */
}
.option-letter {
font-size: 30px;
font-weight: bold;
/* 字母加粗 */
margin-right: 5px;
/* 字母与后面文字的间距 */
color: rgb(165, 144, 95);
}
} }
.submit-buttons { .submit-buttons {
display: flex; /* 使用 Flexbox 布局 */ display: flex;
flex-direction: row; /* 水平排列按钮 */ /* 使用 Flexbox 布局 */
justify-content: center; /* 水平居中 */ flex-direction: row;
gap: 450px; /* 按钮之间的间距 */ /* 水平排列按钮 */
justify-content: center;
/* 水平居中 */
gap: 450px;
/* 按钮之间的间距 */
margin-top: 50px; margin-top: 50px;
} }
.submit-btn { .submit-btn {
background: url("@/assets/images/Button.png") center; background: url("@/assets/images/Button.png") center;
background-size: contain; /* 确保背景图片覆盖整个元素 */ background-size: contain;
background-color: transparent; /* 背景颜色设置为透明 */ /* 确保背景图片覆盖整个元素 */
border: none; /* 移除边框 */ background-color: transparent;
cursor: pointer; /* 鼠标悬停时显示手型 */ /* 背景颜色设置为透明 */
border: none;
/* 移除边框 */
cursor: pointer;
/* 鼠标悬停时显示手型 */
width: 300px; width: 300px;
height: 41px; height: 41px;
font-size: 18px; font-size: 18px;
font-weight: bold; /* 文字加粗 */ font-weight: bold;
/* 文字加粗 */
color: #fff; color: #fff;
} }
/* 覆盖 el-dialog 的背景和边框样式 */ /* 覆盖 el-dialog 的背景和边框样式 */
:deep(.el-dialog){ :deep(.el-dialog) {
background: transparent !important; /* 设置背景为透明 */ background: transparent !important;
border: none !important; /* 移除边框 */ /* 设置背景为透明 */
box-shadow: none !important; /* 移除阴影 */ border: none !important;
overflow: hidden; /* 防止内容溢出 */ /* 移除边框 */
box-shadow: none !important;
/* 移除阴影 */
overflow: hidden;
/* 防止内容溢出 */
width: 640px; width: 640px;
} }

Loading…
Cancel
Save