【修改】 wps-word,pptx出题页面BUG修改
This commit is contained in:
@@ -30,10 +30,13 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="题型难度" prop="quLevel">
|
<el-form-item label="题型难度" prop="quLevel">
|
||||||
<el-select v-model="formData.quLevel" placeholder="请选择题型难度" clearable>
|
<el-select v-model="formData.quLevel" placeholder="请选择题型难度">
|
||||||
<el-option label="简单" :value="'0'" />
|
<el-option
|
||||||
<el-option label="一般" :value="'1'" />
|
v-for="dict in getStrDictOptions(DICT_TYPE.EXAM_QUE_DIFF)"
|
||||||
<el-option label="困难" :value="'2'" />
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@@ -63,6 +66,18 @@
|
|||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="审核状态" prop="audit">
|
||||||
|
<el-select v-model="formData.audit" placeholder="请选择审核状态">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in getStrDictOptions(DICT_TYPE.QUESTION_AUDIT)"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div class="edit-bottom">
|
<div class="edit-bottom">
|
||||||
@@ -92,8 +107,15 @@
|
|||||||
@selection-change="handleSelectionChange"
|
@selection-change="handleSelectionChange"
|
||||||
>
|
>
|
||||||
<!-- <el-table-column type="selection" width="55" /> -->
|
<!-- <el-table-column type="selection" width="55" /> -->
|
||||||
<el-table-column label="考点" align="center" prop="contentIn" />
|
<el-table-column label="考点" align="center" prop="contentIn" width="360px"/>
|
||||||
<el-table-column label="权值" align="center" prop="scoreRate" />
|
<el-table-column label="权值" align="center" prop="scoreRate" width="100px"/>
|
||||||
|
<el-table-column label="操作" align="center" width="100px">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button type="primary" link @click="handleDelete(scope.row)">
|
||||||
|
<Icon icon="ep:delete" />删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
@@ -181,9 +203,29 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" width="150">
|
<el-table-column label="操作" width="150">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button type="primary" plain @click="openForm(scope.row.fileType)">
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
@click="openForm(scope.row.fileType)"
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
<Icon icon="ep:upload" class="mr-5px" /> 上传
|
<Icon icon="ep:upload" class="mr-5px" /> 上传
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
@click="downloadFile(scope.row.url)"
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
|
<Icon icon="ep:download" class="mr-5px" /> 下载
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
@click="deleteUrl(scope.$index)"
|
||||||
|
size="small"
|
||||||
|
><Icon icon="ep:download" class="mr-5px" />删除
|
||||||
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -227,7 +269,7 @@
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict'
|
||||||
import { FormRules } from 'element-plus'
|
import { FormRules } from 'element-plus'
|
||||||
import * as QuestionApi from '@/api/paper/question'
|
import * as QuestionApi from '@/api/paper/question'
|
||||||
import * as WordApi from '@/api/wps/word'
|
import * as WordApi from '@/api/wps/word'
|
||||||
@@ -306,6 +348,14 @@ const pptxPoints = ref({
|
|||||||
})
|
})
|
||||||
let pptxPointsInfosList: (typeof pptxPoints)[] = []
|
let pptxPointsInfosList: (typeof pptxPoints)[] = []
|
||||||
|
|
||||||
|
const handleDelete = (row) => {
|
||||||
|
for (let i = 0; i < list.value.length; i++) {
|
||||||
|
if (row.content == list.value[i].content) {
|
||||||
|
list.value.splice(i, 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function fileTypeFormatter(row, column, cellValue) {
|
function fileTypeFormatter(row, column, cellValue) {
|
||||||
if (cellValue === '0') return '素材文件(上传ZIP)'
|
if (cellValue === '0') return '素材文件(上传ZIP)'
|
||||||
if (cellValue === '1') return '考试文件'
|
if (cellValue === '1') return '考试文件'
|
||||||
@@ -363,11 +413,17 @@ const handleCheckChange = (data: Tree, checked: boolean, indeterminate: boolean)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const addPptxInfo = async () => {
|
const addPptxInfo = async () => {
|
||||||
|
var filePath = ''
|
||||||
|
for (var i = 0; i < documentList.value.length; i++) {
|
||||||
|
if (documentList.value[i].fileType == '2') {
|
||||||
|
filePath = documentList.value[i].url
|
||||||
|
}
|
||||||
|
}
|
||||||
// http://115.120.213.238:9000/exam/9f7d8f5d7c68cc2bfd03a23c19045efe7ba13a4bebeb833abece146908bcd0c6.docx documentList.value[1].url
|
// http://115.120.213.238:9000/exam/9f7d8f5d7c68cc2bfd03a23c19045efe7ba13a4bebeb833abece146908bcd0c6.docx documentList.value[1].url
|
||||||
if (documentList.value[2].url == '' || documentList.value[2].url == null) {
|
if (filePath == '' || filePath == null) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const res = await PptxApi.getPptxInfo(documentList.value[2].url)
|
const res = await PptxApi.getPptxInfo(filePath)
|
||||||
pptxPointsList.value = []
|
pptxPointsList.value = []
|
||||||
pptxPointsList.value.push(...handleTree(res))
|
pptxPointsList.value.push(...handleTree(res))
|
||||||
dialogFormVisiblePptxInfo.value = true
|
dialogFormVisiblePptxInfo.value = true
|
||||||
@@ -400,11 +456,21 @@ const submitPptxPoints = async () => {
|
|||||||
const res = await PptxApi.getPptxListInfos(pptxPointsInfosList)
|
const res = await PptxApi.getPptxListInfos(pptxPointsInfosList)
|
||||||
pptxPointsInfosList = []
|
pptxPointsInfosList = []
|
||||||
console.log(list.value)
|
console.log(list.value)
|
||||||
|
var indexFlag = false
|
||||||
for (let i = 0; i < res.length; i++) {
|
for (let i = 0; i < res.length; i++) {
|
||||||
list.value.push(res[i])
|
for (let x = 0; x < list.value.length; x++) {
|
||||||
|
if (res[i].content == list.value[x].content) {
|
||||||
|
// 如果存在相同的数据话 不进入
|
||||||
|
indexFlag = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!indexFlag) {
|
||||||
|
list.value.push(res[i])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
dialogFormVisiblePptxInfo.value = false
|
dialogFormVisiblePptxInfo.value = false
|
||||||
dialogFormVisiblePptxInfos.value = false
|
dialogFormVisiblePptxInfos.value = false
|
||||||
|
pptxPointsList.value = []
|
||||||
}
|
}
|
||||||
const formRules = reactive<FormRules>({
|
const formRules = reactive<FormRules>({
|
||||||
status: [{ required: true, message: '启用状态必填', trigger: 'blur' }]
|
status: [{ required: true, message: '启用状态必填', trigger: 'blur' }]
|
||||||
@@ -501,7 +567,42 @@ const submitForm = async () => {
|
|||||||
formLoading.value = false
|
formLoading.value = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const downloadFile = async (url: string) => {
|
||||||
|
if (!url) {
|
||||||
|
ElMessage.warning('暂无可下载的文件地址')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetch(url)
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error('下载失败')
|
||||||
|
}
|
||||||
|
|
||||||
|
const blob = await response.blob()
|
||||||
|
const blobUrl = window.URL.createObjectURL(blob)
|
||||||
|
|
||||||
|
// 提取文件名
|
||||||
|
const filename = url.substring(url.lastIndexOf('/') + 1).split('?')[0]
|
||||||
|
|
||||||
|
// 创建 a 标签并下载
|
||||||
|
const a = document.createElement('a')
|
||||||
|
a.href = blobUrl
|
||||||
|
a.download = filename
|
||||||
|
a.style.display = 'none'
|
||||||
|
document.body.appendChild(a)
|
||||||
|
a.click()
|
||||||
|
a.remove()
|
||||||
|
|
||||||
|
window.URL.revokeObjectURL(blobUrl)
|
||||||
|
} catch (err: any) {
|
||||||
|
ElMessage.error(`下载失败:${err.message}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const deleteUrl = (index: number) => {
|
||||||
|
formData.value.fileUploads[index].url = ''
|
||||||
|
formData.value.fileUploads[index].fileName = ''
|
||||||
|
}
|
||||||
/** 重置表单 */
|
/** 重置表单 */
|
||||||
const resetForm = () => {
|
const resetForm = () => {
|
||||||
formData.value = {
|
formData.value = {
|
||||||
@@ -567,6 +668,7 @@ const resetForm = () => {
|
|||||||
fileName: ''
|
fileName: ''
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
list.value = []
|
||||||
formRef.value?.resetFields()
|
formRef.value?.resetFields()
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@@ -30,10 +30,18 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="题型难度" prop="quLevel">
|
<el-form-item label="题型难度" prop="quLevel">
|
||||||
<el-select v-model="formData.quLevel" placeholder="请选择题型难度" clearable>
|
<!-- <el-select v-model="formData.quLevel" placeholder="请选择题型难度" clearable>
|
||||||
<el-option label="简单" :value="'0'" />
|
<el-option label="简单" :value="'0'" />
|
||||||
<el-option label="一般" :value="'1'" />
|
<el-option label="一般" :value="'1'" />
|
||||||
<el-option label="困难" :value="'2'" />
|
<el-option label="困难" :value="'2'" />
|
||||||
|
</el-select> -->
|
||||||
|
<el-select v-model="formData.quLevel" placeholder="请选择题型难度">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in getStrDictOptions(DICT_TYPE.EXAM_QUE_DIFF)"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@@ -63,6 +71,18 @@
|
|||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="审核状态" prop="audit">
|
||||||
|
<el-select v-model="formData.audit" placeholder="请选择审核状态">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in getStrDictOptions(DICT_TYPE.QUESTION_AUDIT)"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div class="edit-bottom">
|
<div class="edit-bottom">
|
||||||
@@ -82,8 +102,24 @@
|
|||||||
<Editor v-model="formData.analysis" height="150px" />
|
<Editor v-model="formData.analysis" height="150px" />
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="试题考点" name="answer">
|
<el-tab-pane name="answer">
|
||||||
<el-button @click="addWordInfo">新增</el-button>
|
<template #label>
|
||||||
|
<div class="custom-tabs-label">
|
||||||
|
<p>试题考点</p>
|
||||||
|
<el-dropdown>
|
||||||
|
<span class="el-dropdown-link" @click.stop="false">
|
||||||
|
<div class="setting_icon"></div>
|
||||||
|
</span>
|
||||||
|
<template #dropdown>
|
||||||
|
<el-dropdown-menu>
|
||||||
|
<el-dropdown-item>
|
||||||
|
<el-button @click="addWordInfo">添加</el-button>
|
||||||
|
</el-dropdown-item>
|
||||||
|
</el-dropdown-menu>
|
||||||
|
</template>
|
||||||
|
</el-dropdown>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
<!-- <el-button type="danger">删除</el-button> -->
|
<!-- <el-button type="danger">删除</el-button> -->
|
||||||
<div class="block">
|
<div class="block">
|
||||||
<el-table
|
<el-table
|
||||||
@@ -92,8 +128,15 @@
|
|||||||
@selection-change="handleSelectionChange"
|
@selection-change="handleSelectionChange"
|
||||||
>
|
>
|
||||||
<!-- <el-table-column type="selection" width="55" /> -->
|
<!-- <el-table-column type="selection" width="55" /> -->
|
||||||
<el-table-column label="考点" align="center" prop="contentIn" />
|
<el-table-column label="考点" align="center" prop="contentIn" width="360px" />
|
||||||
<el-table-column label="权值" align="center" prop="scoreRate" />
|
<el-table-column label="权值" align="center" prop="scoreRate" width="100px" />
|
||||||
|
<el-table-column label="操作" align="center" width="100px">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-button type="primary" link @click="handleDelete(scope.row)">
|
||||||
|
<Icon icon="ep:delete" />删除
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
@@ -181,9 +224,29 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" width="150">
|
<el-table-column label="操作" width="150">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button type="primary" plain @click="openForm(scope.row.fileType)">
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
@click="openForm(scope.row.fileType)"
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
<Icon icon="ep:upload" class="mr-5px" /> 上传
|
<Icon icon="ep:upload" class="mr-5px" /> 上传
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
@click="downloadFile(scope.row.url)"
|
||||||
|
size="small"
|
||||||
|
>
|
||||||
|
<Icon icon="ep:download" class="mr-5px" /> 下载
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
@click="deleteUrl(scope.$index)"
|
||||||
|
size="small"
|
||||||
|
><Icon icon="ep:download" class="mr-5px" />删除
|
||||||
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@@ -202,7 +265,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<!-- 表单弹窗:添加/修改 -->
|
<!-- 表单弹窗:添加/修改 -->
|
||||||
<FileForm ref="FileRef" @success="handleUploadSuccess" />
|
<FileForm ref="FileRef" @success="handleUploadSuccess" />
|
||||||
<el-dialog v-model="dialogFormVisibleWordInfo" title="考点设置" width="400px">
|
<el-dialog v-model="dialogFormVisibleWordInfo" title="考点设置(*暂不支持多选)" width="400px">
|
||||||
|
<el-skeleton :rows="5" animated v-if="wordPointsList.length < 0 && isLoading" />
|
||||||
<el-tree
|
<el-tree
|
||||||
style="max-width: 600px"
|
style="max-width: 600px"
|
||||||
:data="wordPointsList"
|
:data="wordPointsList"
|
||||||
@@ -227,7 +291,7 @@
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
|
import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict'
|
||||||
import { FormRules } from 'element-plus'
|
import { FormRules } from 'element-plus'
|
||||||
import * as QuestionApi from '@/api/paper/question'
|
import * as QuestionApi from '@/api/paper/question'
|
||||||
import * as WordApi from '@/api/wps/word'
|
import * as WordApi from '@/api/wps/word'
|
||||||
@@ -246,6 +310,7 @@ const { t } = useI18n() // 国际化
|
|||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
const loading = ref(false) // 列表的加载中
|
const loading = ref(false) // 列表的加载中
|
||||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||||
|
const isLoading = ref(false)
|
||||||
const dialogTitle = ref('') // 弹窗的标题
|
const dialogTitle = ref('') // 弹窗的标题
|
||||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||||
@@ -371,25 +436,26 @@ const handleCheckChange = (data: Tree, checked: boolean, indeterminate: boolean)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const addWordInfo = async () => {
|
const addWordInfo = async () => {
|
||||||
|
var filePath = ''
|
||||||
|
for (var i = 0; i < documentList.value.length; i++) {
|
||||||
|
if (documentList.value[i].fileType == '2') {
|
||||||
|
filePath = documentList.value[i].url
|
||||||
|
}
|
||||||
|
}
|
||||||
// http://115.120.213.238:9000/exam/9f7d8f5d7c68cc2bfd03a23c19045efe7ba13a4bebeb833abece146908bcd0c6.docx documentList.value[1].url
|
// http://115.120.213.238:9000/exam/9f7d8f5d7c68cc2bfd03a23c19045efe7ba13a4bebeb833abece146908bcd0c6.docx documentList.value[1].url
|
||||||
if (documentList.value[2].url == '' || documentList.value[2].url == null) {
|
if (filePath == '' || filePath == null) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const res = await WordApi.getWordInfo(documentList.value[2].url)
|
dialogFormVisibleWordInfo.value = true
|
||||||
|
isLoading.value = true
|
||||||
|
const res = await WordApi.getWordInfo(filePath)
|
||||||
|
isLoading.value = false
|
||||||
wordPointsList.value = []
|
wordPointsList.value = []
|
||||||
wordPointsList.value.push(...handleTree(res))
|
wordPointsList.value.push(...handleTree(res))
|
||||||
dialogFormVisibleWordInfo.value = true
|
|
||||||
}
|
}
|
||||||
const queryParams = reactive({
|
const queryParams = reactive({
|
||||||
nodeFunction: undefined
|
nodeFunction: undefined
|
||||||
})
|
})
|
||||||
const handleSpecialtyNodeClick = async (row: any) => {
|
|
||||||
titles.value = row.name
|
|
||||||
englishName.value = row.englishName
|
|
||||||
filePath.value = row.filePath
|
|
||||||
nodeFunction.value = row.selectName
|
|
||||||
dialogFormVisibleWordInfos.value = true
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleNodelClick = async (row: any) => {
|
const handleNodelClick = async (row: any) => {
|
||||||
queryParams.nodeFunction = row.selectName
|
queryParams.nodeFunction = row.selectName
|
||||||
@@ -402,6 +468,15 @@ const handleNodelClick = async (row: any) => {
|
|||||||
wordPointsInfoList.value.push(...handleTree(res))
|
wordPointsInfoList.value.push(...handleTree(res))
|
||||||
dialogFormVisibleWordInfos.value = true
|
dialogFormVisibleWordInfos.value = true
|
||||||
}
|
}
|
||||||
|
const handleDelete = (row) => {
|
||||||
|
console.log(row)
|
||||||
|
for (let i = 0; i < list.value.length; i++) {
|
||||||
|
if (row.content == list.value[i].content) {
|
||||||
|
list.value.splice(i, 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const submitWordPoints = async () => {
|
const submitWordPoints = async () => {
|
||||||
wordPointsInfosList.push(wordPoints.value)
|
wordPointsInfosList.push(wordPoints.value)
|
||||||
const res = await WordApi.getWordListInfos(wordPointsInfosList)
|
const res = await WordApi.getWordListInfos(wordPointsInfosList)
|
||||||
@@ -416,12 +491,21 @@ const submitWordPoints = async () => {
|
|||||||
function: []
|
function: []
|
||||||
}
|
}
|
||||||
wordPointsInfosList = []
|
wordPointsInfosList = []
|
||||||
console.log(list.value)
|
|
||||||
for (let i = 0; i < res.length; i++) {
|
for (let i = 0; i < res.length; i++) {
|
||||||
list.value.push(res[i])
|
var indexFlag = false
|
||||||
|
for (let x = 0; x < list.value.length; x++) {
|
||||||
|
if (res[i].content == list.value[x].content) {
|
||||||
|
// 如果存在相同的数据话 不进入
|
||||||
|
indexFlag = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!indexFlag) {
|
||||||
|
list.value.push(res[i])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
dialogFormVisibleWordInfo.value = false
|
dialogFormVisibleWordInfo.value = false
|
||||||
dialogFormVisibleWordInfos.value = false
|
dialogFormVisibleWordInfos.value = false
|
||||||
|
wordPointsList.value = []
|
||||||
}
|
}
|
||||||
const formRules = reactive<FormRules>({
|
const formRules = reactive<FormRules>({
|
||||||
status: [{ required: true, message: '启用状态必填', trigger: 'blur' }]
|
status: [{ required: true, message: '启用状态必填', trigger: 'blur' }]
|
||||||
@@ -450,7 +534,42 @@ const FileRef = ref()
|
|||||||
const openForm = (type: string) => {
|
const openForm = (type: string) => {
|
||||||
FileRef.value.open(type)
|
FileRef.value.open(type)
|
||||||
}
|
}
|
||||||
|
const downloadFile = async (url: string) => {
|
||||||
|
if (!url) {
|
||||||
|
ElMessage.warning('暂无可下载的文件地址')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetch(url)
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error('下载失败')
|
||||||
|
}
|
||||||
|
|
||||||
|
const blob = await response.blob()
|
||||||
|
const blobUrl = window.URL.createObjectURL(blob)
|
||||||
|
|
||||||
|
// 提取文件名
|
||||||
|
const filename = url.substring(url.lastIndexOf('/') + 1).split('?')[0]
|
||||||
|
|
||||||
|
// 创建 a 标签并下载
|
||||||
|
const a = document.createElement('a')
|
||||||
|
a.href = blobUrl
|
||||||
|
a.download = filename
|
||||||
|
a.style.display = 'none'
|
||||||
|
document.body.appendChild(a)
|
||||||
|
a.click()
|
||||||
|
a.remove()
|
||||||
|
|
||||||
|
window.URL.revokeObjectURL(blobUrl)
|
||||||
|
} catch (err: any) {
|
||||||
|
ElMessage.error(`下载失败:${err.message}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const deleteUrl = (index: number) => {
|
||||||
|
formData.value.fileUploads[index].url = ''
|
||||||
|
formData.value.fileUploads[index].fileName = ''
|
||||||
|
}
|
||||||
// 媒体文件
|
// 媒体文件
|
||||||
const mediumList = ref([] as any)
|
const mediumList = ref([] as any)
|
||||||
const multipleMediumSelection = ref([] as any)
|
const multipleMediumSelection = ref([] as any)
|
||||||
@@ -602,6 +721,7 @@ const resetForm = () => {
|
|||||||
fileName: ''
|
fileName: ''
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
list.value = []
|
||||||
formRef.value?.resetFields()
|
formRef.value?.resetFields()
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
Reference in New Issue
Block a user