提交 3fd79443 authored 作者: 王鹏飞's avatar 王鹏飞

Merge branch 'dev' into enterprise-wmp-dev

...@@ -10,23 +10,18 @@ ...@@ -10,23 +10,18 @@
</template> </template>
</el-upload> </el-upload>
<div class="file-list" v-if="fileList.length"> <div class="file-list" v-if="fileList.length">
<div class="file-list-item" v-for="(fileUrl, index) in fileList" :key="index"> <div class="file-list-item" v-for="(item, index) in fileList" :key="index">
<a :href="fileUrl" target="_blank"> <a :href="item.url" :download="item.name" target="_blank">
<i class="el-icon-document"></i> <i class="el-icon-document"></i>
{{ fileUrl | fileName }} {{ item.name }}
</a> </a>
<div> <div>
<a <a href="javascript:;" @click="handleRemove(index)" style="margin-right: 10px" v-if="!disabled">
href="javascript:;"
@click="handleRemove(index)"
style="margin-right:10px;"
v-if="!disabled"
>
<el-tooltip effect="dark" content="删除"> <el-tooltip effect="dark" content="删除">
<i class="el-icon-delete"></i> <i class="el-icon-delete"></i>
</el-tooltip> </el-tooltip>
</a> </a>
<a :href="fileUrl" :download="fileUrl | fileName" target="_blank"> <a :href="item.url" :download="item.name" target="_blank">
<el-tooltip effect="dark" content="下载"> <el-tooltip effect="dark" content="下载">
<i class="el-icon-download"></i> <i class="el-icon-download"></i>
</el-tooltip> </el-tooltip>
...@@ -55,36 +50,39 @@ export default { ...@@ -55,36 +50,39 @@ export default {
value: { value: {
immediate: true, immediate: true,
handler(value) { handler(value) {
if (value) { if (!value) {
if (Array.isArray(value)) { return
this.fileList = value.map(item => { }
return item.url || item let fileList = []
}) if (Array.isArray(value)) {
} else { fileList = value.map(item => {
this.fileList = [value] return { name: item.name || item, url: item.url || item }
} })
} else {
fileList.push({ name: '附件下载', url: value })
} }
this.fileList = fileList
} }
} }
}, },
filters: {
fileName(value) {
return value ? value.split('/').pop() : ''
}
},
methods: { methods: {
httpRequest(xhr) { httpRequest(xhr) {
api.uploadFile({ file: xhr.file }).then(response => { api
if (response.success) { .uploadFile({ file: xhr.file })
if (Array.isArray(this.value)) { .then(response => {
this.fileList.push(response.url) if (response.success) {
this.$emit('input', this.fileList) if (Array.isArray(this.value)) {
} else { this.fileList.push({ name: xhr.file.name, url: response.url })
this.fileList = [response.url] this.$emit('input', this.fileList)
this.$emit('input', response.url) } else {
this.fileList = [response.url]
this.$emit('input', response.url)
}
} }
} })
}) .catch(error => {
this.$message.error(error.message)
})
}, },
handleRemove(index) { handleRemove(index) {
this.fileList.splice(index, 1) this.fileList.splice(index, 1)
......
...@@ -288,7 +288,7 @@ export default { ...@@ -288,7 +288,7 @@ export default {
const params = { answers: JSON.stringify(answers), type: 0 } const params = { answers: JSON.stringify(answers), type: 0 }
// 请求接口 // 请求接口
this.handleSubmitRequest(params) this.handleSubmitRequest(params)
}, 10000) }, 3000)
}, },
// 处理请求接口答案数据 // 处理请求接口答案数据
handleSubmitData() { handleSubmitData() {
......
...@@ -12,13 +12,17 @@ ...@@ -12,13 +12,17 @@
<!-- 单选 --> <!-- 单选 -->
<el-radio-group v-model="currentValue.user_answer" v-if="type === 1"> <el-radio-group v-model="currentValue.user_answer" v-if="type === 1">
<div class="q-option-item" v-for="item in currentOptions" :key="item.id"> <div class="q-option-item" v-for="item in currentOptions" :key="item.id">
<el-radio :class="genClass(item)" :label="item.id"><span v-html="item.abc_option"></span></el-radio> <el-radio :class="genClass(item)" :label="item.id">
<div class="q-option-item__answer" v-html="item.abc_option"></div>
</el-radio>
</div> </div>
</el-radio-group> </el-radio-group>
<!-- 多选 --> <!-- 多选 -->
<el-checkbox-group v-model="currentValue.user_answer" v-if="type === 2"> <el-checkbox-group v-model="currentValue.user_answer" v-if="type === 2">
<div class="q-option-item" v-for="item in currentOptions" :key="item.id"> <div class="q-option-item" v-for="item in currentOptions" :key="item.id">
<el-checkbox :class="genClass(item)" :label="item.id"><span v-html="item.abc_option"></span></el-checkbox> <el-checkbox :class="genClass(item)" :label="item.id">
<div class="q-option-item__answer" v-html="item.abc_option"></div>
</el-checkbox>
</div> </div>
</el-checkbox-group> </el-checkbox-group>
<!-- 简答题 --> <!-- 简答题 -->
...@@ -224,6 +228,12 @@ export default { ...@@ -224,6 +228,12 @@ export default {
padding-left: 20px; padding-left: 20px;
margin-bottom: 14px; margin-bottom: 14px;
} }
.q-option-item__answer {
display: inline;
::v-deep * {
display: inline;
}
}
.is-success { .is-success {
color: #090; color: #090;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论