diff --git a/web/src/management/config/dnd.ts b/web/src/management/config/dnd.ts
new file mode 100644
index 00000000..11039a41
--- /dev/null
+++ b/web/src/management/config/dnd.ts
@@ -0,0 +1 @@
+export const DND_GROUP = 'question'
\ No newline at end of file
diff --git a/web/src/management/pages/edit/components/MaterialGroup.vue b/web/src/management/pages/edit/components/MaterialGroup.vue
index e581ca5c..c3edfd9e 100644
--- a/web/src/management/pages/edit/components/MaterialGroup.vue
+++ b/web/src/management/pages/edit/components/MaterialGroup.vue
@@ -1,8 +1,9 @@
import { computed, defineComponent, ref, getCurrentInstance } from 'vue'
+import { useStore } from 'vuex'
import QuestionContainerB from '@/materials/questions/QuestionContainerB'
import QuestionWrapper from '@/management/pages/edit/components/QuestionWrapper.vue'
import draggable from 'vuedraggable'
import { filterQuestionPreviewData } from '@/management/utils/index'
+import { DND_GROUP } from '@/management/config/dnd'
export default defineComponent({
components: {
@@ -58,8 +61,15 @@ export default defineComponent({
}
},
setup(props, { emit }) {
- const renderData = computed(() => {
- return filterQuestionPreviewData(props.questionDataList)
+ const store = useStore()
+
+ const renderData = computed({
+ get () {
+ return filterQuestionPreviewData(props.questionDataList)
+ },
+ set (questionDataList) {
+ store.commit('edit/setQuestionDataList', questionDataList)
+ }
})
const handleSelect = (index) => {
emit('select', index)
@@ -89,6 +99,7 @@ export default defineComponent({
}
return {
+ DND_GROUP,
renderData,
handleSelect,
handleChangeSeq,
diff --git a/web/src/management/pages/edit/modules/questionModule/components/TypeList.vue b/web/src/management/pages/edit/modules/questionModule/components/TypeList.vue
index 652feb7f..e74100dd 100644
--- a/web/src/management/pages/edit/modules/questionModule/components/TypeList.vue
+++ b/web/src/management/pages/edit/modules/questionModule/components/TypeList.vue
@@ -6,58 +6,91 @@
:name="index"
:key="index"
>
-
-
-
-
-
+
+
+
+
{{ element.title }}
+
-
-
+
+
+
+
+
+
+
+
@@ -103,9 +136,10 @@ const onQuestionType = ({ type }) => {
background-color: $primary-color-light;
border: 1px solid $primary-color;
}
-
+
.text {
font-size: 12px;
+ user-select: none;
}
}
@@ -128,4 +162,64 @@ const onQuestionType = ({ type }) => {
.qtype-popper-2 {
transform: translateX(30px);
}
+// 设置拖拽到编辑区的样式
+.box .qtopic-item {
+ height: 2px;
+ width: 100%;
+ background-color: var(--primary-color);
+ * {
+ display: none;
+ }
+}
+
+@keyframes fadeIn {
+ from {
+ opacity: 0;
+ }
+ to {
+ opacity: 1;
+ }
+}
+
+.preview-popover {
+ position: fixed;
+ left: 390px;
+ z-index: 9;
+ width: 371px;
+ padding: 12px;
+ background: white;
+ border: 1px solid var(--el-border-color-light);
+ box-shadow: var(--el-box-shadow-light);
+ transform: translateY(-50%);
+ animation: fadeIn 100ms linear forwards;
+
+ .preview-image {
+ width: 100%;
+ object-fit: contain;
+ }
+
+ .preview-arrow {
+ position: absolute;
+ top: 50%;
+ left: -6px;
+ height: 10px;
+ width: 10px;
+ transform: translateX(-50%);
+ background: var(--el-border-color-light);
+ z-index: -1;
+ transform: rotate(-45deg);
+
+ &::before {
+ position: absolute;
+ content: "";
+ height: 10px;
+ width: 10px;
+ border: 1px solid var(--el-border-color-light);
+ background: #ffffff;
+ border-bottom-color: transparent;
+ border-right-color: transparent;
+ }
+
+ }
+}
diff --git a/web/src/management/store/edit/mutations.js b/web/src/management/store/edit/mutations.js
index ea62db2f..3f2dc0a5 100644
--- a/web/src/management/store/edit/mutations.js
+++ b/web/src/management/store/edit/mutations.js
@@ -60,5 +60,8 @@ export default {
Object.keys(presets).forEach((key) => {
_set(state.schema, key, presets[key])
})
+ },
+ setQuestionDataList(state, data) {
+ state.schema.questionDataList = data
}
}