优化管理后台

This commit is contained in:
axlrose2333 2023-03-24 18:03:04 +08:00
parent 37402b0ea4
commit 820eae2394
12 changed files with 922 additions and 30 deletions

View File

@ -2,8 +2,8 @@ ENV = 'development'
VITE_CLI_PORT = 8088
VITE_SERVER_PORT = 8888
VITE_BASE_API = /api
//VITE_BASE_PATH = http://192.168.1.133
VITE_BASE_PATH = http://122.9.143.61
VITE_BASE_PATH = http://192.168.1.133
//VITE_BASE_PATH = http://122.9.143.61
VITE_EDITOR = vscode
// VITE_EDITOR = webstorm 如果使用webstorm开发且要使用dom定位到代码行功能 请先自定添加 webstorm到环境变量 再将VITE_EDITOR值修改为webstorm
// 如果使用docker-compose开发模式设置为下面的地址或本机主机IP

View File

@ -18,5 +18,12 @@ const api = {
params:data
})
},
searchUserList: data => { // 搜索用户列表
return service({
url: '/user/search',
method: 'get',
params:data
})
},
}
export default api

View File

@ -92,5 +92,19 @@ const api = {
data
})
},
verifyCourse : data => { // 审核课程
return service({
url: '/sys-course/verify',
method: 'post',
data
})
},
getTeacherCourseList: data => { // 教师课程列表
return service({
url: '/sys-course/teacher/'+data.teacherId,
method: 'get',
params:data
})
},
}
export default api

View File

@ -146,6 +146,34 @@ const custom = {
})
return data
},
getUserPosition(user_type) { // 获取用户身份
const position_arr = ['普通用户','助教','老师', '主管']; //普通用户,助教,老师,主管
const val_arr = []
for(let i = 0;i< position_arr.length;i++) {
if((user_type & 0b1) === 0b1 && i === 0) {
val_arr.push(0)
}
if((user_type & 0b10) === 0b10 && i === 1){
val_arr.push(1)
}
if((user_type & 0b100) === 0b100 && i === 2){
val_arr.push(2)
}
if((user_type & 0b1000) === 0b1000 && i === 3){
val_arr.push(3)
}
}
let str = ''
for(let i= 0;i<val_arr.length;i++) {
if(!str) {
str = position_arr[val_arr[i]]
}
else{
str =str+'&'+position_arr[val_arr[i]]
}
}
return str
},
getDealType() { // 获取交易类型
return [
{

View File

@ -220,7 +220,8 @@ function checkCourseFunc() { // 审核
function transferStateFromVerify(v_state) {
let state = 0
if(v_state === 1) { //
state = form.value.status
// state = form.value.status
state = 3
}
else{ //
state = 4
@ -232,6 +233,26 @@ function closeVerifyVisibleDialog() {
}
async function enterVerifyDialog() { //
const status = transferStateFromVerify(verifyForm.value.is_pass)
// console.log(status)
const res = await api.verifyCourse({
course_id:verifyForm.value.course_id,
status
})
if(res.code === 0) {
ElMessage({
type: 'success',
message: '操作成功!'
})
// closeVerifyVisibleDialog()
// getCourseList()
getCourseInfo()
}
else{
ElMessage({
type: 'warning',
message: res.msg
})
}
}
</script>
<template>
@ -246,12 +267,12 @@ async function enterVerifyDialog() { // 审核提交
<!-- 表单区域-->
<div class="gva-table-box">
<!-- step1-->
<el-form ref="ruleFormRef" disabled="true" v-if="active == 0" :model="form" :rules="rules" label-width="120px" style="width: 50%">
<el-form ref="ruleFormRef" v-if="active == 0" :model="form" :rules="rules" label-width="120px" style="width: 50%">
<el-form-item label="课程名称" prop="name">
<el-input placeholder="请输入课程名称" v-model="form.name" @change="handlerChange" />
<el-input disabled placeholder="请输入课程名称" v-model="form.name" @change="handlerChange" />
</el-form-item>
<el-form-item label="课程分类" prop="subject">
<el-select v-model="form.subject" placeholder="请选择" @change="handlerChange">
<el-select disabled v-model="form.subject" placeholder="请选择" @change="handlerChange">
<el-option
v-for="item in subjectList"
:key="item.id"
@ -262,6 +283,7 @@ async function enterVerifyDialog() { // 审核提交
</el-form-item>
<el-form-item label="封面">
<el-upload
disabled
class="avatar-uploader"
:action="`${path}/fileUploadAndDownload/upload`"
:headers="{ 'x-token': userStore.token }"
@ -274,11 +296,12 @@ async function enterVerifyDialog() { // 审核提交
</el-upload>
</el-form-item>
<el-form-item label="价格(元)" prop="price">
<el-input @change="handlerChange" placeholder="请输入课程价格" type="number" v-model="form.price" />
<el-input disabled @change="handlerChange" placeholder="请输入课程价格" type="number" v-model="form.price" />
</el-form-item>
<el-form-item label="课程简介">
<!-- <el-input @change="handlerChange" v-model="form.intro" type="textarea" />-->
<el-upload
disabled
class="avatar-uploader"
:action="`${path}/fileUploadAndDownload/upload`"
:headers="{ 'x-token': userStore.token }"
@ -294,14 +317,14 @@ async function enterVerifyDialog() { // 审核提交
<!-- <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-input @change="freeTestFunc" placeholder="请输入需要赠送的试卷份数1" v-model="form.free_test" />
<el-input disabled @change="freeTestFunc" placeholder="请输入需要赠送的试卷份数1" v-model="form.free_test" />
<div style="color:gray;font-size: 12px" v-if="form.free_test">总计{{(STD_TEST_PRICE*form.free_test).toFixed(2)}} </div>
</el-form-item>
<el-form-item label="设置精品">
<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 label="课程状态">
<el-switch @change="handlerChange" v-model="form.status" active-text="上架" inactive-text="下架" :active-value="1" :inactive-value="-1" />
<el-switch disabled @change="handlerChange" v-model="form.status" active-text="上架" inactive-text="下架" :active-value="1" :inactive-value="-1" />
</el-form-item>
<el-form-item style="display: none">
<el-button type="primary" @click="submitForm(ruleFormRef)">
@ -316,14 +339,14 @@ async function enterVerifyDialog() { // 审核提交
<div class="btn-box" style="text-align: right">
<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-else type="primary" @click="checkCourseFunc">审核</el-button>
<el-button v-if="form.status === 2" type="primary" @click="checkCourseFunc">审核</el-button>
</div>
</div>
<!-- 审核窗口-->
<el-dialog v-model="verifyVisible" :before-close="closeVerifyVisibleDialog" title="审核课程">
<el-form :model="verifyForm" label-width="80px">
<el-form-item label="是否通过" prop="is_free">
<el-switch v-model="verifyForm.is_pass" active-text="通过" inactive-text="拒绝" :active-value="1" :inactive-value="1" />
<el-switch v-model="verifyForm.is_pass" active-text="通过" inactive-text="拒绝" :active-value="1" :inactive-value="-1" />
</el-form-item>
</el-form>
<template #footer>

View File

@ -147,8 +147,10 @@ function viewCourseFunc(row) { // 查看课程
const verifyVisible = ref(false)
const verifyForm = ref({})
const verifyCourse = ref(null)
function checkCourseFunc(row) { //
// console.log(row)
verifyCourse.value = row
if(row.status == 2 || row.status == 4 ) { //
verifyForm.value.is_pass = -1
}
@ -161,7 +163,8 @@ function checkCourseFunc(row) { // 审核
function transferStateFromVerify(v_state) {
let state = 0
if(v_state == 1) { //
state = verifyCourse.value.status
// state = verifyCourse.value.status
state = 3
}
else{ //
state = 4
@ -173,6 +176,26 @@ function closeVerifyVisibleDialog() {
}
async function enterVerifyDialog() { //
const status = transferStateFromVerify(verifyForm.value.is_pass)
console.log(verifyForm.value)
const res = await api.verifyCourse({
course_id:verifyCourse.value .course_id,
status
})
if(res.code === 0) {
ElMessage({
type: 'success',
message: '操作成功!'
})
closeVerifyVisibleDialog()
getCourseList()
}
// else{
// ElMessage({
// type: 'warning',
// message: res.msg
// })
// }
}
</script>
<template>

View File

@ -0,0 +1,356 @@
<script setup>
//
import api from '@/api/course'
import custom from '@/utils/custom'
// import { toSQLLine } from '@/utils/stringFun'
import WarningBar from '@/components/warningBar/warningBar.vue'
import {ref,onMounted } from 'vue'
import {formatDate} from '@/utils/format'
import { ElMessage, ElMessageBox } from 'element-plus'
import { useRouter, useRoute } from 'vue-router'
const router = useRouter()
const route = useRoute()
//
const queryParams = ref({
page:1,
pageSize:10,
name:'',
status:'',
subject:'',
teacherId:0
})
const subjectParams = ref({
pageIndex:1,
pageSize:100,
})
const tableData = ref([])
const subjectList = ref([])
const deleteVisible = ref(false)
const course_ids = ref([])
const total = ref(0)
const dialogFormVisible = ref(false)
const dialogTitle = ref('')
const form =ref({})
const rules = ref({
name: [{ required: true, message: '请输入课程名称', trigger: 'blur' }]
})
const course_id = ref(0)
//
onMounted(() => {
queryParams.value.teacherId = route.params.user_id
getCourseList()
getSubject()
})
//
async function getCourseList() {
const res = await api.getTeacherCourseList(queryParams.value)
if(res.code === 0) {
tableData.value = res.data.records
}
}
async function getSubject(){ //
const res = await api.getSubjectList(subjectParams.value)
if(res.code === 0) {
// subjectList.value = custom.getStdSubject(res.data.records)
subjectList.value = custom.addTreeFormatSubject(res.data.records,'id')
// console.log(subjectList.value)
}
}
function onSubmit() {
getCourseList()
}
const onReset = () => {
queryParams.value = {
pageIndex:1,
pageSize:10,
name:'',
status:'',
subject:''
}
}
function openDialog(type) {
let params = {}
switch (type){
case 'add':
dialogTitle.value = '新增课程'
break;
case 'edit':
params.course_id = course_id.value
dialogTitle.value = '编辑课程'
break;
}
router.push({name:'addCourse',params})
}
async function onDelete() {
console.log(course_ids.value)
const ids = course_ids.value.map(item => item.course_id)
const res = await api.delCourse({ 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
getCourseList()
}
}
const handleSelectionChange = (val) => {
// console.log(val)
course_ids.value = val
}
function editCourseFunc(row) {
course_id.value = row.course_id
openDialog('edit')
}
function deleteCourseFunc(row) {
ElMessageBox.confirm('此操作将永久删除该数据, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(async() => {
const res = await api.delCourse({
ids:[row.course_id]
})
if (res.code === 0) {
ElMessage({
type: 'success',
message: '删除成功!'
})
// if (tableData.value.length === 1 && page.value > 1) {
// page.value--
// }
getCourseList()
}
},() => {
})
}
function handleCurrentChange(val) {
queryParams.value.pageIndex = val
getCourseList()
}
function handleSizeChange(val) {
queryParams.value.pageSize = val
getCourseList()
}
function closeDialog(){
dialogFormVisible.value = false
}
function enterDialog() {
}
function viewCourseFunc(row) { //
router.push({name:'viewCourse',params:{course_id:row.course_id}})
}
//
//
const verifyVisible = ref(false)
const verifyForm = ref({})
const verifyCourse = ref(null)
function checkCourseFunc(row) { //
// console.log(row)
verifyCourse.value = row
if(row.status == 2 || row.status == 4 ) { //
verifyForm.value.is_pass = -1
}
else{
verifyForm.value.is_pass = 1
}
verifyForm.is_pass = row.status
verifyVisible.value = true
}
function transferStateFromVerify(v_state) {
let state = 0
if(v_state == 1) { //
// state = verifyCourse.value.status
state = 3
}
else{ //
state = 4
}
return state
}
function closeVerifyVisibleDialog() {
verifyVisible.value = false
}
async function enterVerifyDialog() { //
const status = transferStateFromVerify(verifyForm.value.is_pass)
console.log(verifyForm.value)
const res = await api.verifyCourse({
course_id:verifyCourse.value .course_id,
status
})
if(res.code === 0) {
ElMessage({
type: 'success',
message: '操作成功!'
})
closeVerifyVisibleDialog()
getCourseList()
}
// else{
// ElMessage({
// type: 'warning',
// message: res.msg
// })
// }
}
</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.subject" clearable placeholder="请选择">-->
<!-- <el-option-->
<!-- v-for="item in subjectList"-->
<!-- :key="item.id"-->
<!-- :label="item.name"-->
<!-- :value="item.id"-->
<!-- />-->
<!-- </el-select>-->
<el-tree-select v-model="queryParams.subject" :data="subjectList" :render-after-expand="false" />
</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-button size="small" type="primary" icon="plus" @click="openDialog('add')">新增</el-button>-->
<!-- <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>-->
<!-- <template #reference>-->
<!-- <el-button icon="delete" size="small" type="danger" :disabled="!course_ids.length" style="margin-left: 10px;" @click="deleteVisible = true">删除</el-button>-->
<!-- </template>-->
<!-- </el-popover>-->
</div>
<!-- 数据列表-->
<el-table :data="tableData" border @selection-change="handleSelectionChange">
<!-- <el-table-column-->
<!-- type="selection"-->
<!-- width="55"-->
<!-- />-->
<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="subject" />
<el-table-column align="left" label="价格" min-width="150">
<template #default="scope">{{scope.row.price/100}}</template>
</el-table-column>
<el-table-column align="left" label="状态" min-width="150" prop="status">
<template #default="scope">
{{scope.row.status == 1?'上架':scope.row.status == 2?'待审核':scope.row.status == 3?'通过':scope.row.status == 4?'未通过':'下架'}}
</template>
</el-table-column>
<el-table-column align="left" label="是否精品" min-width="150" prop="is_boutique">
<template #default="scope">
{{scope.row.is_sift === 1? '是':'否'}}
</template>
</el-table-column>
<el-table-column align="left" label="创建时间" min-width="150">
<template #default="scope">
{{formatDate(scope.row.CreatedAt)}}
</template>
</el-table-column>
<!-- <el-table-column align="left" fixed="right" label="操作" width="200">-->
<!-- <template #default="scope">-->
<!-- <el-button-->
<!-- icon="view"-->
<!-- size="small"-->
<!-- type="primary"-->
<!-- link-->
<!-- @click="viewCourseFunc(scope.row)"-->
<!-- >预览</el-button>-->
<!-- <el-button-->
<!-- icon="edit"-->
<!-- size="small"-->
<!-- type="primary"-->
<!-- link-->
<!-- @click="editCourseFunc(scope.row)"-->
<!-- >查看</el-button>-->
<!-- <el-button-->
<!-- v-if="scope.row.status === 2"-->
<!-- icon="check"-->
<!-- size="small"-->
<!-- type="primary"-->
<!-- link-->
<!-- @click="checkCourseFunc(scope.row)"-->
<!-- >审核</el-button>-->
<!-- </template>-->
<!-- </el-table-column>-->
</el-table>
<div class="gva-pagination">
<el-pagination
:current-page="queryParams.pageIndex"
: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="dialogFormVisible" :before-close="closeDialog" :title="dialogTitle">
<el-form ref="apiForm" :model="form" :rules="rules" label-width="80px">
<el-form-item label="课程名称" prop="name">
<el-input v-model="form.name" autocomplete="off" />
</el-form-item>
<el-form-item label="课程简介" prop="introduction">
<el-input v-model="form.introduction" autocomplete="off" />
</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="enterDialog"> </el-button>
</div>
</template>
</el-dialog>
<!-- 审核窗口-->
<el-dialog v-model="verifyVisible" :before-close="closeVerifyVisibleDialog" title="审核课程">
<el-form :model="verifyForm" label-width="80px">
<el-form-item label="是否通过" prop="is_free">
<el-switch v-model="verifyForm.is_pass" 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="closeVerifyVisibleDialog"> </el-button>
<el-button size="small" type="primary" @click="enterVerifyDialog"> </el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<style scoped lang="scss">
.button-box {
padding: 10px 20px;
.el-button {
float: right;
}
}
.warning {
color: #dc143c;
}
</style>

View File

@ -0,0 +1,430 @@
<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 { toSQLLine } from '@/utils/stringFun'
import WarningBar from '@/components/warningBar/warningBar.vue'
// import ckEditor from '@/components/richText/ckEditor5.vue'
// import coursePool from './components/coursePool.vue'
// import exercisesPool from '@/view/course/components/exercisesPool.vue'
// import groupPool from './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 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({
pageIndex: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(() => {
queryParams.value.teacherId = route.params.user_id
console.log(queryParams.value.teacherId)
getExaminationList()
getSubject()
})
provide('subjectList', subjectList)
provide('current_subject', current_subject)
const std_group = ref({
persons:'',
expiry_date:'',
public_date:'',
first:'',
second:'',
third:''
})
//
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)
subjectList.value = custom.addTreeFormatSubject(res.data.records,'name')
}
}
function onSubmit() {
getExaminationList()
}
const onReset = () => {
queryParams.value = {
pageIndex: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 editCourseFunc(row) {
// row.exam.course_ids = JSON.parse(row.exam.course_ids)
// row.exam.question_ids = JSON.parse(row.exam.question_ids)
exam_id.value = row.exam.exam_id
form.value = _.cloneDeep(row.exam)
form.value.course_ids = JSON.parse(row.exam.course_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) => {
for(let prop in item) {
if(price_props.includes(prop)) {
item[prop] /= 100
}
}
return item
})
// console.log(form.value)
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.exam_id]
})
if (res.code === 0) {
ElMessage({
type: 'success',
message: '删除成功!'
})
getExaminationList()
}
},() => {
})
}
function handleCurrentChange(val) {
queryParams.value.pageIndex = 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
})
// console.log(form.value)
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)
// return
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 getStateName(state) {
let str = ''
switch (state){
case 1:
str = '上架'
break;
case -1:
str = '下架'
break;
}
return str
}
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!')
}
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 addGroupFunc(data) {
console.log("父组件行为")
exam_types.value = _.clone(data)
}
</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.subject" clearable placeholder="请选择">-->
<!-- <el-option-->
<!-- v-for="item in subjectList"-->
<!-- :key="item.id"-->
<!-- :label="item.name"-->
<!-- :value="item.name"-->
<!-- />-->
<!-- </el-select>-->
<el-tree-select v-model="queryParams.subject" :data="subjectList" :render-after-expand="false" />
</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-button size="small" type="primary" icon="plus" @click="openDialog('add')">新增</el-button>-->
<!-- <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>-->
<!-- <template #reference>-->
<!-- <el-button icon="delete" size="small" type="danger" :disabled="!exam_ids.length" style="margin-left: 10px;" @click="deleteVisible = true">删除</el-button>-->
<!-- </template>-->
<!-- </el-popover>-->
<!-- </div>-->
<!-- 数据列表-->
<el-table :data="tableData" @selection-change="handleSelectionChange">
<!-- <el-table-column-->
<!-- type="selection"-->
<!-- width="55"-->
<!-- />-->
<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.price">
<template #default="scope">
{{scope.row.exam.price/100}}
</template>
</el-table-column>
<el-table-column align="center" label="科目" min-width="150" prop="exam.subject" />
<el-table-column align="center" label="封面" min-width="150" >
<template #default="scope">
<img class="e-img" :src="scope.row.exam.cover" alt="">
</template>
</el-table-column>
<el-table-column align="center" label="状态" min-width="150" >
<template #default="scope">
<div>{{getStateName(scope.row.exam.status)}}</div>
</template>
</el-table-column>
<el-table-column label="销量">
<template #default="scope">
<div>{{scope.row.exam.sale}}</div>
</template>
</el-table-column>
<el-table-column align="center" label="组数" min-width="150" >
<template #default="scope">
<div>{{scope.row.exam_types.length}}</div>
</template>
</el-table-column>
<el-table-column align="center" label="创建时间" min-width="150" >
<template #default="scope">
{{formatDate(scope.row.exam.CreatedAt)}}
</template>
</el-table-column>
<!-- <el-table-column align="center" fixed="right" label="操作" width="200">-->
<!-- <template #default="scope">-->
<!-- <el-button-->
<!-- icon="edit"-->
<!-- size="small"-->
<!-- type="primary"-->
<!-- link-->
<!-- @click="editCourseFunc(scope.row)"-->
<!-- >编辑</el-button>-->
<!-- <el-button-->
<!-- icon="delete"-->
<!-- size="small"-->
<!-- type="danger"-->
<!-- link-->
<!-- @click="deleteExamFunc(scope.row)"-->
<!-- >删除</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>
</div>
</template>
<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>

View File

@ -94,7 +94,7 @@ function getStateName(state) {
注册时间{{formatDate(assistantInfo.created_at)}}
</div>
<div class="bb-item">
身份助教
身份{{custom.getUserPosition(assistantInfo.user_type)}}
</div>
<!-- <div class="bb-item">-->
<!-- 邀请人数105-->

View File

@ -186,14 +186,12 @@ async function saveData() {
const selectLoading = ref(false)
async function remoteMethod(query) {
selectLoading.value = true
const res = await capi.getUserList({
name:query,
page:1,
pageSize:100
const res = await capi.searchUserList({
key:query
})
selectLoading.value = false
if(res.code === 0) {
user_list.value = res.data.records
user_list.value = res.data
}
}
</script>

View File

@ -25,9 +25,9 @@ async function getTeacherDetail() {
const res = await api.getTeacherDetail({id:route.params.id})
if(res.code === 0) {
teacherInfo.value = res.data
let teacher_cert = JSON.parse(res.data.teacher_cert)
// let teacher_cert = JSON.parse(res.data.teacher_cert)
let skill_cert = JSON.parse(res.data.skill_cert)
imgs.value = [...skill_cert,...teacher_cert]
imgs.value = [...skill_cert]
// console.log(imgs.value)
}
}
@ -74,6 +74,19 @@ function getStateName(state) {
}
return str
}
const detail_type = ref({
dealDetailMoney:'dealDetailMoney',
courseListDetail:'courseListDetail', //
examListDetail:'examListDetail', //
// dealDetailPoint:'dealDetailPoint',
// learningDetail:'learningDetail',
// testDetail:'testDetail',
// auctionDetail:'auctionDetail',//
// raffleDetail:'raffleDetail',//
})
function toDealDetail(type) {
router.push({name:type,params:{user_id:route.params.id}})
}
</script>
<template>
<div>
@ -140,7 +153,7 @@ function getStateName(state) {
<div class="di-left">累计收益</div>
<div class="di-right">{{teacherInfo.income}}</div>
</div>
<div class="dib-item link-item">
<div class="dib-item link-item" @click="toDealDetail(detail_type.dealDetailMoney)">
<div class="di-left">查看交易明细</div>
</div>
</div>
@ -149,7 +162,7 @@ function getStateName(state) {
<div class="di-left">上架课程</div>
<div class="di-right">{{teacherInfo.publish_course}}</div>
</div>
<div class="dib-item link-item">
<div class="dib-item link-item" @click="toDealDetail(detail_type.courseListDetail)">
<div class="di-left">查看课程列表</div>
</div>
</div>
@ -158,7 +171,7 @@ function getStateName(state) {
<div class="di-left">上架测试</div>
<div class="di-right">{{teacherInfo.publish_exam}}</div>
</div>
<div class="dib-item link-item">
<div class="dib-item link-item" @click="toDealDetail(detail_type.examListDetail)">
<div class="di-left ">查看试卷列表</div>
</div>
</div>
@ -171,9 +184,9 @@ function getStateName(state) {
<div class="di-left">累计金额</div>
<div class="di-right">{{teacherInfo.course_income}}</div>
</div>
<div class="dib-item link-item">
<div class="di-left">查看学习记录</div>
</div>
<!-- <div class="dib-item link-item">-->
<!-- <div class="di-left">查看销售记录</div>-->
<!-- </div>-->
</div>
<div class="dib-row">
<div class="dib-item">
@ -184,9 +197,9 @@ function getStateName(state) {
<div class="di-left">累计金额</div>
<div class="di-right">{{teacherInfo.exam_income}}</div>
</div>
<div class="dib-item link-item">
<div class="di-left">查看测试记录</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">

View File

@ -70,7 +70,7 @@ function toDealDetail(type) {
注册时间{{userManageInfo.CreatedAt}}
</div>
<div class="bb-item">
身份教师
身份学员
</div>
<div class="bb-item">
邀请人数105