提交 5d5c19de authored 作者: matian's avatar matian

chore:对接教工管理接口

上级 bc8d8a5f
<script lang="ts" setup> <script lang="ts" setup>
import AddStudent from '../../student/components/AddStudent.vue'
const emit = defineEmits<Emits>() const emit = defineEmits<Emits>()
defineProps({ defineProps({
...@@ -12,6 +14,9 @@ defineProps({ ...@@ -12,6 +14,9 @@ defineProps({
interface Emits { interface Emits {
(e: 'update:isAddStuDialog', isAddStuDialog: boolean): void (e: 'update:isAddStuDialog', isAddStuDialog: boolean): void
} }
const isShowAddDialog = ref(false)
const title = ref('')
const id = ref('')
const listOptions = $computed(() => { const listOptions = $computed(() => {
return { return {
// remote: { httpRequest: getProList, params: { name: '' } }, // remote: { httpRequest: getProList, params: { name: '' } },
...@@ -56,20 +61,19 @@ const handleDel = (row: any) => { ...@@ -56,20 +61,19 @@ const handleDel = (row: any) => {
} }
const handleDetail = (row: any) => { const handleDetail = (row: any) => {
console.log(row) console.log(row)
id.value = row.id
isShowAddDialog.value = true
title.value = '查看详情'
} }
const handleCancel = () => { const handleCancel = () => {
emit('update:isAddStuDialog', false) emit('update:isAddStuDialog', false)
} }
const handleRefresh = () => {
console.log('ppp')
}
</script> </script>
<template> <template>
<el-dialog <el-dialog :model-value="isAddStuDialog" draggable title="添加班级学生" width="60%" :before-close="handleCancel">
:model-value="isAddStuDialog"
draggable
title="添加班级学生"
width="60%"
center
:before-close="handleCancel"
>
<div style="overflow-y: auto; height: 70vh"> <div style="overflow-y: auto; height: 70vh">
<el-descriptions> <el-descriptions>
<el-descriptions-item label="班级代码:">kooriookami</el-descriptions-item> <el-descriptions-item label="班级代码:">kooriookami</el-descriptions-item>
...@@ -91,5 +95,13 @@ const handleCancel = () => { ...@@ -91,5 +95,13 @@ const handleCancel = () => {
</template> </template>
</AppList> </AppList>
</div> </div>
<!-- 新增学生 -->
</el-dialog> </el-dialog>
<AddStudent
v-if="isShowAddDialog === true"
v-model:isShowAddDialog="isShowAddDialog"
:id="id"
:title="title"
@create="handleRefresh"
/>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import AddStudentDialog from './AddStudentDialog.vue' import AddStudentDialog from './AddStudentDialog.vue'
import AddStudent from '../../student/components/AddStudent.vue'
const emit = defineEmits<Emits>() const emit = defineEmits<Emits>()
const isAddStuDialog = ref(false) const isAddStuDialog = ref(false)
defineProps({ defineProps({
...@@ -13,6 +15,9 @@ defineProps({ ...@@ -13,6 +15,9 @@ defineProps({
interface Emits { interface Emits {
(e: 'update:isShowClassStuDialog', isShowClassStuDialog: boolean): void (e: 'update:isShowClassStuDialog', isShowClassStuDialog: boolean): void
} }
const isShowAddDialog = ref(false)
const title = ref('')
const id = ref('')
const listOptions = $computed(() => { const listOptions = $computed(() => {
return { return {
// remote: { httpRequest: getProList, params: { name: '' } }, // remote: { httpRequest: getProList, params: { name: '' } },
...@@ -47,27 +52,25 @@ const listOptions = $computed(() => { ...@@ -47,27 +52,25 @@ const listOptions = $computed(() => {
}) })
const handleAddStu = () => { const handleAddStu = () => {
isAddStuDialog.value = true isAddStuDialog.value = true
console.log(111) console.log(isAddStuDialog)
} }
const handleDel = (row: any) => { const handleDel = (row: any) => {
console.log(row) console.log(row)
} }
const handleDetail = (row: any) => { const handleDetail = (row: any) => {
console.log(row) console.log(row)
isShowAddDialog.value = true
title.value = '查看详情'
} }
const handleCancel = () => { const handleCancel = () => {
emit('update:isShowClassStuDialog', false) emit('update:isShowClassStuDialog', false)
} }
const handleRefresh = () => {
console.log('ppp')
}
</script> </script>
<template> <template>
<el-dialog <el-dialog :model-value="isShowClassStuDialog" draggable title="班级学生" width="70%" :before-close="handleCancel">
:model-value="isShowClassStuDialog"
draggable
title="班级学生"
width="70%"
center
:before-close="handleCancel"
>
<div style="overflow-y: auto; height: 70vh"> <div style="overflow-y: auto; height: 70vh">
<el-descriptions> <el-descriptions>
<el-descriptions-item label="班级代码:">kooriookami</el-descriptions-item> <el-descriptions-item label="班级代码:">kooriookami</el-descriptions-item>
...@@ -90,5 +93,12 @@ const handleCancel = () => { ...@@ -90,5 +93,12 @@ const handleCancel = () => {
</AppList> </AppList>
</div> </div>
<AddStudentDialog v-model:isAddStuDialog="isAddStuDialog" v-if="isAddStuDialog === true" /> <AddStudentDialog v-model:isAddStuDialog="isAddStuDialog" v-if="isAddStuDialog === true" />
<AddStudent
v-if="isShowAddDialog === true"
v-model:isShowAddDialog="isShowAddDialog"
:id="id"
:title="title"
@create="handleRefresh"
/>
</el-dialog> </el-dialog>
</template> </template>
...@@ -10,7 +10,7 @@ const isShowProDialog = ref(false) ...@@ -10,7 +10,7 @@ const isShowProDialog = ref(false)
const listOptions = $computed(() => { const listOptions = $computed(() => {
return { return {
// remote: { httpRequest: getProList, params: { name: '' } }, // remote: { httpRequest: getProList, params: { name: '' } },
filters: [{ type: 'input', prop: 'name', label: '专业名称', placeholder: '专业名称' }], filters: [{ type: 'input', prop: 'name', label: '专业名称:', placeholder: '专业名称' }],
columns: [ columns: [
{ label: '序号', type: 'index', align: 'center' }, { label: '序号', type: 'index', align: 'center' },
{ label: '专业代码', prop: 'code', align: 'center' }, { label: '专业代码', prop: 'code', align: 'center' },
......
...@@ -50,9 +50,6 @@ const handleAddStu = () => { ...@@ -50,9 +50,6 @@ const handleAddStu = () => {
console.log(111) console.log(111)
} }
const handleDetail = (row: any) => {
console.log(row)
}
const handleCancel = () => { const handleCancel = () => {
emit('update:isShowCourse', false) emit('update:isShowCourse', false)
} }
...@@ -71,9 +68,11 @@ const handleCancel = () => { ...@@ -71,9 +68,11 @@ const handleCancel = () => {
</el-descriptions> </el-descriptions>
<AppList v-bind="listOptions" ref="appList" border stripe style="margin-top: 30px"> <AppList v-bind="listOptions" ref="appList" border stripe style="margin-top: 30px">
<el-button type="primary" round @click="handleAddStu">关联选择课程</el-button> <el-button type="primary" round @click="handleAddStu">关联选择课程</el-button>
<template #table-operate="{ row }"> <template #table-operate>
<el-space> <el-space>
<el-link type="primary" plain @click="handleDetail(row)">查看</el-link> <router-link :to="'/course/my/view?id=6952509530357891072'" target="_blank">
<el-link type="primary" plain>查看</el-link>
</router-link>
</el-space> </el-space>
</template> </template>
</AppList> </AppList>
......
...@@ -52,9 +52,7 @@ const handleAddCourse = () => { ...@@ -52,9 +52,7 @@ const handleAddCourse = () => {
const handleDel = (row: any) => { const handleDel = (row: any) => {
console.log(row) console.log(row)
} }
const handleDetail = (row: any) => {
console.log(row)
}
const handleCancel = () => { const handleCancel = () => {
emit('update:isShowSemCourseDialog', false) emit('update:isShowSemCourseDialog', false)
} }
...@@ -81,7 +79,9 @@ const handleCancel = () => { ...@@ -81,7 +79,9 @@ const handleCancel = () => {
<el-button type="primary" round @click="handleAddCourse">添加课程</el-button> <el-button type="primary" round @click="handleAddCourse">添加课程</el-button>
<template #table-operate="{ row }"> <template #table-operate="{ row }">
<el-space> <el-space>
<el-link type="primary" plain @click="handleDetail(row)">查看</el-link> <router-link :to="'/course/my/view?id=6952509530357891072'" target="_blank">
<el-link type="primary" plain>查看</el-link>
</router-link>
<el-link plain @click="handleDel(row)">移除</el-link> <el-link plain @click="handleDel(row)">移除</el-link>
</el-space> </el-space>
</template> </template>
......
import httpRequest from '@/utils/axios' import httpRequest from '@/utils/axios'
// 获取学生列表 // // 获取学生列表
export function getStudentList(params?: { type?: string; page?: number; page_size?: number }) { export function getStaffList(params?: { name?: string; organ_id?: string; page?: string; ['per-page']?: string }) {
return httpRequest.get('/api/psp/backend/video/index', { params }) return httpRequest.get('/api/resource/v1/learning/teacher/list', { params })
} }
// // 获取学生列表 // // 获取学生列表
export function importStudent(params?: { file: any }) { export function addStaff(data?: {
return httpRequest.get('/api/psp/backend/video/index', { params }) school: string
name: string
gender: string
mobile: string
role: string
email: string
}) {
return httpRequest.post('/api/resource/v1/learning/teacher/create', data)
}
// 获取教工详情
export function getStaffDetail(params?: { id: string }) {
return httpRequest.get('/api/resource/v1/learning/teacher/view', { params })
}
// 更新教工
export function updateStaff(data?: {
id: string
school: string
name: string
gender: string
mobile: string
role: string
email: string
}) {
return httpRequest.post('/api/resource/v1/learning/teacher/update', data)
} }
<script lang="ts" setup> <script lang="ts" setup>
import type { FormRules } from 'element-plus' import type { FormInstance, FormRules } from 'element-plus'
import { ElMessage } from 'element-plus'
import { useProjectList } from '@/composables/useGetProjectList'
import { useMapStore } from '@/stores/map'
import { addStaff, updateStaff, getStaffDetail } from '../api'
const store = useMapStore()
const ruleFormRef = ref<FormInstance>()
const emit = defineEmits<Emits>() const emit = defineEmits<Emits>()
const schoolList = [
{
id: '111',
name: '清华'
},
{
id: '222',
name: '北大'
}
]
const form = reactive({
school: '',
name: '',
sex: 0,
mobile: '',
role: 0,
email: ''
})
const rules = reactive<FormRules>({
school: [{ required: true, message: '请选择部门/学校', trigger: 'change' }],
name: [{ required: true, message: '请输入姓名', trigger: 'blur' }],
sex: [{ required: true, message: '请选择性别', trigger: 'change' }],
mobile: [{ required: true, message: '请输入手机号', trigger: 'blur' }],
role: [{ required: true, message: '请选择角色类型', trigger: 'change' }],
email: [{ required: true, message: '请输入邮箱', trigger: 'blur' }]
})
const props = defineProps({ const props = defineProps({
isShowStaffDialog: { isShowStaffDialog: {
type: Boolean type: Boolean
}, },
title: { title: {
type: String type: String
},
isEdit: {
type: String
},
id: {
type: String
} }
}) })
interface Emits { interface Emits {
(e: 'update:isShowStaffDialog', isShowStaffDialog: boolean): void (e: 'update:isShowStaffDialog', isShowStaffDialog: boolean): void
(e: 'create'): void (e: 'create'): void
} }
const departmentList: any = useProjectList('', '79806610719731712').departmentList
const sexList = store.mapList.filter((item: any) => item.key === 'system_gender')[0].values
const roleList = store.mapList.filter((item: any) => item.key === 'teacher_role')[0].values
const form = reactive({
organ_id: '',
name: '',
gender: '1',
mobile: '',
role: '2',
email: ''
})
const rules = reactive<FormRules>({
organ_id: [{ required: true, message: '请选择部门/学校', trigger: 'change' }],
name: [{ required: true, message: '请输入姓名', trigger: 'blur' }],
gender: [{ required: true, message: '请选择性别', trigger: 'change' }],
mobile: [
{ required: true, message: '请输入手机号', trigger: 'blur' },
{ pattern: /^1(3|4|5|7|8)\d{9}$/, message: '请输入正确的手机号', trigger: 'blur' }
],
role: [{ required: true, message: '请选择角色类型', trigger: 'change' }],
email: [{ required: true, message: '请输入邮箱', trigger: 'blur' }]
})
// 取消 // 取消
const handleCancel = () => { const handleCancel = () => {
emit('update:isShowStaffDialog', false) emit('update:isShowStaffDialog', false)
} }
const handleConfirm = () => {
emit('update:isShowStaffDialog', false) // 确定
emit('create') const handleConfirm = async (formEl: FormInstance | undefined) => {
if (!formEl) return
await formEl.validate(valid => {
console.log(valid)
if (valid) {
if (props.isEdit === '0') {
// 更新字典的值
const params: any = Object.assign({}, form)
addStaff(params).then(() => {
ElMessage.success('新增教工成功')
emit('update:isShowStaffDialog', false)
emit('create')
})
} else if (props.isEdit === '1') {
const params: any = Object.assign({ id: props.id }, form)
updateStaff(params).then(() => {
ElMessage.success('更新教工成功')
emit('update:isShowStaffDialog', false)
emit('create')
})
} else {
emit('update:isShowStaffDialog', false)
emit('create')
}
}
})
}
// 获取详情
if (props.isEdit === '2' || props.isEdit === '1') {
const params: any = { id: props.id }
getStaffDetail(params).then((res: any) => {
console.log(res)
Object.keys(form).forEach(key => {
form[key] = res.data[key]
})
})
} }
</script> </script>
<template> <template>
<el-dialog :model-value="isShowStaffDialog" draggable :before-close="handleCancel" :title="props.title" width="30%"> <el-dialog :model-value="isShowStaffDialog" draggable :title="props.title" :before-close="handleCancel" width="30%">
<el-form :model="form" label-position="right" label-width="auto" :rules="rules" ref="formRef"> <el-form :model="form" label-position="right" label-width="auto" :rules="rules" ref="ruleFormRef">
<el-form-item label="所属部门/学校:" prop="school"> <el-form-item label="所属部门/学校:" prop="school">
<el-select v-model="form.school" placeholder="请选择所属部门/学校" :disabled="props.title === '查看详情'"> <el-select clearable v-model="form.organ_id" :disabled="props.title === '查看详情'" style="width: 100%">
<el-option v-for="(item, index) in schoolList" :key="index" :label="item.name" :value="item.id"></el-option> <el-option v-for="item in departmentList" :key="item.id" :label="item.name" :value="item.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="姓名:" prop="name"> <el-form-item label="姓名:" prop="name">
<el-input v-model="form.name" :disabled="props.title === '查看详情'"></el-input> <el-input v-model="form.name" :disabled="props.title === '查看详情'"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="性别:" prop="sex"> <el-form-item label="性别:" prop="gender">
<el-radio-group v-model="form.sex" :disabled="props.title === '查看详情'"> <el-radio-group v-model="form.gender" :disabled="props.title === '查看详情'">
<el-radio :label="0"></el-radio> <el-radio v-for="(item, index) in sexList" :key="index" :label="item.value">{{ item.label }}</el-radio>
<el-radio :label="1"></el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="手机号:" prop="mobile"> <el-form-item label="手机号:" prop="mobile">
...@@ -72,7 +116,7 @@ const handleConfirm = () => { ...@@ -72,7 +116,7 @@ const handleConfirm = () => {
</el-form-item> </el-form-item>
<el-form-item label="角色类型:" prop="role"> <el-form-item label="角色类型:" prop="role">
<el-radio-group v-model="form.role" :disabled="props.title === '查看详情'"> <el-radio-group v-model="form.role" :disabled="props.title === '查看详情'">
<el-radio :label="0">班主任</el-radio> <el-radio v-for="(item, index) in roleList" :key="index" :label="item.value">{{ item.label }}</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="邮箱:" prop="email"> <el-form-item label="邮箱:" prop="email">
...@@ -82,7 +126,7 @@ const handleConfirm = () => { ...@@ -82,7 +126,7 @@ const handleConfirm = () => {
<template #footer> <template #footer>
<span> <span>
<el-button @click="handleCancel">取消</el-button> <el-button @click="handleCancel">取消</el-button>
<el-button type="primary" @click="handleConfirm">确认</el-button> <el-button type="primary" @click="handleConfirm(ruleFormRef)">确认</el-button>
</span> </span>
</template> </template>
</el-dialog> </el-dialog>
......
<script setup lang="ts"> <script setup lang="ts">
// import { getStudentList } from '../api' import { getStaffList } from '../api'
// import { useMapStore } from '@/stores/map' // import { useMapStore } from '@/stores/map'
// const store = useMapStore() // const store = useMapStore()
import { useProjectList } from '@/composables/useGetProjectList'
import AddStaff from '../components/AddStaff.vue' import AddStaff from '../components/AddStaff.vue'
const departmentList: any = useProjectList('', '79806610719731712').departmentList
const appList = ref() const appList = ref()
const studentId = ref('') const studentId = ref('')
const title = ref('') // 弹框标题 const title = ref('') // 弹框标题
const isEdit = ref('')
const id = ref('')
const isShowStaffDialog = ref(false) const isShowStaffDialog = ref(false)
const listOptions = $computed(() => { const listOptions = $computed(() => {
return { return {
// remote: { httpRequest: getStudentList, params: { type: '' } }, remote: { httpRequest: getStaffList },
filters: [ filters: [
{ type: 'input', prop: 'name', label: '姓名', placeholder: '姓名' }, { type: 'input', prop: 'name', label: '姓名:', placeholder: '姓名' },
{ type: 'select', prop: 'office', label: '所属部门/学校', placeholder: '所属部门/学校' } { type: 'select', slots: 'filter-department' }
], ],
columns: [ columns: [
{ label: '序号', type: 'index', align: 'center' }, { label: '序号', type: 'index', align: 'center' },
{ label: '所属部门/学校', prop: 'school', align: 'center' }, { label: '所属部门/学校', prop: 'organ_id_name', align: 'center' },
{ label: '手机号', prop: 'mobile', align: 'center' }, { label: '手机号', prop: 'mobile', align: 'center' },
{ label: '姓名', prop: 'name', align: 'center' }, { label: '姓名', prop: 'name', align: 'center' },
{ label: '性别', prop: 'sex', align: 'center' }, { label: '性别', prop: 'gender_name', align: 'center' },
{ label: '邮箱', prop: 'email', align: 'center' }, { label: '邮箱', prop: 'email', align: 'center' },
{ label: '角色类型', prop: 'province', align: 'center' }, { label: '角色类型', prop: 'role_name', align: 'center' },
{ label: '更新时间', prop: 'update_time', align: 'center' }, { label: '更新时间', prop: 'updated_time', align: 'center' },
{ label: '操作', slots: 'table-operate', align: 'center', fixed: 'right' } { label: '操作', slots: 'table-operate', align: 'center', fixed: 'right' }
], ]
data: [{ name: '222' }]
} }
}) })
...@@ -38,18 +42,25 @@ const listOptions = $computed(() => { ...@@ -38,18 +42,25 @@ const listOptions = $computed(() => {
const handleAddStudent = () => { const handleAddStudent = () => {
isShowStaffDialog.value = true isShowStaffDialog.value = true
title.value = '新增教工' title.value = '新增教工'
isEdit.value = '0'
} }
// 编辑学生 // 编辑学生
const handleEdit = (row: any) => { const handleEdit = (row: any) => {
isShowStaffDialog.value = true isShowStaffDialog.value = true
title.value = '编辑教工' title.value = '编辑教工'
studentId.value = row.id studentId.value = row.id
isEdit.value = '1'
} }
// 查看详情 // 查看详情
const handleDetail = (row: any) => { const handleDetail = (row: any) => {
isShowStaffDialog.value = true isShowStaffDialog.value = true
title.value = '查看详情' title.value = '查看详情'
studentId.value = row.id studentId.value = row.id
isEdit.value = '2'
id.value = row.id
}
const handleFresh = () => {
appList.value.refetch()
} }
</script> </script>
...@@ -57,6 +68,12 @@ const handleDetail = (row: any) => { ...@@ -57,6 +68,12 @@ const handleDetail = (row: any) => {
<AppCard title="教工用户管理"> <AppCard title="教工用户管理">
<AppList v-bind="listOptions" ref="appList" border stripe style="margin-top: 30px"> <AppList v-bind="listOptions" ref="appList" border stripe style="margin-top: 30px">
<el-button type="primary" round @click="handleAddStudent">新增教工</el-button> <el-button type="primary" round @click="handleAddStudent">新增教工</el-button>
<template #filter-department="{ params }">
<div class="name" style="font-size: 14px; color: #606266; padding-right: 12px">所属部门/学校:</div>
<el-select @change="handleFresh" clearable v-model="params.authorized">
<el-option v-for="item in departmentList" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</template>
<template #table-operate="{ row }"> <template #table-operate="{ row }">
<el-space> <el-space>
<el-link type="primary" plain @click="handleDetail(row)">查看</el-link> <el-link type="primary" plain @click="handleDetail(row)">查看</el-link>
...@@ -65,5 +82,12 @@ const handleDetail = (row: any) => { ...@@ -65,5 +82,12 @@ const handleDetail = (row: any) => {
</template> </template>
</AppList> </AppList>
</AppCard> </AppCard>
<AddStaff v-model:isShowStaffDialog="isShowStaffDialog" :title="title" /> <AddStaff
v-model:isShowStaffDialog="isShowStaffDialog"
v-if="isShowStaffDialog === true"
:title="title"
:isEdit="isEdit"
:id="id"
@create="handleFresh"
/>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import type { FormRules } from 'element-plus' import type { FormRules } from 'element-plus'
import { useProjectList } from '@/composables/useGetProjectList'
const emit = defineEmits<Emits>() const emit = defineEmits<Emits>()
const departmentList: any = useProjectList('', '79806610719731712').departmentList
const schoolList = [
{
id: '111',
name: '清华'
},
{
id: '222',
name: '北大'
}
]
const classList = [ const classList = [
{ {
id: '111', id: '111',
...@@ -100,8 +93,8 @@ const handleConfirm = () => { ...@@ -100,8 +93,8 @@ const handleConfirm = () => {
<el-input v-model="form.card_number" :disabled="props.title === '查看详情'" /> <el-input v-model="form.card_number" :disabled="props.title === '查看详情'" />
</el-form-item> </el-form-item>
<el-form-item label="所属部门/学校:" prop="school"> <el-form-item label="所属部门/学校:" prop="school">
<el-select v-model="form.school" placeholder="请选择所属部门/学校" :disabled="props.title === '查看详情'"> <el-select clearable v-model="form.school" :disabled="props.title === '查看详情'" style="width: 100%">
<el-option v-for="(item, index) in schoolList" :key="index" :label="item.name" :value="item.id"></el-option> <el-option v-for="item in departmentList" :key="item.id" :label="item.name" :value="item.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="专业:" prop="major"> <el-form-item label="专业:" prop="major">
......
...@@ -13,8 +13,8 @@ const listOptions = $computed(() => { ...@@ -13,8 +13,8 @@ const listOptions = $computed(() => {
return { return {
// remote: { httpRequest: getStudentList, params: { type: '' } }, // remote: { httpRequest: getStudentList, params: { type: '' } },
filters: [ filters: [
{ type: 'input', prop: 'name', label: '学生姓名', placeholder: '学生姓名' }, { type: 'input', prop: 'name', label: '学生姓名:', placeholder: '学生姓名' },
{ type: 'select', prop: 'office', label: '所属部门/学校', placeholder: '所属部门/学校' } { type: 'select', prop: 'office', label: '所属部门/学校:', placeholder: '所属部门/学校' }
], ],
columns: [ columns: [
{ label: '序号', type: 'index', align: 'center' }, { label: '序号', type: 'index', align: 'center' },
......
...@@ -201,6 +201,10 @@ export function delCharacter(data: { id: string; course_id: string }) { ...@@ -201,6 +201,10 @@ export function delCharacter(data: { id: string; course_id: string }) {
return httpRequest.post('/api/resource/v1/course/course/delete-chapter', data) return httpRequest.post('/api/resource/v1/course/course/delete-chapter', data)
} }
// 直播列表 // 直播列表
export function getLiveList(params: { name: string; page?: number; ['page_size']?: number }) { export function getLiveList(params: { name: string; page?: number; ['per-page']?: string }) {
return httpRequest.get('/api/resource/v1/course/course/search-live', { params }) return httpRequest.get('/api/resource/v1/course/course/search-live', { params })
} }
// 专业搜索
export function getMajorList(params: { name: string; page?: number; ['per-page']?: string }) {
return httpRequest.get('/api/resource/v1/course/course/search-specialty', { params })
}
...@@ -77,7 +77,7 @@ const allLecturers: any = ref([]) ...@@ -77,7 +77,7 @@ const allLecturers: any = ref([])
const handleLiveList = (query: string) => { const handleLiveList = (query: string) => {
if (query) { if (query) {
loading.value = true loading.value = true
getLiveList({ name: query }).then((res: any) => { getLiveList({ name: query, 'per-page': '100' }).then((res: any) => {
loading.value = false loading.value = false
liveList.value = res.data.list liveList.value = res.data.list
liveList.value.forEach((item: any) => { liveList.value.forEach((item: any) => {
...@@ -108,6 +108,7 @@ const changeLive = (val: any) => { ...@@ -108,6 +108,7 @@ const changeLive = (val: any) => {
clearable clearable
filterable filterable
remote remote
multiple
placeholder="请输入直播名称或者直播id" placeholder="请输入直播名称或者直播id"
:remote-method="handleLiveList" :remote-method="handleLiveList"
:loading="loading" :loading="loading"
......
<script setup lang="ts"> <script setup lang="ts">
import { createCourse, getCourseDetails, updateCourse } from '../api' import { createCourse, getCourseDetails, updateCourse, getMajorList } from '../api'
// setStatus // setStatus
import { useGetCategoryList } from '@/composables/useGetCategoryList' import { useGetCategoryList } from '@/composables/useGetCategoryList'
import { useMapStore } from '@/stores/map' import { useMapStore } from '@/stores/map'
...@@ -19,6 +19,8 @@ const route = useRoute() ...@@ -19,6 +19,8 @@ const route = useRoute()
const router = useRouter() const router = useRouter()
const id = route.query.id as string const id = route.query.id as string
const majorList: any = ref([])
const allMajorList: any = ref([])
// is 编辑 新建 // is 编辑 新建
const isUpdate = $computed(() => { const isUpdate = $computed(() => {
...@@ -62,7 +64,8 @@ const form = reactive<Record<string, any>>({ ...@@ -62,7 +64,8 @@ const form = reactive<Record<string, any>>({
previous_preparation: '', previous_preparation: '',
target: '', target: '',
exam_id: '', exam_id: '',
live_id: '' live_id: '',
specialty_id: ''
}) })
// 表单验证 // 表单验证
...@@ -75,7 +78,8 @@ const rules = reactive<FormRules>({ ...@@ -75,7 +78,8 @@ const rules = reactive<FormRules>({
{ required: true, message: '请输入学分' }, { required: true, message: '请输入学分' },
{ pattern: /\d/, message: '请输入数字' } { pattern: /\d/, message: '请输入数字' }
], ],
lecturer_id: [{ required: true, message: '请添加课程讲师' }] lecturer_id: [{ required: true, message: '请添加课程讲师' }],
specialty_id: [{ required: true, message: '请选择适用专业' }]
}) })
// 课程封面dialog // 课程封面dialog
...@@ -162,6 +166,22 @@ function handleUpdate() { ...@@ -162,6 +166,22 @@ function handleUpdate() {
} }
}) })
} }
const handleMajorList = (query: string) => {
if (query) {
getMajorList({ name: query, 'per-page': '100' }).then((res: any) => {
majorList.value = res.data.list
majorList.value.forEach((item: any) => {
const findItem = allMajorList.value.find((cItem: any) => cItem.id === item.id)
if (!findItem) {
allMajorList.value.push(item)
}
})
})
} else {
majorList.value = []
}
}
</script> </script>
<template> <template>
...@@ -198,6 +218,25 @@ function handleUpdate() { ...@@ -198,6 +218,25 @@ function handleUpdate() {
<el-form-item label="课程学分" prop="credit"> <el-form-item label="课程学分" prop="credit">
<el-input v-model="form.credit" maxlength="3" /> <el-input v-model="form.credit" maxlength="3" />
</el-form-item> </el-form-item>
<el-form-item label="适用专业" prop="specialty_id">
<el-select
v-model="form.specialty_id"
placeholder="请选择适用专业"
style="width: 100%"
clearable
filterable
remote
:remote-method="handleMajorList"
:loading="loading"
>
<el-option
v-for="(item, index) in majorList"
:key="index"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
</el-form> </el-form>
</div> </div>
<el-form <el-form
......
...@@ -28,16 +28,18 @@ const id = route.query.id ? route.query.id : (route.params.courseId as string) ...@@ -28,16 +28,18 @@ const id = route.query.id ? route.query.id : (route.params.courseId as string)
.chapter-box { .chapter-box {
width: 300px; width: 300px;
background: #aa1941; background: #aa1941;
border-radius: 20px;
margin-left: 20px; margin-left: 20px;
height: fit-content; height: fit-content;
border-radius: 10px;
&.active-black { &.active-black {
background: #aa1941; background: #1f1e24;
border-radius: 20px; border-radius: 0px;
margin-left: 0px;
.chapter-list { .chapter-list {
.item { .item {
border-bottom: 1px dotted #fff; border-bottom: 1px dashed #fff;
} }
} }
} }
...@@ -53,7 +55,7 @@ const id = route.query.id ? route.query.id : (route.params.courseId as string) ...@@ -53,7 +55,7 @@ const id = route.query.id ? route.query.id : (route.params.courseId as string)
.line { .line {
width: 85%; width: 85%;
margin: 20px auto; margin: 20px auto;
border-bottom: 1px dotted #e06386; border-bottom: 1px solid #ffffff;
} }
.chapter-list { .chapter-list {
margin: 0 auto; margin: 0 auto;
...@@ -66,9 +68,9 @@ const id = route.query.id ? route.query.id : (route.params.courseId as string) ...@@ -66,9 +68,9 @@ const id = route.query.id ? route.query.id : (route.params.courseId as string)
border-bottom: 1px dotted #e06386; border-bottom: 1px dotted #e06386;
margin-top: 30px; margin-top: 30px;
.order { .order {
// width: 26px; width: 26px;
// height: 26px; height: 26px;
// background: rgba(255, 255, 255, 1); background: rgba(255, 255, 255, 1);
border-radius: 50%; border-radius: 50%;
font-size: 16px; font-size: 16px;
line-height: 26px; line-height: 26px;
...@@ -78,7 +80,7 @@ const id = route.query.id ? route.query.id : (route.params.courseId as string) ...@@ -78,7 +80,7 @@ const id = route.query.id ? route.query.id : (route.params.courseId as string)
} }
.chapter-text { .chapter-text {
.chapter { .chapter {
font-size: 20px; font-size: 16px;
line-height: 100%; line-height: 100%;
color: #ffffff; color: #ffffff;
margin-bottom: 20px; margin-bottom: 20px;
...@@ -86,7 +88,7 @@ const id = route.query.id ? route.query.id : (route.params.courseId as string) ...@@ -86,7 +88,7 @@ const id = route.query.id ? route.query.id : (route.params.courseId as string)
cursor: pointer; cursor: pointer;
} }
.sections { .sections {
font-size: 16px; font-size: 14px;
line-height: 100%; line-height: 100%;
color: #ffffff; color: #ffffff;
margin-bottom: 20px; margin-bottom: 20px;
......
...@@ -5,7 +5,6 @@ const props: any = defineProps({ ...@@ -5,7 +5,6 @@ const props: any = defineProps({
type: Object type: Object
} }
}) })
const form: any = ref({}) const form: any = ref({})
watch( watch(
...@@ -42,6 +41,12 @@ const basicInfo = computed((): IBasicInfo[] => { ...@@ -42,6 +41,12 @@ const basicInfo = computed((): IBasicInfo[] => {
value: '', value: '',
key: 'credit' key: 'credit'
}, },
{
icon: 'https://webapp-pub.oss-cn-beijing.aliyuncs.com/center_resource/course-view-icon14.png',
label: '适用专业',
value: '',
key: 'specialty'
},
{ {
icon: 'https://webapp-pub.oss-cn-beijing.aliyuncs.com/center_resource/course-view-icon4.png', icon: 'https://webapp-pub.oss-cn-beijing.aliyuncs.com/center_resource/course-view-icon4.png',
label: '创建人', label: '创建人',
...@@ -55,13 +60,13 @@ const basicInfo = computed((): IBasicInfo[] => { ...@@ -55,13 +60,13 @@ const basicInfo = computed((): IBasicInfo[] => {
key: 'updated_operator_name' key: 'updated_operator_name'
}, },
{ {
icon: 'https://webapp-pub.oss-cn-beijing.aliyuncs.com/center_resource/course-view-icon6.png', icon: 'https://webapp-pub.oss-cn-beijing.aliyuncs.com/center_resource/course-view-icon13.png',
label: '负责人', label: '负责人',
value: '', value: '',
key: 'belong_operator_name' key: 'belong_operator_name'
}, },
{ {
icon: 'https://webapp-pub.oss-cn-beijing.aliyuncs.com/center_resource/course-view-icon7.png', icon: 'https://webapp-pub.oss-cn-beijing.aliyuncs.com/center_resource/course-view-icon5.png',
label: '选课类型', label: '选课类型',
value: '', value: '',
key: 'elective_type_name' key: 'elective_type_name'
...@@ -180,7 +185,7 @@ const liveOptions = computed(() => { ...@@ -180,7 +185,7 @@ const liveOptions = computed(() => {
<img :src="item.icon" /> <img :src="item.icon" />
<div class="item-right"> <div class="item-right">
<div class="label">{{ item.label }}</div> <div class="label">{{ item.label }}</div>
<div class="value">{{ item.value }}</div> <div class="value">{{ item.value.toString() || '-' }}</div>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -54,7 +54,6 @@ const changeVideo = (index: number) => { ...@@ -54,7 +54,6 @@ const changeVideo = (index: number) => {
</div> </div>
</div> </div>
<div style="margin-top: 10px">本小节视频资源:</div> <div style="margin-top: 10px">本小节视频资源:</div>
<div class="cover-box"> <div class="cover-box">
<div <div
class="cover-img" class="cover-img"
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论