add:主页进入详情的页面; #37

Merged
yangws merged 1 commits from yangws_ws into main 2024-11-13 17:07:32 +08:00
7 changed files with 258 additions and 46 deletions

View File

@ -60,7 +60,21 @@ export const constantRoutes = [
path: 'management',
component: () => import('@/views/job-management/index.vue'),
name: 'job-management',
meta: { title: '作业管理' }
meta: { title: '作业管理' },
// children: [
// {
// path: 'details',
// component: () => import('@/views/job-management/Details/index.vue'),
// name: 'details',
// meta: { title: '详情' }
// },
// {
// path: 'right',
// component: () => import('@/views/job-management/Right/index.vue'),
// name: 'right',
// meta: { title: '主页' }
// },
// ]
},
]
},

View File

@ -0,0 +1,5 @@
<template>
<div>
2222
</div>
</template>

View File

@ -0,0 +1,97 @@
<template>
<div class="tabs-container">
<div class="button-div">
<el-button @click="goBack" type="primary" size="small">返回主页</el-button>
<el-button type="default" size="small">推送</el-button>
<el-button type="primary" size="small">保存</el-button>
</div>
<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
<template v-for="(item,index) in props.parameter.titleList">
<el-tab-pane :label="item.label" :name="item.id">
<el-row :gutter="10" class="tempalte-main">
<el-col :span="16">
<!-- 左侧组件 -->
<transition name="fade">
<component :is="currentComponent"/>
</transition>
</el-col>
<el-col :span="8">
<!-- 右侧 -->
<el-scrollbar class="right-box" :height="pageHeight">
<el-form label-position="top">
<el-form-item label="作业名称">
<el-input></el-input>
</el-form-item>
<el-form-item label="作业说明">
<el-input type="textarea" :row="5"></el-input>
</el-form-item>
</el-form>
</el-scrollbar>
</el-col>
</el-row>
</el-tab-pane>
</template>
</el-tabs>
</div>
</template>
<script setup>
import { ref,defineProps ,defineEmits,nextTick , onMounted,shallowRef } from 'vue'
import ClassroomPresentation from './classroomPresentation/index.vue'
import selfSearchQuestions from './selfSearchQuestions/index.vue'
const props = defineProps({
parameter: Object
});
const emits = defineEmits(['goBack'])
const currentComponent = shallowRef(null)
const activeName = ref(1)
const pageHeight = ref(0)
const handleClick = (tab, event) => {
console.log(tab, event)
}
//
const goBack = () => {
emits('goBack')
}
//
const rightComponets = (str) => {
switch (str) {
case 'classroomPresentation':
return ClassroomPresentation
case 'selfSearchQuestions':
return selfSearchQuestions
default:
return null
}
}
//
onMounted(() => {
currentComponent.value = rightComponets(props.parameter.components)
//
nextTick(() => {
pageHeight.value = window.innerHeight + window.scrollY - 156;
});
})
</script>
<style lang="scss" scoped>
.tabs-container{
position: relative;
}
.button-div{
position: absolute;
top: 5px;
right: 0;
z-index: 999;
}
.right-box{
background-color: #fff;
padding:5px;
border-radius: 4px;
overflow-y: auto;
}
</style>

View File

@ -0,0 +1,5 @@
<template>
<div>
11111
</div>
</template>

View File

@ -12,29 +12,90 @@
<CustomButton :item="{ type: item.type, text: item.text, plain: true }" />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</template>
<script setup>
import { ref, markRaw } from 'vue';
import { Plus, ArrowDown, Document, User, Setting } from '@element-plus/icons-vue';
import CustomButton from '../components/button.vue'
import CustomButton from '../components/button.vue';
const emits = defineEmits(['skipDetail']);
const items = ref([
{ title: '自主搜题', description: '1111111', icon: markRaw(Document),type:'default',text:'习题训练' },
{ title: '校本题库', description: '222222', icon: markRaw(Document),type:'default',text:'习题训练' },
{ title: '个人题库', description: '333333', icon: markRaw(Document),type:'default',text:'习题训练' },
{ title: '智能推荐', description: '444444', icon: markRaw(Document),type:'',text:'' },
{ title: '课堂展示', description: '555555', icon: markRaw(Document),type:'primary',text:'课堂展示' },
{ title: '常规作业', description: '555555', icon: markRaw(Document),type:'danger',text:'常规作业' },
{ title: 'AI设计作业', description: '555555', icon: markRaw(Document),type:'danger',text:'常规作业' },
{ title: '自主搜题', description: '1111111', icon: markRaw(Document), type: 'default', text: '习题训练',components:'classroomPresentation',titleList:[
{
id:1,
label:'自主搜题',
},
{
id:2,
label:'校本题库',
},
{
id:3,
label:'个人题库',
},
]},
{ title: '校本题库', description: '222222', icon: markRaw(Document), type: 'default', text: '习题训练',components:'classroomPresentation',titleList:[
{
id:1,
label:'自主搜题',
},
{
id:2,
label:'校本题库',
},
{
id:3,
label:'个人题库',
},
] },
{ title: '个人题库', description: '333333', icon: markRaw(Document), type: 'default', text: '习题训练',components:'classroomPresentation',titleList:[
{
id:1,
label:'自主搜题',
},
{
id:2,
label:'校本题库',
},
{
id:3,
label:'个人题库',
},
] },
{ title: '智能推荐', description: '444444', icon: markRaw(Document), type: '', text: '',components:'classroomPresentation',titleList:[
{
id:1,
label:'智能推荐',
},
] },
{ title: '课堂展示', description: '555555', icon: markRaw(Document), type: 'primary', text: '课堂展示',components:'selfSearchQuestions',titleList:[
{
id:1,
label:'课堂展示',
},
] },
{ title: '常规作业', description: '555555', icon: markRaw(Document), type: 'danger', text: '常规作业',components:'selfSearchQuestions',titleList:[
{
id:1,
label:'常规作业',
},
] },
{ title: 'AI设计作业', description: '555555', icon: markRaw(Document), type: 'danger', text: '常规作业',components:'selfSearchQuestions',titleList:[
{
id:1,
label:'AI设计作业',
},
] },
]);
const handleClick = (item) => {
console.log('Clicked on:', item.title);
emits('skipDetail', item);
};
</script>
@ -96,12 +157,23 @@ const handleClick = (item) => {
text-overflow: ellipsis;
word-break: break-all;
}
.title-header {
display: flex;
justify-content: space-between;
align-items: center;
}
.item-bottom {
text-align: right;
}
/* 过渡动画 */
.fade-enter-active, .fade-leave-active {
transition: opacity 0.3s;
}
.fade-enter, .fade-leave-to {
opacity: 0;
}
</style>

View File

@ -46,7 +46,6 @@ const toggleDropup = () => {
};
const selectOption = (option) => {
selectedOption.value = option;
isDropdownOpen.value = false;
emits('select-click', option)
};

View File

@ -12,7 +12,7 @@
@select-click="selectClick"
/>
</div>
<div :style="{height:viewportHeight - 72}" class="no-horizontal-scroll">
<div :style="{height: viewportHeight - 72 + 'px'}" class="no-horizontal-scroll">
<el-row :gutter="20" class="tempalte-main">
<el-col :span="6">
<!-- 左侧列表 -->
@ -20,7 +20,7 @@
</el-col>
<el-col :span="18">
<!-- 右侧 -->
<Right/>
<component :is="currentComponent" v-on="listeners" :parameter="parameter" />
</el-col>
</el-row>
</div>
@ -28,9 +28,10 @@
</template>
<script setup>
import { ref, onMounted, nextTick } from 'vue';
import { ref, shallowRef, onMounted, nextTick, computed } from 'vue';
import Right from './Right/index.vue';
import Left from './Left/index.vue';
import Detials from './Details/index.vue';
import CustomSelect from './components/customSelect.vue';
const options = ref(['自主搜题', '校本题库', '个人题库', '智能推荐', '课堂展示', '常规作业', 'AI作业设计']);
@ -38,17 +39,31 @@ const options = ref(['自主搜题', '校本题库', '个人题库', '智能推
// checkbox
const isChceked = ref(false);
const viewportHeight = ref(0);
const isSkip = ref(false);
//
const parameter = ref({});
// checkbox
const checked = (val) => {
console.log(val);
val.length > 0 ? isChceked.value = true : isChceked.value = false;
}
const currentComponent = shallowRef(Right);
//
const selectClick = (val) => {
console.log(val);
}
//
const skipDetail = (val) => {
parameter.value = Object.assign({}, val);
isSkip.value = true;
currentComponent.value = Detials;
}
//
const goBack = () => {
isSkip.value = false;
currentComponent.value = Right;
}
//
const getViewportHeight = () => {
@ -65,6 +80,11 @@ onMounted(() => {
});
});
});
const listeners = computed(() => ({
skipDetail,
goBack
}));
</script>
<style lang="scss" scoped>
@ -87,7 +107,7 @@ onMounted(() => {
}
}
.no-horizontal-scroll {
overflow-y: scroll;
overflow: auto;
overflow-x: hidden;
}
</style>