|
@@ -1,4 +1,11 @@
|
|
|
-import { PropType, defineComponent, onMounted, reactive, ref } from 'vue';
|
|
|
+import {
|
|
|
+ PropType,
|
|
|
+ defineComponent,
|
|
|
+ onMounted,
|
|
|
+ reactive,
|
|
|
+ ref,
|
|
|
+ toRef
|
|
|
+} from 'vue';
|
|
|
import styles from './index.module.less';
|
|
|
import {
|
|
|
NButton,
|
|
@@ -21,6 +28,9 @@ import { usePrepareStore } from '/src/store/modules/prepareLessons';
|
|
|
import AssignStudent from './assign-student';
|
|
|
import { state } from '/src/state';
|
|
|
import { nextTick } from 'process';
|
|
|
+import useDrag from '@/hooks/useDrag';
|
|
|
+import Dragbom from '@/hooks/useDrag/dragbom';
|
|
|
+import { useUserStore } from '@/store/modules/users';
|
|
|
|
|
|
export default defineComponent({
|
|
|
name: 'assign-homework',
|
|
@@ -50,6 +60,11 @@ export default defineComponent({
|
|
|
homeworkType: {
|
|
|
type: String as PropType<'CLASSWORK' | 'HOMEWORK'>,
|
|
|
default: 'CLASSWORK'
|
|
|
+ },
|
|
|
+ from: {
|
|
|
+ // 来自哪里
|
|
|
+ type: String,
|
|
|
+ default: ''
|
|
|
}
|
|
|
},
|
|
|
emits: ['close', 'confirm'],
|
|
@@ -181,6 +196,22 @@ export default defineComponent({
|
|
|
onMounted(async () => {
|
|
|
await getClassGroupList();
|
|
|
});
|
|
|
+ // 选择学生
|
|
|
+ let assignHomeworkStuBoxDragData: any;
|
|
|
+ let assignHomeworkStuBoxClass: string;
|
|
|
+ if (props.from === 'class') {
|
|
|
+ const users = useUserStore();
|
|
|
+ assignHomeworkStuBoxClass = 'assignHomeworkStuBoxClass_drag';
|
|
|
+ assignHomeworkStuBoxDragData = useDrag(
|
|
|
+ [
|
|
|
+ `${assignHomeworkStuBoxClass}>.n-card-header`,
|
|
|
+ `${assignHomeworkStuBoxClass} .bom_drag`
|
|
|
+ ],
|
|
|
+ assignHomeworkStuBoxClass,
|
|
|
+ toRef(forms, 'workVisiable'),
|
|
|
+ users.info.id
|
|
|
+ );
|
|
|
+ }
|
|
|
return () => (
|
|
|
<div class={styles.assignHomeworkContainer}>
|
|
|
<NForm
|
|
@@ -363,11 +394,20 @@ export default defineComponent({
|
|
|
|
|
|
<NModal
|
|
|
v-model:show={forms.workVisiable}
|
|
|
+ style={
|
|
|
+ props.from === 'class'
|
|
|
+ ? {
|
|
|
+ width: '640px',
|
|
|
+ ...assignHomeworkStuBoxDragData.styleDrag.value
|
|
|
+ }
|
|
|
+ : {
|
|
|
+ width: '640px'
|
|
|
+ }
|
|
|
+ }
|
|
|
preset="card"
|
|
|
showIcon={false}
|
|
|
- class={['modalTitle background']}
|
|
|
+ class={['modalTitle background', assignHomeworkStuBoxClass]}
|
|
|
title={'选择学生'}
|
|
|
- style={{ width: '640px' }}
|
|
|
blockScroll={false}>
|
|
|
<AssignStudent
|
|
|
classGroupId={props.classGroupId}
|
|
@@ -381,6 +421,7 @@ export default defineComponent({
|
|
|
forms.workVisiable = false;
|
|
|
}}
|
|
|
/>
|
|
|
+ {props.from === 'class' && <Dragbom></Dragbom>}
|
|
|
</NModal>
|
|
|
</div>
|
|
|
);
|