Compare commits

..

No commits in common. '16b0f84bbfd660642ff7012bab2b6172bf1d7cf9' and '4c838107c305b56f9adb349231ab2da76ae08164' have entirely different histories.

  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> <template>
<div class="logo" @click="goHome"> <div class="logo" v-if="setting.logoHidden" @click="goHome">
<img :src="setting.logo" alt="" style="width: 40px;"/> <img :src="setting.logo" alt="" />
<div class="font"> <div class="font">
<p v-show="!fold">{{ setting.title }}</p> <p v-show="!fold">{{ setting.title }}</p>
</div> </div>
@ -11,17 +11,8 @@
import useLayoutSettingStoe from '@/store/modules/setting' import useLayoutSettingStoe from '@/store/modules/setting'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
// logo // logo
// import setting from '@/setting' import setting from '@/setting'
import { ref, watch } from 'vue' 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 fold = ref(false)
const LayoutSettingStoe = useLayoutSettingStoe() const LayoutSettingStoe = useLayoutSettingStoe()
const $router = useRouter() const $router = useRouter()

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

@ -1,118 +1,32 @@
<template> <script setup>
<div class="container"> // import router from '@/router'
<el-card> import { ref } from 'vue'
<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 { ElMessageBox, ElMessage } from 'element-plus'
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import useUserStore from '@/store/modules/user'
const router = useRouter() import { onMounted } from 'vue'
//
import { LearningRecordsControllerService } from '../../../generated/services/LearningRecordsControllerService'
const total = ref(0)
const userStore = useUserStore() const userStore = useUserStore()
const formInline = reactive({
user: '',
region: '',
date: '',
})
const recordList = ref([]) const recordList = ref([])
const selectedIds = ref([])
const loading = ref(false)
const showCheckbox = ref(false)
onMounted(() => {
userStore.getUserInfo()
})
const params = ref({ const params = ref({
pagesize: 10, // pagesize: '10',
pagenum: '1', // pagenum: '1',
userId: userStore.data.id, userId: userStore.data.id,
}) })
const total = ref(0) console.log(userStore.data.id)
// //
const getrecordList = async () => { const getrecordList = async () => {
loading.value = true
// const res = await getRecordListService(params.value) // const res = await getRecordListService(params.value)
const res = await LearningRecordsControllerService.courseLearningRecords( const res = await LearningRecordsControllerService.courseLearningRecords(
params.value.userId, params.value.userId,
@ -121,12 +35,26 @@ const getrecordList = async () => {
) )
console.log(res) console.log(res)
recordList.value = res.data.records recordList.value = res.data.records
// recordList.value = res.data.records //
// //
total.value = res.data.total total.value = res.data.total
console.log(total.value, 'vvv') loading.value = false
} }
getrecordList() 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) => { const onDeleteRecord = async (ids) => {
await ElMessageBox.confirm('你确认删除该条浏览信息吗?', '温馨提示', { await ElMessageBox.confirm('你确认删除该条浏览信息吗?', '温馨提示', {
@ -143,29 +71,30 @@ const onDeleteRecord = async (ids) => {
ElMessage({ type: 'success', message: '删除成功' }) ElMessage({ type: 'success', message: '删除成功' })
getrecordList() getrecordList()
} }
const goToAnotherPage = (address, courseId) => { //
router.push({ const toggleCheckbox = () => {
path: address, showCheckbox.value = !showCheckbox.value
query: { if (showCheckbox.value) {
courseId: courseId, showCheckbox.value = []
},
})
} }
const currentChange = (index: any) => {
console.log(index)
params.value.pagenum = index
getrecordList()
} }
const selectID = ref([]) //
const selectionChange = (e) => { // change toggleSelection
if (e) { // id selectedIds
selectID.value = e.map((item) => item.id) const toggleSelection = (id) => {
console.log(selectID.value) 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 () => { const deleteSelected = async () => {
// //
if (selectID.value.length === 0) { if (selectedIds.value.length === 0) {
await ElMessageBox.confirm('请选择你要删除的内容', '温馨提示', { await ElMessageBox.confirm('请选择你要删除的内容', '温馨提示', {
type: 'warning', type: 'warning',
confirmButtonText: '确认', confirmButtonText: '确认',
@ -179,12 +108,12 @@ const deleteSelected = async () => {
}) })
// //
await LearningRecordsControllerService.deleteCourseRecords(selectID.value) await LearningRecordsControllerService.deleteCourseRecords(selectedIds.value)
.then(() => { .then(() => {
recordList.value = recordList.value.filter( recordList.value = recordList.value.filter(
(item) => !selectID.value.includes(item.id), (item) => !selectedIds.value.includes(item.id),
) )
selectID.value = [] selectedIds.value = []
}) })
.catch((error) => { .catch((error) => {
console.error('删除失败:', error) console.error('删除失败:', error)
@ -192,26 +121,156 @@ const deleteSelected = async () => {
ElMessage({ type: 'success', message: '删除成功' }) ElMessage({ type: 'success', message: '删除成功' })
getrecordList() getrecordList()
} }
//
const router = useRouter()
const goToAnotherPage = (address, courseId) => {
router.push({
path: address,
query: {
courseId: courseId,
},
})
}
//
</script> </script>
<style lang="scss" scoped> <template>
.container { <div class="record">
position: relative; <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%; width: 100%;
// height: calc(100vh - 100px); list-style-type: none;
.pagination { padding: 10;
position: absolute;
bottom: 20px;
left: 50%;
transform: translateX(-50%);
display: flex; display: flex;
justify-content: center; 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;
} }
:deep(.el-form-item) {
margin-bottom: 0; li:hover {
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
} }
:deep(.el-scrollbar__wrap) {
padding: 0; .img {
display: block;
width: 250px;
height: 250px;
} }
</style> </style>

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

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

Loading…
Cancel
Save