全面优化

master
axlrose2333 1 year ago
parent a2087efdc9
commit a3c4468ee9

Binary file not shown.

@ -36,5 +36,12 @@ const api = {
params:data params:data
}) })
}, },
getExaminationDetail: data => { // 获取试卷详情
return service({
url: '/exam/'+data.id,
method: 'get',
params:data
})
},
} }
export default api export default api

File diff suppressed because it is too large Load Diff

@ -64,8 +64,10 @@ const custom = {
return name return name
}, },
getProvinceName(province) { getProvinceName(province) {
if(province < 0 || !province) return '' if(province != 0) {
return cityList[province].name if(province < 0 || !province) return ''
}
return cityList[province].province
}, },
getExamGroupType() { getExamGroupType() {
return [ return [
@ -173,7 +175,57 @@ const custom = {
} }
} }
return str return str
},dateFmt(date, fmt = 'yyyy-mm-dd HH:MM') {
if (!date) return ''
// if (typeof(date) == 'string') {
// date = date.replace(/-/g, '/');
// // date = date.replace(/\./g, '/');
// }
date = new Date(date);
let ret;
let opt = {
"y+": date.getFullYear().toString(), // 年
"m+": (date.getMonth() + 1).toString(), // 月
"d+": date.getDate().toString(), // 日
"H+": date.getHours().toString(), // 时
"M+": date.getMinutes().toString(), // 分
"S+": date.getSeconds().toString() // 秒
// 有其他格式化字符需求可以继续添加,必须转化成字符串
};
for (let k in opt) {
ret = new RegExp("(" + k + ")").exec(fmt);
if (ret) {
fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
};
};
return fmt;
},
getCourseStateName(state){ // 获取课程状态名称
let name = ''
switch(state) {
case -1:
name = '未上架';
break;
case 1:
name = '已上架';
break;
case 2:
name = '待审核';
break;
case 3:
name = '审核通过';
break;
case 4:
name = '审核拒绝';
break;
}
return name
}, },
getStdPrice(price) { // 获取标准格式价格
return Number(price)/100;
},
getDealType() { // 获取交易类型 getDealType() { // 获取交易类型
return [ return [
{ {

@ -336,7 +336,7 @@ function closeViewDialog() {
</el-popover> </el-popover>
</div> </div>
<!-- 数据列表--> <!-- 数据列表-->
<el-table :data="tableData" border @selection-change="handleSelectionChange"> <el-table border :data="tableData" @selection-change="handleSelectionChange">
<el-table-column <el-table-column
type="selection" type="selection"
width="55" width="55"

@ -122,7 +122,8 @@ async function saveStep1() {
async function getSubject(){ // async function getSubject(){ //
const res = await api.getSubjectList(subjectParams.value) const res = await api.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)
subjectList.value = custom.addTreeFormatSubject(res.data.records,'id')
} }
} }
async function uploadAction(file){// oss async function uploadAction(file){// oss
@ -254,6 +255,9 @@ async function enterVerifyDialog() { // 审核提交
}) })
} }
} }
function goListFunc() {
router.push({name:'courseManage'})
}
</script> </script>
<template> <template>
<div> <div>
@ -272,14 +276,15 @@ async function enterVerifyDialog() { // 审核提交
<el-input disabled placeholder="请输入课程名称" v-model="form.name" @change="handlerChange" /> <el-input disabled placeholder="请输入课程名称" v-model="form.name" @change="handlerChange" />
</el-form-item> </el-form-item>
<el-form-item label="课程分类" prop="subject"> <el-form-item label="课程分类" prop="subject">
<el-select disabled v-model="form.subject" placeholder="请选择" @change="handlerChange"> <!-- <el-select disabled v-model="form.subject" placeholder="请选择" @change="handlerChange">-->
<el-option <!-- <el-option-->
v-for="item in subjectList" <!-- v-for="item in subjectList"-->
:key="item.id" <!-- :key="item.id"-->
:label="item.name" <!-- :label="item.name"-->
:value="item.name" <!-- :value="item.name"-->
/> <!-- />-->
</el-select> <!-- </el-select>-->
<el-tree-select v-model="form.subject" :data="subjectList" :render-after-expand="false" />
</el-form-item> </el-form-item>
<el-form-item label="封面"> <el-form-item label="封面">
<el-upload <el-upload
@ -338,8 +343,9 @@ async function enterVerifyDialog() { // 审核提交
</div> </div>
<div class="btn-box" style="text-align: right"> <div class="btn-box" style="text-align: right">
<el-button v-if="active>0" @click="stepChangeFunc(1)"></el-button> <el-button v-if="active>0" @click="stepChangeFunc(1)"></el-button>
<el-button v-if="active<1" type="primary" @click="stepChangeFunc(2)"></el-button> <el-button v-if="active<1" @click="stepChangeFunc(2)"></el-button>
<el-button v-if="form.status === 2" type="primary" @click="checkCourseFunc"></el-button> <el-button v-if="form.status === 2" type="primary" @click="checkCourseFunc"></el-button>
<el-button plain @click="goListFunc"></el-button>
</div> </div>
</div> </div>
<!-- 审核窗口--> <!-- 审核窗口-->

@ -10,9 +10,6 @@ export default {
// //
import _ from 'lodash' import _ from 'lodash'
import api from '@/api/course' import api from '@/api/course'
// import com_api from '@/api/common'
// import custom from '@/utils/custom'
// import WarningBar from '@/components/warningBar/warningBar.vue'
import {ref,onMounted,watch } from 'vue' import {ref,onMounted,watch } 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'
@ -23,31 +20,13 @@ const userStore = useUserStore()
import mediaCom from '../components/mediaPool.vue' import mediaCom from '../components/mediaPool.vue'
import exercisesCom from '../components/exercisesPool.vue' import exercisesCom from '../components/exercisesPool.vue'
import examCom from '../components/examinationPool.vue' import examCom from '../components/examinationPool.vue'
import viewExamCom from '../components/viewExamination.vue'
const props = defineProps(['course_id','chapter_info']) const props = defineProps(['course_id','chapter_info'])
const emit = defineEmits(['reload']) const emit = defineEmits(['reload'])
import UploadCommon from '@/components/upload/common.vue'
// //
const is_sub = ref(-1)
const dialogChapterVisible = ref(false)
// const dialogChapterTitle = ref('')
const chapterForm = ref({pid:0,sort:0})
const chapterRules = ref({
name: [{ required: true, message: '请输入章节名称', trigger: 'blur' }]
})
const chapter_data = ref([]) const chapter_data = ref([])
const dialogChapterChildVisible = ref(false)
const chapterChildForm = ref({sort:0})
const chapterChildRules = ref({
name: [{ required: true, message: '请输入章节名称', trigger: 'blur' }],
price: [{ required: true, message: '请输入章节价格', trigger: 'blur' }]
})
const dialogChapterTitle = ref('')
const dialogChapterChildTitle = ref('')
// const path = ref(import.meta.env.VITE_BASE_API)
const imageCommon = ref('')
// const current_chapter = ref({}) //
// const current_chapter_child = ref({}) //
// const chapter_index = ref(0)
// //
onMounted(() => { onMounted(() => {
chapter_data.value = props.chapter_info chapter_data.value = props.chapter_info
@ -55,130 +34,31 @@ onMounted(() => {
watch(props,(old, newProps) => { watch(props,(old, newProps) => {
chapter_data.value = props.chapter_info chapter_data.value = props.chapter_info
}) })
//
function addChapterFunc() { //
chapterForm.value = {pid:0,sort:0}
dialogChapterVisible.value = true
dialogChapterTitle.value = '添加大章节'
}
async function deleteChapterFunc(item) { //
is_sub.value = -1
delFunc(item.course_chapter_id)
}
function delFunc(id) {
ElMessageBox.confirm('此操作将永久删除该数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(async() => {
const res = await api.delChapter({
ids:[id],
course_id:parseInt(props.course_id),
sub:parseInt(is_sub.value)
})
if (res.code === 0) {
ElMessage({
type: 'success',
message: '删除成功!'
})
emit('reload')
}
},() => {
})
}
function editChapterFunc(item) { //
chapterForm.value = item
dialogChapterVisible.value = true
dialogChapterTitle.value = '编辑大章节'
}
function closeChapterDialog() {
dialogChapterVisible.value = false
}
function closeChapterChildDialog() {
dialogChapterChildVisible.value = false
chapterChildForm.value = {sort:0}
}
async function enterChapterDialog() { //
// return
chapterForm.value.sort = parseInt(chapterForm.value.sort)
const params = {
...chapterForm.value //
} function indexMethod(index) {
let func_name = '' return index +=1
if(chapterForm.value.course_chapter_id) { //
func_name = 'editChapter'
params.course_id = parseInt(props.course_id)
}
else{ //
func_name = 'addChapter'
params.course_id = parseInt(props.course_id)
}
const res = await api[func_name](params)
if(res.code === 0) {
ElMessage({
type: 'success',
message: '操作成功!'
})
closeChapterDialog()
emit('reload')
}
}
function addChapterchildFunc(item) { //
dialogChapterChildTitle.value = '新增子章节'
// current_chapter.value = item
chapterChildForm.value = {pid:item.course_chapter_id,sort:0}
dialogChapterChildVisible.value = true
}
function editChapterChildFunc(item,main_index) { //
dialogChapterChildTitle.value = '编辑子章节'
// current_chapter.value = chapter_data.value[main_index]
// item.exam_ids =item.exam_id?[item.exam_id]: []
item.examination_id = item.exam_id
chapterChildForm.value = _.cloneDeep(item)
chapterChildForm.value.price /= 100
dialogChapterChildVisible.value = true
}
function deleteChapterChildFunc(item) { //
is_sub.value = 1
delFunc(item.course_subsection_id)
} }
async function enterChapterChildDialog() { // //
chapterChildForm.value.sort = parseInt(chapterChildForm.value.sort) const videoDialogTitle = ref('')
// chapterChildForm.value.price = parseInt(chapterChildForm.value.price*100) const dialogVideoVisible = ref(false)
chapterChildForm.value.price = chapterChildForm.value.price*100 const video_url = ref(null)
const params = { function viewFunc(row,type) { // /
...chapterChildForm.value if(type ===1) { //
videoDialogTitle.value = '章节:'+row.name
// console.log(row)
dialogVideoVisible.value = true
video_url.value = row.url
} }
let func_name = '' else{ //
// return // dialogFormVisible.value = true
if(chapterChildForm.value.course_subsection_id){ //
func_name = 'editChapter'
params.course_id = parseInt(props.course_id)
}
else{ //
func_name = 'addChapter'
params.course_id = parseInt(props.course_id)
}
const res = await api[func_name](params)
if(res.code === 0) {
ElMessage({
type: 'success',
message: '操作成功!'
})
closeChapterChildDialog()
emit('reload')
} }
} }
function getFilePath(file) { // function closeVideoDialog() {
chapterChildForm.value.url = file.url dialogVideoVisible.value = false
chapterChildForm.value.url_name = file.url_name
}
function addExamFunc(data) {
chapterChildForm.value.examination_id = data
chapterChildForm.value.exam_id = data
} }
</script> </script>
<template> <template>
<div> <div>
@ -189,146 +69,46 @@ function addExamFunc(data) {
<div class="lb-card" v-for="(item,i) in chapter_data"> <div class="lb-card" v-for="(item,i) in chapter_data">
<!--大章节标题--> <!--大章节标题-->
<div class="lb-title-part"> <div class="lb-title-part">
<div class="lbt-title">{{item.name}}</div> <div class="lbt-title" style="margin-bottom: 10px">{{item.name}}</div>
<!-- <div class="lbt-btn-box">-->
<!-- <el-button-->
<!-- icon="edit"-->
<!-- size="small"-->
<!-- type="primary"-->
<!-- link-->
<!-- @click="editChapterFunc(item)"-->
<!-- />-->
<!-- <el-button-->
<!-- icon="plus"-->
<!-- size="small"-->
<!-- type="primary"-->
<!-- link-->
<!-- @click="addChapterchildFunc(item)"-->
<!-- />-->
<!-- <el-button-->
<!-- icon="delete"-->
<!-- size="small"-->
<!-- type="primary"-->
<!-- link-->
<!-- @click="deleteChapterFunc(item)"-->
<!-- />-->
<!-- </div>-->
</div> </div>
<!--表格数据--> <!--表格数据-->
<div class="lb-table-part" style="margin-bottom: 20px"> <div class="lb-table-part" style="margin-bottom: 20px">
<el-table :data="item.course_sub" > <el-table border :data="item.course_sub" >
<el-table-column align="left" type="index" :index="indexMethod" label="序号" width="60" />
<el-table-column align="left" label="ID" width="60" prop="course_subsection_id" /> <el-table-column align="left" label="ID" width="60" prop="course_subsection_id" />
<el-table-column align="left" label="子章节名称" min-width="60" prop="name" /> <el-table-column align="left" label="子章节名称" min-width="60" prop="name" />
<el-table-column align="left" label="课件名称" min-width="60" prop="url"> <el-table-column align="left" label="课件名称" min-width="60" prop="url">
<template #default="scope">{{scope.row.url?scope.row.url:'未上传课件'}}</template> <template #default="scope">
<div class="view-css" v-if="scope.row.url" @click="viewFunc(scope.row,1)"></div>
<div v-else></div>
</template>
</el-table-column> </el-table-column>
<el-table-column align="left" label="章节试卷" min-width="60" prop="exam_id"> <el-table-column align="left" label="章节试卷" min-width="60" prop="exam_id">
<template #default="scope"> <template #default="scope">
{{scope.row.exam_id === 0?'未添加习题':scope.row.exam_id}} <viewExamCom v-if="scope.row.exam_id" :exam_id = 'scope.row.exam_id' :chaper_name="scope.row.name" ></viewExamCom>
<div v-else></div>
</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">
<template #default="scope">{{scope.row.price/100}}</template>
</el-table-column>
<!-- <el-table-column align="left" label="是否免费" min-width="60">-->
<!-- <template #default="scope">-->
<!-- {{scope.row.is_free === 1? '是':'否'}}-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column align="left" label="是否展示" min-width="60">
<template #default="scope"> <template #default="scope">
{{scope.row.is_show === 1? '是':'否'}} {{scope.row.is_free === 1? '是':'否'}}
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column align="left" label="操作" min-width="60">-->
<!-- <template #default="scope">-->
<!-- <el-button-->
<!-- icon="edit"-->
<!-- size="small"-->
<!-- type="primary"-->
<!-- link-->
<!-- @click="editChapterChildFunc(scope.row)"-->
<!-- >编辑</el-button>-->
<!-- <el-button-->
<!-- icon="delete"-->
<!-- size="small"-->
<!-- type="primary"-->
<!-- link-->
<!-- @click="deleteChapterChildFunc(scope.row)"-->
<!-- >删除</el-button>-->
<!-- </template>-->
<!-- </el-table-column>-->
</el-table> </el-table>
</div> </div>
</div> </div>
</div> </div>
<!-- 添加/编辑 大章节窗口--> <el-dialog v-model="dialogVideoVisible" :before-close="closeVideoDialog" :title="videoDialogTitle">
<el-dialog v-model="dialogChapterVisible" :before-close="closeChapterDialog" :title="dialogChapterTitle"> <video style="width: 100%" :src="video_url" controls></video>
<el-form ref="apiForm" :model="chapterForm" :rules="chapterRules" label-width="80px">
<el-form-item label="章节名称" prop="name">
<el-input v-model="chapterForm.name" autocomplete="off" />
</el-form-item>
<el-form-item label="章节排序" prop="sort">
<el-input v-model="chapterForm.sort" placeholder="输入整数,排序越小越靠前展示" autocomplete="off" />
</el-form-item>
<el-form-item label="是否免费" prop="is_free">
<el-switch v-model="chapterForm.is_free" active-text="" inactive-text="" :active-value="1" :inactive-value="-1" />
</el-form-item>
<!-- <el-form-item label="是否展示" prop="is_show">-->
<!-- <el-switch v-model="chapterForm.is_show" active-text="" inactive-text="" :active-value="1" :inactive-value="-1" />-->
<!-- </el-form-item>-->
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button size="small" @click="closeChapterDialog"> </el-button>
<el-button size="small" type="primary" @click="enterChapterDialog"> </el-button>
</div>
</template>
</el-dialog>
<!-- 添加小章节窗口-->
<el-dialog v-model="dialogChapterChildVisible" :before-close="closeChapterChildDialog" :title="dialogChapterChildTitle">
<el-form ref="apiForm" :model="chapterChildForm" :rules="chapterChildRules" label-width="80px">
<el-form-item label="章节名称" prop="name">
<el-input v-model="chapterChildForm.name" autocomplete="off" />
</el-form-item>
<el-form-item label="上传课件">
<!-- <upload-common-->
<!-- v-model:imageCommon="imageCommon"-->
<!-- class="upload-btn"-->
<!-- @on-success="getFilePath"-->
<!-- />-->
<media-com @on-success="getFilePath" :url_name="chapterChildForm.url_name" />
<!-- <el-button size="small" type="primary" @click="openExercisesWinFunc"></el-button>-->
</el-form-item>
<el-form-item label="试卷管理">
<!-- <el-button size="small" @click="chooseChapterChildExercises"></el-button>-->
<exam-com @addFunc="addExamFunc" :seleted_id="chapterChildForm.exam_id" />
</el-form-item>
<el-form-item label="章节价格" prop="price">
<el-input type="number" v-model="chapterChildForm.price" placeholder="输入章节价格" autocomplete="off" />
</el-form-item>
<el-form-item label="章节排序" prop="sort">
<el-input v-model="chapterChildForm.sort" placeholder="输入整数,排序越小越靠前展示" autocomplete="off" />
</el-form-item>
<el-form-item label="是否免费" prop="is_free">
<el-switch v-model="chapterChildForm.is_free" active-text="" inactive-text="" :active-value="1" :inactive-value="-1" />
</el-form-item>
<!-- <el-form-item label="是否展示" prop="is_show">-->
<!-- <el-switch v-model="chapterChildForm.is_show" active-text="" inactive-text="" :active-value="1" :inactive-value="-1" />-->
<!-- </el-form-item>-->
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button size="small" @click="closeChapterChildDialog"> </el-button>
<el-button size="small" type="primary" @click="enterChapterChildDialog"> </el-button>
</div>
</template>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<style scoped> <style scoped>
.view-css{
cursor: pointer;
}
.lbt-title{ .lbt-title{
margin-right: 20px; margin-right: 20px;
font-size: 18px; font-size: 18px;

@ -162,16 +162,6 @@ function handleChooseChange(row) {
<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-select v-model="queryParams.subject" clearable placeholder="请选择">-->
<!-- <el-option-->
<!-- v-for="item in subjectList"-->
<!-- :key="item.id"-->
<!-- :label="item.name"-->
<!-- :value="item.name"-->
<!-- />-->
<!-- </el-select>-->
<!-- </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>
@ -181,11 +171,7 @@ function handleChooseChange(row) {
<!-- 数据列表--> <!-- 数据列表-->
<div class="list-box"> <div class="list-box">
<el-table ref="multipleTableRef" row-key="exam.exam_id" :data="tableData" highlight-current-row @current-change="handleChooseChange"> <el-table ref="multipleTableRef" row-key="exam.exam_id" :data="tableData" highlight-current-row @current-change="handleChooseChange">
<!-- <el-table-column-->
<!-- type="selection"-->
<!-- width="55"-->
<!-- reserve-selection="true"-->
<!-- />-->
<el-table-column align="center" label="ID" min-width="60" prop="exam.exam_id" sortable="custom" /> <el-table-column align="center" label="ID" min-width="60" prop="exam.exam_id" sortable="custom" />
<el-table-column align="center" label="试卷名称" min-width="150" prop="exam.name" /> <el-table-column align="center" label="试卷名称" min-width="150" prop="exam.name" />
<el-table-column align="center" label="科目" min-width="150" prop="exam.subject" /> <el-table-column align="center" label="科目" min-width="150" prop="exam.subject" />

@ -1,6 +1,6 @@
<script setup> <script setup>
// //
// import api from '@/api/course' import capi from '@/api/course'
// import com_api from '@/api/common' // import com_api from '@/api/common'
// import WarningBar from '@/components/warningBar/warningBar.vue' // import WarningBar from '@/components/warningBar/warningBar.vue'
import api from '@/api/exercises' import api from '@/api/exercises'
@ -12,15 +12,16 @@ const route = useRoute()
import { useUserStore } from '@/pinia/modules/user' import { useUserStore } from '@/pinia/modules/user'
const userStore = useUserStore() const userStore = useUserStore()
// import chapterCom from '../components/chapter.vue' // import chapterCom from '../components/chapter.vue'
const props = defineProps(['url_name','seleted_arr']) const props = defineProps(['seleted_arr'])
const emit = defineEmits(['addFunc']) const emit = defineEmits(['addFunc'])
// import { clients, getNowDate } from '@/utils' // import { clients, getNowDate } from '@/utils'
import custom from '@/utils/custom' import custom from '@/utils/custom'
// import { getToken } from '@/utils/auth' // import { getToken } from '@/utils/auth'
// //
watch(props,(val1,val2) => { watch(props,(val1,val2) => {
selected_question_ids.value = val2.seleted_arr || [] selected_question_ids.value = val2.seleted_arr?JSON.parse(val2.seleted_arr):[]
}) })
// console.log(props)
// //
const selected_question_ids = ref(props.seleted_arr || []) const selected_question_ids = ref(props.seleted_arr || [])
@ -39,14 +40,27 @@ const tableData =ref([])
const total = ref(0) const total = ref(0)
const question_ids = ref([]) const question_ids = ref([])
// //
const subjectList = inject('subjectList') // const subjectList = inject('subjectList')
const subjectList = ref([])
const current_subject = inject('current_subject') const current_subject = inject('current_subject')
queryParams.value.subject = current_subject queryParams.value.subject = current_subject
const subjectParams = ref({
page:1,
pageSize:100,
})
onMounted(() => { onMounted(() => {
// console.log(headers.value) // console.log(headers.value)
// getExercisesList() // getExercisesList()
getSubject()
}) })
// //
async function getSubject(){ //
const res = await capi.getSubjectList(subjectParams.value)
if(res.code === 0) {
// subjectList.value = custom.getStdSubject(res.data.records)
subjectList.value = custom.addTreeFormatSubject(res.data.records,'name')
}
}
async function getExercisesList() { async function getExercisesList() {
const res = await api.getExercisesList(queryParams.value) const res = await api.getExercisesList(queryParams.value)
if(res.code === 0) { if(res.code === 0) {
@ -114,12 +128,15 @@ const toggleSelection = (rows) => { // 判断是否被选中
multipleTableRef.value.clearSelection() multipleTableRef.value.clearSelection()
} }
} }
function selectFunc(row, index) {
return false
}
</script> </script>
<template> <template>
<div> <div>
<el-button v-if="selected_question_ids.length==0" size="small" @click="chooseChapterChildExercises"></el-button> <el-button v-if="selected_question_ids.length==0" size="small" @click="chooseChapterChildExercises"></el-button>
<el-button v-else size="small" @click="chooseChapterChildExercises" type="plain">点击查看已选{{selected_question_ids.length}}道题</el-button> <el-button v-else size="small" @click="chooseChapterChildExercises" type="plain">点击查看已选{{selected_question_ids.length}}道题</el-button>
<div v-if="url_name">{{url_name}}</div> <!-- <div v-if="url_name">{{url_name}}</div>-->
<el-drawer v-model="drawer" title="习题库" size="60%"> <el-drawer v-model="drawer" title="习题库" size="60%">
<div class="drawer-section"> <div class="drawer-section">
<!-- 搜索框--> <!-- 搜索框-->
@ -129,14 +146,15 @@ const toggleSelection = (rows) => { // 判断是否被选中
<el-input v-model="queryParams.content" placeholder="请输入" /> <el-input v-model="queryParams.content" placeholder="请输入" />
</el-form-item> </el-form-item>
<el-form-item label="课程分类"> <el-form-item label="课程分类">
<el-select v-model="queryParams.subject" clearable placeholder="请选择"> <!-- <el-select v-model="queryParams.subject" clearable placeholder="请选择">-->
<el-option <!-- <el-option-->
v-for="item in subjectList" <!-- v-for="item in subjectList"-->
:key="item.id" <!-- :key="item.id"-->
:label="item.name" <!-- :label="item.name"-->
:value="item.name" <!-- :value="item.name"-->
/> <!-- />-->
</el-select> <!-- </el-select>-->
<el-tree-select v-model="queryParams.subject" :data="subjectList" :render-after-expand="false" />
</el-form-item> </el-form-item>
<el-form-item label="题目类型"> <el-form-item label="题目类型">
<el-select v-model="queryParams.type" clearable placeholder="请选择"> <el-select v-model="queryParams.type" clearable placeholder="请选择">
@ -156,7 +174,7 @@ const toggleSelection = (rows) => { // 判断是否被选中
</div> </div>
<!-- 数据列表--> <!-- 数据列表-->
<div class="list-box"> <div class="list-box">
<el-table ref="multipleTableRef" row-key="question_id" :data="tableData" @selection-change="handleSelectionChange"> <el-table border ref="multipleTableRef" row-key="question_id" :data="tableData" @selection-change="handleSelectionChange">
<el-table-column <el-table-column
type="selection" type="selection"
width="55" width="55"
@ -190,7 +208,7 @@ const toggleSelection = (rows) => { // 判断是否被选中
</div> </div>
<!-- 按钮--> <!-- 按钮-->
<div class="btn-box" style="text-align: right"> <div class="btn-box" style="text-align: right">
<el-button size="small" type="primary" icon="plus" @click="addFunc"></el-button> <!-- <el-button size="small" type="primary" icon="plus" @click="addFunc"></el-button>-->
</div> </div>
</div> </div>
</el-drawer> </el-drawer>

@ -0,0 +1,357 @@
<script setup>
//
import api from '@/api/examination'
import capi from '@/api/course'
import custom from '@/utils/custom'
import {formatDate} from '@/utils/format'
import _ from 'lodash'
import WarningBar from '@/components/warningBar/warningBar.vue'
import exercisesPool from '@/view/course/components/exercisesPool.vue'
import groupPool from '@/view/examinationManage/components/groupPool.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()
// store
import { useUserStore } from '@/pinia/modules/user'
const userStore = useUserStore()
//
const props = defineProps(['exam_id','chaper_name'])
// const emit = defineEmits(['reload'])
//
const path = ref(import.meta.env.VITE_BASE_API)
// const typeList = custom.getExercisesTypeList()
// const queryParams = ref({
// teacherId:0,
// page:1,
// pageSize:10,
// name:'',
// status:'',
// subject:''
// })
const subjectParams = ref({
page:1,
pageSize:100,
})
const tableData = ref([])
const subjectList = ref([])
const current_subject = ref('')
const deleteVisible = ref(false)
const question_ids = ref([])
const total = ref(0)
const dialogFormVisible = ref(false)
const dialogTitle = ref('')
const form =ref({price:4.9})
const rules = ref({
// name: [{ required: true, message: '', trigger: 'blur' }]
})
const question_id = ref(0)
const content = ref(null)
// const options = ref([]) //
const exam_types = ref([])
const exam_ids = ref([])
const price_props = ['first','second','third','price']
const exam_type_ids = ref([])
//
onMounted(() => {
// getExaminationList()
// getExaminationDetail()
// getSubject()
})
// provide('subjectList', subjectList)
// provide('current_subject', current_subject)
const std_group = ref({
persons:'',
expiry_date:'',
public_date:'',
first:'',
second:'',
third:''
})
const exam_info =ref(null)
//
async function viewFunc() {
dialogFormVisible.value = true
if(subjectList.value.length === 0) {
await getSubject()
}
// await getSubject()
getExaminationDetail()
}
async function getExaminationDetail() {
const res = await api.getExaminationDetail({
id:props.exam_id
})
if(res.code === 0) {
exam_info.value = res.data
form.value = res.data.exam
exam_types.value = res.data.exam_types.map((item) => {
for(let prop in item) {
if(price_props.includes(prop)) {
item[prop] /= 100
}
}
return item
})
console.log(exam_info.value,exam_types.value)
}
}
// async function getExaminationList() {
// const res = await api.getExaminationList(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() {
// getExaminationList()
// }
// const onReset = () => {
// queryParams.value = {
// page:1,
// pageSize:10,
// name:'',
// status:'',
// subject:''
// }
// }
function openDialog(type) {
// let params = {}
switch (type){
case 'add':
dialogTitle.value = '新增试卷'
form.value = {price:4.9}
break;
case 'edit':
// params.question_id = question_id.value
dialogTitle.value = '编辑试卷'
break;
}
dialogFormVisible.value = true
// router.push({name:'addCourse',params})
}
// async function onDelete() {
// const ids = exam_ids.value
// const res = await api.delExamination({ exam_ids:ids })
// if (res.code === 0) {
// ElMessage({
// type: 'success',
// message: res.msg
// })
// // if (tableData.value.length === ids.length && page.value > 1) {
// // page.value--
// // }
// deleteVisible.value = false
// getExaminationList()
// }
// }
// const handleSelectionChange = (val) => {
// exam_ids.value = val.map((item) => {
// return item.exam.exam_id
// })
// }
// const exam_id = ref(null)
// function handleCurrentChange(val) {
// queryParams.value.page = val
// getExaminationList()
// }
// function handleSizeChange(val) {
// queryParams.value.pageSize = val
// getExaminationList()
// }
function closeDialog(){
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) => {
// for(let prop in item) {
// if(Object.keys(std_group.value).includes(prop)) {
// item[prop] = Number(item[prop])
// if(price_props.includes(prop)) {
// item[prop] *= 100
// }
// }
// }
// return item
// })
// form.value.price = parseInt(Number(form.value.price )*100)
// form.value.duration = parseInt(form.value.duration)
// 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()
// getExaminationList()
// }
}
// function viewCourseFunc(row) { //
// router.push({name:'viewCourse',params:{question_id:row.question_id}})
// }
// function getExercisesName(row) {
// return JSON.parse(row.question).title
// }
// const std_options_title = ref(['A','B','C','D','E','F'])
// function addOptionFunc() {
// exam_types.value.push(_.cloneDeep(std_group.value))
// }
// function delet_func(i) {
// exam_types.value.splice(i,1)
// }
// function handleAvatarSuccess(res) {
// form.value.cover = res.data.file.url
// }
// 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!')
// }
// return !isJPG && isLt05M
// }
// function changeSubjectFunc(e) {
// current_subject.value = e
// }
function addExercisesFunc(data) {
form.value.question_ids = data
}
function addGroupFunc(data) {
console.log("父组件行为")
exam_types.value = _.clone(data)
}
</script>
<template>
<div>
<el-button size="small" @click="viewFunc" type="plain">点击查看</el-button>
<!-- 编辑窗口 -->
<el-dialog v-model="dialogFormVisible" :before-close="closeDialog" :title="'章节:'+chaper_name">
<el-form ref="apiForm" :model="form" :rules="rules" label-width="80px">
<el-form-item label="试卷名称" >
<el-input disabled v-model="form.name" placeholder="请输入试卷名称" />
</el-form-item>
<el-form-item label="科目" prop="subject">
<el-select disabled v-model="form.subject" @change="changeSubjectFunc" clearable placeholder="请选择">
<el-option
v-for="item in subjectList"
:key="item.id"
:label="item.name"
:value="item.name"
/>
</el-select>
</el-form-item>
<el-form-item label="封面">
<el-upload
disabled
class="avatar-uploader"
:action="`${path}/fileUploadAndDownload/upload`"
:headers="{ 'x-token': userStore.token }"
:show-file-list="false"
:on-success="handleAvatarSuccess"
:before-upload="beforeAvatarUpload"
>
<img v-if="form.cover" :src="form.cover" class="avatar avatar-uploader-img" />
<el-icon v-else class="avatar-uploader-icon"><Plus /></el-icon>
</el-upload>
</el-form-item>
<el-form-item label="测试时长" >
<el-input disabled type="number" v-model="form.duration" placeholder="请输入测试时长(分钟)" />
</el-form-item>
<el-form-item label="测试价格" >
<el-input type="number" v-model="form.price" disabled placeholder="请输入测试价格(元)" />
</el-form-item>
<el-form-item label="测试组别" >
<groupPool @addFunc="addGroupFunc" :exam_types="exam_types" :exam_id="exam_id" />
</el-form-item>
<el-form-item label="添加习题" >
<exercisesPool @addFunc="addExercisesFunc" :seleted_arr="form.question_ids" />
</el-form-item>
<el-form-item label="是否上架" >
<el-switch
disabled
v-model="form.status"
active-text="上架"
inactive-text="下架"
:active-value="1"
:inactive-value="-1"
/>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button size="small" @click="closeDialog"> </el-button>
<el-button size="small" type="primary" @click="closeDialog"> </el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<style>
.el-table .el-table__cell{
z-index: unset;
}
</style>
<style scoped lang="scss">
.avatar-uploader-img{
width: 178px;
height: 178px;
}
.avatar-uploader{
}
.rb-item{
margin-bottom: 10px;
}
.e-img{
width: 150px;
height: 100px;
}
.option-item{
border-bottom: 1px solid #ebebeb;
margin-bottom: 10px;
.oi-row{
display: flex;
align-items: center;
margin-bottom: 10px;
.oi-item{
//color: red;
}
}
}
.button-box {
padding: 10px 20px;
.el-button {
float: right;
}
}
.warning {
color: #dc143c;
}
</style>

@ -4,8 +4,12 @@ import api from '@/api/course'
import {ref,onMounted } from 'vue' import {ref,onMounted } 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'
import custom from '@/utils/custom'
const router = useRouter() const router = useRouter()
const route = useRoute() const route = useRoute()
//
// import examCom from '../components/examinationPool.vue'
import viewExamCom from '../components/viewExamination.vue'
// //
const course_id = ref(0) const course_id = ref(0)
const courseData = ref({}) const courseData = ref({})
@ -28,14 +32,27 @@ function downloadChapterChildFunc(item) { // 点击下载
// console.log(item) // console.log(item)
window.open(row.url) window.open(row.url)
} }
function viewFunc(row,type) { // function indexMethod(index) {
if(type === 1) { // return index +=1
console.log(row.url) }
//
const videoDialogTitle = ref('')
const dialogVideoVisible = ref(false)
const video_url = ref(null)
function viewFunc(row,type) { // /
if(type ===1) { //
videoDialogTitle.value = '章节:'+row.name
// console.log(row)
dialogVideoVisible.value = true
video_url.value = row.url
} }
else{ // else{ //
// dialogFormVisible.value = true
} }
} }
function closeVideoDialog() {
dialogVideoVisible.value = false
}
</script> </script>
<template> <template>
<div> <div>
@ -56,19 +73,19 @@ function viewFunc(row,type) { // 查看课程课件或者试卷
</div> </div>
<div class="base-card"> <div class="base-card">
<div class="bc-left">课程状态</div> <div class="bc-left">课程状态</div>
<div class="bc-right">{{baseInfo.status === 1?'上架':'下架'}}</div> <div class="bc-right">{{custom.getCourseStateName(baseInfo.status)}}</div>
</div> </div>
<div class="base-card"> <div class="base-card">
<div class="bc-left">课程价格</div> <div class="bc-left">课程价格</div>
<div class="bc-right">{{baseInfo.price}}</div> <div class="bc-right">{{custom.getStdPrice(baseInfo.price)}}</div>
</div> </div>
<div class="base-card"> <div class="base-card">
<div class="bc-left">教师姓名</div> <div class="bc-left">教师姓名</div>
<div class="bc-right"></div> <div class="bc-right">{{courseData.teacher_name}}</div>
</div> </div>
<div class="base-card"> <div class="base-card">
<div class="bc-left">创建时间</div> <div class="bc-left">创建时间</div>
<div class="bc-right">{{baseInfo.CreatedAt}}</div> <div class="bc-right">{{custom.dateFmt(baseInfo.CreatedAt)}}</div>
</div> </div>
<div class="base-card"> <div class="base-card">
<div class="bc-left">课程简介</div> <div class="bc-left">课程简介</div>
@ -87,19 +104,22 @@ function viewFunc(row,type) { // 查看课程课件或者试卷
<!--表格数据--> <!--表格数据-->
<div class="lb-table-part" style="margin-bottom: 20px"> <div class="lb-table-part" style="margin-bottom: 20px">
<el-table :data="item.course_sub" border > <el-table :data="item.course_sub" border >
<el-table-column align="left" label="id" width="60" prop="id" /> <el-table-column align="left" type="index" :index="indexMethod" label="序号" width="60" />
<el-table-column align="left" label="ID" width="60" prop="course_subsection_id" />
<el-table-column align="left" label="子章节名称" min-width="60" prop="name" /> <el-table-column align="left" label="子章节名称" min-width="60" prop="name" />
<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.url === ''?'未上传课件':scope.row.url}}--> <!-- {{scope.row.url === ''?'未上传课件':scope.row.url}}-->
<div v-if="scope.row.url" @click="viewFunc(scope.row,1)"></div> <el-button v-if="scope.row.url" @click="viewFunc(scope.row,1)" size="small" type="plain"></el-button>
<!-- <div v-if="scope.row.url" @click="viewFunc(scope.row,1)" class="view-css"></div>-->
<div v-else></div> <div v-else></div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="left" label="试卷习题" min-width="60" prop="is_contain_exercise"> <el-table-column align="left" label="试卷习题" min-width="60" prop="is_contain_exercise">
<template #default="scope"> <template #default="scope">
<!-- {{scope.row.exam_id === 0?'未添加习题':scope.row.exam_id}}--> <!-- {{scope.row.exam_id === 0?'未添加习题':scope.row.exam_id}}-->
<div v-if="scope.row.exam_id" @click="viewFunc(scope.row,2)"></div> <!-- <div v-if="scope.row.exam_id" @click="viewFunc(scope.row,2)" class="view-css"></div>-->
<viewExamCom v-if="scope.row.exam_id" :exam_id = 'scope.row.exam_id' :chaper_name="scope.row.name" ></viewExamCom>
<div v-else></div> <div v-else></div>
</template> </template>
</el-table-column> </el-table-column>
@ -108,30 +128,33 @@ function viewFunc(row,type) { // 查看课程课件或者试卷
{{scope.row.is_free === 1? '是':'否'}} {{scope.row.is_free === 1? '是':'否'}}
</template> </template>
</el-table-column> </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_show === 1? '是':'否'}}--> <!-- <el-button v-if="scope.row.url"-->
<!-- icon="edit"-->
<!-- size="small"-->
<!-- type="primary"-->
<!-- link-->
<!-- @click="downloadChapterChildFunc(scope.row)"-->
<!-- >下载</el-button>-->
<!-- </template>--> <!-- </template>-->
<!-- </el-table-column>--> <!-- </el-table-column>-->
<el-table-column align="left" label="操作" min-width="60">
<template #default="scope">
<el-button v-if="scope.row.url"
icon="edit"
size="small"
type="primary"
link
@click="downloadChapterChildFunc(scope.row)"
>下载</el-button>
</template>
</el-table-column>
</el-table> </el-table>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<el-dialog v-model="dialogVideoVisible" :before-close="closeVideoDialog" :title="videoDialogTitle">
<video style="width: 100%" :src="video_url" controls></video>
</el-dialog>
</div> </div>
</template> </template>
<style scoped> <style scoped>
.view-css{
color: #4d70ff;
cursor: pointer;
}
.lbt-title{ .lbt-title{
margin-right: 20px; margin-right: 20px;
font-size: 18px; font-size: 18px;

@ -345,21 +345,21 @@ async function viewAuctionFunc(row) { // 竞拍明细
</el-popover> </el-popover>
</div> </div>
<!-- 数据列表--> <!-- 数据列表-->
<el-table :data="tableData" bor @selection-change="handleSelectionChange"> <el-table :data="tableData" border @selection-change="handleSelectionChange">
<el-table-column <el-table-column
type="selection" type="selection"
width="55" width="55"
/> />
<el-table-column align="center" label="ID" prop="id" sortable="custom" /> <el-table-column align="center" label="ID" prop="id" sortable="custom" />
<el-table-column align="center" label="商品名称" prop="product_name" /> <el-table-column align="center" label="商品名称" min-width="150" prop="product_name" />
<el-table-column align="center" label="商品图片"> <el-table-column align="center" label="商品图片" min-width="150">
<template #default="scope"> <template #default="scope">
<img class="avatar-box" :src="scope.row.product_cover" alt=""> <img class="avatar-box" :src="scope.row.product_cover" alt="">
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="市场价值(元)" min-width="150" prop="market_value" /> <el-table-column align="center" label="市场价值(元)" min-width="150" prop="market_value" />
<el-table-column align="center" label="参与积分" prop="in_point" /> <el-table-column align="center" label="参与积分" min-width="150" prop="in_point" />
<el-table-column align="center" label="满员人数" prop="full_member" /> <el-table-column align="center" label="满员人数" min-width="150" prop="full_member" />
<el-table-column align="center" label="发布日期" min-width="150" > <el-table-column align="center" label="发布日期" min-width="150" >
<template #default="scope"> <template #default="scope">
{{custom.timestampToDate2(scope.row.begin_time)}} {{custom.timestampToDate2(scope.row.begin_time)}}

@ -73,9 +73,9 @@ function onReset() {
queryParams.value = { queryParams.value = {
page:1, page:1,
pageSize:10, pageSize:10,
name:'', term:'',
subject:'', persons:'',
status:'', examId:props.exam_id
} }
} }
function handleCurrentChange(val) { function handleCurrentChange(val) {
@ -248,7 +248,7 @@ function close_draw() {
<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>
<el-button size="small" type="primary" icon="plus" @click="addWindow"></el-button> <!-- <el-button size="small" type="primary" icon="plus" @click="addWindow"></el-button>-->
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
@ -258,11 +258,14 @@ function close_draw() {
<el-table-column align="left" label="人数级别" min-width="150" prop="persons"> <el-table-column align="left" label="人数级别" min-width="150" prop="persons">
<template #default="scope">{{custom.getSTdPerson(scope.row.persons)}}</template> <template #default="scope">{{custom.getSTdPerson(scope.row.persons)}}</template>
</el-table-column> </el-table-column>
<el-table-column align="left" label="开始时间" min-width="150" prop="expiry_date">
<template #default="scope">{{custom.timestampToDate2(scope.row.start_date)}}</template>
</el-table-column>
<el-table-column align="left" label="截止时间" min-width="150" prop="expiry_date"> <el-table-column align="left" label="截止时间" min-width="150" prop="expiry_date">
<template #default="scope">{{custom.timestampToDate(scope.row.expiry_date)}}</template> <template #default="scope">{{custom.timestampToDate2(scope.row.expiry_date)}}</template>
</el-table-column> </el-table-column>
<el-table-column align="left" label="公开时间" min-width="150" prop="public_date"> <el-table-column align="left" label="公开时间" min-width="150" prop="public_date">
<template #default="scope">{{custom.timestampToDate(scope.row.public_date)}}</template> <template #default="scope">{{custom.timestampToDate2(scope.row.public_date)}}</template>
</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">
@ -271,25 +274,25 @@ function close_draw() {
</el-table-column> </el-table-column>
<el-table-column align="left" label="报名人数" min-width="150" prop="enroll_num" /> <el-table-column align="left" label="报名人数" min-width="150" prop="enroll_num" />
<el-table-column align="left" label="提交人数" min-width="150" prop="finish_num" /> <el-table-column align="left" label="提交人数" min-width="150" prop="finish_num" />
<el-table-column align="left" fixed="right" label="操作" width="200"> <!-- <el-table-column align="left" fixed="right" label="操作" width="200">-->
<template #default="scope"> <!-- <template #default="scope">-->
<el-button <!-- <el-button-->
icon="edit" <!-- icon="edit"-->
size="small" <!-- size="small"-->
type="primary" <!-- type="primary"-->
link <!-- link-->
@click="editGroupFunc(scope.row)" <!-- @click="editGroupFunc(scope.row)"-->
>编辑</el-button> <!-- >编辑</el-button>-->
<el-button <!-- <el-button-->
icon="delete" <!-- icon="delete"-->
size="small" <!-- size="small"-->
type="danger" <!-- type="danger"-->
link <!-- link-->
v-if="!checkFunc(scope.row)" <!-- v-if="!checkFunc(scope.row)"-->
@click="delGroupFunc(scope.row)" <!-- @click="delGroupFunc(scope.row)"-->
>删除</el-button> <!-- >删除</el-button>-->
</template> <!-- </template>-->
</el-table-column> <!-- </el-table-column>-->
</el-table> </el-table>
<div class="gva-pagination"> <div class="gva-pagination">
<el-pagination <el-pagination
@ -305,7 +308,7 @@ function close_draw() {
</div> </div>
<!-- 按钮--> <!-- 按钮-->
<div class="btn-box" style="text-align: right"> <div class="btn-box" style="text-align: right">
<el-button size="small" type="primary" @click="addFunc"></el-button> <el-button size="small" type="primary" @click="addFunc"> </el-button>
</div> </div>
</div> </div>
</el-drawer> </el-drawer>

@ -9,7 +9,7 @@ import _ from 'lodash'
// import { toSQLLine } from '@/utils/stringFun' // import { toSQLLine } from '@/utils/stringFun'
import WarningBar from '@/components/warningBar/warningBar.vue' import WarningBar from '@/components/warningBar/warningBar.vue'
// import ckEditor from '@/components/richText/ckEditor5.vue' // import ckEditor from '@/components/richText/ckEditor5.vue'
import coursePool from './components/coursePool.vue' // import coursePool from './components/coursePool.vue'
import exercisesPool from '@/view/course/components/exercisesPool.vue' import exercisesPool from '@/view/course/components/exercisesPool.vue'
import groupPool from './components/groupPool.vue' import groupPool from './components/groupPool.vue'
@ -420,9 +420,6 @@ function addGroupFunc(data) {
<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="适用课程" >-->
<!-- <coursePool @addFunc="addCourseFunc" :seleted_arr="form.course_ids" />-->
<!-- </el-form-item>-->
<el-form-item label="受否上架" > <el-form-item label="受否上架" >
<el-switch <el-switch
v-model="form.status" v-model="form.status"

@ -3,7 +3,7 @@
// //
import api from '@/api/integral' import api from '@/api/integral'
// import capi from '@/api/course' // 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 { toSQLLine } from '@/utils/stringFun' // import { toSQLLine } from '@/utils/stringFun'
// import WarningBar from '@/components/warningBar/warningBar.vue' // import WarningBar from '@/components/warningBar/warningBar.vue'
@ -248,11 +248,15 @@ async function integralOperationFunc(type,row) { // 冻结 解冻
<!-- 表格数据--> <!-- 表格数据-->
<div class="gva-table-box"> <div class="gva-table-box">
<!-- 数据列表--> <!-- 数据列表-->
<el-table :data="tableData" @selection-change="handleSelectionChange"> <el-table border :data="tableData" @selection-change="handleSelectionChange">
<el-table-column align="center" label="ID" prop="point_id" sortable="custom" /> <el-table-column align="center" label="ID" prop="point_id" sortable="custom" />
<el-table-column align="center" label="姓名" prop="nickname" /> <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" prop="phone" />
<el-table-column align="center" label="所属区域" prop="province" /> <el-table-column align="center" label="所属区域" prop="province" >
<template #default="scope">
<div>{{custom.getProvinceName(scope.row.province)}}</div>
</template>
</el-table-column>
<el-table-column align="center" label="剩余积分" prop="balance" /> <el-table-column align="center" label="剩余积分" prop="balance" />
<el-table-column align="center" label="累计积分" prop="total" /> <el-table-column align="center" label="累计积分" prop="total" />
<el-table-column align="center" label="邀请好友(分)" min-width="150" prop="invite" /> <el-table-column align="center" label="邀请好友(分)" min-width="150" prop="invite" />

@ -189,7 +189,7 @@ function handleSizeChange(val) {
</el-popover> </el-popover>
</div> </div>
<!-- 数据列表--> <!-- 数据列表-->
<el-table :data="tableData" @selection-change="handleSelectionChange"> <el-table border :data="tableData" @selection-change="handleSelectionChange">
<el-table-column <el-table-column
type="selection" type="selection"
width="55" width="55"

@ -188,7 +188,7 @@ async function pOk() { // 审核提交
</el-popover> </el-popover>
</div> </div>
<!-- 数据列表--> <!-- 数据列表-->
<el-table :data="tableData" @selection-change="handleSelectionChange"> <el-table border :data="tableData" @selection-change="handleSelectionChange">
<el-table-column align="center" label="ID" prop="user_id" sortable="custom" /> <el-table-column align="center" label="ID" prop="user_id" sortable="custom" />
<el-table-column align="center" label="头像"> <el-table-column align="center" label="头像">
<template #default="scope"> <template #default="scope">
@ -204,7 +204,7 @@ async function pOk() { // 审核提交
<el-table-column align="center" label="手机号" min-width="150" prop="phone" /> <el-table-column align="center" label="手机号" min-width="150" prop="phone" />
<el-table-column align="center" label="所属区域" min-width="150"> <el-table-column align="center" label="所属区域" min-width="150">
<template #default="scope"> <template #default="scope">
{{scope.row.province>-1?cityList[scope.row.province].name:'无'}} {{scope.row.province>-1?cityList[scope.row.province].province:'无'}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="状态" min-width="150"> <el-table-column align="center" label="状态" min-width="150">

@ -26,10 +26,16 @@ const brokerageFormRules = ref({
course_assistant_teacher:[{ required: true, message: '请输入助教推荐老师佣金占比', trigger: 'blur' }], course_assistant_teacher:[{ required: true, message: '请输入助教推荐老师佣金占比', trigger: 'blur' }],
}) })
const brokerageFormRef = ref(null) const brokerageFormRef = ref(null)
const std_percent_arr = ['course_assistant','course_manage','course_assistant_assistant','course_assistant_teacher']
// //
async function getBrokerage() { async function getBrokerage() {
const res = await api.getBrokerage() const res = await api.getBrokerage()
if(res.code === 0) { if(res.code === 0) {
for(let prop in res.data) {
if(!std_percent_arr.includes(prop)) {
res.data[prop] = parseFloat((res.data[prop]/100).toFixed(2))
}
}
brokerageForm.value = res.data brokerageForm.value = res.data
} }
} }
@ -46,7 +52,12 @@ async function submitForm(formEl) {
} }
async function saveData() { async function saveData() {
const params = { const params = {
...brokerageForm.value ..._.cloneDeep(brokerageForm.value)
}
for(let prop in params) {
if(!std_percent_arr.includes(prop)) {
params[prop] = params[prop]*100
}
} }
const res = await api.brokerageFunc(params) const res = await api.brokerageFunc(params)
if(res.code === 0) { if(res.code === 0) {

@ -208,8 +208,8 @@ async function remoteMethod(query) {
<el-select v-model="queryParams.province" clearable placeholder="请选择"> <el-select v-model="queryParams.province" clearable placeholder="请选择">
<el-option <el-option
v-for="(item,index) in cityList" v-for="(item,index) in cityList"
:key="item.ProID" :key="item.province"
:label="item.name" :label="item.province"
:value="index" :value="index"
/> />
</el-select> </el-select>
@ -237,7 +237,7 @@ async function remoteMethod(query) {
</el-popover> </el-popover>
</div> </div>
<!-- 数据列表--> <!-- 数据列表-->
<el-table :data="tableData" @selection-change="handleSelectionChange"> <el-table border :data="tableData" @selection-change="handleSelectionChange">
<el-table-column <el-table-column
type="selection" type="selection"
width="55" width="55"
@ -252,7 +252,7 @@ async function remoteMethod(query) {
<el-table-column align="center" label="手机号" min-width="150" prop="phone" /> <el-table-column align="center" label="手机号" min-width="150" prop="phone" />
<el-table-column align="center" label="负责区域" min-width="150"> <el-table-column align="center" label="负责区域" min-width="150">
<template #default="scope"> <template #default="scope">
{{scope.row.province>-1?cityList[scope.row.province].name:'无'}} {{scope.row.province>-1?cityList[scope.row.province].province:'无'}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" min-width="150" label="域内市场助教" prop="assistant_num" /> <el-table-column align="center" min-width="150" label="域内市场助教" prop="assistant_num" />
@ -304,8 +304,8 @@ async function remoteMethod(query) {
<el-select v-model="mForm.province" clearable placeholder="请选择"> <el-select v-model="mForm.province" clearable placeholder="请选择">
<el-option <el-option
v-for="(item,index) in cityList" v-for="(item,index) in cityList"
:key="item.ProID" :key="item.province"
:label="item.name" :label="item.province"
:value="index" :value="index"
/> />
</el-select> </el-select>

@ -103,7 +103,7 @@ function getStateName(state) {
<div class="dib-row"> <div class="dib-row">
<div class="dib-item"> <div class="dib-item">
<div class="di-left">管理区域</div> <div class="di-left">管理区域</div>
<div class="di-right">{{managerInfo.province>-1?cityList[managerInfo.province].name:'无'}}</div> <div class="di-right">{{managerInfo.province>-1?cityList[managerInfo.province].province:'无'}}</div>
</div> </div>
</div> </div>
<div class="dib-row"> <div class="dib-row">

@ -299,7 +299,7 @@ function getTypeName(type) {
</el-popover> </el-popover>
</div> </div>
<!-- 数据列表--> <!-- 数据列表-->
<el-table :data="tableData" @selection-change="handleSelectionChange"> <el-table :data="tableData" border @selection-change="handleSelectionChange">
<!-- <el-table-column--> <!-- <el-table-column-->
<!-- type="selection"--> <!-- type="selection"-->
<!-- width="55"--> <!-- width="55"-->
@ -315,7 +315,11 @@ function getTypeName(type) {
</el-table-column> </el-table-column>
<el-table-column align="center" label="商品名称" min-width="150" prop="name" /> <el-table-column align="center" label="商品名称" min-width="150" prop="name" />
<el-table-column align="center" label="订单金额" min-width="150" prop="price" /> <el-table-column align="center" label="订单金额" min-width="150" prop="price" />
<el-table-column align="center" label="所属区域" min-width="150" prop="province" /> <el-table-column align="center" label="所属区域" min-width="150" prop="province">
<template #default="scope">
{{custom.getProvinceName(scope.row.province)}}
</template>
</el-table-column>
<el-table-column align="center" label="状态" > <el-table-column align="center" label="状态" >
<template #default="scope"> <template #default="scope">
<div>{{getStateName(scope.row.status)}}</div> <div>{{getStateName(scope.row.status)}}</div>

@ -44,6 +44,24 @@ function getStateName(state) {
} }
return str return str
} }
function getOrderTypeName(order_type) {
let name = ''
switch(order_type){
case 1:
name = '课程';
break;
case 2:
name = '章节';
break;
case 3:
name = '大章节';
break;
case 4:
name = '试卷';
break;
}
return name
}
</script> </script>
<template> <template>
<div> <div>
@ -51,11 +69,22 @@ function getStateName(state) {
<div class="gva-search-box"> <div class="gva-search-box">
<div class="baseInfo-box"> <div class="baseInfo-box">
<div class="bd-img"> <div class="bd-img">
<img :src="orderInfo.cover" alt=""> <!-- <img :src="orderInfo.cover" alt=""> -->
<el-image
style="width: 100px; height: 100px"
:src="orderInfo.cover"
:zoom-rate="1.2"
:initial-index="4"
fit="cover"
/>
</div> </div>
<div class="bd-info"> <div class="bd-info">
<div class="bdi-title">{{orderInfo.name}}</div> <div class="bdi-title">
<div class="bdi-price">{{orderInfo.price}}</div> {{orderInfo.name}}
<!-- <text class="tip-css">{{ getOrderTypeName(orderInfo.order_type) }}</text> -->
<el-tag class="ml-2" type="warning">{{ getOrderTypeName(orderInfo.order_type) }}</el-tag>
</div>
<div class="bdi-price" style="color:red">{{custom.getStdPrice(orderInfo.price)}}</div>
</div> </div>
</div> </div>
</div> </div>
@ -73,12 +102,20 @@ function getStateName(state) {
<div class="di-left">用户手机</div> <div class="di-left">用户手机</div>
<div class="di-right">{{orderInfo.phone}}</div> <div class="di-right">{{orderInfo.phone}}</div>
</div> </div>
<div class="dib-item">
<div class="di-left">用户区域</div>
<div class="di-right">{{custom.getProvinceName(orderInfo.province)}}</div>
</div>
<div class="dib-item di-title"> <div class="dib-item di-title">
订单信息 订单信息
</div> </div>
<div class="dib-item"> <div class="dib-item">
<div class="di-left">订单编号</div> <div class="di-left">订单编号</div>
<div class="di-right">{{orderInfo.order_id}}</div> <div class="di-right">{{orderInfo.order_no}}</div>
</div>
<div class="dib-item">
<div class="di-left">订单详情</div>
<div class="di-right">{{orderInfo.desc}}</div>
</div> </div>
<div class="dib-item"> <div class="dib-item">
<div class="di-left">提交时间</div> <div class="di-left">提交时间</div>
@ -124,14 +161,20 @@ function getStateName(state) {
flex-direction: column; flex-direction: column;
justify-content: space-around; justify-content: space-around;
.bdi-title,.bdi-price{ .bdi-title,.bdi-price{
font-weight: 900; // font-weight: 900;
font-size: 18px; font-size: 18px;
} }
.bdi-title{ .bdi-title{
margin-bottom: 20px; margin-bottom: 20px;
// .tip-css{
// font-size: 15px;
// color: gray;
// border: 1px solid red;
// padding: 0 20px;
// }
} }
.bdi-price{ .bdi-price{
font-weight: 900;
} }
} }
} }

@ -103,7 +103,7 @@ function toDealDetail(type) {
ID{{teacherInfo.user_id}} ID{{teacherInfo.user_id}}
</div> </div>
<div class="bb-item"> <div class="bb-item">
注册时间{{teacherInfo.CreatedAt}} 注册时间{{custom.dateFmt(teacherInfo.CreatedAt)}}
</div> </div>
<div class="bb-item"> <div class="bb-item">
身份教师 身份教师

@ -186,7 +186,7 @@ async function pOk() { // 审核提交
</el-popover> </el-popover>
</div> </div>
<!-- 数据列表--> <!-- 数据列表-->
<el-table :data="tableData" @selection-change="handleSelectionChange"> <el-table border :data="tableData" @selection-change="handleSelectionChange">
<el-table-column align="center" label="ID" prop="teacher_info_id" sortable="custom" /> <el-table-column align="center" label="ID" prop="teacher_info_id" sortable="custom" />
<el-table-column align="center" label="头像"> <el-table-column align="center" label="头像">
<template #default="scope"> <template #default="scope">
@ -197,7 +197,7 @@ async function pOk() { // 审核提交
<el-table-column align="center" label="手机号" min-width="150" prop="phone" /> <el-table-column align="center" label="手机号" min-width="150" prop="phone" />
<el-table-column align="center" label="所属区域" min-width="150" prop="province"> <el-table-column align="center" label="所属区域" min-width="150" prop="province">
<template #default="scope"> <template #default="scope">
{{cityList[scope.row.province].name}} {{cityList[scope.row.province].province}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="申请时间" min-width="150" > <el-table-column align="center" label="申请时间" min-width="150" >
@ -229,14 +229,14 @@ async function pOk() { // 审核提交
size="small" size="small"
type="primary" type="primary"
link link
@click="processFunc(scope.row,2)" @click="processFunc(scope.row,3)"
>同意</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="processFunc(scope.row,3)" @click="processFunc(scope.row,2)"
>拒绝</el-button> >拒绝</el-button>
</template> </template>
</el-table-column> </el-table-column>

@ -258,7 +258,7 @@ function getTypeName(type) {
} }
function getProvinceName(province) { function getProvinceName(province) {
if(province < 0) return '' if(province < 0) return ''
return cityList[province].name return cityList[province].province
} }
</script> </script>
<template> <template>
@ -273,8 +273,8 @@ function getProvinceName(province) {
<el-select v-model="queryParams.province" clearable placeholder="请选择"> <el-select v-model="queryParams.province" clearable placeholder="请选择">
<el-option <el-option
v-for="(item,i) in cityList" v-for="(item,i) in cityList"
:key="item.ProID" :key="item.province"
:label="item.name" :label="item.province"
:value="i" :value="i"
/> />
</el-select> </el-select>
@ -315,19 +315,19 @@ function getProvinceName(province) {
</el-table-column> </el-table-column>
<el-table-column align="center" label="姓名" prop="nickname" /> <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" prop="phone" />
<el-table-column align="center" label="身份" min-width="150" prop="order_type"> <!-- <el-table-column align="center" label="身份" min-width="150" prop="order_type">-->
<template #default="scope"> <!-- <template #default="scope">-->
{{scope.row.idCard}} <!-- {{scope.row.idCard}}-->
</template> <!-- </template>-->
</el-table-column> <!-- </el-table-column>-->
<el-table-column align="center" label="所属区域" min-width="150"> <el-table-column align="center" label="所属区域" min-width="150">
<template #default="scope"> <template #default="scope">
{{getProvinceName(scope.row.province)}} {{getProvinceName(scope.row.province)}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="推荐人ID" min-width="150" prop="invite_id" /> <el-table-column align="center" label="推荐人ID" min-width="150" prop="invite_id" />
<el-table-column align="center" label="报课次数" min-width="150" prop="name" /> <el-table-column align="center" label="报课次数" min-width="150" prop="course_num" />
<el-table-column align="center" label="测试次数" min-width="150" prop="price" /> <el-table-column align="center" label="测试次数" min-width="150" prop="exam_num" />
<el-table-column align="center" label="累计金额" min-width="150" prop="balance" /> <el-table-column align="center" label="累计金额" min-width="150" prop="balance" />
<el-table-column align="center" label="注册时间" min-width="150" > <el-table-column align="center" label="注册时间" min-width="150" >
<template #default="scope"> <template #default="scope">

@ -76,7 +76,7 @@ function toDealDetail(type) {
ID{{userManageInfo.user_id}} ID{{userManageInfo.user_id}}
</div> </div>
<div class="bb-item"> <div class="bb-item">
注册时间{{userManageInfo.CreatedAt}} 注册时间{{custom.dateFmt(userManageInfo.created_at)}}
</div> </div>
<div class="bb-item"> <div class="bb-item">
身份学员 身份学员

@ -87,10 +87,6 @@ function getStateName(state) {
return item.value === state return item.value === state
})[0].name })[0].name
} }
function getProvinceName(province) {
if(province < 0) return ''
return cityList[province].name
}
async function passFunc(row) { // async function passFunc(row) { //
ElMessageBox.confirm('是否通过该提现申请?', '提示', { ElMessageBox.confirm('是否通过该提现申请?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
@ -169,7 +165,7 @@ async function rejectFunc(row) { // 拒绝
<div class="gva-btn-list"> <div class="gva-btn-list">
</div> </div>
<!-- 数据列表--> <!-- 数据列表-->
<el-table :data="tableData"> <el-table border :data="tableData">
<el-table-column align="center" label="ID" prop="user_id" sortable="custom" /> <el-table-column align="center" label="ID" prop="user_id" sortable="custom" />
<el-table-column align="center" label="头像" min-width="150"> <el-table-column align="center" label="头像" min-width="150">
<template #default="scope"> <template #default="scope">
@ -187,7 +183,7 @@ async function rejectFunc(row) { // 拒绝
</el-table-column> </el-table-column>
<el-table-column align="center" label="所属省份" min-width="150"> <el-table-column align="center" label="所属省份" min-width="150">
<template #default="scope"> <template #default="scope">
{{getProvinceName(scope.row.province)}} {{custom.getProvinceName(scope.row.province)}}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="状态" min-width="150"> <el-table-column align="center" label="状态" min-width="150">

Loading…
Cancel
Save