后台链接点击前往前台,收藏页面、点赞页面

master
significative 2 months ago
parent f074bef41e
commit d948aaca3d
  1. 1
      teaching_integration_platform_admin_template/src/assets/icons/收藏.svg
  2. 1
      teaching_integration_platform_admin_template/src/assets/icons/未收藏.svg
  3. 1
      teaching_integration_platform_admin_template/src/assets/icons/未点赞.svg
  4. 1
      teaching_integration_platform_admin_template/src/assets/icons/点赞.svg
  5. 2
      teaching_integration_platform_admin_template/src/layout/tabbar/setting/index.vue
  6. 87
      teaching_integration_platform_admin_template/src/views/MyCourseStudy/learningProcess.vue
  7. 512
      teaching_integration_platform_admin_template/src/views/myFavorites/index.vue
  8. 510
      teaching_integration_platform_admin_template/src/views/myLike/index.vue
  9. 2
      teaching_integration_platform_template/src/Layout/tabbar/index.vue

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1726624898969" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6635" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M575.12 131l94.74 192a47.68 47.68 0 0 0 35.9 26.08l211.84 30.78c39.11 5.68 54.72 53.74 26.43 81.33l-153.3 149.39a47.68 47.68 0 0 0-13.73 42.2l36.19 211c6.68 39-34.2 68.65-69.18 50.26l-189.46-99.62a47.68 47.68 0 0 0-44.38 0L320.7 914c-35 18.39-75.86-11.31-69.18-50.26l36.19-211A47.68 47.68 0 0 0 274 610.58L120.7 461.16c-28.3-27.58-12.68-75.65 26.43-81.33L359 349.05A47.68 47.68 0 0 0 394.87 323l94.73-192c17.49-35.43 68.03-35.43 85.52 0z" fill="#FED547" p-id="6636"></path><path d="M943.3 461.77c28.3-27.58 12.68-75.65-26.43-81.33L705 349.66a47.68 47.68 0 0 1-35.9-26.08l-94.74-192c-16.31-33.05-61.35-35.25-81.53-6.65a49.51 49.51 0 0 1 4 6.65l94.74 192a47.68 47.68 0 0 0 35.9 26.08l211.84 30.78c39.11 5.68 54.72 53.74 26.43 81.33L712.47 611.19a47.68 47.68 0 0 0-13.71 42.2l36.19 211a46.76 46.76 0 0 1-11.52 39.81l19.89 10.46c35 18.39 75.86-11.31 69.18-50.26l-36.19-211A47.68 47.68 0 0 1 790 611.19z" fill="#E2B742" p-id="6637"></path><path d="M263.93 925.77a54 54 0 0 1-53.06-63.05l36.19-211A41.47 41.47 0 0 0 235.13 615L81.85 465.6a53.88 53.88 0 0 1 29.87-91.9l211.83-30.78a41.51 41.51 0 0 0 31.23-22.69l94.73-192a53.89 53.89 0 0 1 96.64 0l94.74 192a41.5 41.5 0 0 0 31.23 22.69L884 373.7a53.88 53.88 0 0 1 29.86 91.9L760.53 615a41.45 41.45 0 0 0-11.93 36.71l36.19 211a53.88 53.88 0 0 1-78.18 56.8l-189.48-99.6a41.49 41.49 0 0 0-38.6 0l-189.47 99.61a53.86 53.86 0 0 1-25.13 6.25z m233.9-815.13a40.71 40.71 0 0 0-37.19 23.12l-94.73 192a53.89 53.89 0 0 1-40.57 29.47L113.5 386a41.48 41.48 0 0 0-23 70.75l153.3 149.39a53.88 53.88 0 0 1 15.5 47.69l-36.19 211a41.48 41.48 0 0 0 60.18 43.73l189.48-99.61a53.81 53.81 0 0 1 50.15 0l189.47 99.61a41.48 41.48 0 0 0 60.18-43.73l-36.19-211a53.86 53.86 0 0 1 15.5-47.69l153.28-149.42a41.48 41.48 0 0 0-23-70.75l-211.82-30.78a53.88 53.88 0 0 1-40.57-29.47L535 133.75a40.71 40.71 0 0 0-37.17-23.12z" fill="#28CA67" p-id="6638"></path></svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1726624906743" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6784" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M766.8 940.7c-5.5 0-11-1.3-16.2-4L511.3 810.6 272 936.7c-11.8 6.2-25.7 5.2-36.5-2.6-10.7-7.8-16-20.8-13.8-33.9L267.4 633 73.8 443.8c-9.5-9.3-12.8-22.9-8.7-35.5 4.1-12.6 14.8-21.6 27.9-23.5l267.6-39 119.7-243c5.9-11.9 17.8-19.3 31.1-19.3s25.2 7.4 31.1 19.3l119.7 243 267.6 39c13.1 1.9 23.8 10.9 27.9 23.5 4.1 12.6 0.8 26.2-8.7 35.5L755.2 633.1l45.7 267.2c2.2 13.1-3 26.1-13.8 33.8-6 4.4-13.1 6.6-20.3 6.6z m-654-516.8l186.3 182c8.1 7.9 11.8 19.4 9.9 30.6l-44 256.9 230.1-121.3c10.1-5.3 22.2-5.3 32.3 0l230.2 121.3-44-256.9c-1.9-11.2 1.8-22.7 9.9-30.6l186.3-182-257.4-37.5c-11.3-1.7-21-8.7-26.1-19l-115-233.6-115 233.7c-5 10.2-14.8 17.3-26 19l-257.5 37.4z m392.3-302.7z" fill="#4F4F4F" p-id="6785"></path></svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1726625930668" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8031" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M190.193225 471.411583c14.446014 0 26.139334-11.718903 26.139334-26.13831 0-14.44499-11.69332-26.164916-26.139334-26.164916-0.271176 0-0.490164 0.149403-0.73678 0.149403l-62.496379 0.146333c-1.425466-0.195451-2.90005-0.295735-4.373611-0.295735-19.677155 0-35.621289 16.141632-35.621289 36.114522L86.622358 888.550075c0 19.949354 15.96767 35.597753 35.670407 35.597753 1.916653 0 3.808746 0.292666 5.649674 0l61.022819 0.022513c0.099261 0 0.148379 0.048095 0.24764 0.048095 0.097214 0 0.146333-0.048095 0.24457-0.048095l0.73678 0 0-0.148379c13.413498-0.540306 24.174586-11.422144 24.174586-24.960485 0-13.55983-10.760065-24.441669-24.174586-24.981974l0-0.393973-50.949392 0 1.450025-402.275993L190.193225 471.409536z" fill="#5D5D5D" p-id="8032"></path><path d="M926.52241 433.948343c-19.283182-31.445176-47.339168-44.172035-81.289398-45.546336-1.77032-0.246617-3.536546-0.39295-5.380544-0.39295l-205.447139-0.688685c13.462616-39.059598 22.698978-85.58933 22.698978-129.317251 0-28.349675-3.193739-55.962569-9.041934-82.542948l-0.490164 0.049119c-10.638291-46.578852-51.736315-81.31498-100.966553-81.31498-57.264215 0-95.466282 48.15065-95.466282 106.126063 0 3.241834-0.294712 6.387477 0 9.532097-2.996241 108.386546-91.240027 195.548698-196.23636 207.513194l0 54.881958-0.785899 222.227314 0 229.744521 10.709923 0 500.025271 0.222057 8.746198-0.243547c19.35686 0.049119 30.239721-4.817726 47.803749-16.116049 16.682961-10.761088 29.236881-25.50079 37.490869-42.156122 2.260483-3.341095 4.028757-7.075139 5.106298-11.20111l77.018118-344.324116c1.056052-4.053316 1.348718-8.181333 1.056052-12.160971C943.643346 476.446249 938.781618 453.944769 926.52241 433.948343zM893.82573 486.837924l-82.983993 367.783411-0.099261-0.049119c-2.555196 6.141884-6.879688 11.596106-12.872169 15.427364-4.177136 2.727111-8.773827 4.351098-13.414521 4.964058-1.49812-0.195451-3.046383 0-4.620227 0l-477.028511-0.540306-0.171915-407.408897c89.323375-40.266076 154.841577-79.670527 188.596356-173.661202 0.072655 0.024559 0.124843 0.049119 0.195451 0.072655 2.99931-9.137101 6.313799-20.73423 8.697079-33.164331 5.551436-29.185716 5.258771-58.123792 5.258771-58.123792-4.937452-37.98001 25.940812-52.965306 44.364417-52.965306 25.304316 0.860601 50.263777 33.656541 50.263777 52.326762 0 0 5.600555 27.563776 5.649674 57.190537 0.048095 37.366026-4.6673 56.847729-4.6673 56.847729l-0.466628 0c-5.872754 30.879288-16.214287 60.138682-30.464849 86.964654l0.36839 0.342808c-2.358721 4.815679-3.709485 10.220782-3.709485 15.943111 0 19.922748 19.088754 21.742187 38.765909 21.742187l238.761895 0.270153c0 0 14.666024 0.465604 14.690584 0.465604l0 0.100284c12.132318-0.638543 24.221658 5.207605 31.100322 16.409738 5.504364 9.016351 6.437619 19.6045 3.486404 28.988218L893.82573 486.837924z" fill="#5D5D5D" p-id="8033"></path><path d="M264.827039 924.31872c0.319272 0.024559 0.441045 0.024559 0.295735-0.024559 0.243547-0.048095 0.367367-0.074701-0.295735-0.074701s-0.539282 0.026606-0.271176 0.074701C264.43409 924.343279 264.532327 924.343279 264.827039 924.31872z" fill="#5D5D5D" p-id="8034"></path></svg>

After

Width:  |  Height:  |  Size: 3.3 KiB

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1726625917372" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7808" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M64 483.04V872c0 37.216 30.144 67.36 67.36 67.36H192V416.32l-60.64-0.64A67.36 67.36 0 0 0 64 483.04zM857.28 344.992l-267.808 1.696c12.576-44.256 18.944-83.584 18.944-118.208 0-78.56-68.832-155.488-137.568-145.504-60.608 8.8-67.264 61.184-67.264 126.816v59.264c0 76.064-63.84 140.864-137.856 148L256 416.96v522.4h527.552a102.72 102.72 0 0 0 100.928-83.584l73.728-388.96a102.72 102.72 0 0 0-100.928-121.824z" p-id="7809" fill="#d81e06"></path></svg>

After

Width:  |  Height:  |  Size: 780 B

@ -84,7 +84,7 @@ const handleCommand = (command: string) => {
} }
// //
const openWeb = () => { const openWeb = () => {
window.open(setting.value.home) window.open(import.meta.env.VITE_APP_OTHER_ORIGIN)
} }
// //

@ -3,71 +3,43 @@
<el-card> <el-card>
<el-form :inline="true" :model="formInline" class="demo-form-inline"> <el-form :inline="true" :model="formInline" class="demo-form-inline">
<el-form-item label="课程名称"> <el-form-item label="课程名称">
<el-input <el-input v-model="formInline.user" placeholder="请输入课程名称" clearable style="width: 300px" />
v-model="formInline.user"
placeholder="请输入课程名称"
clearable
style="width: 300px"
/>
</el-form-item> </el-form-item>
<el-form-item label="日期"> <el-form-item label="日期">
<el-date-picker <el-date-picker v-model="formInline.date" type="date" placeholder="请选择日期" clearable style="width: 300px" />
v-model="formInline.date"
type="date"
placeholder="请选择日期"
clearable
style="width: 300px"
/>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary">查询</el-button> <el-button type="primary" :loading="inquireLoading" @click="handleInquire">查询</el-button>
<el-button <el-button type="danger" v-if="selectID.length" @click="deleteSelected">
type="danger"
v-if="selectID.length"
@click="deleteSelected"
>
批量删除 批量删除
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-card> </el-card>
<el-card style="margin-top: 20px; height: calc(100vh - 200px); width: 100%"> <el-card style="margin-top: 20px; height: calc(100vh - 200px); width: 100%">
<el-table <el-table :data="recordList" border style="width: 100%" @selection-change="selectionChange">
:data="recordList"
border
style="width: 100%"
@selection-change="selectionChange"
>
<el-table-column type="selection" width="55" /> <el-table-column type="selection" width="55" />
<el-table-column type="index" width="55" label="序号"/> <el-table-column type="index" width="55" label="序号" />
<el-table-column prop="courseName" label="课程名称" /> <el-table-column prop="courseName" label="课程名称" />
<el-table-column prop="number" label="学习人数" /> <el-table-column prop="number" label="学习人数" />
<el-table-column prop="time" label="时间" /> <el-table-column prop="time" label="时间" />
<el-table-column label="操作"> <el-table-column label="操作">
<template #default="{ row }"> <template #default="{ row }">
<el-button <el-button type="primary" link @click="
type="primary" goToAnotherPage(
link '/myCourseStudyManagement/learningProcess1',
@click=" row.courseId,
goToAnotherPage( )
'/myCourseStudyManagement/learningProcess1', ">
row.courseId,
)
"
>
知识点学习记录 知识点学习记录
</el-button> </el-button>
<el-button <el-button type="primary" link @click="
type="primary" goToAnotherPage(
link '/myCourseStudyManagement/learningProcess2',
@click=" row.courseId,
goToAnotherPage( )
'/myCourseStudyManagement/learningProcess2', ">
row.courseId,
)
"
>
资源学习记录 资源学习记录
</el-button> </el-button>
<el-button type="danger" link @click="onDeleteRecord(row.id)"> <el-button type="danger" link @click="onDeleteRecord(row.id)">
@ -77,13 +49,8 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
<div class="pagination"> <div class="pagination">
<el-pagination <el-pagination background layout="prev, pager, next" :total="total" :page-size="params.pagesize"
background @current-change="currentChange" />
layout="prev, pager, next"
:total="total"
:page-size="params.pagesize"
@current-change="currentChange"
/>
</div> </div>
</el-card> </el-card>
</div> </div>
@ -104,6 +71,17 @@ const formInline = reactive({
region: '', region: '',
date: '', date: '',
}) })
const inquireLoading = ref(false)
function handleInquire() {
inquireLoading.value = true
setTimeout(() => {
inquireLoading.value = false
ElMessage({
type: 'success',
message: '查询成功',
})
}, Math.random() * 1000)
}
const recordList = ref([]) const recordList = ref([])
const params = ref({ const params = ref({
pagesize: 10, pagesize: 10,
@ -198,6 +176,7 @@ const deleteSelected = async () => {
.container { .container {
position: relative; position: relative;
width: 100%; width: 100%;
// height: calc(100vh - 100px); // height: calc(100vh - 100px);
.pagination { .pagination {
position: absolute; position: absolute;
@ -208,9 +187,11 @@ const deleteSelected = async () => {
justify-content: center; justify-content: center;
} }
} }
:deep(.el-form-item) { :deep(.el-form-item) {
margin-bottom: 0; margin-bottom: 0;
} }
:deep(.el-scrollbar__wrap) { :deep(.el-scrollbar__wrap) {
padding: 0; padding: 0;
} }

@ -1,14 +1,514 @@
<script lang="ts" setup>
import { ref, onMounted } from 'vue'
import { Plus } from '@element-plus/icons-vue'
import {
getCourseListApi,
deleteCourseApi,
getTeacherListApi,
} from '../../api/user/crouse'
import { userNewLikeService } from '@/api/user/user'
import { ElMessageBox, ElMessage } from 'element-plus'
// import router from '@/router'
import { useRouter } from 'vue-router'
import useUserStore from '@/store/modules/user'
// import { useRoute } from 'vue-router'
const userStore = useUserStore()
// const userInfo = userStore.userInfo
const router = useRouter()
// const route = useRoute()
// console.log(route)
// import { client } from '@/utils/alioss.js'
//
const courseList = ref()
//
const teacherList = ref()
const getTeacherList = async () => {
const res = await userNewLikeService(userStore.data.id)
console.log(res, 'teacher')
teacherList.value = res.data
console.log(teacherList.value, 'teacherList.value')
}
const total = ref(0)
const params = ref({
pageNo: 1,
pageSize: 7,
// username: 'qiuqiu',
userId: userStore.data.id,
assessmenttype: '',
category: '',
nature: '',
teacher: '',
})
console.log(userStore.data, 'userStore.data')
const loading = ref(false)
//
const getCourseList = async () => {
loading.value = true
// console.log(params.value, '11')
if (userStore.userInfo.roleId[0] === 2) {
params.value.pageSize = 8
}
const res = await getCourseListApi(params.value)
courseList.value = res.data.list
total.value = res.data.total
console.log(res, 'courseres')
console.log(courseList.value, 'courseList.value')
loading.value = false
// console.log(userStore.userName, '1111')
fill()
}
//
onMounted(() => {
getCourseList()
getTeacherList()
})
//
const onSearch = () => {
params.value.pageNo = 1
getCourseList()
}
const onReset = () => {
params.value.pageNo = 1
params.value.assessmenttype = ''
// params.value.teacher = ''
params.value.category = ''
params.value.nature = ''
getCourseList()
}
//
const handleSizeChange = (size: any) => {
// loading.value = true
// console.log(size)
params.value.pageNo = 1
params.value.pageSize = size
//
getCourseList()
}
const handleCurrentChange = (page: any) => {
console.log(page)
params.value.pageNo = page
//
getCourseList()
}
//
const drawer = ref()
//
const onAddCourse = () => {
flog.value = false
drawer.value.open({})
}
const flog = ref(false)
//
const onEditCourse = (item: any) => {
flog.value = true
console.log(item)
drawer.value.open(item)
}
//
const onSuccess = () => {
loading.value = true
getCourseList()
loading.value = false
}
//
const onDeleteCourse = async (id: any) => {
await ElMessageBox.confirm('您确定删除这条课程信息吗', '温馨提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
})
await deleteCourseApi(id)
.then(() => {
console.log(id, '删除id')
ElMessage.success('删除成功')
// console.log(res)
})
.catch((err: any) => {
console.log(id, 'id')
ElMessage.error(err.response.data.message)
})
getCourseList()
}
// id
const onGetCourseObject = async (id: any) => {
console.log(id, 'id')
// const res = await getCourseObjectApi(id)
router.push({
path: '/curriculumCenter/courseDetails',
// path: '/curriculumCenter/CourseObjectives',
query: {
id: id,
},
})
// console.log(res)
}
const course_name = ref('点击添加课程')
// const credit_name = ref('32')
// const classhours_name = ref('2.0')
// const creditChangeEvent = (credit: any) => {
// credit_name.value = credit
// }
// const ClosecreditChangeEvent = () => {
// credit_name.value = '32'
// }
const couresNameChangeEvent = (name: any) => {
// console.log(name, 'name')
course_name.value = name
}
const CloseCouresNameChangeEvent = () => {
course_name.value = '点击添加课程'
}
// const classhoursChangeEvent = (classhours: any) => {
// classhours_name.value = classhours
// }
// const CloseclasshoursChangeEvent = () => {
// classhours_name.value = '2.0'
// }
// const goToObject = () => {
// this.$route.push('/curriculumCenter/CourseObjectives')
// }
const likeObj = ref<Record<string, boolean>>({})
function changeLike(id: string) {
likeObj.value[id] = !likeObj.value[id]
}
const collectObj = ref<Record<string, boolean>>({})
function changeCollect(id: string) {
collectObj.value[id] = !collectObj.value[id]
}
function fill() {
if (!Array.isArray(courseList.value)) return
courseList.value.forEach((item) => {
likeObj.value[item.id] = item.liked
collectObj.value[item.id] = item.collected || true
})
}
</script>
<template> <template>
<div> <div class="main-content" v-loading="loading">
我的收藏 <div class="header">
<div class="btn">
<!-- <el-button type="primary" round size="large">全部课程</el-button>
<el-button type="primary" round plain size="large">我的文件夹</el-button> -->
<el-form inline v-if="userStore.userInfo.roleId[0] === '1'">
<!-- <el-form-item label="课程教师:" class="short-form-item">
<el-select v-model="params.teacher">
<el-option v-for="teachers in teacherList" :key="teachers.username" :value="teachers.username"
:label="teachers.name"></el-option>
</el-select>
</el-form-item> -->
<el-form-item label="课程类别:" class="short-form-item">
<el-select v-model="params.category">
<el-option label="专业教育" value="1"></el-option>
<el-option label="通识教育" value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item label="课程性质" class="short-form-item">
<el-select v-model="params.nature">
<el-option label="必修" value="1"></el-option>
<el-option label="选修" value="2"></el-option>
<el-option label="任修" value="3"></el-option>
</el-select>
</el-form-item>
<el-form-item label="考核类型:" class="short-form-item">
<el-select v-model="params.assessmenttype">
<el-option label="考试" value="1"></el-option>
<el-option label="考查" value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSearch">搜索</el-button>
<el-button type="primary" plain @click="onReset">重置</el-button>
</el-form-item>
</el-form>
<div class="course">
<ul class="course_list">
<li
v-if="userStore.userInfo.roleId[0] === '1'"
@click="onAddCourse()"
class="add_course"
>
<div class="plus">
<el-icon class="avatar-uploader-icon">
<Plus />
</el-icon>
</div>
<h2 class="course_name">{{ course_name }}</h2>
</li>
<li v-for="item in courseList" :key="item.id">
<img
title="点击查看课程详情"
:src="item.img"
alt=""
@click="onGetCourseObject(item.id)"
/>
<h2 title="点击查看课程基本信息" class="course_name">
{{ item.name }}
</h2>
<p class="teacher_name">讲师{{ item.teacher }}</p>
<p class="credit">
<span>{{ item.classhours }}</span>
学时 |
<span>{{ item.credit }}</span>
学分
</p>
<div class="icon-box">
<svg-icon
v-if="likeObj[item.id]"
@click="changeLike(item.id)"
width="25px"
height="25px"
name="点赞"
></svg-icon>
<svg-icon
v-else
@click="changeLike(item.id)"
width="25px"
height="25px"
name="未点赞"
></svg-icon>
<svg-icon
v-if="collectObj[item.id]"
@click="changeCollect(item.id)"
width="25px"
height="25px"
name="收藏"
></svg-icon>
<svg-icon
v-else
@click="changeCollect(item.id)"
width="25px"
height="25px"
name="未收藏"
></svg-icon>
</div>
<!-- <el-icon class="del" @click="onDeleteCourse(item.id)">
<Delete />
</el-icon> -->
<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)"
v-if="userStore.data.roles[0] == 1"
>
编辑
</el-button>
</li>
</ul>
</div>
<el-pagination
v-model:current-page="params.pageNo"
v-model:page-size="params.pageSize"
:page-sizes="[2, 5, 7, 10]"
:background="true"
layout="jumper,total, sizes, prev, pager, next "
:total="total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
style="margin-top: 10px; justify-content: center"
/>
</div>
<course-edit
ref="drawer"
@success="onSuccess"
@couresNameChange="couresNameChangeEvent"
@CloseCouresNameChange="CloseCouresNameChangeEvent"
:flog="flog"
></course-edit>
</div> </div>
</div>
</template> </template>
<script lang='ts' setup> <style lang="scss" scoped>
import { onMounted, reactive, ref, toRefs, watch } from 'vue' .main-content {
width: 1440px;
margin: 0 auto;
}
</script> .header {
width: 100%;
// height: 100px;
display: flex;
flex-direction: row;
}
// .btn {
// // display: flex;
// width: 50%;
// height: 100%;
// padding: 10px 0;
// // display: inline;
// // height: 40px;
// // margin: 20px;
// // padding-left: 50px;
// }
.search {
width: 50%;
display: flex;
height: 100%;
justify-content: flex-end;
// flex-direction: row-reverse;
// padding: 0 40px 0;
input {
width: 240px;
height: 40px;
border: 1px solid #dcdcdc;
border-radius: 60px;
font-size: 14px;
}
}
.course {
// display: flex;
// flex: 0 0 25%;
// justify-content: space-between;
// flex-wrap: wrap;
.course_list {
display: flex;
// flex: 0 0 25%;
// justify-content: space-between;
flex-wrap: wrap;
display: grid;
grid-template-columns: repeat(4, 1fr);
column-gap: 50px;
}
li {
margin: 40px 0;
width: 349px;
width: 100%;
height: 297px;
background: rgb(255, 255, 255);
transition: all 0.5s;
border-radius: 6px;
position: relative;
// flex: 1; /* */
&:hover {
transform: translate3d(0, -3px, 0);
box-shadow: 0 3px 8px rgb(0 0 0 / 20%);
}
.course_name {
font-family: Inter-Bold;
color: #333;
font-size: 24px;
margin-left: 30px;
margin-top: 10px;
font-weight: bold;
&:hover {
cursor: pointer;
}
}
img {
background-color: #cccccc;
width: 100%;
height: 178px;
cursor: pointer;
}
p {
margin-left: 30px;
margin-top: 5px;
color: #555555;
font-size: 14px;
padding-top: 10px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
span {
color: #0052ff;
}
}
}
.icon-box {
position: absolute;
right: 20px;
// margin-left: 280px;
margin-top: -80px;
color: #0052ff;
cursor: pointer;
display: flex;
column-gap: 5px;
}
.del {
position: absolute;
margin-left: 280px;
margin-top: -80px;
color: #0052ff;
cursor: pointer;
}
.object {
position: absolute;
margin-left: 180px;
margin-top: -29px;
}
.object1 {
position: absolute;
margin-left: 250px;
margin-top: -29px;
}
}
.plus {
width: 100%;
height: 178px;
&:hover {
cursor: pointer;
}
// background-position: center center;
.el-icon.avatar-uploader-icon {
font-size: 50px;
color: #8c939d;
width: 100%;
height: 178px;
margin-top: 20px;
text-align: center;
}
}
.add_course {
border: 2px dashed rgb(143, 139, 139);
h2 {
font-size: 40px;
text-align: center;
font-family: Inter-Bold;
color: #535050;
font-weight: bold;
margin-top: 20px;
<style lang='scss' scoped> &:hover {
cursor: pointer;
}
}
}
.short-form-item {
width: 300px;
margin-right: 100px;
}
</style> </style>

@ -1,14 +1,512 @@
<script lang="ts" setup>
import { ref, onMounted } from 'vue'
import { Plus } from '@element-plus/icons-vue'
import {
getCourseListApi,
deleteCourseApi,
getTeacherListApi,
} from '../../api/user/crouse'
import { ElMessageBox, ElMessage } from 'element-plus'
// import router from '@/router'
import { useRouter } from 'vue-router'
import useUserStore from '@/store/modules/user'
// import { useRoute } from 'vue-router'
const userStore = useUserStore()
// const userInfo = userStore.userInfo
const router = useRouter()
// const route = useRoute()
// console.log(route)
// import { client } from '@/utils/alioss.js'
//
const courseList = ref()
//
const teacherList = ref()
const getTeacherList = async () => {
const res = await getTeacherListApi()
console.log(res, 'teacher')
teacherList.value = res.data
console.log(teacherList.value, 'teacherList.value')
}
const total = ref(0)
const params = ref({
pageNo: 1,
pageSize: 7,
// username: 'qiuqiu',
userId: userStore.data.id,
assessmenttype: '',
category: '',
nature: '',
teacher: '',
})
console.log(userStore.data, 'userStore.data')
const loading = ref(false)
//
const getCourseList = async () => {
loading.value = true
// console.log(params.value, '11')
if (userStore.userInfo.roleId[0] === 2) {
params.value.pageSize = 8
}
const res = await getCourseListApi(params.value)
courseList.value = res.data.list
total.value = res.data.total
console.log(res, 'courseres')
console.log(courseList.value, 'courseList.value')
loading.value = false
// console.log(userStore.userName, '1111')
fill()
}
//
onMounted(() => {
getCourseList()
getTeacherList()
})
//
const onSearch = () => {
params.value.pageNo = 1
getCourseList()
}
const onReset = () => {
params.value.pageNo = 1
params.value.assessmenttype = ''
// params.value.teacher = ''
params.value.category = ''
params.value.nature = ''
getCourseList()
}
//
const handleSizeChange = (size: any) => {
// loading.value = true
// console.log(size)
params.value.pageNo = 1
params.value.pageSize = size
//
getCourseList()
}
const handleCurrentChange = (page: any) => {
console.log(page)
params.value.pageNo = page
//
getCourseList()
}
//
const drawer = ref()
//
const onAddCourse = () => {
flog.value = false
drawer.value.open({})
}
const flog = ref(false)
//
const onEditCourse = (item: any) => {
flog.value = true
console.log(item)
drawer.value.open(item)
}
//
const onSuccess = () => {
loading.value = true
getCourseList()
loading.value = false
}
//
const onDeleteCourse = async (id: any) => {
await ElMessageBox.confirm('您确定删除这条课程信息吗', '温馨提示', {
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'warning',
})
await deleteCourseApi(id)
.then(() => {
console.log(id, '删除id')
ElMessage.success('删除成功')
// console.log(res)
})
.catch((err: any) => {
console.log(id, 'id')
ElMessage.error(err.response.data.message)
})
getCourseList()
}
// id
const onGetCourseObject = async (id: any) => {
console.log(id, 'id')
// const res = await getCourseObjectApi(id)
router.push({
path: '/curriculumCenter/courseDetails',
// path: '/curriculumCenter/CourseObjectives',
query: {
id: id,
},
})
// console.log(res)
}
const course_name = ref('点击添加课程')
// const credit_name = ref('32')
// const classhours_name = ref('2.0')
// const creditChangeEvent = (credit: any) => {
// credit_name.value = credit
// }
// const ClosecreditChangeEvent = () => {
// credit_name.value = '32'
// }
const couresNameChangeEvent = (name: any) => {
// console.log(name, 'name')
course_name.value = name
}
const CloseCouresNameChangeEvent = () => {
course_name.value = '点击添加课程'
}
// const classhoursChangeEvent = (classhours: any) => {
// classhours_name.value = classhours
// }
// const CloseclasshoursChangeEvent = () => {
// classhours_name.value = '2.0'
// }
// const goToObject = () => {
// this.$route.push('/curriculumCenter/CourseObjectives')
// }
const likeObj = ref<Record<string, boolean>>({})
function changeLike(id: string) {
likeObj.value[id] = !likeObj.value[id]
}
const collectObj = ref<Record<string, boolean>>({})
function changeCollect(id: string) {
collectObj.value[id] = !collectObj.value[id]
}
function fill() {
if (!Array.isArray(courseList.value)) return
courseList.value.forEach((item) => {
likeObj.value[item.id] = item.liked || true
collectObj.value[item.id] = item.collected
})
}
</script>
<template> <template>
<div> <div class="main-content" v-loading="loading">
我的点赞 <div class="header">
<div class="btn">
<!-- <el-button type="primary" round size="large">全部课程</el-button>
<el-button type="primary" round plain size="large">我的文件夹</el-button> -->
<el-form inline v-if="userStore.userInfo.roleId[0] === '1'">
<!-- <el-form-item label="课程教师:" class="short-form-item">
<el-select v-model="params.teacher">
<el-option v-for="teachers in teacherList" :key="teachers.username" :value="teachers.username"
:label="teachers.name"></el-option>
</el-select>
</el-form-item> -->
<el-form-item label="课程类别:" class="short-form-item">
<el-select v-model="params.category">
<el-option label="专业教育" value="1"></el-option>
<el-option label="通识教育" value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item label="课程性质" class="short-form-item">
<el-select v-model="params.nature">
<el-option label="必修" value="1"></el-option>
<el-option label="选修" value="2"></el-option>
<el-option label="任修" value="3"></el-option>
</el-select>
</el-form-item>
<el-form-item label="考核类型:" class="short-form-item">
<el-select v-model="params.assessmenttype">
<el-option label="考试" value="1"></el-option>
<el-option label="考查" value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSearch">搜索</el-button>
<el-button type="primary" plain @click="onReset">重置</el-button>
</el-form-item>
</el-form>
<div class="course">
<ul class="course_list">
<li
v-if="userStore.userInfo.roleId[0] === '1'"
@click="onAddCourse()"
class="add_course"
>
<div class="plus">
<el-icon class="avatar-uploader-icon">
<Plus />
</el-icon>
</div>
<h2 class="course_name">{{ course_name }}</h2>
</li>
<li v-for="item in courseList" :key="item.id">
<img
title="点击查看课程详情"
:src="item.img"
alt=""
@click="onGetCourseObject(item.id)"
/>
<h2 title="点击查看课程基本信息" class="course_name">
{{ item.name }}
</h2>
<p class="teacher_name">讲师{{ item.teacher }}</p>
<p class="credit">
<span>{{ item.classhours }}</span>
学时 |
<span>{{ item.credit }}</span>
学分
</p>
<div class="icon-box">
<svg-icon
v-if="likeObj[item.id]"
@click="changeLike(item.id)"
width="25px"
height="25px"
name="点赞"
></svg-icon>
<svg-icon
v-else
@click="changeLike(item.id)"
width="25px"
height="25px"
name="未点赞"
></svg-icon>
<svg-icon
v-if="collectObj[item.id]"
@click="changeCollect(item.id)"
width="25px"
height="25px"
name="收藏"
></svg-icon>
<svg-icon
v-else
@click="changeCollect(item.id)"
width="25px"
height="25px"
name="未收藏"
></svg-icon>
</div>
<!-- <el-icon class="del" @click="onDeleteCourse(item.id)">
<Delete />
</el-icon> -->
<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)"
v-if="userStore.data.roles[0] == 1"
>
编辑
</el-button>
</li>
</ul>
</div>
<el-pagination
v-model:current-page="params.pageNo"
v-model:page-size="params.pageSize"
:page-sizes="[2, 5, 7, 10]"
:background="true"
layout="jumper,total, sizes, prev, pager, next "
:total="total"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
style="margin-top: 10px; justify-content: center"
/>
</div>
<course-edit
ref="drawer"
@success="onSuccess"
@couresNameChange="couresNameChangeEvent"
@CloseCouresNameChange="CloseCouresNameChangeEvent"
:flog="flog"
></course-edit>
</div> </div>
</div>
</template> </template>
<script lang='ts' setup> <style lang="scss" scoped>
import { onMounted, reactive, ref, toRefs, watch } from 'vue' .main-content {
width: 1440px;
margin: 0 auto;
}
</script> .header {
width: 100%;
// height: 100px;
display: flex;
flex-direction: row;
}
// .btn {
// // display: flex;
// width: 50%;
// height: 100%;
// padding: 10px 0;
// // display: inline;
// // height: 40px;
// // margin: 20px;
// // padding-left: 50px;
// }
.search {
width: 50%;
display: flex;
height: 100%;
justify-content: flex-end;
// flex-direction: row-reverse;
// padding: 0 40px 0;
input {
width: 240px;
height: 40px;
border: 1px solid #dcdcdc;
border-radius: 60px;
font-size: 14px;
}
}
.course {
// display: flex;
// flex: 0 0 25%;
// justify-content: space-between;
// flex-wrap: wrap;
.course_list {
display: flex;
// flex: 0 0 25%;
// justify-content: space-between;
flex-wrap: wrap;
display: grid;
grid-template-columns: repeat(4, 1fr);
column-gap: 50px;
}
li {
margin: 40px 0;
width: 349px;
width: 100%;
height: 297px;
background: rgb(255, 255, 255);
transition: all 0.5s;
border-radius: 6px;
position: relative;
// flex: 1; /* */
&:hover {
transform: translate3d(0, -3px, 0);
box-shadow: 0 3px 8px rgb(0 0 0 / 20%);
}
.course_name {
font-family: Inter-Bold;
color: #333;
font-size: 24px;
margin-left: 30px;
margin-top: 10px;
font-weight: bold;
&:hover {
cursor: pointer;
}
}
img {
background-color: #cccccc;
width: 100%;
height: 178px;
cursor: pointer;
}
p {
margin-left: 30px;
margin-top: 5px;
color: #555555;
font-size: 14px;
padding-top: 10px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
span {
color: #0052ff;
}
}
}
.icon-box {
position: absolute;
right: 20px;
// margin-left: 280px;
margin-top: -80px;
color: #0052ff;
cursor: pointer;
display: flex;
column-gap: 5px;
}
.del {
position: absolute;
margin-left: 280px;
margin-top: -80px;
color: #0052ff;
cursor: pointer;
}
.object {
position: absolute;
margin-left: 180px;
margin-top: -29px;
}
.object1 {
position: absolute;
margin-left: 250px;
margin-top: -29px;
}
}
.plus {
width: 100%;
height: 178px;
&:hover {
cursor: pointer;
}
// background-position: center center;
.el-icon.avatar-uploader-icon {
font-size: 50px;
color: #8c939d;
width: 100%;
height: 178px;
margin-top: 20px;
text-align: center;
}
}
.add_course {
border: 2px dashed rgb(143, 139, 139);
h2 {
font-size: 40px;
text-align: center;
font-family: Inter-Bold;
color: #535050;
font-weight: bold;
margin-top: 20px;
<style lang='scss' scoped> &:hover {
cursor: pointer;
}
}
}
.short-form-item {
width: 300px;
margin-right: 100px;
}
</style> </style>

@ -82,7 +82,7 @@ function skip(url: string) {
// ======================== // ========================
let otherWin: any = null; let otherWin: any = null;
function send() { function send() {
if (otherWin) { if (otherWin && !otherWin.closed) {
otherWin.focus(); otherWin.focus();
return return
} }

Loading…
Cancel
Save