修改部分会议提到的bug

This commit is contained in:
axlrose2333 2023-03-14 18:11:48 +08:00
parent afcb62b4eb
commit 92657ea736
18 changed files with 1186 additions and 284 deletions

View File

@ -17,7 +17,7 @@ const api = {
}, },
editLbtManage : data => { editLbtManage : data => {
return service({ return service({
url: '/sys-index-lbt/'+data.ID, url: '/sys-index-lbt/'+data.banner_id,
method: 'put', method: 'put',
data data
}) })

19
src/api/market.js Normal file
View File

@ -0,0 +1,19 @@
import service from '@/utils/request'
const api = {
/*助教*/
getAssistantList : data => { // 助教列表
return service({
url: '/assistant',
method: 'get',
params:data
})
},
getAssistantDetail: data => { // 助教详情
return service({
url: '/assistant/'+data.id,
method: 'get',
params:data
})
},
}
export default api

View File

@ -14,12 +14,19 @@ const api = {
method: 'get' method: 'get'
}) })
}, },
teacherOperator : data => { teacherOperator : data => {// 审核提交
return service({ return service({
url: '/teacher/change', url: '/teacher/change',
method: 'post', method: 'post',
data data
}) })
} },
getAssistantList : data => { // 助教列表
return service({
url: '/assistant',
method: 'get',
params:data
})
},
} }
export default api export default api

View File

@ -414,8 +414,8 @@ export function clients() {
let client = {} let client = {}
client = new OSS({ client = new OSS({
endpoint: 'oss-cn-chengdu.aliyuncs.com', endpoint: 'oss-cn-chengdu.aliyuncs.com',
accessKeyId: 'LTAI5t7K52jxxBCvYtS3CCm3', accessKeyId: 'LTAI5tGUFScGh9qdB8j7vKo1',
accessKeySecret: 'VFLO6JDorP8fFmjZuxsSCxL5zzHMgW', accessKeySecret: 'XhBPsJ3fom9sE4yjTQAqwwVEw2nqac',
bucket: 'gwjxb', bucket: 'gwjxb',
timeout: 10 * 60 * 1000 timeout: 10 * 60 * 1000
}) })

View File

@ -47,6 +47,7 @@ async function getCourseInfo() { // 获取课程信息
const res = await api.getCourse({id:course_id.value}) const res = await api.getCourse({id:course_id.value})
if(res.code === 0) { if(res.code === 0) {
chapter_info.value = res.data.course_ware_json chapter_info.value = res.data.course_ware_json
res.data.course.price /=100
form.value = res.data.course form.value = res.data.course
} }
} }
@ -83,12 +84,15 @@ const submitForm = async (formEl) => {
}) })
} }
async function saveStep1() { async function saveStep1() {
form.value.course_category_id = subjectList.value.filter((item,i) => {
return item.name === form.value.subject
})[0].id
let params = { let params = {
step1:{ step1:{
...form.value ...form.value
} }
} }
params.step1.price = parseInt(params.step1.price) params.step1.price = parseFloat(params.step1.price)*100
let func_name ='' let func_name =''
if(course_id.value) { // if(course_id.value) { //
params.course_id = parseInt(course_id.value) params.course_id = parseInt(course_id.value)
@ -153,6 +157,10 @@ function handleAvatarSuccess(res) {
form.value.cover = res.data.file.url form.value.cover = res.data.file.url
handlerChange() handlerChange()
} }
function handleIntroSuccess(res) {
form.value.intro = res.data.file.url
handlerChange()
}
function beforeAvatarUpload(file) { function beforeAvatarUpload(file) {
const isLt05M = file.size / 1024 / 1024 < 20 const isLt05M = file.size / 1024 / 1024 < 20
const isJPG = file.type.indexOf('image/') === -1 const isJPG = file.type.indexOf('image/') === -1
@ -215,11 +223,22 @@ function handlerChange(e) {
<el-input @change="handlerChange" placeholder="请输入课程价格" type="number" v-model="form.price" /> <el-input @change="handlerChange" placeholder="请输入课程价格" type="number" v-model="form.price" />
</el-form-item> </el-form-item>
<el-form-item label="课程简介"> <el-form-item label="课程简介">
<el-input @change="handlerChange" v-model="form.intro" type="textarea" /> <!-- <el-input @change="handlerChange" v-model="form.intro" type="textarea" />-->
</el-form-item> <el-upload
<el-form-item label="包含试听"> class="avatar-uploader"
<el-switch @change="handlerChange" v-model="form.is_audition" active-text="" inactive-text="" :active-value="1" :inactive-value="-1" /> :action="`${path}/fileUploadAndDownload/upload`"
:headers="{ 'x-token': userStore.token }"
:show-file-list="false"
:on-success="handleIntroSuccess"
:before-upload="beforeAvatarUpload"
>
<img v-if="form.intro" :src="form.intro" class="avatar" />
<el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>
</el-upload>
</el-form-item> </el-form-item>
<!-- <el-form-item label="包含试听">-->
<!-- <el-switch @change="handlerChange" v-model="form.is_audition" active-text="" inactive-text="" :active-value="1" :inactive-value="-1" />-->
<!-- </el-form-item>-->
<el-form-item label="设置精品"> <el-form-item label="设置精品">
<el-switch @change="handlerChange" v-model="form.is_boutique" active-text="" inactive-text="" :active-value="1" :inactive-value="-1" /> <el-switch @change="handlerChange" v-model="form.is_boutique" active-text="" inactive-text="" :active-value="1" :inactive-value="-1" />
</el-form-item> </el-form-item>

View File

@ -27,6 +27,7 @@ const props = defineProps(['course_id','chapter_info'])
const emit = defineEmits(['reload']) const emit = defineEmits(['reload'])
import UploadCommon from '@/components/upload/common.vue' import UploadCommon from '@/components/upload/common.vue'
// //
const is_sub = ref(-1)
const dialogChapterVisible = ref(false) const dialogChapterVisible = ref(false)
// const dialogChapterTitle = ref('') // const dialogChapterTitle = ref('')
const chapterForm = ref({pid:0,sort:0}) const chapterForm = ref({pid:0,sort:0})
@ -61,6 +62,7 @@ function addChapterFunc() { // 添加大章节
dialogChapterTitle.value = '添加大章节' dialogChapterTitle.value = '添加大章节'
} }
async function deleteChapterFunc(item) { // async function deleteChapterFunc(item) { //
is_sub.value = -1
delFunc(item.course_chapter_id) delFunc(item.course_chapter_id)
} }
function delFunc(id) { function delFunc(id) {
@ -71,7 +73,9 @@ function delFunc(id) {
}) })
.then(async() => { .then(async() => {
const res = await api.delChapter({ const res = await api.delChapter({
ids:[id] ids:[id],
course_id:parseInt(props.course_id),
sub:parseInt(is_sub.value)
}) })
if (res.code === 0) { if (res.code === 0) {
ElMessage({ ElMessage({
@ -132,14 +136,17 @@ function editChapterChildFunc(item,main_index) { // 打开编辑子章节窗口
// item.exam_ids =item.exam_id?[item.exam_id]: [] // item.exam_ids =item.exam_id?[item.exam_id]: []
item.examination_id = item.exam_id item.examination_id = item.exam_id
chapterChildForm.value = _.cloneDeep(item) chapterChildForm.value = _.cloneDeep(item)
chapterChildForm.value.price /= 100
dialogChapterChildVisible.value = true dialogChapterChildVisible.value = true
} }
function deleteChapterChildFunc(item) { // function deleteChapterChildFunc(item) { //
is_sub.value = 1
delFunc(item.course_subsection_id) delFunc(item.course_subsection_id)
} }
async function enterChapterChildDialog() { // async function enterChapterChildDialog() { //
chapterChildForm.value.sort = parseInt(chapterChildForm.value.sort) chapterChildForm.value.sort = parseInt(chapterChildForm.value.sort)
chapterChildForm.value.price = parseInt(chapterChildForm.value.price) // chapterChildForm.value.price = parseInt(chapterChildForm.value.price*100)
chapterChildForm.value.price = chapterChildForm.value.price*100
const params = { const params = {
...chapterChildForm.value ...chapterChildForm.value
} }
@ -219,7 +226,9 @@ function addExamFunc(data) {
{{scope.row.exam_id === 0?'未添加习题':scope.row.exam_id}} {{scope.row.exam_id === 0?'未添加习题':scope.row.exam_id}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="left" label="章节价格" min-width="60" prop="price" /> <el-table-column align="left" label="章节价格" min-width="60" prop="price">
<template #default="scope">{{scope.row.price/100}}</template>
</el-table-column>
<!-- <el-table-column align="left" label="是否免费" min-width="60">--> <!-- <el-table-column align="left" label="是否免费" min-width="60">-->
<!-- <template #default="scope">--> <!-- <template #default="scope">-->
<!-- {{scope.row.is_free === 1? '是':'否'}}--> <!-- {{scope.row.is_free === 1? '是':'否'}}-->

View File

@ -191,7 +191,9 @@ function viewCourseFunc(row) { // 查看课程
<el-table-column align="left" label="id" min-width="60" prop="course_id" sortable="custom" /> <el-table-column align="left" label="id" min-width="60" prop="course_id" sortable="custom" />
<el-table-column align="left" label="名称" min-width="150" prop="name" /> <el-table-column align="left" label="名称" min-width="150" prop="name" />
<el-table-column align="left" label="科目" min-width="150" prop="subject" /> <el-table-column align="left" label="科目" min-width="150" prop="subject" />
<el-table-column align="left" label="价格" min-width="150" prop="price" /> <el-table-column align="left" label="价格" min-width="150" prop="price">
<template #default="scope">{{scope.row.price/100}}</template>
</el-table-column>
<el-table-column align="left" label="状态" min-width="150" prop="status"> <el-table-column align="left" label="状态" min-width="150" prop="status">
<template #default="scope"> <template #default="scope">
{{scope.row.status == 1?'上架':scope.row.status == 2?'待审核':scope.row.status == 3?'通过':scope.row.status == 4?'未通过':'下架'}} {{scope.row.status == 1?'上架':scope.row.status == 2?'待审核':scope.row.status == 3?'通过':scope.row.status == 4?'未通过':'下架'}}

View File

@ -22,6 +22,7 @@ import custom from '@/utils/custom'
// //
watch(props,(val1,val2) => { watch(props,(val1,val2) => {
has_exam_types.value = _.cloneDeep(val1.exam_types) || [] has_exam_types.value = _.cloneDeep(val1.exam_types) || []
queryParams.value.examId = val1.exam_id
}) })
// //
const has_exam_types = ref(_.cloneDeep(props.exam_types) || []) const has_exam_types = ref(_.cloneDeep(props.exam_types) || [])
@ -49,6 +50,10 @@ async function getExamGroupList() {
if(res.code === 0) { if(res.code === 0) {
type_list.value = res.data.records type_list.value = res.data.records
total.value = res.data.total total.value = res.data.total
console.log('子组件获取行为')
if(type_list.value.length==0) {
type_list.value = _.cloneDeep(has_exam_types.value)
}
} }
} }
function chooseChapterChildExercises() { function chooseChapterChildExercises() {
@ -130,11 +135,11 @@ function enterDb() { // 确认新增/编辑
} }
else{ // else{ //
let f = checkFunc(gform.value) // let f = checkFunc(gform.value)
if(!f) { // , // if(!f) { // ,
ElMessage.error('该级别组数已存在!') // ElMessage.error('!')
return // return
} // }
} }
if(!edit_flag.value) { // if(!edit_flag.value) { //
gform.value.term = assigntTermFunc() gform.value.term = assigntTermFunc()
@ -327,21 +332,35 @@ function close_draw() {
<!-- </div>--> <!-- </div>-->
</el-form-item> </el-form-item>
<el-form-item label="截止时间" > <el-form-item label="截止时间" >
<el-date-picker class="oi-item" style="margin-left:5px" <!-- <el-date-picker class="oi-item" style="margin-left:5px"-->
<!-- v-model="gform.expiry_date"-->
<!-- type="date"-->
<!-- placeholder="截至日期"-->
<!-- format="YYYY-MM-DD"-->
<!-- value-format="x"-->
<!-- />-->
<el-date-picker
v-model="gform.expiry_date" v-model="gform.expiry_date"
type="date" type="datetime"
placeholder="截至日期" placeholder="截至日期"
format="YYYY-MM-DD" format="YYYY-MM-DD HH:mm:ss"
value-format="x" value-format="x"
/> />
</el-form-item> </el-form-item>
<el-form-item label="公开时间" > <el-form-item label="公开时间" >
<el-date-picker class="oi-item" style="margin-left:5px" <!-- <el-date-picker class="oi-item" style="margin-left:5px"-->
<!-- v-model="gform.public_date"-->
<!-- type="date"-->
<!-- placeholder="截至日期"-->
<!-- format="YYYY-MM-DD"-->
<!-- value-format="x"-->
<!-- />-->
<el-date-picker
v-model="gform.public_date" v-model="gform.public_date"
type="date" type="datetime"
placeholder="截至日期" placeholder="公开时间"
format="YYYY-MM-DD" format="YYYY-MM-DD HH:mm:ss"
value-format="x" value-format="x"
/> />
</el-form-item> </el-form-item>

View File

@ -53,7 +53,7 @@ const content = ref(null)
// const options = ref([]) // // const options = ref([]) //
const exam_types = ref([]) const exam_types = ref([])
const exam_ids = ref([]) const exam_ids = ref([])
const price_props = ['first','second','third'] const price_props = ['first','second','third','price']
const exam_type_ids = ref([]) const exam_type_ids = ref([])
// //
onMounted(() => { onMounted(() => {
@ -139,6 +139,7 @@ function editCourseFunc(row) {
form.value = _.cloneDeep(row.exam) form.value = _.cloneDeep(row.exam)
form.value.course_ids = JSON.parse(row.exam.course_ids) form.value.course_ids = JSON.parse(row.exam.course_ids)
form.value.question_ids = JSON.parse(row.exam.question_ids) form.value.question_ids = JSON.parse(row.exam.question_ids)
form.value.price = Number(form.value.price)/100
exam_types.value = row.exam_types.map((item) => { exam_types.value = row.exam_types.map((item) => {
for(let prop in item) { for(let prop in item) {
if(price_props.includes(prop)) { if(price_props.includes(prop)) {
@ -147,6 +148,7 @@ function editCourseFunc(row) {
} }
return item return item
}) })
// console.log(form.value)
current_subject.value = form.value.subject current_subject.value = form.value.subject
openDialog('edit') openDialog('edit')
} }
@ -196,6 +198,8 @@ async function enterDialog() { // 提交
} }
return item return item
}) })
// console.log(form.value)
form.value.price = Number(form.value.price )*100
form.value.duration = parseInt(form.value.duration) form.value.duration = parseInt(form.value.duration)
const params = { const params = {
...form.value ...form.value
@ -267,6 +271,7 @@ function addCourseFunc(data) {
form.value.course_ids = data form.value.course_ids = data
} }
function addGroupFunc(data) { function addGroupFunc(data) {
console.log("父组件行为")
exam_types.value = _.clone(data) exam_types.value = _.clone(data)
} }
</script> </script>
@ -406,54 +411,18 @@ function addGroupFunc(data) {
<el-form-item label="测试时长" > <el-form-item label="测试时长" >
<el-input type="number" v-model="form.duration" placeholder="请输入测试时长(分钟)" /> <el-input type="number" v-model="form.duration" placeholder="请输入测试时长(分钟)" />
</el-form-item> </el-form-item>
<!-- <el-form-item label="测试组别" >--> <el-form-item label="测试价格" >
<!-- <div class="options-box" style="width: 100%">--> <el-input type="number" v-model="form.price" placeholder="请输入测试价格(元)" />
<!-- <div class="option-item" v-if="exam_types.length>0" v-for="(item,i) in exam_types">--> </el-form-item>
<!-- <el-form :model="item" >-->
<!-- <div class="oi-row">-->
<!-- <div class="oi-item">{{i+1}}</div>-->
<!-- <el-input class="oi-item" type="number" style="margin-left:5px;width: 30%" v-model="item.persons" placeholder="请输入组别人数" />-->
<!-- <el-date-picker class="oi-item" style="margin-left:5px"-->
<!-- v-model="item.expiry_date"-->
<!-- type="date"-->
<!-- placeholder="截至日期"-->
<!-- format="YYYY-MM-DD"-->
<!-- value-format="x"-->
<!-- />-->
<!-- <el-date-picker class="oi-item" style="margin-left:5px"-->
<!-- v-model="item.public_date"-->
<!-- type="date"-->
<!-- placeholder="成绩公布日期"-->
<!-- format="YYYY-MM-DD"-->
<!-- value-format="x"-->
<!-- />-->
<!-- <el-icon class="oi-item" style="margin-left: 5px;cursor: pointer" @click="delet_func(i)"><Delete /></el-icon>-->
<!-- </div>-->
<!-- <div class="reward-box">-->
<!-- <el-form-item class="rb-item" style="margin-right:10px;display: flex" label="第一名">-->
<!-- <el-input style="width:auto;margin-right: 5px" type="number" v-model="item.first" placeholder="请输入第一名奖励" /><div></div>-->
<!-- </el-form-item>-->
<!-- <el-form-item class="rb-item" style="margin-right:10px;" label="第二名">-->
<!-- <el-input style="width:auto;margin-right: 5px" type="number" v-model="item.second" placeholder="请输入第二名奖励" />-->
<!-- </el-form-item>-->
<!-- <el-form-item class="rb-item" style="margin-right:10px;" label="第三名">-->
<!-- <el-input style="width:auto;margin-right: 5px" type="number" v-model="item.third" placeholder="请输入第三名奖励" />-->
<!-- </el-form-item>-->
<!-- </div>-->
<!-- </el-form>-->
<!-- </div>-->
<!-- <el-button @click="addOptionFunc">添加组别</el-button>-->
<!-- </div>-->
<!-- </el-form-item>-->
<el-form-item label="测试组别" > <el-form-item label="测试组别" >
<groupPool @addFunc="addGroupFunc" :exam_types="exam_types" :exam_id="form.exam_id" /> <groupPool @addFunc="addGroupFunc" :exam_types="exam_types" :exam_id="form.exam_id" />
</el-form-item> </el-form-item>
<el-form-item label="添加习题" > <el-form-item label="添加习题" >
<exercisesPool @addFunc="addExercisesFunc" :seleted_arr="form.question_ids" /> <exercisesPool @addFunc="addExercisesFunc" :seleted_arr="form.question_ids" />
</el-form-item> </el-form-item>
<el-form-item label="适用课程" > <!-- <el-form-item label="适用课程" >-->
<coursePool @addFunc="addCourseFunc" :seleted_arr="form.course_ids" /> <!-- <coursePool @addFunc="addCourseFunc" :seleted_arr="form.course_ids" />-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item label="受否上架" > <el-form-item label="受否上架" >
<el-switch <el-switch
v-model="form.status" v-model="form.status"

View File

@ -346,7 +346,7 @@ function delet_func(item) {
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="题目内容" > <el-form-item label="题目内容" >
<ckEditor v-model="question_form.title" :content="question_form.title" /> <ckEditor v-model="question_form.title" style="width:100%" :content="question_form.title" />
</el-form-item> </el-form-item>
<el-form-item label="分值" > <el-form-item label="分值" >
<el-input type="number" v-model="form.score" placeholder="请输入分值" /> <el-input type="number" v-model="form.score" placeholder="请输入分值" />
@ -356,7 +356,7 @@ function delet_func(item) {
<view class="options-box"> <view class="options-box">
<view class="option-item" v-if="question_form" v-for="(item,i) in question_form.options"> <view class="option-item" v-if="question_form" v-for="(item,i) in question_form.options">
<view>{{item.name}}</view> <view>{{item.name}}</view>
<ckEditor v-model="item.value" :content="item.value" style="margin-left:5px" /> <ckEditor v-model="item.value" :content="item.value" style="margin-left:5px;width:100%" />
<el-icon style="margin-left: 5px;cursor: pointer" v-if="(i+1) == question_form.options.length" @click="delet_func(item)"><Delete /></el-icon> <el-icon style="margin-left: 5px;cursor: pointer" v-if="(i+1) == question_form.options.length" @click="delet_func(item)"><Delete /></el-icon>
</view> </view>
<el-button @click="addOptionFunc">添加答案</el-button> <el-button @click="addOptionFunc">添加答案</el-button>
@ -367,7 +367,7 @@ function delet_func(item) {
</el-form-item> </el-form-item>
<el-form-item label="题目解析" > <el-form-item label="题目解析" >
<!-- <el-input v-model="form.analysis" placeholder="请输入题目解析" />--> <!-- <el-input v-model="form.analysis" placeholder="请输入题目解析" />-->
<ckEditor v-model="form.resolve" :content="form.resolve" /> <ckEditor v-model="form.resolve" style="width:100%" :content="form.resolve" />
</el-form-item> </el-form-item>
</el-form> </el-form>
<template #footer> <template #footer>

View File

@ -61,7 +61,7 @@ function openDialog(type) {
} }
} }
async function onDelete() { async function onDelete() {
const ids = lbt_ids.value.map(item => item.ID) const ids = lbt_ids.value.map(item => item.banner_id)
const res = await api.delLbt({ ids }) const res = await api.delLbt({ ids })
if (res.code === 0) { if (res.code === 0) {
ElMessage({ ElMessage({
@ -111,12 +111,15 @@ const submitForm = async (formEl) => {
} }
async function saveForm() { async function saveForm() {
let func_name = '' let func_name = ''
if(form.value.ID){ // if(form.value.banner_id){ //
func_name = 'editLbtManage' func_name = 'editLbtManage'
} }
else{ else{
func_name = 'addLbtManage' func_name = 'addLbtManage'
} }
form.value.status = parseInt(form.value.status)
form.value.lbtSkipUrlType = parseInt(form.value.lbtSkipUrlType)
form.value.lbtType = parseInt(form.value.lbtType)
const res = await api[func_name](form.value) const res = await api[func_name](form.value)
if(res.code === 0) if(res.code === 0)
{ {
@ -144,7 +147,7 @@ function delLbtFunc(item) {
.then(async() => { .then(async() => {
console.log(1) console.log(1)
const res = await api.delLbt({ const res = await api.delLbt({
ids:[item.ID] ids:[item.banner_id]
}) })
if (res.code === 0) { if (res.code === 0) {
ElMessage({ ElMessage({
@ -199,7 +202,7 @@ function handleSizeChange(val) {
</el-table-column> </el-table-column>
<el-table-column align="left" label="是否启用" min-width="150" prop="status" > <el-table-column align="left" label="是否启用" min-width="150" prop="status" >
<template #default="scope"> <template #default="scope">
{{scope.row.status === '1'?'启用':'禁用'}} {{scope.row.status == '1'?'启用':'禁用'}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="left" label="说明" min-width="150" prop="lbtIntroduction" /> <el-table-column align="left" label="说明" min-width="150" prop="lbtIntroduction" />
@ -268,7 +271,7 @@ function handleSizeChange(val) {
<el-input v-model="form.lbtSkipUrl" placeholder="链接地址" autocomplete="off" /> <el-input v-model="form.lbtSkipUrl" placeholder="链接地址" autocomplete="off" />
</el-form-item> </el-form-item>
<el-form-item label="启用状态" prop="status"> <el-form-item label="启用状态" prop="status">
<el-switch v-model="form.status" active-value="1" inactive-value="2" active-text="启用" inactive-text="禁用" /> <el-switch v-model="form.status" :active-value="1" :inactive-value="2" active-text="启用" inactive-text="禁用" />
</el-form-item> </el-form-item>
<el-form-item label="展示位置" prop="lbtType"> <el-form-item label="展示位置" prop="lbtType">
<el-select v-model="form.lbtType" class="m-2" placeholder="请选择"> <el-select v-model="form.lbtType" class="m-2" placeholder="请选择">

View File

@ -0,0 +1,333 @@
<script setup>
//
import api from '@/api/market'
// import capi from '@/api/course'
import custom from '@/utils/custom'
import {formatDate} from '@/utils/format'
// import { toSQLLine } from '@/utils/stringFun'
// import WarningBar from '@/components/warningBar/warningBar.vue'
// import coursePool from './components/coursePool.vue'
// import exercisesPool from '@/view/course/components/exercisesPool.vue'
import {ref,onMounted,provide } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { useRouter, useRoute } from 'vue-router'
const router = useRouter()
const route = useRoute()
//
const assistantInfo = ref({})
const imgs = ref([])
//
onMounted(() => {
getAssistantDetail()
})
// funstions
async function getAssistantDetail() {
const res = await api.getAssistantDetail({id:route.params.id})
if(res.code === 0) {
assistantInfo.value = res.data
// let teacher_cert = JSON.parse(res.data.teacher_cert)
// let skill_cert = JSON.parse(res.data.skill_cert)
// imgs.value = [...skill_cert,...teacher_cert]
// console.log(imgs.value)
}
}
const tip_text = ref('')
const dialogVisible = ref(false)
const a_type = ref(0)
function actionFunc(type) {
dialogVisible.value = true
a_type.value = type
switch (type){
case 3:
tip_text.value = '是否同意该教师申请?';
break;
case 2:
tip_text.value = '是否拒绝该教师申请?';
break;
}
}
async function actionOk() { //
const res = await api.teacherOperator({
teacher_id:assistantInfo.value.user_id,
status:a_type.value
})
if(res.code === 0) {
ElMessage({
type: 'success',
message: res.msg
})
getAssistantDetail()
}
}
function getStateName(state) {
let str = ''
switch (state){
case 1:
str = '待审核'
break;
case 2:
str = '已拒绝'
break;
case 3:
str = '已同意'
break;
}
return str
}
</script>
<template>
<div>
助教详情
<!-- 基本信息-->
<div class="gva-search-box">
<div class="baseInfo-box">
<div class="bb-item">
<img class="avatar" :src="assistantInfo.avatar" alt="">
</div>
<div class="bb-item">
昵称{{assistantInfo.nickname}}
</div>
<div class="bb-item">
ID{{assistantInfo.user_id}}
</div>
<div class="bb-item">
注册时间{{assistantInfo.created_at}}
</div>
<div class="bb-item">
身份助教
</div>
<!-- <div class="bb-item">-->
<!-- 邀请人数105-->
<!-- </div>-->
</div>
</div>
<!-- 章节信息-->
<div class="gva-table-box">
<div class="detail-info-box">
<div class="dib-row">
<div class="dib-item">
<div class="di-left">身份证号码</div>
<div class="di-right">{{assistantInfo.id_card}}</div>
</div>
<div class="dib-item">
<div class="di-left">手机号码</div>
<div class="di-right">{{assistantInfo.phone}}</div>
</div>
</div>
<div class="dib-row">
<div class="dib-item">
<div class="di-left">邀请人姓名</div>
<div class="di-right">{{assistantInfo.invite_nickname}}</div>
</div>
<div class="dib-item">
<div class="di-left">邀请人ID号</div>
<div class="di-right">{{assistantInfo.invite_id}}</div>
</div>
</div>
<div class="dib-row">
<div class="dib-item">
<div class="di-left">邀请人数</div>
<div class="di-right">{{assistantInfo.assistant_info.num}}</div>
</div>
<div class="dib-item">
<div class="di-left">有效人数</div>
<div class="di-right">{{assistantInfo.student_info.num}}</div>
</div>
</div>
<div class="dib-row">
<div class="dib-item">
<div class="di-left">区域</div>
<div class="di-right">{{assistantInfo.province}}</div>
</div>
<div class="dib-item">
<div class="di-left">提交时间</div>
<div class="di-right">{{formatDate(assistantInfo.created_at)}}</div>
</div>
<div class="dib-item">
<div class="di-left">就职单位</div>
<div class="di-right">重庆大学</div>
</div>
<div class="dib-item">
<div class="di-left">任职行业</div>
<div class="di-right">金融</div>
</div>
</div>
<div class="dib-row">
<div class="dib-item">
<div class="di-left">余额</div>
<div class="di-right">{{assistantInfo.balance}}</div>
</div>
<div class="dib-item">
<div class="di-left">累计收益</div>
<div class="di-right">{{assistantInfo.income}}</div>
</div>
<div class="dib-item link-item">
<div class="di-left">查看交易明细</div>
</div>
</div>
<div class="dib-row">
<div class="dib-item">
<div class="di-left">上架课程</div>
<div class="di-right">{{assistantInfo.publish_course}}</div>
</div>
<div class="dib-item link-item">
<div class="di-left">查看课程列表</div>
</div>
</div>
<div class="dib-row">
<div class="dib-item">
<div class="di-left">上架测试</div>
<div class="di-right">{{assistantInfo.publish_exam}}</div>
</div>
<div class="dib-item link-item">
<div class="di-left ">查看试卷列表</div>
</div>
</div>
<div class="dib-row">
<div class="dib-item">
<div class="di-left">销售次数(课程)</div>
<div class="di-right">{{assistantInfo.course_sale}}</div>
</div>
<div class="dib-item">
<div class="di-left">累计金额</div>
<div class="di-right">{{assistantInfo.course_income}}</div>
</div>
<div class="dib-item link-item">
<div class="di-left">查看学习记录</div>
</div>
</div>
<div class="dib-row">
<div class="dib-item">
<div class="di-left">销售次数(测试)</div>
<div class="di-right">{{assistantInfo.exam_sale}}</div>
</div>
<div class="dib-item">
<div class="di-left">累计金额</div>
<div class="di-right">{{assistantInfo.exam_income}}</div>
</div>
<div class="dib-item link-item">
<div class="di-left">查看测试记录</div>
</div>
</div>
<!-- <div class="dib-row" style="margin-top: 50px">-->
<!-- <div class="dib-item">-->
<!-- <div class="di-left">资质证书多张</div>-->
<!-- </div>-->
<!-- <div class="dib-item">-->
<!-- <el-image-->
<!-- v-for="(item,i) in imgs"-->
<!-- class="img-css"-->
<!-- :src="item"-->
<!-- :zoom-rate="1.2"-->
<!-- :preview-src-list="imgs"-->
<!-- :initial-index="4"-->
<!-- fit="cover"-->
<!-- />-->
<!-- </div>-->
<!-- </div>-->
</div>
<!-- 操作区域-->
<!-- <div class="action-box" v-if="assistantInfo.status == 1">-->
<!-- <div class="a-btn approved" @click="actionFunc(3)">同意</div>-->
<!-- <div class="a-btn refuse" @click="actionFunc(2)">拒绝</div>-->
<!-- </div>-->
<!-- <div class="action-box" v-else>-->
<!-- <div class="state-text" :class="{'reuse-text':assistantInfo.status == 2}">{{getStateName(assistantInfo.status)}}</div>-->
<!-- </div>-->
<div class="action-box">
<div class="state-text" :class="{'reuse-text':assistantInfo.status == 2}">{{getStateName(assistantInfo.status)}}</div>
</div>
</div>
<el-dialog
v-model="dialogVisible"
title="操作提醒"
width="30%"
:before-close="handleClose"
>
<span>{{tip_text}}</span>
<template #footer>
<span class="dialog-footer">
<el-button @click="dialogVisible = false">取消</el-button>
<el-button type="primary" @click="actionOk">
确定
</el-button>
</span>
</template>
</el-dialog>
</div>
</template>
<style scoped lang="scss">
.action-box{
display: flex;
margin-top: 20px;
justify-content: center;
.a-btn{
background: rgb(60, 106, 112);
color: white;
padding: 10px 50px;
cursor: pointer;
margin: 10px;
border-radius: 5px;
}
.approved{
}
.refuse{
background: white !important;
color:rgb(60, 106, 112) !important;
border: 1px solid rgb(60, 106, 112) !important;
}
}
/*基本信息*/
.gva-search-box{
.baseInfo-box{
display: flex;
align-items: center;
//justify-content: space-around;
.bb-item{
margin: 10px 20px;
.avatar{
width: 50px;
height: 50px;
border-radius: 50%;
border: 1px solid #cdcdcd;
}
}
}
}
/*详细信息*/
.text{
color: red !important;
}
.state-text{
font-size: 15px;
color: gray;
}
.gva-table-box{
.detail-info-box{
.dib-row{
overflow: hidden;
.link-item{
color: #3C6A70 !important;
cursor: pointer;
}
.dib-item{
//color: gray;
padding: 10px 0;
display: flex;
float: left;
margin-right: 30px;
.di-left{
}
.img-css{
width: 100px;
height: 100px;
margin: 0 10px 10px 0;
cursor: pointer;
}
}
}
}
}
</style>

View File

@ -0,0 +1,315 @@
<script setup>
//
import api from '@/api/market'
import custom from '@/utils/custom'
import {formatDate} from '@/utils/format'
import cityList from '@/utils/city.json'
import {ref,onMounted,provide } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { useRouter, useRoute } from 'vue-router'
const router = useRouter()
const route = useRoute()
// store
import { useUserStore } from '@/pinia/modules/user'
const userStore = useUserStore()
//
// const path = ref(import.meta.env.VITE_BASE_API)
const queryParams = ref({
page:1,
pageSize:10,
name:'',
status:'',
province:''
})
// const subjectParams = ref({
// pageIndex:1,
// pageSize:100,
// })
const state_arr = ref([
{
name:'申请中',
id:1
},
{
name:'拒绝',
id:2
},
{
name:'同意',
id:3
}
])
const tableData = ref([])
const deleteVisible = ref(false)
const total = ref(0)
// const dialogFormVisible = ref(false)
// const dialogTitle = ref('')
// const form =ref({})
// const rules = ref({
// name: [{ required: true, message: '', trigger: 'blur' }]
// })
const question_id = ref(0)
const content = ref(null)
const teacher_ids = ref([])
//
onMounted(() => {
getAssistantList()
})
// provide('subjectList', subjectList)
// provide('current_subject', current_subject)
//
async function getAssistantList() {
const res = await api.getAssistantList(queryParams.value)
if(res.code === 0) {
tableData.value = res.data.records
total.value = res.data.total
}
}
// async function getSubject(){ //
// const res = await capi.getSubjectList(subjectParams.value)
// if(res.code === 0) {
// subjectList.value = custom.getStdSubject(res.data.records)
// }
// }
function onSubmit() {
getAssistantList()
}
const onReset = () => {
queryParams.value = {
pageIndex:1,
pageSize:10,
name:'',
status:'',
subject:''
}
}
async function onDelete() {
const ids = teacher_ids.value
const res = await api.delExamination({ teacher_ids:ids })
if (res.code === 0) {
ElMessage({
type: 'success',
message: res.msg
})
deleteVisible.value = false
getAssistantList()
}
}
const handleSelectionChange = (val) => {
teacher_ids.value = val.map((item) => {
return item.teacher_info_id
})
}
function handleCurrentChange(val) {
queryParams.value.pageIndex = val
getAssistantList()
}
function handleSizeChange(val) {
queryParams.value.pageSize = val
getAssistantList()
}
function viewAssistantFunc(row) { //
router.push({name:'assistantDetail',params:{id:row.user_id}})
}
//
const p_visible = ref(false)
const pFormRules = ref({
desc: [{ required: true, message: '请输入说明', trigger: 'blur' }]
})
const p_type = ref(null); //
const pForm = ref({})
const teacher_id = ref(0)
const p_title = ref('')
function processFunc(row,state) { //
p_type.value = state
p_visible.value = true
teacher_id.value = row.user_id
if(state === 3) { //
p_title.value = '审核同意'
}
else if(state === 2) { //
p_title.value = '审核拒绝'
}
}
function close_pv(){
p_visible.value = false
}
async function pOk() { //
const res = await api.teacherOperator({
teacher_id:teacher_id.value,
status:p_type.value,
desc:pForm.value.desc
})
ElMessage({
type: 'success',
message: res.data.msg
})
if(res.code === 0) {
close_pv()
}
}
</script>
<template>
<div>
<!-- 搜索框-->
<div class="gva-search-box">
<el-form ref="searchForm" :inline="true" :model="queryParams">
<el-form-item label="助教名称">
<el-input v-model="queryParams.name" placeholder="根据助教名称进行查询" />
</el-form-item>
<el-form-item label="助教状态">
<el-select v-model="queryParams.status" clearable placeholder="请选择">
<el-option
v-for="item in state_arr"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button size="small" type="primary" icon="search" @click="onSubmit">查询</el-button>
<el-button size="small" icon="refresh" @click="onReset">重置</el-button>
</el-form-item>
</el-form>
</div>
<!-- 表格数据-->
<div class="gva-table-box">
<!-- 批量操作-->
<div class="gva-btn-list">
<el-popover v-model="deleteVisible" placement="top" width="160">
<p>确定要删除吗</p>
<div style="text-align: right; margin-top: 8px;">
<el-button size="small" type="primary" link @click="deleteVisible = false">取消</el-button>
<el-button size="small" type="primary" @click="onDelete">确定</el-button>
</div>
</el-popover>
</div>
<!-- 数据列表-->
<el-table :data="tableData" @selection-change="handleSelectionChange">
<el-table-column align="center" label="ID" prop="user_id" sortable="custom" />
<el-table-column align="center" label="头像">
<template #default="scope">
<img class="avatar-box" :src="scope.row.avatar" alt="">
</template>
</el-table-column>
<el-table-column align="center" label="姓名" prop="nickname" />
<el-table-column align="center" label="手机号" min-width="150" prop="phone" />
<el-table-column align="center" label="申请时间" min-width="150" >
<template #default="scope">
{{formatDate(scope.row.created_at)}}
</template>
</el-table-column>
<el-table-column align="center" label="所属区域" min-width="150">
<template #default="scope">
{{scope.row.province>-1?cityList[scope.row.province].name:''}}
</template>
</el-table-column>
<el-table-column align="center" label="管理学员" prop="invite_id" />
<el-table-column align="center" label="课程订单" prop="invite_id" />
<el-table-column align="center" label="收益" prop="invite_id" />
<el-table-column align="center" label="试卷订单" prop="invite_id" />
<el-table-column align="center" label="收益" prop="invite_id" />
<el-table-column align="center" label="推荐老师" prop="invite_id" />
<el-table-column align="center" label="收益" prop="invite_id" />
<!-- <el-table-column align="center" label="推荐人ID" prop="invite_id" />-->
<!-- <el-table-column align="center" label="授课次数" prop="publish_course" />-->
<!-- <el-table-column align="center" label="测试次数" prop="publish_exam" />-->
<!-- <el-table-column align="center" label="累计销售" prop="exam_sale" />-->
<!-- <el-table-column align="center" label="状态" prop="exam_sale">-->
<!-- <template #default="scope">-->
<!-- <div>{{scope.row.status == 1?'审核中':scope.row.status == 2?'已同意':'已拒绝'}}</div>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column align="center" label="审核说明" prop="desc" />-->
<el-table-column align="center" fixed="right" label="操作" width="200">
<template #default="scope">
<el-button
icon="view"
size="small"
type="primary"
link
@click="viewAssistantFunc(scope.row)"
>查看</el-button>
<el-button v-if="scope.row.status == 1"
icon="edit"
size="small"
type="primary"
link
@click="processFunc(scope.row,2)"
>同意</el-button>
<el-button v-if="scope.row.status == 1"
icon="delete"
size="small"
type="danger"
link
@click="processFunc(scope.row,3)"
>拒绝</el-button>
</template>
</el-table-column>
</el-table>
<div class="gva-pagination">
<el-pagination
:current-page="queryParams.page"
:page-size="queryParams.pageSize"
:page-sizes="[10, 30, 50, 100]"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@current-change="handleCurrentChange"
@size-change="handleSizeChange"
/>
</div>
</div>
<!-- 审核窗口-->
<el-dialog
v-model="p_visible"
:title="p_title"
width="30%"
:before-close="close_pv"
>
<el-form ref="apiForm" :model="pForm" :rules="pFormRules" label-width="80px">
<el-form-item label="审核说明" prop="name">
<el-input v-model="pForm.desc" autocomplete="off" />
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="p_visible = false">取消</el-button>
<el-button type="primary" @click="pOk">
确定
</el-button>
</span>
</template>
</el-dialog>
</div>
</template>
<style scoped lang="scss">
.avatar-box{
width: 50px;
height: 50px;
border-radius: 50%;
border: 1px solid #dbdbdb;
}
.e-img{
width: 150px;
height: 100px;
}
.option-item{
display: flex;
align-items: center;
margin-bottom: 10px;
}
.button-box {
padding: 10px 20px;
.el-button {
float: right;
}
}
.warning {
color: #dc143c;
}
</style>

View File

@ -0,0 +1,305 @@
<script setup>
//
import api from '@/api/teacher'
import custom from '@/utils/custom'
import {formatDate} from '@/utils/format'
import cityList from '@/utils/city.json'
import {ref,onMounted,provide } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { useRouter, useRoute } from 'vue-router'
const router = useRouter()
const route = useRoute()
// store
import { useUserStore } from '@/pinia/modules/user'
const userStore = useUserStore()
//
// const path = ref(import.meta.env.VITE_BASE_API)
const queryParams = ref({
page:1,
pageSize:10,
name:'',
status:'',
province:''
})
// const subjectParams = ref({
// pageIndex:1,
// pageSize:100,
// })
const state_arr = ref([
{
name:'申请中',
id:1
},
{
name:'拒绝',
id:2
},
{
name:'同意',
id:3
}
])
const tableData = ref([])
const deleteVisible = ref(false)
const total = ref(0)
// const dialogFormVisible = ref(false)
// const dialogTitle = ref('')
// const form =ref({})
// const rules = ref({
// name: [{ required: true, message: '', trigger: 'blur' }]
// })
const question_id = ref(0)
const content = ref(null)
const teacher_ids = ref([])
//
onMounted(() => {
getAssistantList()
})
// provide('subjectList', subjectList)
// provide('current_subject', current_subject)
//
async function getAssistantList() {
const res = await api.getAssistantList(queryParams.value)
if(res.code === 0) {
tableData.value = res.data.records
total.value = res.data.total
}
}
// async function getSubject(){ //
// const res = await capi.getSubjectList(subjectParams.value)
// if(res.code === 0) {
// subjectList.value = custom.getStdSubject(res.data.records)
// }
// }
function onSubmit() {
getAssistantList()
}
const onReset = () => {
queryParams.value = {
pageIndex:1,
pageSize:10,
name:'',
status:'',
subject:''
}
}
async function onDelete() {
const ids = teacher_ids.value
const res = await api.delExamination({ teacher_ids:ids })
if (res.code === 0) {
ElMessage({
type: 'success',
message: res.msg
})
deleteVisible.value = false
getAssistantList()
}
}
const handleSelectionChange = (val) => {
teacher_ids.value = val.map((item) => {
return item.teacher_info_id
})
}
function handleCurrentChange(val) {
queryParams.value.pageIndex = val
getAssistantList()
}
function handleSizeChange(val) {
queryParams.value.pageSize = val
getAssistantList()
}
function viewTeacherFunc(row) { //
router.push({name:'teacherDetail',params:{id:row.teacher_info_id}})
}
//
const p_visible = ref(false)
const pFormRules = ref({
desc: [{ required: true, message: '请输入说明', trigger: 'blur' }]
})
const p_type = ref(null); //
const pForm = ref({})
const teacher_id = ref(0)
const p_title = ref('')
function processFunc(row,state) { //
p_type.value = state
p_visible.value = true
teacher_id.value = row.user_id
if(state === 3) { //
p_title.value = '审核同意'
}
else if(state === 2) { //
p_title.value = '审核拒绝'
}
}
function close_pv(){
p_visible.value = false
}
async function pOk() { //
const res = await api.teacherOperator({
teacher_id:teacher_id.value,
status:p_type.value,
desc:pForm.value.desc
})
ElMessage({
type: 'success',
message: res.data.msg
})
if(res.code === 0) {
close_pv()
}
}
</script>
<template>
<div>
<!-- 搜索框-->
<div class="gva-search-box">
<el-form ref="searchForm" :inline="true" :model="queryParams">
<el-form-item label="教师名称">
<el-input v-model="queryParams.name" placeholder="根据教师名称进行查询" />
</el-form-item>
<el-form-item label="教师状态">
<el-select v-model="queryParams.status" clearable placeholder="请选择">
<el-option
v-for="item in state_arr"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button size="small" type="primary" icon="search" @click="onSubmit">查询</el-button>
<el-button size="small" icon="refresh" @click="onReset">重置</el-button>
</el-form-item>
</el-form>
</div>
<!-- 表格数据-->
<div class="gva-table-box">
<!-- 批量操作-->
<div class="gva-btn-list">
<el-popover v-model="deleteVisible" placement="top" width="160">
<p>确定要删除吗</p>
<div style="text-align: right; margin-top: 8px;">
<el-button size="small" type="primary" link @click="deleteVisible = false">取消</el-button>
<el-button size="small" type="primary" @click="onDelete">确定</el-button>
</div>
</el-popover>
</div>
<!-- 数据列表-->
<el-table :data="tableData" @selection-change="handleSelectionChange">
<el-table-column align="center" label="ID" prop="teacher_info_id" sortable="custom" />
<el-table-column align="center" label="头像">
<template #default="scope">
<img class="avatar-box" :src="scope.row.avatar" alt="">
</template>
</el-table-column>
<el-table-column align="center" label="姓名" prop="name" />
<el-table-column align="center" label="手机号" min-width="150" prop="phone" />
<el-table-column align="center" label="所属区域" min-width="150" prop="province">
<template #default="scope">
{{cityList[scope.row.province].name}}
</template>
</el-table-column>
<el-table-column align="center" label="申请时间" min-width="150" >
<template #default="scope">
{{formatDate(scope.row.CreatedAt)}}
</template>
</el-table-column>
<el-table-column align="center" label="推荐人ID" prop="invite_id" />
<el-table-column align="center" label="授课次数" prop="publish_course" />
<el-table-column align="center" label="测试次数" prop="publish_exam" />
<el-table-column align="center" label="累计销售" prop="exam_sale" />
<el-table-column align="center" label="状态" prop="exam_sale">
<template #default="scope">
<div>{{scope.row.status == 1?'审核中':scope.row.status == 2?'已同意':'已拒绝'}}</div>
</template>
</el-table-column>
<el-table-column align="center" label="审核说明" prop="desc" />
<el-table-column align="center" fixed="right" label="操作" width="200">
<template #default="scope">
<el-button
icon="view"
size="small"
type="primary"
link
@click="viewTeacherFunc(scope.row)"
>查看</el-button>
<el-button v-if="scope.row.status == 1"
icon="edit"
size="small"
type="primary"
link
@click="processFunc(scope.row,2)"
>同意</el-button>
<el-button v-if="scope.row.status == 1"
icon="delete"
size="small"
type="danger"
link
@click="processFunc(scope.row,3)"
>拒绝</el-button>
</template>
</el-table-column>
</el-table>
<div class="gva-pagination">
<el-pagination
:current-page="queryParams.page"
:page-size="queryParams.pageSize"
:page-sizes="[10, 30, 50, 100]"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@current-change="handleCurrentChange"
@size-change="handleSizeChange"
/>
</div>
</div>
<!-- 审核窗口-->
<el-dialog
v-model="p_visible"
:title="p_title"
width="30%"
:before-close="close_pv"
>
<el-form ref="apiForm" :model="pForm" :rules="pFormRules" label-width="80px">
<el-form-item label="审核说明" prop="name">
<el-input v-model="pForm.desc" autocomplete="off" />
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="p_visible = false">取消</el-button>
<el-button type="primary" @click="pOk">
确定
</el-button>
</span>
</template>
</el-dialog>
</div>
</template>
<style scoped lang="scss">
.avatar-box{
width: 50px;
height: 50px;
border-radius: 50%;
border: 1px solid #dbdbdb;
}
.e-img{
width: 150px;
height: 100px;
}
.option-item{
display: flex;
align-items: center;
margin-bottom: 10px;
}
.button-box {
padding: 10px 20px;
.el-button {
float: right;
}
}
.warning {
color: #dc143c;
}
</style>

View File

@ -25,7 +25,7 @@ const queryParams = ref({
page:1, page:1,
pageSize:10, pageSize:10,
name:'', name:'',
status:'' status:1
}) })
const subjectParams = ref({ const subjectParams = ref({
pageIndex:1, pageIndex:1,

View File

@ -207,11 +207,14 @@ function getStateName(state) {
</div> </div>
<!-- 操作区域--> <!-- 操作区域-->
<div class="action-box" v-if="teacherInfo.status == 1"> <!-- <div class="action-box" v-if="teacherInfo.status == 1">-->
<div class="a-btn approved" @click="actionFunc(3)">同意</div> <!-- <div class="a-btn approved" @click="actionFunc(3)">同意</div>-->
<div class="a-btn refuse" @click="actionFunc(2)">拒绝</div> <!-- <div class="a-btn refuse" @click="actionFunc(2)">拒绝</div>-->
</div> <!-- </div>-->
<div class="action-box" v-else> <!-- <div class="action-box" v-else>-->
<!-- <div class="state-text" :class="{'reuse-text':teacherInfo.status == 2}">{{getStateName(teacherInfo.status)}}</div>-->
<!-- </div>-->
<div class="action-box">
<div class="state-text" :class="{'reuse-text':teacherInfo.status == 2}">{{getStateName(teacherInfo.status)}}</div> <div class="state-text" :class="{'reuse-text':teacherInfo.status == 2}">{{getStateName(teacherInfo.status)}}</div>
</div> </div>
</div> </div>

View File

@ -2,14 +2,9 @@
<script setup> <script setup>
// //
import api from '@/api/teacher' import api from '@/api/teacher'
import capi from '@/api/course'
import custom from '@/utils/custom' import custom from '@/utils/custom'
import {formatDate} from '@/utils/format' import {formatDate} from '@/utils/format'
import cityList from '@/utils/city.json' import cityList from '@/utils/city.json'
// import { toSQLLine } from '@/utils/stringFun'
// import WarningBar from '@/components/warningBar/warningBar.vue'
// import coursePool from './components/coursePool.vue'
// import exercisesPool from '@/view/course/components/exercisesPool.vue'
import {ref,onMounted,provide } from 'vue' import {ref,onMounted,provide } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus' import { ElMessage, ElMessageBox } from 'element-plus'
import { useRouter, useRoute } from 'vue-router' import { useRouter, useRoute } from 'vue-router'
@ -19,18 +14,17 @@ const route = useRoute()
import { useUserStore } from '@/pinia/modules/user' import { useUserStore } from '@/pinia/modules/user'
const userStore = useUserStore() const userStore = useUserStore()
// //
const path = ref(import.meta.env.VITE_BASE_API) // const path = ref(import.meta.env.VITE_BASE_API)
// const typeList = custom.getExercisesTypeList()
const queryParams = ref({ const queryParams = ref({
page:1, page:1,
pageSize:10, pageSize:10,
name:'', name:'',
status:'' status:''
}) })
const subjectParams = ref({ // const subjectParams = ref({
pageIndex:1, // pageIndex:1,
pageSize:100, // pageSize:100,
}) // })
const state_arr = ref([ const state_arr = ref([
{ {
name:'申请中', name:'申请中',
@ -46,29 +40,23 @@ const state_arr = ref([
} }
]) ])
const tableData = ref([]) const tableData = ref([])
const subjectList = ref([])
const current_subject = ref('')
const deleteVisible = ref(false) const deleteVisible = ref(false)
const question_ids = ref([])
const total = ref(0) const total = ref(0)
const dialogFormVisible = ref(false) // const dialogFormVisible = ref(false)
const dialogTitle = ref('') // const dialogTitle = ref('')
const form =ref({}) // const form =ref({})
const rules = ref({ // const rules = ref({
name: [{ required: true, message: '请输入课程名称', trigger: 'blur' }] // name: [{ required: true, message: '', trigger: 'blur' }]
}) // })
const question_id = ref(0) const question_id = ref(0)
const content = ref(null) const content = ref(null)
// const options = ref([]) // const teacher_ids = ref([])
const exam_types = ref([])
const exam_ids = ref([])
// //
onMounted(() => { onMounted(() => {
getTeacherList() getTeacherList()
// getSubject()
}) })
provide('subjectList', subjectList) // provide('subjectList', subjectList)
provide('current_subject', current_subject) // provide('current_subject', current_subject)
// //
async function getTeacherList() { async function getTeacherList() {
const res = await api.getTeacherList(queryParams.value) const res = await api.getTeacherList(queryParams.value)
@ -77,12 +65,12 @@ async function getTeacherList() {
total.value = res.data.total total.value = res.data.total
} }
} }
async function getSubject(){ // // async function getSubject(){ //
const res = await capi.getSubjectList(subjectParams.value) // const res = await capi.getSubjectList(subjectParams.value)
if(res.code === 0) { // if(res.code === 0) {
subjectList.value = custom.getStdSubject(res.data.records) // subjectList.value = custom.getStdSubject(res.data.records)
} // }
} // }
function onSubmit() { function onSubmit() {
getTeacherList() getTeacherList()
} }
@ -95,70 +83,21 @@ const onReset = () => {
subject:'' subject:''
} }
} }
function openDialog(type) {
// let params = {}
switch (type){
case 'add':
dialogTitle.value = '新增试卷'
form.value = {}
break;
case 'edit':
// params.question_id = question_id.value
dialogTitle.value = '编辑试卷'
break;
}
dialogFormVisible.value = true
// router.push({name:'addCourse',params})
}
async function onDelete() { async function onDelete() {
const ids = exam_ids.value const ids = teacher_ids.value
const res = await api.delExamination({ exam_ids:ids }) const res = await api.delExamination({ teacher_ids:ids })
if (res.code === 0) { if (res.code === 0) {
ElMessage({ ElMessage({
type: 'success', type: 'success',
message: res.msg message: res.msg
}) })
// if (tableData.value.length === ids.length && page.value > 1) {
// page.value--
// }
deleteVisible.value = false deleteVisible.value = false
getTeacherList() getTeacherList()
} }
} }
const handleSelectionChange = (val) => { const handleSelectionChange = (val) => {
exam_ids.value = val.map((item) => { teacher_ids.value = val.map((item) => {
return item.exam_id return item.teacher_info_id
})
}
function editCourseFunc(row) {
row.course_ids = JSON.parse(row.course_ids)
row.question_ids = JSON.parse(row.question_ids)
form.value = row.exam
exam_types.value = row.exam_types.map((item) => {
return item.persons
})
current_subject.value = form.value.subject
openDialog('edit')
}
function deleteExamFunc(row) {
ElMessageBox.confirm('此操作将永久删除该数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(async() => {
const res = await api.delExamination({
exam_ids:[row.exam_id]
})
if (res.code === 0) {
ElMessage({
type: 'success',
message: '删除成功!'
})
getTeacherList()
}
},() => {
}) })
} }
function handleCurrentChange(val) { function handleCurrentChange(val) {
@ -169,107 +108,45 @@ function handleSizeChange(val) {
queryParams.value.pageSize = val queryParams.value.pageSize = val
getTeacherList() getTeacherList()
} }
function closeDialog(){ function viewTeacherFunc(row) { //
dialogFormVisible.value = false
exam_types.value = []
form.value = {}
}
async function enterDialog() { //
form.value.teacher_id = 0
form.value.exam_type = exam_types.value.map((item) => {
return item = parseInt(item)
})
form.value.duration = parseInt(form.value.duration)
// return
const params = {
...form.value
}
params.question_ids = JSON.stringify(form.value.question_ids)
params.course_ids = JSON.stringify(form.value.course_ids)
let func_name = 'addExamination'
if(form.value.exam_id) { //
func_name = 'editExamination'
}
const res = await api[func_name](params)
if(res.code === 0) {
ElMessage({
type: 'success',
message: res.msg
})
closeDialog()
getTeacherList()
}
}
function viewTeacherFunc(row) { //
console.log(row)
router.push({name:'teacherDetail',params:{id:row.teacher_info_id}}) router.push({name:'teacherDetail',params:{id:row.teacher_info_id}})
} }
function getExercisesName(row) { //
return JSON.parse(row.question).title const p_visible = ref(false)
} const pFormRules = ref({
// const std_options_title = ref(['A','B','C','D','E','F']) desc: [{ required: true, message: '请输入说明', trigger: 'blur' }]
function addOptionFunc() { })
exam_types.value.push('') const p_type = ref(null); //
} const pForm = ref({})
function delet_func() { const teacher_id = ref(0)
exam_types.value.pop() const p_title = ref('')
} function processFunc(row,state) { //
function getStateName(state) { p_type.value = state
let str = '' p_visible.value = true
switch (state){ teacher_id.value = row.user_id
case 1: if(state === 3) { //
str = '未付款' p_title.value = '审核同意'
break;
case 2:
str = '已付款'
break;
case 3:
str = '已过期'
break;
} }
return str else if(state === 2) { //
} p_title.value = '审核拒绝'
function handleAvatarSuccess(res) {
form.value.cover = res.data.file.url
// handlerChange()
}
function beforeAvatarUpload(file) {
const isLt05M = file.size / 1024 / 1024 < 20
const isJPG = file.type.indexOf('image/') === -1
if (isJPG) {
ElMessage.error('文件格式错误,请上传图片类型,如JPGPNG后缀的文件')
} }
if (!isLt05M) { }
ElMessage.error('上传头像图片大小不能超过 2M!') function close_pv(){
p_visible.value = false
}
async function pOk() { //
const res = await api.teacherOperator({
teacher_id:teacher_id.value,
status:p_type.value,
desc:pForm.value.desc
})
ElMessage({
type: 'success',
message: res.data.msg
})
if(res.code === 0) {
close_pv()
} }
return !isJPG && isLt05M
}
function changeSubjectFunc(e) {
current_subject.value = e
}
function addExercisesFunc(data) {
form.value.question_ids = data
}
function addCourseFunc(data) {
form.value.course_ids = data
}
function getTypeName(type) {
let name = ""
switch (type) {
case 1:
name = '课程';
break;
case 2:
name = '章节';
break;
case 3:
name = '子章节';
break;
case 4:
name = '试卷';
break;
}
return name
} }
</script> </script>
<template> <template>
@ -280,16 +157,16 @@ function getTypeName(type) {
<el-form-item label="教师名称"> <el-form-item label="教师名称">
<el-input v-model="queryParams.name" placeholder="根据教师名称进行查询" /> <el-input v-model="queryParams.name" placeholder="根据教师名称进行查询" />
</el-form-item> </el-form-item>
<!-- <el-form-item label="教师状态">--> <el-form-item label="教师状态">
<!-- <el-select v-model="queryParams.status" clearable placeholder="请选择">--> <el-select v-model="queryParams.status" clearable placeholder="请选择">
<!-- <el-option--> <el-option
<!-- v-for="item in state_arr"--> v-for="item in state_arr"
<!-- :key="item.id"--> :key="item.id"
<!-- :label="item.name"--> :label="item.name"
<!-- :value="item.id"--> :value="item.id"
<!-- />--> />
<!-- </el-select>--> </el-select>
<!-- </el-form-item>--> </el-form-item>
<el-form-item> <el-form-item>
<el-button size="small" type="primary" icon="search" @click="onSubmit">查询</el-button> <el-button size="small" type="primary" icon="search" @click="onSubmit">查询</el-button>
<el-button size="small" icon="refresh" @click="onReset">重置</el-button> <el-button size="small" icon="refresh" @click="onReset">重置</el-button>
@ -332,11 +209,12 @@ function getTypeName(type) {
<el-table-column align="center" label="授课次数" prop="publish_course" /> <el-table-column align="center" label="授课次数" prop="publish_course" />
<el-table-column align="center" label="测试次数" prop="publish_exam" /> <el-table-column align="center" label="测试次数" prop="publish_exam" />
<el-table-column align="center" label="累计销售" prop="exam_sale" /> <el-table-column align="center" label="累计销售" prop="exam_sale" />
<!-- <el-table-column align="center" label="状态" prop="exam_sale">--> <el-table-column align="center" label="状态" prop="exam_sale">
<!-- <template #default="scope">--> <template #default="scope">
<!-- <div>{{scope.row.status == 1?'查看':scope.row.status == 2?'已拒绝':'已同意'}}</div>--> <div>{{scope.row.status == 1?'审核中':scope.row.status == 2?'已同意':'已拒绝'}}</div>
<!-- </template>--> </template>
<!-- </el-table-column>--> </el-table-column>
<el-table-column align="center" label="审核说明" prop="desc" />
<el-table-column align="center" fixed="right" label="操作" width="200"> <el-table-column align="center" fixed="right" label="操作" width="200">
<template #default="scope"> <template #default="scope">
<el-button <el-button
@ -351,14 +229,14 @@ function getTypeName(type) {
size="small" size="small"
type="primary" type="primary"
link link
@click="viewTeacherFunc(scope.row)" @click="processFunc(scope.row,2)"
>同意</el-button> >同意</el-button>
<el-button v-if="scope.row.status == 1" <el-button v-if="scope.row.status == 1"
icon="delete" icon="delete"
size="small" size="small"
type="danger" type="danger"
link link
@click="deleteExamFunc(scope.row)" @click="processFunc(scope.row,3)"
>拒绝</el-button> >拒绝</el-button>
</template> </template>
</el-table-column> </el-table-column>
@ -375,6 +253,27 @@ function getTypeName(type) {
/> />
</div> </div>
</div> </div>
<!-- 审核窗口-->
<el-dialog
v-model="p_visible"
:title="p_title"
width="30%"
:before-close="close_pv"
>
<el-form ref="apiForm" :model="pForm" :rules="pFormRules" label-width="80px">
<el-form-item label="审核说明" prop="name">
<el-input v-model="pForm.desc" autocomplete="off" />
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="p_visible = false">取消</el-button>
<el-button type="primary" @click="pOk">
确定
</el-button>
</span>
</template>
</el-dialog>
</div> </div>
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@ -120,7 +120,7 @@ function toDealDetail(type) {
<div class="di-right">{{userManageInfo.course_sale}}</div> <div class="di-right">{{userManageInfo.course_sale}}</div>
</div> </div>
<div class="dib-item"> <div class="dib-item">
<div class="di-left">累计金额</div> <div class="di-left">累计消费金额</div>
<div class="di-right">{{userManageInfo.course_income}}</div> <div class="di-right">{{userManageInfo.course_income}}</div>
</div> </div>
<div class="dib-item link-item" @click="toDealDetail(detail_type.learningDetail)"> <div class="dib-item link-item" @click="toDealDetail(detail_type.learningDetail)">