调整ui优化

This commit is contained in:
xueyuan committed 2023-02-13 11:25:20 +08:00
1 parent 3066478cd8
commit 680d5d5c90
6 files changed
+199 -128

No files matched your search

+13 -5
View File
@@ -4,7 +4,7 @@
<span class="jh-input-label">{{ formItem.statement }}</span>
<!-- 文本 -->
<v-text-field v-if="formItem.type === 'input'" :rules="validationRules.requireRules" class="jh-v-input" dense single-line filled label="班级ID" v-model="formItem.answer"></v-text-field>
<v-text-field v-if="formItem.type === 'input'" :rules="validationRules.requireRules" class="jh-v-input" dense single-line filled label="班级ID" v-model="formItem.answer" :readonly="readonly"></v-text-field>
<!-- 单选 -->
<v-select
@@ -13,6 +13,7 @@
:items="formItem.optionList"
dense single-line filled
:rules="validationRules.requireRules"
:readonly="readonly"
></v-select>
<!-- 多选 -->
@@ -23,14 +24,15 @@
multiple
dense single-line filled
:rules="validationRules.requireRules"
:readonly="readonly"
></v-select>
<!-- 文本框 -->
<v-textarea v-if="formItem.type === 'short'" :rules="validationRules.requireRules" class="jh-v-input" no-resize dense single-line filled label="备注"
<v-textarea v-if="formItem.type === 'short'" :rules="validationRules.requireRules" class="jh-v-input" no-resize dense single-line filled label="备注" :readonly="readonly"
v-model="formItem.answer"></v-textarea>
<!-- 时间选择 -->
<v-text-field v-if="formItem.type === 'date'" class="jh-v-input" dense single-line filled readonly @click="openDataPicker" label="出生日期" v-model="formItem.answer" :rules="validationRules.requireRules"></v-text-field>
<v-text-field v-if="formItem.type === 'date'" class="jh-v-input" dense single-line filled readonly @click="openDataPicker" label="出生日期" v-model="formItem.answer" :rules="validationRules.requireRules" :readonly="readonly"></v-text-field>
<v-menu v-if="formItem.type === 'date'" class="jh-v-input" :close-on-content-click="false" v-model="isDataPickerShown" :position-x="dataPickerPosition.x" :position-y="dataPickerPosition.y" transition="scale-transition" offset-y min-width="auto">
<v-date-picker color="green lighten-1" elevation="20" @input="isDataPickerShown = false" v-model="formItem.answer"></v-date-picker>
</v-menu>
@@ -44,9 +46,15 @@
vuetify: new Vuetify(),
props: {
formItem: {
type: Boolean,
default: false,
type: Object,
default: () => {
return {}
},
},
readonly: {
type: Boolean,
default: false
}
},
data() {
return {
@@ -1,97 +0,0 @@
<template id="form-item-list-render">
<div>
<v-card v-for="(formItem, index) in formItemList" :key="index" class="ma-2 formItem-item-body" :elevation="hover ? 12 : 2" dense>
<v-list-item>
<v-list-item-content v-if="formItem.component.type === 'singleSelect'">
<v-list-item-title class="formItem-title">{{ index+1 }}、 {{ formItem.component.outline }}</v-list-item-title>
<v-radio-group v-model="formItem.answerData.selected">
<v-radio :disabled="isCorrecting" v-for="(option, optionIndex) in formItem.component.property.selectOptionList" :key="optionIndex" :label="option.value" :value="option.value"></v-radio>
</v-radio-group>
<form-item-action v-if="isCorrecting" :data="formItem.check"></form-item-action>
</v-list-item-content>
<v-list-item-content v-if="formItem.component.type === 'multipleSelect'">
<v-list-item-title class="formItem-title">{{ index+1 }}、 {{ formItem.component.outline }}</v-list-item-title>
<div v-for="(option, optionIndex) in formItem.component.property.selectOptionList" :key="optionIndex">
<v-checkbox :disabled="isCorrecting" style="margin-top: 0px;" v-model="formItem.answerData[option.value]" :label="option.value" hide-details color="red"></v-checkbox>
</div>
<form-item-action v-if="isCorrecting" :data="formItem.check"></form-item-action>
</v-list-item-content>
<v-list-item-content v-if="formItem.component.type === 'textarea'">
<v-list-item-title class="formItem-title">{{ index+1 }}、 {{ formItem.component.outline }}</v-list-item-title>
<v-row>
<v-col cols="12">
<v-textarea :disabled="isCorrecting" outlined placeholder="" v-model="formItem.answerData.answer" :rows="4"/>
</v-col>
</v-row>
<form-item-action v-if="isCorrecting" :data="formItem.check"></form-item-action>
</v-list-item-content>
</v-list-item>
</v-card>
</div>
</template>
<script>
Vue.component("form-item-list-render", {
template: '#form-item-list-render',
vuetify: new Vuetify(),
name: 'form-item-list-render',
props: {
formItemList: {
type: Array,
default: () => {
return []
},
required: true,
},
action: {
type: String,
default: '',
},
},
data: () => ({
}),
computed: {
isCorrecting() {
return this.action === 'correcting'
}
},
watch: {
form: {
deep: true,
}
},
destroyed() {},
watch: {},
async created() {},
methods: {},
})
</script>
<style scoped>
.formItem-title {
white-space: normal;
}
.correct {
border-top: 1px solid #999;
padding-top: 10px;
}
.correct-title-box .successText {
color: rgb(1, 166, 46);
font-weight: bold;
}
.correct-title-box .failText {
color: darkred;
font-weight: bold;
}
.correct-title-box {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
}
</style>
@@ -0,0 +1,165 @@
<template id="form-item-list-review">
<div class="form-item-list-review-container">
<!-- 单选 -->
<template v-if="formItem.component.type === 'singleSelect'">
<span class="jh-input-label">{{ formItem.component.statement
}}</span>
<v-radio-group readonly v-model="formItem.user.answer">
<v-radio v-for="(option, optionIndex) in formItem.component.selectOptionList" :key="optionIndex"
:label="assignmentOptionKey[optionIndex]+': '+option" :value="option"></v-radio>
</v-radio-group>
</template>
<!-- 多选和填空 -->
<template v-if="['fillBlank', 'multipleSelect'].includes(formItem.component.type)">
<span class="jh-input-label" style="white-space:nowrap !important;"
v-if="formItem.component.type === 'fillBlank'">
<template v-for="(blank, blankIndex) in formItem.component.statement" :key="blankIndex">
<span class="fill-blank fill-blank-input" v-if="blank.type === 'input'">{{
formItem.user.answer[blank.id] }}</span>
<span v-else>{{ blank.value }}</span>
</template>
</span>
<span class="jh-input-label" v-else>{{ formItem.component.statement
}}</span>
<template v-if="formItem.component.type === 'multipleSelect'">
<template v-for="(option, optionIndex) in formItem.component.selectOptionList" :key="optionIndex">
<v-checkbox readonly style="margin-top: 0px;" v-model="formItem.user.answer" :value="option"
:label="assignmentOptionKey[optionIndex]+': '+option" hide-details color="red"></v-checkbox>
</template>
</template>
</template>
<!-- 多行文本,问答和markdown -->
<template v-if="['textarea', 'questionAnswer', 'markdown'].includes(formItem.component.type)">
<span class="jh-input-label">{{ formItem.component.statement
}}</span>
<template v-if="formItem.component.type === 'markdown'" cols="12">
<md2html :article-content="formItem.user.answer" @complete="isContentLoading = false"></md2html>
</template>
<template v-else cols="12">
<v-textarea readonly dense filled single-line v-model="formItem.user.answer" :rows="5" auto-grow />
</template>
</template>
<!-- 题目组 -->
<template v-if="formItem.component.type === 'questionGroup'">
<span class="jh-input-label">{{ formItem.component.statement
}}</span>
<md2html :article-content="formItem.component.markdownContent" @complete="isContentLoading = false">
</md2html>
<form-item-list-review :form-item-list="formItem.component.itemList" :review-data="reviewData"
:answer-check="answerCheck" />
</template>
<!-- 纯标题 -->
<v-list-item-content v-if="formItem.component.type === 'displayText'">
<p>{{formItem.component.statement}}</p>
</v-list-item-content>
</v-list-item>
</v-card>
</div>
</template>
<script>
Vue.component("form-item-list-review", {
template: '#form-item-list-review',
vuetify: new Vuetify(),
name: 'form-item-list-review',
props: {
formItem: {
type: Object,
default: () => {
return {};
},
},
reviewData: {
type: Object,
default: () => {
return {};
},
},
answerCheck: {
type: Object,
default: () => {
return {};
},
},
},
data: () => ({
overlay: false,
imgSrc: '',
assignmentOptionKey: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K'],
}),
computed: {
isMobile() {
return window.innerWidth < 500;
}
},
destroyed() { },
watch: {
},
created() {
},
methods: {}
})
</script>
<style scoped>
.form-item-list-review-container {
background-color: unset;
}
.form-item-list-review-container .jh-input-label {
white-space: pre-line;
font-weight: bold;
font-size: 16px !important;
}
.form-item-list-review-container audio {
height: 35px;
}
.form-item-list-review-container .audio-box {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
}
/*.form-item-list-review-container .submit-handle-box {
position: relative;
}
.form-item-list-review-container .submit-handle-box::after {
position: absolute;
width: 1px;
content: '';
background-color: #e0e0e0;
height: 200px;
top: auto;
bottom: auto;
}*/
.student-remark textarea {
color: rgb(0, 172, 37) !important;
}
.fill-blank {
display: inline-block;
}
.fill-blank-input {
padding-left: 10px;
padding-right: 10px;
border-bottom: 2px solid gray;
margin-left: 5px;
margin-right: 5px;
}
.icon-close {
position: fixed; right: 10px; top: 5px; z-index: 50000
}
.icon-download {
position: fixed; right: 50px; top: 5px; z-index: 50000
}
.file-prev-wrap {
overflow: auto; max-width: 80vw; max-height: 90vh;
}
</style>