Commit cf737d7e by wuqian

打扮管理文件上传累加

parent df5972b5
...@@ -4,6 +4,7 @@ import App from './App.vue' ...@@ -4,6 +4,7 @@ import App from './App.vue'
import router from './router' import router from './router'
import store from './store' import store from './store'
import './styles/index.scss' import './styles/index.scss'
// 确保在渲染用户提供的HTML内容时,不会执行任何潜在的恶意脚本,从而提高应用的安全性
import vueDomPurifyHTMLPlugin from 'vue-dompurify-html' import vueDomPurifyHTMLPlugin from 'vue-dompurify-html'
createApp(App).use(vueDomPurifyHTMLPlugin).use(router).use(store).mount('#app') createApp(App).use(vueDomPurifyHTMLPlugin).use(router).use(store).mount('#app')
...@@ -446,7 +446,7 @@ const submitReview = async () => { ...@@ -446,7 +446,7 @@ const submitReview = async () => {
// showError('请上传图片') // showError('请上传图片')
// return // return
// } // }
let BtnIndex = Number(version.value - 1) const BtnIndex = Number(version.value - 1)
// 检查 imagePath 是否为空或 null // 检查 imagePath 是否为空或 null
if ( if (
versionImageList.value.length == 0 || versionImageList.value.length == 0 ||
...@@ -534,13 +534,23 @@ const onChange = async (files: Event) => { ...@@ -534,13 +534,23 @@ const onChange = async (files: Event) => {
fileInputRef.value.value = '' fileInputRef.value.value = ''
try { try {
const res = await Promise.all(requestList) const res = await Promise.all(requestList)
versionImageList.value = res.map((item) => { const createImage: VersionImageList[] = []
return { res.forEach((item, index) => {
imagePath: item?.filePath, const imgInfo = {
sort: versionImageList.value.length + 1, sort: versionImageList.value.length + index,
imagePath: item.filePath,
} }
createImage.push(imgInfo)
}) })
versionImageUrl.value = res[0].filePath ?? '' versionImageList.value = [...versionImageList.value, ...createImage]
versionImageUrl.value = versionImageList.value[0].imagePath ?? ''
// versionImageList.value = res.map((item) => {
// return {
// imagePath: item?.filePath,
// sort: versionImageList.value.length + 1,
// }
// })
// versionImageUrl.value = res[0].filePath ?? ''
} catch (e) { } catch (e) {
console.error(e) console.error(e)
} finally { } finally {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment