ww 3 months ago
parent bf170a0d40
commit b9f8abd1a9
  1. 18
      src/api/courseChaptersApi.ts
  2. 3
      src/api/stu.js
  3. 10
      src/api/user/user.js
  4. 54
      src/views/home/components/Lessonlist.vue
  5. 4
      src/views/home/components/Student1.vue
  6. 46
      src/views/home/components/Welcome.vue
  7. 66
      src/views/home/index.vue

@ -96,25 +96,7 @@ export const deleteCourse = (params: any) => {
// 获取详情 // 获取详情
export const getCourseInfo = (params: any) => { export const getCourseInfo = (params: any) => {
return request({ return request({
<<<<<<< HEAD
// <<<<<<< HEAD
url: '/objective_contents/' + params.id,
method: 'get',
// // params
// =======
// <<<<<<< HEAD
// url: '/api/objective_contents/' + params.id,
// method: 'get',
// params,
// =======
// url: '/objective_contents/' + params.id,
// method: "get",
// // params
// >>>>>>> 1a620e19de970965f426e07348b1dbc4be900eaf
// >>>>>>> 991fa5ab08c56c84c5a276226f8fbc2ec78f859a
=======
url: '/api/objective_contents/' + params.id, url: '/api/objective_contents/' + params.id,
// method: 'get', // method: 'get',
>>>>>>> 0b7db324dad8347654933e91ae7e6ca8d2dabd05
}) })
} }

@ -0,0 +1,3 @@
export const userStudentListService = (id) => {
return request.post('/api/coursesteacher/studentList?userId=' + id)
}

@ -63,9 +63,9 @@ export const userStudentListService = (id) => {
return request.post('/api/coursesteacher/studentList?userId=' + id) return request.post('/api/coursesteacher/studentList?userId=' + id)
} }
//获取课程列表 //获取课程列表
// export const userLessonListService = (id) => { export const userLessonListService = (id) => {
// return request.post('/api/coursesteacher/studentList?userId=' + id) return request.post('/api/courselearingrecord/courseList?userId=' + id)
// } }
//获取浏览量 //获取浏览量
export const userLookService = () => { export const userLookService = () => {
return request.get('/api/report/receptionBrowse') return request.get('/api/report/receptionBrowse')
@ -74,3 +74,7 @@ export const userLookService = () => {
export const userPicService = () => { export const userPicService = () => {
return request.get('/api/report/browseStatistics') return request.get('/api/report/browseStatistics')
} }
//获取学习最多的知识点
export const userMaxKnowService = (id) => {
return request.post('/api/knowledgelearning/studyMaxKnowledge?userId=' + id)
}

@ -1,40 +1,65 @@
<script setup> <script setup>
import conheader from '@/views/home/components/ConHeader.vue' import conheader from '@/views/home/components/ConHeader.vue'
import fe from '@/assets/images/fe.jpg' import courseedit from '@/views/course/components/courseEdit.vue'
// import { userLessonListService } from '@/api/user/user.js' import { ref, onMounted } from 'vue'
// const getLesList = async () => { import useUserStore from '@/store/modules/user'
// const res = await userLessonListService() import { userLessonListService, userMaxKnowService } from '@/api/user/user.js'
// console.log(res) const userStore = useUserStore()
// } // console.log(userStore.data.id, 'sfa')
// getLesList() const loading = ref(false)
const lessonList = ref([])
const getLesList = async () => {
loading.value = true
const res = await userLessonListService(userStore.data.id)
lessonList.value = res.data
loading.value = false
// console.log(res.data, 'less')
}
//
const maxKnow = ref('')
const getmaxKnow = async () => {
const res = await userMaxKnowService(userStore.data.id)
maxKnow.value = res.data
// console.log(res.data.label, 'max')
}
getmaxKnow()
onMounted(() => {
getLesList()
getmaxKnow()
})
</script> </script>
<template> <template>
<div class="lesson_container" style="width: 95%; height: 90%"> <div
class="lesson_container"
style="width: 95%; height: 90%"
v-loading="loading"
>
<conheader <conheader
:title="`课程列表`" :title="`课程列表`"
:urouter="'/curriculumCenter/basicCourseInformation'" :urouter="'/curriculumCenter/basicCourseInformation'"
></conheader> ></conheader>
<div class="lessonlist-content"> <div class="lessonlist-content">
<div class="lessonlist-item" v-for="item in 4" :key="item"> <div class="lessonlist-item" v-for="item in lessonList" :key="item.id">
<div class="lessonlist-item-img"> <div class="lessonlist-item-img">
<img <img
src="" :src="item.img"
alt=""
style="width: 100%; height: 125px; border-radius: 10px 10px 0px 0px" style="width: 100%; height: 125px; border-radius: 10px 10px 0px 0px"
/> />
</div> </div>
<div class="lessonlist-item-info"> <div class="lessonlist-item-info">
<h3>软件构造</h3> <h3>{{ item.name }}</h3>
<div class="p"><p>编辑</p></div> <div class="p"><p>编辑</p></div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<courseedit @click="open"></courseedit>
</template> </template>
<style scoped> <style scoped>
.lesson_container { .lesson_container {
/* background-color: purple; */ /* background-color: purple; */
overflow: hidden;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-between; justify-content: space-between;
@ -59,12 +84,12 @@ import fe from '@/assets/images/fe.jpg'
flex-direction: column; flex-direction: column;
justify-content: space-between; justify-content: space-between;
border: 1px solid #e8e8f2; border: 1px solid #e8e8f2;
/* border-radius: 6px 6px 6px 6px; */ margin: 10px 0px;
/* box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); */
} }
.lessonlist-item-info { .lessonlist-item-info {
box-sizing: border-box; box-sizing: border-box;
padding: 6px 5px; padding: 6px 5px;
/* background-color: pink; */ /* background-color: pink; */
/* padding: 10px; */ /* padding: 10px; */
/* display: flex; /* display: flex;
@ -85,6 +110,7 @@ import fe from '@/assets/images/fe.jpg'
/* width: 100%; */ /* width: 100%; */
display: flex; display: flex;
justify-content: end; justify-content: end;
cursor: pointer;
} }
.lessonlist-item-info p { .lessonlist-item-info p {
font-size: 12px; font-size: 12px;

@ -4,6 +4,8 @@ import { ref, computed } from 'vue'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { userStudentListService } from '@/api/user/user' import { userStudentListService } from '@/api/user/user'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import defImg from '@/assets/images/default.png'
const userStore = useUserStore() const userStore = useUserStore()
const router = useRouter() const router = useRouter()
const loading = ref(false) const loading = ref(false)
@ -30,7 +32,7 @@ getStuList()
<div class="stu_content" v-loading="loading"> <div class="stu_content" v-loading="loading">
<ul> <ul>
<li class="stu-item" v-for="(item, index) in stuList" :key="index"> <li class="stu-item" v-for="(item, index) in stuList" :key="index">
<img :src="item.icon" class="stu-item-img" /> <img :src="item.icon || defImg" class="stu-item-img" />
<div class="stu-item-info"> <div class="stu-item-info">
<h4>{{ item.name }}</h4> <h4>{{ item.name }}</h4>
<h4 style="color: #666">{{ item.number }}</h4> <h4 style="color: #666">{{ item.number }}</h4>

@ -36,15 +36,32 @@ const passFormVisible = ref(false)
//dialog //dialog
const form = ref({}) const form = ref({})
const formLabelWidth = '80px' const formLabelWidth = '80px'
//dialog //dialog
const openInfo = () => { const openInfo = () => {
dialogFormVisible.value = true dialogFormVisible.value = true
form.value = { ...props.userData } form.value = { ...props.userData }
// console.log(form.value, 'form')
} }
const openPass = () => { const openPass = () => {
passFormVisible.value = true passFormVisible.value = true
} }
//
const checkOldSame = (rule, value, callback) => {
if (value === props.userData.password) {
callback(new Error('新密码不能与旧密码相同'))
} else {
callback()
}
}
const checkNewSame = (rule, value, cb) => {
if (value !== pwdForm.value.new_pwd) {
cb(new Error('新密码和确认再次输入的新密码不一样!'))
} else {
cb()
}
}
// //
const infoRules = { const infoRules = {
phone: [ phone: [
@ -64,23 +81,6 @@ const infoRules = {
}, },
], ],
} }
// ---
//
const checkOldSame = (rule, value, callback) => {
if (value === props.userData.password) {
callback(new Error('新密码不能与旧密码相同'))
} else {
callback()
}
}
const checkNewSame = (rule, value, cb) => {
if (value !== pwdForm.value.new_pwd) {
cb(new Error('新密码和确认再次输入的新密码不一样!'))
} else {
cb()
}
}
// ---
// //
const rules = { const rules = {
// //
@ -118,13 +118,13 @@ const infoRef = ref()
// //
const emit = defineEmits(['get-message']) const emit = defineEmits(['get-message'])
const changeInfo = async () => { const changeInfo = async () => {
await infoRef.value.validate()
const userInfo = { const userInfo = {
phone: form.value.phone, phone: form.value.phone,
id: form.value.id, id: form.value.id,
nickName: form.value.nickName, nickName: form.value.nickName,
} }
const jsonData = JSON.stringify(userInfo) const jsonData = JSON.stringify(userInfo)
// const valid = await infoRef.value.validate()
await userChangeService(jsonData).then(() => { await userChangeService(jsonData).then(() => {
ElMessage.success('修改成功') ElMessage.success('修改成功')
emit('get-message', form.value.nickName) emit('get-message', form.value.nickName)
@ -158,7 +158,7 @@ const onSubmit = async () => {
const onReset = () => { const onReset = () => {
pwdForm.value = {} pwdForm.value = {}
} }
//
const username = computed(() => { const username = computed(() => {
if (props.userData.nickName) { if (props.userData.nickName) {
return props.userData.nickName return props.userData.nickName
@ -212,12 +212,8 @@ onMounted(() => {
title="登录信息" title="登录信息"
style="width: 800px; text-align: center" style="width: 800px; text-align: center"
> >
<el-form :rules="infoRules" ref="infoRef" :model="form"> <el-form :rules="infoRules" ref="infoRef" :data="form">
<el-form-item <el-form-item label="用户名" :label-width="formLabelWidth">
label="用户名"
:label-width="formLabelWidth"
prop="username"
>
<el-input :disabled="true" v-model="form.username" autocomplete="off" /> <el-input :disabled="true" v-model="form.username" autocomplete="off" />
</el-form-item> </el-form-item>
<el-form-item label="昵称" :label-width="formLabelWidth" prop="nickName"> <el-form-item label="昵称" :label-width="formLabelWidth" prop="nickName">

@ -9,11 +9,16 @@ import lessonlist from './components/Lessonlist.vue'
import Student1 from './components/Student1.vue' import Student1 from './components/Student1.vue'
// import Class2 from './components/Class2.vue' // import Class2 from './components/Class2.vue'
// import Student2 from './components/Student2.vue' // import Student2 from './components/Student2.vue'
import { userNewLikeService, userLookService } from '@/api/user/user' import {
userNewLikeService,
userLookService,
userMaxKnowService,
} from '@/api/user/user'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import fe from '@/assets/images/fe.jpg' import fe from '@/assets/images/fe.jpg'
import { ref, onMounted } from 'vue' import { ref, onMounted } from 'vue'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
// import { Picture } from 'element-plus/icons-vue'
const router = useRouter() const router = useRouter()
const userStore = useUserStore() const userStore = useUserStore()
const username = ref() const username = ref()
@ -39,6 +44,14 @@ const courselist = ref([])
const img = ref() const img = ref()
const courseName = ref() const courseName = ref()
const courseTea = ref() const courseTea = ref()
//
const maxKnow = ref([])
const getmaxKnow = async () => {
const res = await userMaxKnowService(userStore.data.id)
maxKnow.value = res.data
console.log(maxKnow.value, 'max')
}
onMounted(() => { onMounted(() => {
// getData() // getData()
username.value = userStore.userName username.value = userStore.userName
@ -60,16 +73,18 @@ onMounted(() => {
// // console.log(res, '') // // console.log(res, '')
// }) // })
// //
const res = userNewLikeService(userStore.data.id).then((res) => { userNewLikeService(userStore.data.id).then((res) => {
console.log(res.data.id, '最新收藏的课程') console.log(res.data, '最新收藏的课程')
courselist.value = res.data courselist.value = res.data
// console.log(courselist.value.id, 'course') // console.log(courselist.value.id, 'course')
img.value = res.data.img // img.value = res.data.img
courseName.value = res.data.name // courseName.value = res.data.name
courseTea.value = res.data.teacher // courseTea.value = res.data.teacher
}) })
//echart //echart
userLookService() userLookService()
//
getmaxKnow()
}) })
</script> </script>
<template> <template>
@ -111,8 +126,8 @@ onMounted(() => {
style=" style="
font-size: 14px; font-size: 14px;
display: flex; display: flex;
margin: 0px auto; /* margin: 0px auto; */
margin: 0px 30px; margin: 0px 10px;
" "
> >
<conheader <conheader
@ -121,8 +136,8 @@ onMounted(() => {
></conheader> ></conheader>
</a> </a>
<div class="con"> <div class="con">
<p class="button" round v-for="item in 30" :key="item"> <p class="button" round v-for="item in maxKnow" :key="item.id">
Spring clould {{ item.label }}
</p> </p>
</div> </div>
</div> </div>
@ -152,9 +167,10 @@ onMounted(() => {
<ul> <ul>
<li class="lessonlist-item" v-for="item in 4" :key="item"> <li class="lessonlist-item" v-for="item in 4" :key="item">
<img :src="fe" class="lessonlist-item-img" /> <img :src="fe" class="lessonlist-item-img" />
<div class="lessonlist-item-info"> <div class="lessonlist-item-info">
<h5>{{ courseName }}</h5> <h5>课程名称</h5>
<p>{{ courseTea }}</p> <p>教师</p>
</div> </div>
</li> </li>
</ul> </ul>
@ -171,11 +187,15 @@ onMounted(() => {
</a> </a>
<div class="con"> <div class="con">
<ul> <ul>
<li class="lessonlist-item" v-for="item in courselist" :key="item"> <li
<img :src="img" class="lessonlist-item-img" /> class="lessonlist-item"
v-for="item in courselist"
:key="item.id"
>
<img :src="item.img || fe" class="lessonlist-item-img" />
<div class="lessonlist-item-info"> <div class="lessonlist-item-info">
<h5>{{ courseName }}</h5> <h5>{{ item.name }}</h5>
<p>{{ courseTea }}</p> <p>{{ item.teacher }}</p>
</div> </div>
</li> </li>
</ul> </ul>
@ -227,10 +247,12 @@ onMounted(() => {
justify-content: space-between; justify-content: space-between;
} }
.lesson { .lesson {
// background-color: pink; background-color: pink;
padding-top: 5px; padding-top: 30px;
// padding-bottom: 30px;
padding: 30px 10px 0px 10px;
margin-bottom: 16px; margin-bottom: 16px;
height: 290px; height: 317px;
background: #ffffff; background: #ffffff;
box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.1); box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.1);
border-radius: 6px 6px 6px 6px; border-radius: 6px 6px 6px 6px;
@ -261,6 +283,7 @@ onMounted(() => {
line-height: 30px; line-height: 30px;
margin: 5px 10px; margin: 5px 10px;
border: 2px solid #ccc; border: 2px solid #ccc;
width: 40%;
} }
a { a {
text-decoration: none; text-decoration: none;
@ -313,13 +336,14 @@ ul {
align-items: center; align-items: center;
} }
.lessonlist-item-info { .lessonlist-item-info {
margin-left: 5px; margin-left: 15px;
width: 80%; width: 80%;
height: 40px; height: 40px;
background-color: #ffffff; background-color: #ffffff;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-evenly; justify-content: space-between;
// align-items: flex-start;
h3 { h3 {
font-weight: bold; font-weight: bold;
} }

Loading…
Cancel
Save