Compare commits

..

No commits in common. '3c97806ef0f3d78e820ebb18ce0eccc3e210ca21' and 'f5b55dc00e22094ab58d77fa84ca9e6c197af26d' have entirely different histories.

  1. 7
      src/api/user.ts
  2. 101
      src/layout/knowledgePage.vue
  3. 127
      src/layout/spacePage.vue
  4. 1
      src/layout/studyPage.vue
  5. 1
      src/views/subjectTest/index.vue

@ -35,7 +35,7 @@ export const getUserInfoService = () => {
//获取知识点信息 //获取知识点信息
export const getKnowledgeService = () => { export const getKnowledgeService = () => {
return request({ return request({
url: "/pointrecords/xnPointRecords/api/list", url: "knowledgepoint/xnKnowledgePoint/list",
method: "get", method: "get",
}); });
}; };
@ -43,9 +43,4 @@ export const getKnowledgeService = () => {
//修改密码 //修改密码
export const userChangePasswordService = (params) => { export const userChangePasswordService = (params) => {
return request.post('/xnRecords/changeStuPassword', params) return request.post('/xnRecords/changeStuPassword', params)
}
// 修改个人信息
export const userChangeService = (params) => {
return request.post('/xnRecords/editInfo', params)
} }

@ -8,18 +8,19 @@
<!-- 左边按钮 --> <!-- 左边按钮 -->
<button class="submit-left" @click="SubLeft"></button> <button class="submit-left" @click="SubLeft"></button>
<div class="question-body"> <div class="question-body">
<div class="sumTotal"><span>{{ currentKnowledgeIndex + 1 }}</span>/{{ Knowledges.length }}</div> <div class="sumTotal"><span>{{currentKnowledgeIndex+1}}</span>/{{Knowledges .length}}</div>
<div class="question">{{ currentKnowledgeTitle }}</div> <div class="question">{{currentKnowledgeTitle}}</div>
<el-scrollbar max-height="210px">
<div class="txt" v-html="currentKnowledge"></div> <el-scrollbar height="210px">
<div class="txt" v-html="currentKnowledge"></div>
</el-scrollbar> </el-scrollbar>
<div class="finished" v-show="isStudy">已学习</div> <div class="finished">已学习</div>
</div> </div>
<div class="submit-buttons"> <div class="submit-buttons">
<button class="submit-btn" @click="reset">退出</button> <!-- <button class="submit-btn" @click="reset">退出</button> -->
<button class="submit-btn" @click="enter">完成学习</button> <!-- <button class="submit-btn" @click="enter">进入仿真实验</button> -->
<!-- <router-link class="submit-btn" :to="{ path:'/studyPage'}" >返回</router-link> --> <router-link class="submit-btn" to="">返回</router-link>
<!-- <router-link class="submit-btn" @click="finishStudy">完成学习</router-link> --> <router-link class="submit-btn" to="/program">完成学习</router-link>
</div> </div>
</div> </div>
@ -29,75 +30,50 @@
import settingStore from "@/store/modules/setting"; import settingStore from "@/store/modules/setting";
import { ref, computed, onMounted, } from "vue" import { ref, computed, onMounted, } from "vue"
import { ElMessage } from 'element-plus' 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 setting = settingStore();
const isStudy = ref(false)
// //
const SubLeft = () => { const SubLeft = () => {
console.log(currentKnowledgeIndex.value) console.log(currentKnowledgeIndex.value)
if (currentKnowledgeIndex.value >= 1) { if(currentKnowledgeIndex.value >= 1){
currentKnowledgeIndex.value = currentKnowledgeIndex.value - 1 currentKnowledgeIndex.value = currentKnowledgeIndex.value - 1
} else { }else{
ElMessage.warning('已是第一个知识点') ElMessage.warning('无法上翻')
} }
isStudy.value = true
} }
const index = ref(0)
// //
// const activeData = ref({})
const SubRight = () => { const SubRight = () => {
if (currentKnowledgeIndex.value+1 < Knowledges.value.length) {
Knowledges.value[currentKnowledgeIndex.value].isStudy = true
if (currentKnowledgeIndex.value + 1 < Knowledges.value.length) {
currentKnowledgeIndex.value++; // currentKnowledgeIndex.value++; //
} }
else { else {
ElMessage.success('知识点已学习完毕,请提交') ElMessage.success('知识点已学习完毕,请提交')
} }
isStudy.value = Knowledges.value[currentKnowledgeIndex.value].isStudy
console.log(Knowledges.value);
} }
const Knowledges = ref<any[]>([]); const Knowledges = ref<any[]>([]);
const getKnowledge = async () => { const getKnowledge = async () => {
const res: any = await getKnowledgeService(); const res: any = await getKnowledgeService();
Knowledges.value = res.result.kpVlist Knowledges.value = res.result.records
// isStudy.value = Knowledges.value[currentKnowledgeIndex.value].isStudy // console.log(Knowledges.value,'ress')
console.log(Knowledges.value, 'ress')
} }
// //
const currentKnowledgeIndex = ref(0); const currentKnowledgeIndex = ref(0);
const currentKnowledge = computed(() => { const currentKnowledge = computed(() => {
// questions.value // questions.value
if (Knowledges.value.length > 0) { if (Knowledges.value.length > 0) {
return Knowledges.value[currentKnowledgeIndex.value].knowledgeContext; return Knowledges.value[currentKnowledgeIndex.value].knowledgeContext;
} }
return ''; return '';
}); });
const currentKnowledgeTitle = computed(() => { const currentKnowledgeTitle = computed(() => {
// questions.value // questions.value
if (Knowledges.value.length > 0) { if (Knowledges.value.length > 0) {
return Knowledges.value[currentKnowledgeIndex.value].knowledgeName; return Knowledges.value[currentKnowledgeIndex.value].knowledgeName;
}
return ''; }
}); 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() }); onMounted(() => { getKnowledge() });
</script> </script>
@ -236,7 +212,7 @@ onMounted(() => { getKnowledge() });
letter-spacing: 3px; letter-spacing: 3px;
/* 字符间距,单位可以是 px、em 等 */ /* 字符间距,单位可以是 px、em 等 */
color: #dc4758; color: #dc4758;
margin-top: 30px; margin-top: -235px;
margin-right: 20px; margin-right: 20px;
} }
} }
@ -261,7 +237,7 @@ onMounted(() => { getKnowledge() });
/* 背景颜色设置为透明 */ /* 背景颜色设置为透明 */
border: none; border: none;
/* 移除边框 */ /* 移除边框 */
//cursor: pointer; cursor: pointer;
/* 鼠标悬停时显示手型 */ /* 鼠标悬停时显示手型 */
width: 300px; width: 300px;
height: 41px; height: 41px;
@ -277,8 +253,5 @@ onMounted(() => { getKnowledge() });
text-decoration: none text-decoration: none
} }
.el-scrollbar {
height: 290px;
}
} }
</style> </style>

@ -98,13 +98,13 @@
<el-form-item prop="name" label="姓名" label-width="58px"> <el-form-item prop="name" label="姓名" label-width="58px">
<el-input v-model="dialogForm.name"></el-input> <el-input v-model="dialogForm.name"></el-input>
</el-form-item> </el-form-item>
<el-form-item prop="phone" label="手机号" label-width="58px"> <el-form-item prop="mobile" label="手机号" label-width="58px">
<el-input v-model="dialogForm.phone"></el-input> <el-input v-model="dialogForm.phone" placeholder="请输入手机号"></el-input>
</el-form-item> </el-form-item>
<!-- <el-form-item prop="clssid" label="班级" label-width="58px"> <el-form-item prop="clssid" label="班级" label-width="58px">
<el-cascader placeholder="请选择所属班级" :props="props" style="width: 142%; height: 0.2344rem" <el-cascader placeholder="请选择所属班级" :props="props" style="width: 142%; height: 0.2344rem"
v-model="dialogForm.clssid" @change="handleChange" /> v-model="dialogForm.clssid" @change="handleChange" />
</el-form-item> --> </el-form-item>
</el-form> </el-form>
<template #footer> <template #footer>
<div class="dialog-footer"> <div class="dialog-footer">
@ -118,14 +118,14 @@
</template> </template>
<script setup lang="ts" name="spacePage"> <script setup lang="ts" name="spacePage">
import { ElMessage } from 'element-plus'
import { ref,onMounted} from "vue" import { ref,onMounted} from "vue"
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import settingStore from "@/store/modules/setting"; import settingStore from "@/store/modules/setting";
const setting = settingStore(); const setting = settingStore();
import userStore from '@/store/modules/user'; import userStore from '@/store/modules/user';
import { getUserInfoService,userChangeService } from '@/api/user' import { getUserInfoService } from '@/api/user'
// import {getFaculties } from '@/api/user' import {getFaculties } from '@/api/user'
const router = useRouter() const router = useRouter()
const user = userStore(); const user = userStore();
const loginFn = () => { const loginFn = () => {
@ -152,6 +152,7 @@ const formModel = ref({
const dialogForm=ref({ const dialogForm=ref({
username: "", username: "",
name: "", name: "",
clssid: '',
phone: '', phone: '',
}) })
const getUser=async()=>{ const getUser=async()=>{
@ -183,87 +184,71 @@ const rules = {
// }, // },
// ], // ],
name: [{ required: true, message: "请输入姓名", trigger: "blur" }], name: [{ required: true, message: "请输入姓名", trigger: "blur" }],
// clssid: [ clssid: [
// { required: true, message: "", trigger: "blur" }, { required: true, message: "请选择所属班级", trigger: "blur" },
// ], ],
phone: [ mobile: [
{ required: true, message: "请输入手机号", trigger: "blur" }, { required: true, message: "请输入手机号", trigger: "blur" },
// { {
// pattern: /^1[3-9]\d{9}$/, pattern: /^1[3-9]\d{9}$/,
// message: "", message: "手机号格式不正确",
// trigger: ["change", "blur"], trigger: ["change", "blur"],
// }, },
] ]
// score:[
// { required: true, message: "", trigger: "blur" },
// ]
}; };
onMounted(()=>{ onMounted(()=>{
getUser() 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 loading = ref(false)
const dialog = ref(false) const dialog=ref(false)
const changeInformation =async() => { const changeInformation = () => {
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 loading.value = true
setTimeout(() => { setTimeout(() => {
dialog.value = false dialog.value = false
}, 400) }, 400)
getUser()
} }
const openDialog = () => { const openDialog=()=>{
dialog.value = true dialog.value=true
dialogForm.value.name = formModel.value.realname
dialogForm.value.phone = formModel.value.phone
} }
const handleClose = () => { const handleClose = () => {
dialog.value = false dialog.value = false
} }
//
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
}
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>

@ -45,7 +45,6 @@ const handleBoxClick = (boxNumber) => {
case 1: case 1:
isBox1Clicked.value = true; isBox1Clicked.value = true;
// router.push('/page1'); // /page1 // router.push('/page1'); // /page1
router.push('/knowledgePage')
break; break;
case 2: case 2:
isBox2Clicked.value = true; isBox2Clicked.value = true;

@ -62,7 +62,6 @@ import { useRouter } from 'vue-router';
} }
// //
const SubRight = async()=>{ const SubRight = async()=>{
const res:any = await checkapi(selectedOption.value[currentQuestionIndex.value]); const res:any = await checkapi(selectedOption.value[currentQuestionIndex.value]);
// answer.value = res.result; // answer.value = res.result;
console.log(selectedOption.value); console.log(selectedOption.value);

Loading…
Cancel
Save