Skip to content

Commit

Permalink
Merge pull request #100 from kevin-geng/master
Browse files Browse the repository at this point in the history
讲师审核功能
  • Loading branch information
sfw5201314 authored Nov 8, 2023
2 parents e5f8d59 + f7c0c73 commit 72b246c
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 10 deletions.
18 changes: 17 additions & 1 deletion src/components/common/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,15 @@
</div>
</div>
</div>
<el-button type="primary" :icon="Upload" @click="goUpload">
<!-- <el-button type="primary" :icon="Upload" @click="goUpload">
投稿
</el-button>
<el-button type="primary" @click="becomeTeacher">
成为讲师
</el-button>
<el-button type="primary" @click="reviewTeacher">
讲师审核
</el-button> -->
</div>
</div>
</div>
Expand Down Expand Up @@ -336,6 +339,19 @@ const becomeTeacher = () => {
else currentTabRouter.value = name
}
}
const reviewTeacher = () => {
if (!userStore.token) {
router.push({
name: 'login',
})
} else {
router.push({
name: 'TeacherReview'
})
if (name.includes('course')) currentTabRouter.value = 'course'
else currentTabRouter.value = name
}
}
</script>

<style scoped lang="scss">
Expand Down
7 changes: 4 additions & 3 deletions src/utils/api/teacher.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ export function teacherApplyList(data){
})
}
// 讲师审核
export function teacherReview(teacherId){
export function teacherReview(teacherId, data){
return request({
url: '/api/teacher/review' + teacherId,
method: 'patch'
url: '/api/teacher/review/' + teacherId,
method: 'patch',
data
})
}
4 changes: 2 additions & 2 deletions src/views/CourseUploadDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ const deleteLessons = (id) => {
border-bottom: none;
margin-bottom: 0;
}
::v-deep .el-collapse-item__header {
:deep(.el-collapse-item__header) {
font-size: 16px !important;
}
::v-deep .el-collapse-item__content {
:deep(.el-collapse-item__content) {
padding-bottom: 0;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/views/PlayCourse.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ onMounted(() => {
videoSource.value = query.source || 'bilibili'
// 给一个默认的七牛云的地址
if (videoSource.value !== 'bilibili') {
videoUrl.value = 'http://s2g6nkhso.bkt.clouddn.com/golang%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F01-%E7%BC%93%E5%AD%98%E4%BB%A3%E7%90%86.mp4'
videoUrl.value = 'http://s2g6nkhso.bkt.clouddn.com/go/01-%E5%8D%95%E4%BE%8B%E6%A8%A1%E5%BC%8F.mp4'
}
console.log('videoUrl', videoUrl.value)
// console.log('课程id', lessonId)
Expand Down
78 changes: 75 additions & 3 deletions src/views/Teacher/TeacherReview.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,86 @@
<template>
<div>
<div class="review-container">
<el-table :data="sourceData" stripe>
<el-table-column prop="createAt" label="申请日期" width="400" />
<el-table-column prop="name" label="姓名" width="400" />
<el-table-column label="审核状态" >
<template #default="scope">
<div v-if="scope.row.isPassed === 1">已审核通过</div>
<div v-if="scope.row.isPassed === 2">审核不通过</div>
<div v-if="scope.row.isPassed === 3">
<el-button link type="primary" size="small" @click="handlePassed(scope.row)">通过</el-button>
<el-button link type="primary" size="small" @click="handleNoPassed(scope.row)">不通过</el-button>
</div>
</template>
</el-table-column>
</el-table>
<Pagination :page-count="pageCount" @page-number="clickPageNumber"></Pagination>
</div>
</template>
<script setup>
import Pagination from '@/components/common/Pagination.vue'
let pageCount = ref(1) // 分页数据
const sourceData = ref(null)
import { teacherApplyList, teacherReview } from '@/utils/api/teacher.js'
// 1、查询讲师申请列表
const queryList = (pageNum) => {
const data = {
pageSize: 10,
pageNum: pageNum
}
teacherApplyList(data).then(res => {
pageCount.value = Math.ceil(res.count/10)
res.data.forEach(item => {
item.createAt = convertTime(item.createAt)
})
sourceData.value = res.data
})
}
const clickPageNumber = (p) => {
if (p) {
queryList(p)
}
}
// 2、审核通过
const handlePassed = (item) => {
const data = {
isPassed: '2',
message: '审核通过'
}
teacherReview(item.id, data).then(res => {
console.log(res)
})
}
// 3、审核不通过
const handleNoPassed = (item) => {
teacherReview(item.id).then(res => {
console.log(res)
})
}
// 时间转换
const convertTime = (timeStr) => {
let cerateDate = new Date(timeStr).getTime()
const date = new Date(cerateDate)
console.log(date)
const year = date.getFullYear()
const month = (date.getMonth() + 1).toString().padStart(2, '0')
const day = date.getDate().toString().padStart(2, '0')
const hour = date.getHours().toString().padStart(2, '0')
const minute = date.getMinutes().toString().padStart(2, '0')
const second = date.getSeconds().toString().padStart(2, '0')
const beijingTimeStr = `${year}-${month}-${day} ${hour}:${minute}:${second}`
return beijingTimeStr
}
onMounted(() => {
queryList(1)
})
</script>
<style scoped lang="scss">
.review-container {
padding-top: 70px;
width: 1200px;
margin: 0 auto;
}
</style>

0 comments on commit 72b246c

Please sign in to comment.