Compare commits

..

2 Commits

  1. 15
      src/layout/logo/index.vue
  2. 18
      src/layout/tabbar/setting/index.vue
  3. 343
      src/views/MyCourseStudy/learningProcess.vue
  4. 276
      src/views/MyCourseStudy/learningProcess1.vue
  5. 5
      src/views/course/basicCourseInformation.vue
  6. 29
      src/views/student/index.vue

@ -1,6 +1,6 @@
<template>
<div class="logo" v-if="setting.logoHidden" @click="goHome">
<img :src="setting.logo" alt="" />
<div class="logo" @click="goHome">
<img :src="setting.logo" alt="" style="width: 40px;"/>
<div class="font">
<p v-show="!fold">{{ setting.title }}</p>
</div>
@ -11,8 +11,17 @@
import useLayoutSettingStoe from '@/store/modules/setting'
import { useRouter } from 'vue-router'
// logo
import setting from '@/setting'
// import setting from '@/setting'
import { ref, watch } from 'vue'
import {getSysSettingApi} from '@/api/configuration'
const setting = ref({})
const getLogo = async () => {
const res = await getSysSettingApi()
setting.value = res.data
console.log(res);
}
getLogo()
const fold = ref(false)
const LayoutSettingStoe = useLayoutSettingStoe()
const $router = useRouter()

@ -16,7 +16,7 @@
size="small"
icon="Link"
circle
@click="openWeb('https://www.baidu.com', 'baidu')"
@click="openWeb"
/>
<img
:src="userStore.data.icon || defImg"
@ -48,10 +48,12 @@
// import { useDark, useToggle } from '@vueuse/core'
import useLayoutSettingStoe from '@/store/modules/setting'
import useUserStore from '@/store/modules/user'
import { onMounted } from 'vue'
import { onMounted,ref } from 'vue'
import { useRouter, useRoute } from 'vue-router'
// import default from '@/assets/images/default.jpg'
import defImg from '@/assets/images/default.png'
import {getSysSettingApi} from '@/api/configuration'
// import { Moon, Sunny } from '@element-plus/icons-vue'
const useStore = useLayoutSettingStoe()
const userStore = useUserStore()
@ -71,6 +73,14 @@ const fullScreen = () => {
const refresh = () => {
useStore.refresh = !useStore.refresh
}
const setting = ref()
const getSysSettingApiEvent = async () => {
const res =await getSysSettingApi()
setting.value = res.data
console.log(res);
}
getSysSettingApiEvent()
//
const handleCommand = (command: string) => {
switch (command) {
@ -80,8 +90,8 @@ const handleCommand = (command: string) => {
}
}
//
const openWeb = (url, name) => {
window.open(url, name, '_blank')
const openWeb = () => {
window.open(setting.value.home)
}
//

@ -1,32 +1,118 @@
<script setup>
// import router from '@/router'
import { ref } from 'vue'
<template>
<div class="container">
<el-card>
<el-form :inline="true" :model="formInline" class="demo-form-inline">
<el-form-item label="课程名称">
<el-input
v-model="formInline.user"
placeholder="请输入课程名称"
clearable
style="width: 300px"
/>
</el-form-item>
<el-form-item label="日期">
<el-date-picker
v-model="formInline.date"
type="date"
placeholder="请选择日期"
clearable
style="width: 300px"
/>
</el-form-item>
<el-form-item>
<el-button type="primary">查询</el-button>
<el-button
type="danger"
v-if="selectID.length"
@click="deleteSelected"
>
批量删除
</el-button>
</el-form-item>
</el-form>
</el-card>
<el-card style="margin-top: 20px; height: calc(100vh - 200px); width: 100%">
<el-table
:data="recordList"
border
style="width: 100%"
@selection-change="selectionChange"
>
<el-table-column type="selection" width="55" />
<el-table-column type="index" width="55" label="序号"/>
<el-table-column prop="courseName" label="课程名称" />
<el-table-column prop="number" label="学习人数" />
<el-table-column prop="time" label="时间" />
<el-table-column label="操作">
<template #default="{ row }">
<el-button
type="primary"
link
@click="
goToAnotherPage(
'/myCourseStudyManagement/learningProcess1',
row.courseId,
)
"
>
知识点学习记录
</el-button>
<el-button
type="primary"
link
@click="
goToAnotherPage(
'/myCourseStudyManagement/learningProcess2',
row.courseId,
)
"
>
资源学习记录
</el-button>
<el-button type="danger" link @click="onDeleteRecord(row.id)">
删除
</el-button>
</template>
</el-table-column>
</el-table>
<div class="pagination">
<el-pagination
background
layout="prev, pager, next"
:total="total"
:page-size="params.pagesize"
@current-change="currentChange"
/>
</div>
</el-card>
</div>
</template>
<script lang="ts" setup>
import { onMounted, reactive, ref, toRefs, watch } from 'vue'
import { LearningRecordsControllerService } from '../../../generated/services/LearningRecordsControllerService'
import useUserStore from '@/store/modules/user'
import { ElMessageBox, ElMessage } from 'element-plus'
import { useRouter } from 'vue-router'
import useUserStore from '@/store/modules/user'
import { onMounted } from 'vue'
//
import { LearningRecordsControllerService } from '../../../generated/services/LearningRecordsControllerService'
const total = ref(0)
const userStore = useUserStore()
const recordList = ref([])
const selectedIds = ref([])
const loading = ref(false)
const showCheckbox = ref(false)
onMounted(() => {
userStore.getUserInfo()
const router = useRouter()
const userStore = useUserStore()
const formInline = reactive({
user: '',
region: '',
date: '',
})
const recordList = ref([])
const params = ref({
// pagesize: '10',
// pagenum: '1',
pagesize: 10,
pagenum: '1',
userId: userStore.data.id,
})
console.log(userStore.data.id)
const total = ref(0)
//
const getrecordList = async () => {
loading.value = true
// const res = await getRecordListService(params.value)
const res = await LearningRecordsControllerService.courseLearningRecords(
params.value.userId,
@ -35,26 +121,12 @@ const getrecordList = async () => {
)
console.log(res)
recordList.value = res.data.records
//
// recordList.value = res.data.records
// //
total.value = res.data.total
loading.value = false
console.log(total.value, 'vvv')
}
getrecordList()
//
const onSizeChange = (size) => {
// console.log('', size)
//访
//
params.value.pagenum = 1
params.value.pagesize = size
//
getrecordList()
}
const onCurrentChange = (page) => {
recordList.value.pagenum = page
getrecordList()
}
//
const onDeleteRecord = async (ids) => {
await ElMessageBox.confirm('你确认删除该条浏览信息吗?', '温馨提示', {
@ -71,30 +143,29 @@ const onDeleteRecord = async (ids) => {
ElMessage({ type: 'success', message: '删除成功' })
getrecordList()
}
//
const toggleCheckbox = () => {
showCheckbox.value = !showCheckbox.value
if (showCheckbox.value) {
showCheckbox.value = []
const goToAnotherPage = (address, courseId) => {
router.push({
path: address,
query: {
courseId: courseId,
},
})
}
const currentChange = (index: any) => {
console.log(index)
params.value.pagenum = index
getrecordList()
}
//
// change toggleSelection
// id selectedIds
const toggleSelection = (id) => {
if (selectedIds.value.includes(id)) {
selectedIds.value = selectedIds.value.filter((recordId) => recordId !== id)
} else {
selectedIds.value.push(id)
const selectID = ref([])
const selectionChange = (e) => {
if (e) {
selectID.value = e.map((item) => item.id)
console.log(selectID.value)
}
console.log(selectedIds)
}
// selectedIds
// selectedIds
// selectedIds record selectedIds
const deleteSelected = async () => {
//
if (selectedIds.value.length === 0) {
if (selectID.value.length === 0) {
await ElMessageBox.confirm('请选择你要删除的内容', '温馨提示', {
type: 'warning',
confirmButtonText: '确认',
@ -108,12 +179,12 @@ const deleteSelected = async () => {
})
//
await LearningRecordsControllerService.deleteCourseRecords(selectedIds.value)
await LearningRecordsControllerService.deleteCourseRecords(selectID.value)
.then(() => {
recordList.value = recordList.value.filter(
(item) => !selectedIds.value.includes(item.id),
(item) => !selectID.value.includes(item.id),
)
selectedIds.value = []
selectID.value = []
})
.catch((error) => {
console.error('删除失败:', error)
@ -121,156 +192,26 @@ const deleteSelected = async () => {
ElMessage({ type: 'success', message: '删除成功' })
getrecordList()
}
//
const router = useRouter()
const goToAnotherPage = (address, courseId) => {
router.push({
path: address,
query: {
courseId: courseId,
},
})
}
//
</script>
<template>
<div class="record">
<div class="content">
<!-- 头部 -->
<div class="header">
<el-button type="primary" plain>浏览记录</el-button>
<el-button type="danger" plain style="float: right" @click="deleteSelected">
批量删除
</el-button>
<el-button type="primary" plain @click="toggleCheckbox" style="float: right">
管理
</el-button>
</div>
<!-- 中间 -->
<div class="record-list">
<ul v-if="recordList.length > 0">
<li v-for="record in recordList" :key="record.id" v-loading="loading">
<input style="display: flex" type="checkbox" :value="record.id" @change="toggleSelection(record.id)"
v-if="showCheckbox" />
<img class="img" :src="record.img" @click="goToAnotherPage(record.address)" style="margin-bottom: 10px" />
<div style="
display: flex;
justify-content: space-between;
flex-grow: 1;
margin-top: 10px;
margin-bottom: 10px;
">
<p>
{{ record.courseName }}
</p>
<el-icon @click="onDeleteRecord(record.id)">
<Delete />
</el-icon>
</div>
<div style="
display: flex;
justify-content: space-between;
flex-grow: 1;
margin-top: 10px;
">
<p>{{ record.time }}</p>
<p>学习人数:{{ record.number }}</p>
</div>
<div style="display: flex;margin: 10px 0;">
<el-button @click="
goToAnotherPage(
'/myCourseStudyManagement/learningProcess1',
record.courseId,
)
">知识点学习记录</el-button>
<el-button @click="
goToAnotherPage(
'/myCourseStudyManagement/learningProcess2',
record.courseId,
)
">资源学习记录</el-button>
</div>
</li>
</ul>
<el-empty v-else description="暂时没有浏览记录" />
</div>
</div>
<!-- 分页 -->
<div class="example-pagination-block">
<el-pagination v-model:current-page="params.pagenum" v-model:page-size="params.pagesize"
:page-sizes="[5, 10, 15, 20]" :background="true" layout="jumper,total, sizes, prev, pager, next " :total="total"
@current-change="onCurrentChange" @size-change="onSizeChange"
style="margin-top: 20px; justify-content: flex-end" />
</div>
</div>
</template>
<style scoped>
.record {
display: flex;
flex-direction: column;
min-height: 100vh;
}
.content {
flex: 1;
}
.example-pagination-block {
position: sticky;
bottom: 0;
margin: 0 auto;
/* text-align: center; */
}
.record-list {
margin: 10px 0;
}
ul {
<style lang="scss" scoped>
.container {
position: relative;
width: 100%;
list-style-type: none;
padding: 10;
// height: calc(100vh - 100px);
.pagination {
position: absolute;
bottom: 20px;
left: 50%;
transform: translateX(-50%);
display: flex;
flex-wrap: wrap;
justify-content: start;
text-align: center;
display: grid;
grid-template-columns: repeat(auto-fill, 272px);
justify-content: space-around;
justify-content: center;
}
li {
/* margin-bottom: 30px; */
transition: filter 0.3s;
/* 添加过渡动画 */
/* flex: 1 0 20%; */
width: calc(20% - 20px);
width: 250px;
width: 100%;
flex-direction: column;
align-items: center;
text-align: center;
/* margin: 0 15px; */
padding: 10px;
box-sizing: border-box;
transition: box-shadow 0.3s;
cursor: pointer;
}
li:hover {
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
:deep(.el-form-item) {
margin-bottom: 0;
}
.img {
display: block;
width: 250px;
height: 250px;
:deep(.el-scrollbar__wrap) {
padding: 0;
}
</style>

@ -0,0 +1,276 @@
<script setup>
// import router from '@/router'
import { ref } from 'vue'
import { ElMessageBox, ElMessage } from 'element-plus'
import { useRouter } from 'vue-router'
import useUserStore from '@/store/modules/user'
import { onMounted } from 'vue'
//
import { LearningRecordsControllerService } from '../../../generated/services/LearningRecordsControllerService'
const total = ref(0)
const userStore = useUserStore()
const recordList = ref([])
const selectedIds = ref([])
const loading = ref(false)
const showCheckbox = ref(false)
onMounted(() => {
userStore.getUserInfo()
})
const params = ref({
// pagesize: '10',
// pagenum: '1',
userId: userStore.data.id,
})
console.log(userStore.data.id)
//
const getrecordList = async () => {
loading.value = true
// const res = await getRecordListService(params.value)
const res = await LearningRecordsControllerService.courseLearningRecords(
params.value.userId,
params.value.pagenum,
params.value.pagesize,
)
console.log(res)
recordList.value = res.data.records
//
total.value = res.data.total
loading.value = false
}
getrecordList()
//
const onSizeChange = (size) => {
// console.log('', size)
//访
//
params.value.pagenum = 1
params.value.pagesize = size
//
getrecordList()
}
const onCurrentChange = (page) => {
recordList.value.pagenum = page
getrecordList()
}
//
const onDeleteRecord = async (ids) => {
await ElMessageBox.confirm('你确认删除该条浏览信息吗?', '温馨提示', {
type: 'warning',
confirmButtonText: '确认',
cancelButtonText: '取消',
})
//await DelRecordService(ids)
console.log('hello')
await LearningRecordsControllerService.deleteCourseRecords(ids)
// console.log(ids)
ElMessage({ type: 'success', message: '删除成功' })
getrecordList()
}
//
const toggleCheckbox = () => {
showCheckbox.value = !showCheckbox.value
if (showCheckbox.value) {
showCheckbox.value = []
}
}
//
// change toggleSelection
// id selectedIds
const toggleSelection = (id) => {
if (selectedIds.value.includes(id)) {
selectedIds.value = selectedIds.value.filter((recordId) => recordId !== id)
} else {
selectedIds.value.push(id)
}
console.log(selectedIds)
}
// selectedIds
// selectedIds
// selectedIds record selectedIds
const deleteSelected = async () => {
//
if (selectedIds.value.length === 0) {
await ElMessageBox.confirm('请选择你要删除的内容', '温馨提示', {
type: 'warning',
confirmButtonText: '确认',
})
return
}
await ElMessageBox.confirm('你确认删除浏览记录吗?', '温馨提示', {
type: 'warning',
confirmButtonText: '确认',
cancelButtonText: '取消',
})
//
await LearningRecordsControllerService.deleteCourseRecords(selectedIds.value)
.then(() => {
recordList.value = recordList.value.filter(
(item) => !selectedIds.value.includes(item.id),
)
selectedIds.value = []
})
.catch((error) => {
console.error('删除失败:', error)
})
ElMessage({ type: 'success', message: '删除成功' })
getrecordList()
}
//
const router = useRouter()
const goToAnotherPage = (address, courseId) => {
router.push({
path: address,
query: {
courseId: courseId,
},
})
}
//
</script>
<template>
<div class="record">
<div class="content">
<!-- 头部 -->
<div class="header">
<el-button type="primary" plain>浏览记录</el-button>
<el-button type="danger" plain style="float: right" @click="deleteSelected">
批量删除
</el-button>
<el-button type="primary" plain @click="toggleCheckbox" style="float: right">
管理
</el-button>
</div>
<!-- 中间 -->
<div class="record-list">
<ul v-if="recordList.length > 0">
<li v-for="record in recordList" :key="record.id" v-loading="loading">
<input style="display: flex" type="checkbox" :value="record.id" @change="toggleSelection(record.id)"
v-if="showCheckbox" />
<img class="img" :src="record.img" @click="goToAnotherPage(record.address)" style="margin-bottom: 10px" />
<div style="
display: flex;
justify-content: space-between;
flex-grow: 1;
margin-top: 10px;
margin-bottom: 10px;
">
<p>
{{ record.courseName }}
</p>
<el-icon @click="onDeleteRecord(record.id)">
<Delete />
</el-icon>
</div>
<div style="
display: flex;
justify-content: space-between;
flex-grow: 1;
margin-top: 10px;
">
<p>{{ record.time }}</p>
<p>学习人数:{{ record.number }}</p>
</div>
<div style="display: flex;margin: 10px 0;">
<el-button @click="
goToAnotherPage(
'/myCourseStudyManagement/learningProcess1',
record.courseId,
)
">知识点学习记录</el-button>
<el-button @click="
goToAnotherPage(
'/myCourseStudyManagement/learningProcess2',
record.courseId,
)
">资源学习记录</el-button>
</div>
</li>
</ul>
<el-empty v-else description="暂时没有浏览记录" />
</div>
</div>
<!-- 分页 -->
<div class="example-pagination-block">
<el-pagination v-model:current-page="params.pagenum" v-model:page-size="params.pagesize"
:page-sizes="[5, 10, 15, 20]" :background="true" layout="jumper,total, sizes, prev, pager, next " :total="total"
@current-change="onCurrentChange" @size-change="onSizeChange"
style="margin-top: 20px; justify-content: flex-end" />
</div>
</div>
</template>
<style scoped>
.record {
display: flex;
flex-direction: column;
min-height: 100vh;
}
.content {
flex: 1;
}
.example-pagination-block {
position: sticky;
bottom: 0;
margin: 0 auto;
/* text-align: center; */
}
.record-list {
margin: 10px 0;
}
ul {
width: 100%;
list-style-type: none;
padding: 10;
display: flex;
flex-wrap: wrap;
justify-content: start;
text-align: center;
display: grid;
grid-template-columns: repeat(auto-fill, 272px);
justify-content: space-around;
}
li {
/* margin-bottom: 30px; */
transition: filter 0.3s;
/* 添加过渡动画 */
/* flex: 1 0 20%; */
width: calc(20% - 20px);
width: 250px;
width: 100%;
flex-direction: column;
align-items: center;
text-align: center;
/* margin: 0 15px; */
padding: 10px;
box-sizing: border-box;
transition: box-shadow 0.3s;
cursor: pointer;
}
li:hover {
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}
.img {
display: block;
width: 250px;
height: 250px;
}
</style>

@ -40,6 +40,7 @@ const params = ref({
nature: '',
teacher: '',
})
console.log(userStore.data,'userStore.data')
const loading = ref(false)
//
const getCourseList = async () => {
@ -233,10 +234,10 @@ const CloseCouresNameChangeEvent = () => {
<el-icon class="del" @click="onDeleteCourse(item.id)">
<Delete />
</el-icon>
<el-button class="object" round plain @click="onGetCourseObject(item.id)">
<el-button :class="userStore.data.roles[0] == 1 ? 'object' : 'object1'" round plain @click="onGetCourseObject(item.id)">
详情
</el-button>
<el-button class="object1" round plain @click="onEditCourse(item)">
<el-button class="object1" round plain @click="onEditCourse(item)" v-if="userStore.data.roles[0] == 1">
编辑
</el-button>
</li>

@ -139,20 +139,29 @@ const status = ref()
tableData.value.forEach((item) => {
item.status = item.status === 1
})
async function handleStatusChange(row) {
status.value = row.status
console.log(`${row.status}` === 1 ? true : false, 'status')
console.log(status.value === 0 ? true : false, 'status1')
console.log(`状态更改: ${row.status}`)
if (!isFirstLoad.value) {
await changeStaService(status.value, row.userId).then(() => {
async function handleStatusChange(id,row) {
console.log(row,id);
await changeStaService(row, id).then(() => {
ElMessage({
message: '状态更改成功',
type: 'success',
})
})
}
getData()
// console.log(row)
// status.value = row.status
// console.log(`${row.status}` === 1 ? true : false, 'status')
// console.log(status.value === 0 ? true : false, 'status1')
// console.log(`: ${row.status}`)
// if (!isFirstLoad.value) {
// await changeStaService(status.value, row.userId).then(() => {
// ElMessage({
// message: '',
// type: 'success',
// })
// })
// }
// getData()
}
//
@ -343,7 +352,7 @@ onMounted(() => {
v-model="scope.row.status"
active-value="1"
inactive-value="0"
@change="handleStatusChange(scope.row)"
@change="handleStatusChange(scope.row.userId,$event)"
/>
</template>
</el-table-column>

Loading…
Cancel
Save