个人中心与知识点信息获取接口

main
xy 2 weeks ago
parent 5f4b46dc14
commit 932a023d84
  1. 16
      src/api/user.ts
  2. 51
      src/layout/knowledgePage.vue
  3. 18
      src/layout/spacePage.vue

@ -23,3 +23,19 @@ export const sturegister = (data: any) => {
data, data,
}) })
} }
// 获取用户信息
export const getUserInfoService = () => {
return request({
url: "/xnRecords/getIndividualScore",
method: "get",
});
};
//获取知识点信息
export const getKnowledgeService = () => {
return request({
url: "knowledgepoint/xnKnowledgePoint/list",
method: "get",
});
};

@ -8,11 +8,11 @@
<!-- 左边按钮 --> <!-- 左边按钮 -->
<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">一个/共X</div> <div class="sumTotal"><span>{{currentKnowledgeIndex+1}}</span>/{{Knowledges .length}}</div>
<div class="question">知识点学习</div> <div class="question">{{currentKnowledgeTitle}}</div>
<el-scrollbar height="210px"> <el-scrollbar height="210px">
<div class="txt" v-html="Text"></div> <div class="txt" v-html="currentKnowledge"></div>
</el-scrollbar> </el-scrollbar>
<div class="finished">已学习</div> <div class="finished">已学习</div>
</div> </div>
@ -26,32 +26,51 @@
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup name="knowledgePage">
import settingStore from "@/store/modules/setting"; import settingStore from "@/store/modules/setting";
import { getExperiment } from '@/api/index' import { ref, computed, onMounted, } from "vue"
import { ref, computed, onMounted, onUnmounted } from "vue" import { ElMessage } from 'element-plus'
import { useRouter } from 'vue-router'; import {getKnowledgeService } from '@/api/user'
const setting = settingStore(); const setting = settingStore();
// //
const SubLeft = () => { const SubLeft = () => {
console.log(currentKnowledgeIndex.value)
if(currentKnowledgeIndex.value >= 1){
currentKnowledgeIndex.value = currentKnowledgeIndex.value - 1
}else{
ElMessage.warning('无法上翻')
}
} }
// //
const SubRight = () => { const SubRight = () => {
} }
const Text = ref() const Knowledges = ref<any[]>([]);
const getContent = async () => { const getKnowledge = async () => {
const res: any = await getExperiment(); const res: any = await getKnowledgeService();
// console.log(res.result.purposeRequirements,'res') Knowledges.value = res.result.records
Text.value = res.result.purposeRequirements // console.log(Knowledges.value,'ress')
console.log(Text.value);
} }
//
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;
onMounted(() => { getContent() }); }
return '';
});
onMounted(() => { getKnowledge() });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

@ -43,7 +43,7 @@
班级 班级
</div> </div>
<div class="right"> <div class="right">
<el-input v-model="formModel.clssid" style="border-color: #20bec8;"></el-input> <el-input v-model="formModel.className" style="border-color: #20bec8;"></el-input>
</div> </div>
</el-form-item> </el-form-item>
@ -57,7 +57,7 @@
学号 学号
</div> </div>
<div class="right"> <div class="right">
<el-input v-model="formModel.studentNumb" <el-input v-model="formModel.workNo"
style="border-color: #20bec8"></el-input> style="border-color: #20bec8"></el-input>
</div> </div>
</div> </div>
@ -99,7 +99,7 @@ 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 { getUserInfo } from "@/api"; import { getUserInfoService } from '@/api/user'
const router = useRouter() const router = useRouter()
const user = userStore(); const user = userStore();
const loginFn = () => { const loginFn = () => {
@ -120,15 +120,17 @@ const formRef = ref();
const formModel = ref({ const formModel = ref({
username: "", username: "",
realname: "", realname: "",
clssid: '', className: '',
studentNumb: "", workNo: "",
phone: '', phone: '',
score: '' score: ''
}); });
const getUser=async()=>{ const getUser=async()=>{
const res: any = await getUserInfo(); const res: any = await getUserInfoService();
formModel.value = res.result.userInfo; // console.log(res.result,'aaaaa');
console.log(formModel, 'formModel');
formModel.value = res.result;
// console.log(formModel, 'formModel');
} }

Loading…
Cancel
Save