diff --git a/src/api/user.ts b/src/api/user.ts index 5d893e2..7381d99 100644 --- a/src/api/user.ts +++ b/src/api/user.ts @@ -35,7 +35,17 @@ export const getUserInfoService = () => { //获取知识点信息 export const getKnowledgeService = () => { return request({ - url: "knowledgepoint/xnKnowledgePoint/list", + url: "/pointrecords/xnPointRecords/api/list", method: "get", }); -}; \ No newline at end of file +}; + +//修改密码 +export const userChangePasswordService = (params) => { + return request.post('/xnRecords/changeStuPassword', params) +} + +// 修改个人信息 +export const userChangeService = (params) => { + return request.post('/xnRecords/editInfo', params) +} \ No newline at end of file diff --git a/src/assets/images/login.png b/src/assets/images/login.png index 6fda787..56e256f 100644 Binary files a/src/assets/images/login.png and b/src/assets/images/login.png differ diff --git a/src/layout/index.vue b/src/layout/index.vue index bcfdaff..b3bc0b3 100644 --- a/src/layout/index.vue +++ b/src/layout/index.vue @@ -26,6 +26,7 @@ const setting = settingStore(); const router = useRouter() console.log(setting.title); +user.token ? router.push('/spacePage') : '' const loginFn=()=>{ router.push('/login') } diff --git a/src/layout/knowledgePage.vue b/src/layout/knowledgePage.vue index cbfe8c4..83364d5 100644 --- a/src/layout/knowledgePage.vue +++ b/src/layout/knowledgePage.vue @@ -8,19 +8,18 @@ <!-- 左边按钮 --> <button class="submit-left" @click="SubLeft"></button> <div class="question-body"> - <div class="sumTotal">第<span>{{currentKnowledgeIndex+1}}</span>个/共{{Knowledges .length}}个</div> - <div class="question">{{currentKnowledgeTitle}}</div> - - <el-scrollbar height="210px"> - <div class="txt" v-html="currentKnowledge"></div> + <div class="sumTotal">第<span>{{ currentKnowledgeIndex + 1 }}</span>个/共{{ Knowledges.length }}个</div> + <div class="question">{{ currentKnowledgeTitle }}</div> + <el-scrollbar max-height="210px"> + <div class="txt" v-html="currentKnowledge"></div> </el-scrollbar> - <div class="finished">已学习</div> + <div class="finished" v-show="isStudy">已学习</div> </div> <div class="submit-buttons"> - <!-- <button class="submit-btn" @click="reset">退出</button> --> - <!-- <button class="submit-btn" @click="enter">进入仿真实验</button> --> - <router-link class="submit-btn" to="">返回</router-link> - <router-link class="submit-btn" to="/program">完成学习</router-link> + <button class="submit-btn" @click="reset">退出</button> + <button class="submit-btn" @click="enter">完成学习</button> + <!-- <router-link class="submit-btn" :to="{ path:'/studyPage'}" >返回</router-link> --> + <!-- <router-link class="submit-btn" @click="finishStudy">完成学习</router-link> --> </div> </div> @@ -30,45 +29,75 @@ import settingStore from "@/store/modules/setting"; import { ref, computed, onMounted, } from "vue" import { ElMessage } from 'element-plus' -import {getKnowledgeService } from '@/api/user' +import { getKnowledgeService } from '@/api/user' +import { useRouter } from 'vue-router'; +const router = useRouter() const setting = settingStore(); +const isStudy = ref(false) //左箭头 const SubLeft = () => { - console.log(currentKnowledgeIndex.value) - if(currentKnowledgeIndex.value >= 1){ - currentKnowledgeIndex.value = currentKnowledgeIndex.value - 1 - }else{ - ElMessage.warning('无法上翻') - } + console.log(currentKnowledgeIndex.value) + if (currentKnowledgeIndex.value >= 1) { + currentKnowledgeIndex.value = currentKnowledgeIndex.value - 1 + } else { + ElMessage.warning('已是第一个知识点') + } + isStudy.value = true } +const index = ref(0) //右箭头 +// const activeData = ref({}) const SubRight = () => { + + Knowledges.value[currentKnowledgeIndex.value].isStudy = true + if (currentKnowledgeIndex.value + 1 < Knowledges.value.length) { + currentKnowledgeIndex.value++; // 更新到下一题 + } + else { + ElMessage.success('知识点已学习完毕,请提交') + } + isStudy.value = Knowledges.value[currentKnowledgeIndex.value].isStudy + console.log(Knowledges.value); + } const Knowledges = ref<any[]>([]); const getKnowledge = async () => { const res: any = await getKnowledgeService(); - Knowledges.value = res.result.records - // console.log(Knowledges.value,'ress') + Knowledges.value = res.result.kpVlist + // isStudy.value = Knowledges.value[currentKnowledgeIndex.value].isStudy + console.log(Knowledges.value, 'ress') } // 当前题目的索引 - const currentKnowledgeIndex = ref(0); +const currentKnowledgeIndex = ref(0); const currentKnowledge = computed(() => { - // 确保 questions.value 至少有一个元素 - if (Knowledges.value.length > 0) { - return Knowledges.value[currentKnowledgeIndex.value].knowledgeContext; - } - return ''; - }); - const currentKnowledgeTitle = computed(() => { - // 确保 questions.value 至少有一个元素 - if (Knowledges.value.length > 0) { - return Knowledges.value[currentKnowledgeIndex.value].knowledgeName; - - } - return ''; - }); + // 确保 questions.value 至少有一个元素 + if (Knowledges.value.length > 0) { + return Knowledges.value[currentKnowledgeIndex.value].knowledgeContext; + } + return ''; +}); +const currentKnowledgeTitle = computed(() => { + // 确保 questions.value 至少有一个元素 + if (Knowledges.value.length > 0) { + return Knowledges.value[currentKnowledgeIndex.value].knowledgeName; + } + return ''; +}); + +const reset = () => { + router.push('/studyPage') +} +const enter = () => { + console.log('gggg'); + const allStudied = Knowledges.value.every(item => item.isStudy); + if (allStudied) { + router.push('/studyPage'); + } else { + ElMessage.error('请先完成所有学习内容') + } +} onMounted(() => { getKnowledge() }); </script> @@ -207,7 +236,7 @@ onMounted(() => { getKnowledge() }); letter-spacing: 3px; /* 字符间距,单位可以是 px、em 等 */ color: #dc4758; - margin-top: -235px; + margin-top: 30px; margin-right: 20px; } } @@ -232,7 +261,7 @@ onMounted(() => { getKnowledge() }); /* 背景颜色设置为透明 */ border: none; /* 移除边框 */ - cursor: pointer; + //cursor: pointer; /* 鼠标悬停时显示手型 */ width: 300px; height: 41px; @@ -248,5 +277,8 @@ onMounted(() => { getKnowledge() }); text-decoration: none } + .el-scrollbar { + height: 290px; + } } </style> diff --git a/src/layout/loginPage.vue b/src/layout/loginPage.vue index 92a98cf..730d485 100644 --- a/src/layout/loginPage.vue +++ b/src/layout/loginPage.vue @@ -9,8 +9,8 @@ <el-row style="display: flex; justify-content: center"> <el-col> <el-form :rules="rules" :model="formModel" ref="formRef" size="large" autocomplete="off" v-if="isRegister"> - <el-form-item prop="username" class="custom-form-item"> - <div style="display: flex; align-items: center; color: pink"> + <el-form-item prop="username"> + <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"> <el-icon class="bold-icon"> @@ -20,8 +20,7 @@ <div style="padding-right: 10px; color: #2592a1">用户账号</div> </div> <div class="right"> - <el-input v-model="formModel.username" style="border-color: #20bec8;" - placeholder="请输入用户账号"></el-input> + <el-input v-model="formModel.username" placeholder="请输入用户账号"></el-input> </div> </div> </el-form-item> @@ -36,7 +35,7 @@ <div style="padding-right: 10px; color: #2592a1">用户密码</div> </div> <div class="right"> - <el-input type="password" v-model="formModel.password" style="border-color: #20bec8" + <el-input type="password" v-model="formModel.password" placeholder="请输入密码" show-password></el-input> </div> </div> @@ -57,7 +56,7 @@ </div> </div> </el-form-item> - <el-form-item prop="name" class="custom-form-item"> + <el-form-item prop="name"> <div style="display: flex; align-items: center; color: pink"> <div class="left" style="display: flex; align-items: center;width: 90px;"> <div style="padding-right: 10px; color: #1084c1"> @@ -160,7 +159,7 @@ </el-form> <el-form style="margin-bottom: 90px;" :model="formModel" :rules="rules" ref="formRef" size="large" autocomplete="off" v-else class="custom-form"> - <el-form-item prop="username" class="custom-form-item"> + <el-form-item prop="username"> <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"> @@ -254,10 +253,10 @@ <script setup lang="ts"> // import { ref } from "vue" // import { onMounted, reactive, ref, toRefs, watch } from "vue"; -import { ElMessage, ElMessageBox } from 'element-plus' +import { ElMessage} from 'element-plus' import settingStore from "@/store/modules/setting"; import { User, Lock, Avatar, Stamp, Grid, Iphone } from "@element-plus/icons-vue"; -import { ref } from "vue"; +import { ref,onMounted} from "vue"; import userStore from "@/store/modules/user"; import { getCode, sturegister, getFaculties } from '@/api/user' import { useRouter } from "vue-router"; @@ -446,6 +445,9 @@ const toLogin = () => { const clickErrorBtn=()=>{ console.log('aaa'); } +onMounted(()=>{ + getcodeinfo(); +}) </script> <style lang="less" scoped> diff --git a/src/layout/passwordPage.vue b/src/layout/passwordPage.vue new file mode 100644 index 0000000..f92f67c --- /dev/null +++ b/src/layout/passwordPage.vue @@ -0,0 +1,410 @@ +<template> + <div class="login_container"> + <div class="top"> + <div class="loginBtn"> + <p @click="loginFn">{{ user.token ? '已登录' : '登录/注册' }}</p> + </div> + <div class="title">{{ setting.title }}</div> + </div> + + <div class="main-content"> + <div class="personal-center"> + <div class="leftBox"> + <h2>个人中心</h2> + <p>学生8527</p> + <button class="btn1" @click="handleHomeClick">返回首页</button> + <button class="btn2" @click="handleRecordClick">个人中心</button> + <button class="btn3">重置密码</button> + </div> + <div class="rightBoxes"> + <div class="topBox"> + <el-form style="margin:55px 0 0 200px;" :rules="rules" :model="formModel" ref="formRef" + size="large" autocomplete="off"> + <el-form-item prop="username" class="custom-form-item"> + <div class="left" style="width: 60px;color: #fbfdfd;"> + 用户账号 + </div> + <div class="right"> + <el-input disabled v-model="formModel.username" + style="border-color: #20bec8;"></el-input> + </div> + </el-form-item> + <el-form-item prop="oldPassword" class="custom-form-item" style="margin-top: 25px;"> + <div style="display: flex; align-items: center; color: pink"> + <div class="left" style="width: 60px;color: #fbfdfd;"> + 旧密码 + </div> + <div class="right"> + <el-input type="password" v-model="formModel.oldPassword" + style="border-color: #20bec8;" placeholder="请输入旧密码" + show-password></el-input> + </div> + </div> + </el-form-item> + </el-form> + </div> + <div class="bottomBox"> + <el-form size="large" style="margin:36px 0 0 265px;" :rules="rules" :model="formModel"> + <el-form-item prop="password"> + <div style="display: flex; align-items: center;"> + <div class="left" style="width: 60px;color: #fbfdfd;"> + 新密码 + </div> + <div class="right"> + <el-input type="password" v-model="formModel.password" + style="border-color: #20bec8" placeholder="请输入新密码" show-password></el-input> + </div> + </div> + </el-form-item> + <el-form-item prop="repassword"> + <div style="display: flex; align-items: center;"> + <div class="left" style="width: 60px;color: #fbfdfd;"> + 确认密码 + </div> + <div class="right"> + <el-input placeholder="请再次输入新密码" type="password" v-model="formModel.repassword" + style="border-color: #20bec8 ;margin-top: 6px" show-password></el-input> + </div> + </div> + </el-form-item> + + </el-form> + <el-button style="margin:10px 0 0 580px;font-size: 13px;font-weight: 700;" + size="large" @click="confirmChange">确认修改</el-button> + </div> + </div> + </div> + </div> + </div> + + +</template> + +<script setup lang="ts" name="spacePage"> + +import { ref, onMounted } from "vue" +import { useRouter } from 'vue-router' +import { ElMessage } from 'element-plus' +import settingStore from "@/store/modules/setting"; +const setting = settingStore(); +import userStore from '@/store/modules/user'; +import { getUserInfoService, userChangePasswordService } from '@/api/user' +const router = useRouter() +const user = userStore(); +const loginFn = () => { + router.push('/login') +} +const handleHomeClick = () => { + // 处理首页按钮点击逻辑,如路由跳转 + console.log('返回首页'); + router.push('/studyPage') +}; +const handleRecordClick = () => { + console.log('个人中心'); + router.push('/spacePage') +}; + +const formRef = ref(); +const formModel = ref({ + username: "", + oldPassword:'', + password:'', + repassword:'' +}); +const getUser = async () => { + const res: any = await getUserInfoService(); + // console.log(res.result,'aaaaa'); + + formModel.value.username = res.result.username; + // console.log(formModel, 'formModel'); +} + + + +const rules = { + username: [ + { required: true, message: "请输入用户名", trigger: "blur" }, + { + min: 5, + max: 30, + message: "用户名长度最小五位最大三十位", + trigger: ["change", "blur"], + }, + ], + oldpassword: [ + { required: true, message: "请输入旧密码", trigger: "blur" }, + { + pattern: /^\S{6,15}$/, + message: "旧密码长度最小六位最大十五位", + trigger: ["change", "blur"], + }, + ], + password: [ + { required: true, message: "请输入新密码", trigger: "blur" }, + { + pattern: /^\S{6,15}$/, + message: "密码长度最小六位最大十五位", + trigger: ["change", "blur"], + }, + { + validator: (rule, value, callback) => { + if (value === formModel.value.oldPassword) { + callback(new Error("新密码不能跟旧密码输入一致!")); + } else { + callback(); + } + }, + trigger: "blur", + }, + ], + repassword: [ + { required: true, message: "请再次输入新密码", trigger: "blur" }, + { + max: 15, + min: 6, + pattern: /^\S{6,15}$/, + message: "密码长度最小六位最大十五位", + trigger: ["change", "blur"], + }, + { + validator: (rule, value, callback) => { + if (value !== formModel.value.password) { + callback(new Error("两次输入新密码不一致!")); + } else { + callback(); + } + }, + trigger: "blur", + }, + ], +}; +const confirmChange =async()=>{ + await userChangePasswordService({ + username: formModel.value.username, + password: formModel.value.password, + oldPassword: formModel.value.oldPassword, + }) + .then(() => { + ElMessage.success('修改成功') + }) + .catch((error) => { + // console.log(error, 'error') + ElMessage.error(error.response.data.message) + }) + formModel.value.oldPassword='' + formModel.value.password = '' + formModel.value.repassword='' + +} +onMounted(() => { + getUser() +}) +</script> + +<style lang="less" scoped> +.login_container { + position: relative; + width: 100%; + // height: 1080px; + min-height: 100vh; + background-color: #091d22; + background: url("../assets//images/bg3.png") no-repeat; + background-size: cover; + + .top { + width: 100%; + height: 75px; + text-align: center; + font-size: 42px; + line-height: 75px; + font-style: italic; + background: url("../assets/images/topbgc.png") no-repeat; + // background-position: center bottom -10px; + background-size: cover; + + .title { + color: #fff; + } + + .loginBtn { + position: absolute; + /* 清除浮动影响 */ + float: left; + /* 向左浮动 */ + top: 10px; + left: 230px; + border: 1px solid #33FEFE; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); + width: 142px; + height: 40px; + line-height: 37px; + background: linear-gradient(to bottom, #08B9C1, #0758B8); + transform: skew(-30deg); + cursor: pointer; + /* 在X轴方向倾斜 -30 度 */ + border-radius: 5%; + + p { + transform: skew(30deg); + /* 反向倾斜,抵消父元素的变形 */ + font-size: 18px; + color: #fff; + } + } + } +} + +.main-content { + display: flex; + justify-content: center; + align-items: center; + + .personal-center { + display: flex; + width: 1800px; + height: 600px; + margin-top: 150px; + justify-content: space-evenly; + + .leftBox { + position: relative; + width: 550px; + height: 600px; + background: url("../assets/images/space1.png") no-repeat; + transform: skewX(-5deg); + margin-right: -150px; + // flex-direction: column; + background-size: 98%; + + h2 { + position: absolute; + top: 6px; + left: 60%; + transform: translateX(-50%); + color: #ededd8; + font-size: 16px; + font-weight: 700; + height: 40px; + line-height: 40px; + font-size: 20px; + } + + p { + position: absolute; + top: 28%; + left: 55%; + transform: translateX(-50%); + color: #fdeda0; + font-size: 20px; + font-weight: 700; + height: 40px; + line-height: 40px; + } + + .btn1, + .btn2, + .btn3 { + display: block; + width: 200px; + height: 55px; + background-color: #e9ddab; + margin: 25px auto; + border: none; + border-radius: 5px; + color: #333; + font-size: 20px; + font-weight: 700; + transform: skewX(-17deg); + } + + .btn1 { + position: absolute; + top: 268px; + left: 31%; + } + + .btn2 { + position: absolute; + left: 26%; + top: 360px; + + } + + .btn3 { + position: absolute; + left: 22%; + top: 453px; + background-color: #e2c04f; + } + } + + .rightBoxes { + width: 1200px; + height: 600px; + // background-color: skyblue; + // flex: 1; + display: flex; + justify-content: space-around; + flex-direction: column; + transform: skewX(-17deg); + + .topBox { + // width: 800px; + // height: 300px; + flex: 1; + background-color: lightgreen; + background: url("../assets/images/space2.png") no-repeat; + background-size: 98%; + // display: flex; + // justify-content: center; + // align-items: center; + transform: skewX(15deg); + + .el-input { + width: 450px; + height: 50px; + } + + :deep(.el-form-item__error) { + left: 90px; + } + } + + .bottomBox { + margin-top: 36px; + flex: 1; + // width: 800px; + // height: 200px; + background-color: lightcoral; + background: url("../assets/images/space3.png") no-repeat; + background-size: 98%; + // display: flex; + // justify-content: center; + // align-items: center; + transform: skewX(15deg); + + .el-input { + width: 450px; + height: 50px; + } + + :deep(.el-form-item__error) { + left: 90px; + } + } + + + } + } +} + +// .personal-center { +// background-color: #003366; +// padding: 20px; +// color: white; +// border-radius: 10px; +// transform: skewX(-15deg); +// display: flex; + + +// }</style> \ No newline at end of file diff --git a/src/layout/spacePage.vue b/src/layout/spacePage.vue index 4a8861b..c9a9a58 100644 --- a/src/layout/spacePage.vue +++ b/src/layout/spacePage.vue @@ -12,74 +12,74 @@ <div class="leftBox"> <h2>个人中心</h2> <p>学生8527</p> - <button class="btn1" @click="handleHomeClick">首页</button> - <button class="btn2" @click="handleRecordClick">学习/成绩记录</button> + <button class="btn1" @click="handleHomeClick">返回首页</button> + <button class="btn2" disabled>个人中心</button> <button class="btn3" @click="handlePasswordClick">重置密码</button> </div> <div class="rightBoxes"> <div class="topBox"> - <el-form style="margin:30px 0 0 200px;" :rules="rules" :model="formModel" ref="formRef" - size="large" autocomplete="off"> - <el-form-item prop="username" class="custom-form-item"> + <el-form style="margin:30px 0 0 200px;" :model="formModel" size="large" autocomplete="off"> + <el-form-item> <div class="left" style="width: 60px;color: #fbfdfd;"> 用户账号 </div> <div class="right"> - <el-input disabled v-model="formModel.username" style="border-color: #20bec8;"></el-input> + <el-input disabled v-model="formModel.username"></el-input> </div> </el-form-item> - <el-form-item prop="name" class="custom-form-item"> + <el-form-item> <div style="display: flex; align-items: center; color: pink"> <div class="left" style="width: 60px;color: #fbfdfd;"> 姓名 </div> <div class="right"> - <el-input v-model="formModel.realname" style="border-color: #20bec8;"></el-input> + <el-input disabled v-model="formModel.realname"></el-input> </div> </div> </el-form-item> - <el-form-item prop="clssid" class="custom-form-item"> + <el-form-item prop="clssid"> <div class="left" style="width: 60px;color: #fbfdfd;"> 班级 </div> <div class="right"> - <el-input v-model="formModel.className" style="border-color: #20bec8;"></el-input> + <el-input disabled v-model="formModel.className"></el-input> </div> </el-form-item> - </el-form> </div> <div class="bottomBox"> - <el-form size="large" style="margin:30px 0 0 265px;" :rules="rules" :model="formModel"> - <el-form-item prop="studentNumb"> + <el-form size="large" style="margin:30px 0 0 265px;" :model="formModel"> + <el-form-item> <div style="display: flex; align-items: center;"> <div class="left" style="width: 60px;color: #fbfdfd;"> 学号 </div> <div class="right"> - <el-input v-model="formModel.workNo" - style="border-color: #20bec8"></el-input> + <el-input disabled v-model="formModel.workNo"></el-input> </div> </div> </el-form-item> - <el-form-item prop="mobile"> + <el-form-item> <div style="display: flex; align-items: center;"> <div class="left" style="width: 60px;color: #fbfdfd;"> 手机号 </div> <div class="right"> - <el-input v-model="formModel.phone" style="border-color: #20bec8"></el-input> + <el-input disabled v-model="formModel.phone"></el-input> </div> </div> </el-form-item> - <el-form-item prop="score"> + <el-form-item> <div style="display: flex; align-items: center;"> <div class="left" style="width: 60px;color: #fbfdfd;"> 成绩 </div> <div class="right"> - <el-input-number disabled v-model="formModel.score" style="border-color: #20bec8"></el-input-number> + <el-input-number disabled v-model="formModel.score"></el-input-number> </div> + <el-button + style="color: #333333; margin: 5px 3px 0 83px; font-size: 15px; font-weight: 700; background-color: #e9ddab;" + size="large" @click="openDialog">更改个人信息</el-button> </div> </el-form-item> </el-form> @@ -89,31 +89,55 @@ </div> </div> - + <!-- 弹框 --> + <el-dialog v-model="dialog" title="更改个人信息" width="500"> + <el-form :model="dialogForm" :rules="rules" ref="formRef"> + <el-form-item prop="username" label="用户账号" style="margin-top: 30px;"> + <el-input v-model="dialogForm.username" disabled></el-input> + </el-form-item> + <el-form-item prop="name" label="姓名" label-width="58px"> + <el-input v-model="dialogForm.name"></el-input> + </el-form-item> + <el-form-item prop="phone" label="手机号" label-width="58px"> + <el-input v-model="dialogForm.phone"></el-input> + </el-form-item> + <!-- <el-form-item prop="clssid" label="班级" label-width="58px"> + <el-cascader placeholder="请选择所属班级" :props="props" style="width: 142%; height: 0.2344rem" + v-model="dialogForm.clssid" @change="handleChange" /> + </el-form-item> --> + </el-form> + <template #footer> + <div class="dialog-footer"> + <el-button @click="handleClose">取消</el-button> + <el-button type="primary" @click="changeInformation"> + 确认修改 + </el-button> + </div> + </template> + </el-dialog> </template> <script setup lang="ts" name="spacePage"> - -import { ref,onMounted } from "vue" +import { ElMessage } from 'element-plus' +import { ref,onMounted} from "vue" import { useRouter } from 'vue-router' import settingStore from "@/store/modules/setting"; const setting = settingStore(); import userStore from '@/store/modules/user'; -import { getUserInfoService } from '@/api/user' +import { getUserInfoService,userChangeService } from '@/api/user' +// import {getFaculties } from '@/api/user' const router = useRouter() const user = userStore(); const loginFn = () => { router.push('/login') } const handleHomeClick = () => { - // 处理首页按钮点击逻辑,如路由跳转 - console.log('首页按钮被点击'); -}; -const handleRecordClick = () => { - console.log('学习/成绩记录按钮被点击'); + + router.push('/studyPage') }; const handlePasswordClick = () => { - console.log('密码管理按钮被点击'); + console.log('密码管理'); + router.push('/passwordPage') }; const formRef = ref(); @@ -125,14 +149,18 @@ const formModel = ref({ phone: '', score: '' }); +const dialogForm=ref({ + username: "", + name: "", + phone: '', +}) const getUser=async()=>{ const res: any = await getUserInfoService(); // console.log(res.result,'aaaaa'); - formModel.value = res.result; // console.log(formModel, 'formModel'); + dialogForm.value.username=res.result.username } - const rules = { @@ -145,34 +173,97 @@ const rules = { trigger: ["change", "blur"], }, ], - studentNumb: [ - { required: true, message: "请输入学号", trigger: "blur" }, - { - min: 5, - max: 11, - message: "学号长度最小五位最大十一位", - trigger: ["change", "blur"], - }, - ], + // workNo: [ + // { required: true, message: "请输入学号", trigger: "blur" }, + // { + // min: 5, + // max: 11, + // message: "学号长度最小五位最大十一位", + // trigger: ["change", "blur"], + // }, + // ], name: [{ required: true, message: "请输入姓名", trigger: "blur" }], - clssid: [ - { required: true, message: "请选择所属班级", trigger: "blur" }, - ], - mobile: [ + // clssid: [ + // { required: true, message: "请选择所属班级", trigger: "blur" }, + // ], + phone: [ { required: true, message: "请输入手机号", trigger: "blur" }, - { - pattern: /^1[3-9]\d{9}$/, - message: "手机号格式不正确", - trigger: ["change", "blur"], - }, - ], - // score:[ - // { required: true, message: "成绩", trigger: "blur" }, - // ] + // { + // pattern: /^1[3-9]\d{9}$/, + // message: "手机号格式不正确", + // trigger: ["change", "blur"], + // }, + ] }; onMounted(()=>{ getUser() }) + + +// // 班级 +// const FacultiesList = ref([]) +// const getFacultiesList = async (data: any) => { +// const res: any = await getFaculties(data) +// console.log(res, 'res11') +// FacultiesList.value = res.result +// } +// const deepValues = ref([]) +// // 配置部门级联选择器 +// const props = { +// lazy: true, +// checkStrictly: true, +// emitPath: false, +// async lazyLoad(node: any, resolve: any) { +// console.log(node); +// deepValues.value = node.pathValues +// await getFacultiesList({ +// primaryType: node.level + 1, +// pid: node.value, +// }) +// const nodes = FacultiesList.value.map((item: any) => ({ +// value: item.id, +// label: item.name, +// })) +// resolve(nodes) +// }, +// } +// const handleChange = (e: any) => { +// console.log(e); +// dialogForm.value.clssid = e +// } + + +const loading = ref(false) +const dialog = ref(false) +const changeInformation =async() => { + await formRef.value.validate(); + await userChangeService({ + realname: dialogForm.value.name, + phone: dialogForm.value.phone, + + }) + .then(() => { + ElMessage.success('修改成功') + }) + .catch((error) => { + // console.log(error, 'error') + ElMessage.error(error.response.data.message) + }) + loading.value = true + setTimeout(() => { + dialog.value = false + }, 400) + getUser() +} +const openDialog = () => { + dialog.value = true + dialogForm.value.name = formModel.value.realname + dialogForm.value.phone = formModel.value.phone +} +const handleClose = () => { + dialog.value = false +} + </script> <style lang="less" scoped> @@ -301,6 +392,7 @@ onMounted(()=>{ position: absolute; left: 26%; top: 360px; + background-color:#e2c04f ; } .btn3 { diff --git a/src/layout/studyPage.vue b/src/layout/studyPage.vue index 9d2ec13..6640097 100644 --- a/src/layout/studyPage.vue +++ b/src/layout/studyPage.vue @@ -45,6 +45,7 @@ const handleBoxClick = (boxNumber) => { case 1: isBox1Clicked.value = true; // router.push('/page1'); // 跳转到对应的页面,这里以 /page1 为例 + router.push('/knowledgePage') break; case 2: isBox2Clicked.value = true; diff --git a/src/router/index.ts b/src/router/index.ts index e9d09e4..699d5f5 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -59,7 +59,11 @@ const routerList: any = [ path: '/knowledgePage', name: 'KnowledgePage', component: () => import('@/layout/knowledgePage.vue') - }, + },{ + path:'/passwordPage', + name:'PasswordPage', + component:()=>import('@/layout/passwordPage.vue') + } ]; diff --git a/src/views/resultsAnnounced/index.vue b/src/views/resultsAnnounced/index.vue index 06af3a0..57e3c5f 100644 --- a/src/views/resultsAnnounced/index.vue +++ b/src/views/resultsAnnounced/index.vue @@ -81,7 +81,7 @@ const emit = defineEmits(['recreate']); //去学习按钮 const Study =()=>{ - router.push('/studyPage') + router.push('/knowledgePage') } //重做按钮 @@ -93,7 +93,7 @@ const Recreate=()=>{ //回首页 const router = useRouter(); const Back =()=>{ - router.push('/spacePage'); // 返回首页 + router.push('/studyPage'); // 返回首页 } </script> @@ -103,6 +103,7 @@ const Back =()=>{ height: 540px; background: url("@/assets/images/bg4.png") no-repeat center center; background-size: contain; + margin-top: -5px; padding-top: 15px; padding-left: 25px; padding-right:25px; @@ -162,7 +163,7 @@ const Back =()=>{ height: 28px; width: 100%; position: absolute; /* 绝对定位 */ - bottom: 200px; + bottom: 210px; gap: 90px; left: 110px; } @@ -178,9 +179,9 @@ const Back =()=>{ } .footer{ width: 560px; - height: 160px; + height: 150px; position: absolute; /* 绝对定位 */ - bottom: 0; /* 置于底部 */ + bottom: 15px; /* 置于底部 */ display: flex; flex-direction: row; padding-left: 50px; diff --git a/src/views/subjectTest/index.vue b/src/views/subjectTest/index.vue index 3f99451..1c6f31a 100644 --- a/src/views/subjectTest/index.vue +++ b/src/views/subjectTest/index.vue @@ -62,6 +62,7 @@ import { useRouter } from 'vue-router'; } //右箭头 const SubRight = async()=>{ + const res:any = await checkapi(selectedOption.value[currentQuestionIndex.value]); // answer.value = res.result; console.log(selectedOption.value);