diff --git a/.env.production b/.env.production index 696385f..ac86e8a 100644 --- a/.env.production +++ b/.env.production @@ -4,4 +4,4 @@ VITE_CLI_PORT = 8080 VITE_SERVER_PORT = 8888 VITE_BASE_API = /api #下方修改为你的线上ip -VITE_BASE_PATH = http://118.31.78.83 +VITE_BASE_PATH = https://admin.api.gwkjxb.com diff --git a/src/utils/custom.js b/src/utils/custom.js index 5f6ffee..d52a88b 100644 --- a/src/utils/custom.js +++ b/src/utils/custom.js @@ -66,7 +66,58 @@ const custom = { getProvinceName(province) { if(province < 0 || !province) return '' return cityList[province].name + }, + getExamGroupType() { + return [ + { + name:'1', + value:1 + }, + { + name:'10', + value:10 + },{ + name:'100', + value:100 + },{ + name:'1000', + value:1000 + }, + { + name:'1万', + value:10000 + }, + { + name:'10万', + value:100000 + }, + { + name:'100万', + value:1000000 + }, + { + name:'1000万', + value:10000000 + }, + ] + }, + timestampToDate(stamp) { // 时间戳转日期 + var time = new Date(stamp); + var y = time.getFullYear(); + var m = time.getMonth()+1; + var d = time.getDate(); + const date = `${y}-${m}-${d}` + console.log(date) + return date + }, + getSTdPerson(num) { + const flag = 10000 + if(num +// 引入依赖 +// import api from '@/api/course' +// import com_api from '@/api/common' +// import WarningBar from '@/components/warningBar/warningBar.vue' +import api from '@/api/course' +import { ref, onMounted, watch, inject, nextTick } from 'vue' +import { ElMessage, ElMessageBox } from 'element-plus' +import { useRouter, useRoute } from 'vue-router' +const router = useRouter() +const route = useRoute() +import { useUserStore } from '@/pinia/modules/user' +const userStore = useUserStore() +// import chapterCom from '../components/chapter.vue' +const props = defineProps(['exam_types','exam_id','seleted_arr']) +const emit = defineEmits(['addFunc']) +// import { clients, getNowDate } from '@/utils' +import custom from '@/utils/custom' +// import { getToken } from '@/utils/auth' +// 监听 +watch(props,(val1,val2) => { + selected_exam_ids.value = val1.seleted_arr || [] + exam_types.value = val1.exam_types || [] +}) +// 变量 +const exam_types = ref([]) +const selected_exam_ids = ref(props.seleted_arr || []) +console.log(props.exam_types) +// const headers = ref({ Authorization: 'Bearer ' + getToken() }) +const drawer = ref(false) +const queryParams =ref({ + page:1, + pageSize:10, + version:'', + type:'', +}) +// const typeList = custom.getExercisesTypeList() +const tableData =ref([]) +const total = ref(0) +const course_ids = ref([]) +// 生命周期 +const typeList = inject('typeList') +// console.log(typeList.value) +// const current_subject =getSubjectId(inject('current_subject')) +const current_subject_str = inject('current_subject') +const current_subject = ref(null) +watch(current_subject_str,(val1,val2) => { + console.log(val1) + queryParams.value.subject = getSubjectId(val1) + console.log(queryParams.value.subject) +}) +// queryParams.value.subject = current_subject +onMounted(() => { + // console.log(headers.value) + // getCourseList() +}) +// 方法 +function getSubjectId(str) { + // console.log(str) + let s_id = null + for(let item of typeList.value) { + if(item.name === str) { + s_id = item.id + } + } + return s_id +} +async function getCourseList() { + const res = await api.getCourseList(queryParams.value) + if(res.code === 0) { + tableData.value = res.data.records + total.value = res.data.total + await nextTick() + toggleSelection(tableData.value) + } +} +function chooseChapterChildExercises() { + drawer.value = true + // getCourseList() + onSubmit() +} +function onSubmit() { + queryParams.value.page = 1 + getCourseList() +} +function onReset() { + queryParams.value = { + page:1, + pageSize:10, + name:'', + subject:'', + status:'', + } +} +const handleSelectionChange = (val) => { + course_ids.value = val +} +function handleCurrentChange(val) { + queryParams.value.page = val + getCourseList() +} +function handleSizeChange(val) { + queryParams.value.pageSize = val + getCourseList() +} +function addFunc() { + const list = course_ids.value.map((item,i) => { + return item.course_id + }) + emit('addFunc',list) + drawer.value = false +} +const multipleTableRef = ref(null) +const toggleSelection = (rows) => { // 判断是否被选中 + if (rows) { + rows.forEach((row) => { + if(selected_exam_ids.value.length>0 && selected_exam_ids.value.includes(row.course_id)) { + multipleTableRef.value.toggleRowSelection(row, true) + } + else{ + multipleTableRef.value.toggleRowSelection(row, false) + } + }) + } else { + multipleTableRef.value.clearSelection() + } +} +function viewCourseFunc(row) { // 查看课程 + router.push({name:'viewCourse',params:{course_id:row.course_id}}) +} + + + diff --git a/src/view/examinationManage/index.vue b/src/view/examinationManage/index.vue index 7f57f2d..dee5773 100644 --- a/src/view/examinationManage/index.vue +++ b/src/view/examinationManage/index.vue @@ -11,6 +11,8 @@ 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' @@ -52,6 +54,7 @@ const content = ref(null) const exam_types = ref([]) const exam_ids = ref([]) const price_props = ['first','second','third'] +const exam_type_ids = ref([]) // 生命周期 onMounted(() => { getExaminationList() @@ -131,11 +134,12 @@ const handleSelectionChange = (val) => { }) // console.log(exam_ids.value) } +const exam_id = ref(null) function editCourseFunc(row) { console.log(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) @@ -269,6 +273,9 @@ function addExercisesFunc(data) { } function addCourseFunc(data) { form.value.course_ids = data +} +function addGroupFunc() { + }