|
|
@@ -1,4 +1,5 @@
|
|
|
import { ref } from 'vue'
|
|
|
+
|
|
|
export interface FormOptions {
|
|
|
value: string
|
|
|
label: string
|
|
|
@@ -66,7 +67,7 @@ export const changeUploadDataWithCustom = (
|
|
|
return {
|
|
|
uploadData: {
|
|
|
fileType: mapping.uploadType,
|
|
|
- uploadFrom: `${basePath}${attachmentId ? '/' + attachmentId : ''}`,
|
|
|
+ uploadFrom: `${basePath}${attachmentId ? `/${attachmentId}` : ''}`,
|
|
|
storageStyle: 6
|
|
|
},
|
|
|
fileType: mapping.fileType
|
|
|
@@ -82,7 +83,7 @@ export const changeUploadDataWithCustom = (
|
|
|
return {
|
|
|
uploadData: {
|
|
|
fileType: mapping.uploadType,
|
|
|
- uploadFrom: `${basePath}${attachmentId ? '/' + attachmentId : ''}`,
|
|
|
+ uploadFrom: `${basePath}${attachmentId ? `/${attachmentId}` : ''}`,
|
|
|
storageStyle: 6
|
|
|
},
|
|
|
fileType: mapping.fileType
|
|
|
@@ -107,7 +108,7 @@ export const showFileSize = (_size: string | number) => {
|
|
|
if (typeof size === 'string') {
|
|
|
size = Number(size)
|
|
|
}
|
|
|
- return (size / 1024 / 1024).toFixed(3) + 'MB'
|
|
|
+ return `${(size / 1024 / 1024).toFixed(3)}MB`
|
|
|
}
|
|
|
|
|
|
//将6位以上的值 以*显示,总长度限制在10位
|
|
|
@@ -231,7 +232,8 @@ export const decodeHtmlEntities = (str: string) => {
|
|
|
export const changeUploadData = (mimeType: string, uploadPath: string) => {
|
|
|
console.log(mimeType)
|
|
|
|
|
|
- let fileType, uploadType
|
|
|
+ let fileType
|
|
|
+ let uploadType
|
|
|
|
|
|
switch (mimeType) {
|
|
|
case 'image/jpeg':
|
|
|
@@ -288,7 +290,7 @@ export const changeUploadData = (mimeType: string, uploadPath: string) => {
|
|
|
uploadFrom: uploadPath,
|
|
|
storageStyle: 6 // This value is kept as it might be a constant for your system
|
|
|
},
|
|
|
- fileType: fileType
|
|
|
+ fileType
|
|
|
}
|
|
|
}
|
|
|
/**
|
|
|
@@ -333,7 +335,7 @@ export const qs = (obj: Record<string, any>): string => {
|
|
|
|
|
|
export const truncateText = (text: string, limit = 10) => {
|
|
|
if (!text) return ''
|
|
|
- return text.length > limit ? text.slice(0, limit) + '...' : text
|
|
|
+ return text.length > limit ? `${text.slice(0, limit)}...` : text
|
|
|
}
|
|
|
|
|
|
export const extractTextFromHTML = (text: string, limit = 10) => {
|
|
|
@@ -344,10 +346,10 @@ export const extractTextFromHTML = (text: string, limit = 10) => {
|
|
|
const doc = parser.parseFromString(text, 'text/html')
|
|
|
// Get the text content from the parsed HTML
|
|
|
const plainText = doc.body.textContent || text
|
|
|
- return plainText.length > limit ? plainText.slice(0, limit) + '...' : plainText
|
|
|
+ return plainText.length > limit ? `${plainText.slice(0, limit)}...` : plainText
|
|
|
} catch (error) {
|
|
|
// If parsing fails, return the original text
|
|
|
- return text.length > limit ? text.slice(0, limit) + '...' : text
|
|
|
+ return text.length > limit ? `${text.slice(0, limit)}...` : text
|
|
|
}
|
|
|
}
|
|
|
|