mirror of
https://github.com/yudaocode/yudao-ui-admin-vue3.git
synced 2026-04-19 13:48:37 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -28,7 +28,8 @@ const props = defineProps({
|
|||||||
default: () => undefined
|
default: () => undefined
|
||||||
},
|
},
|
||||||
readonly: propTypes.bool.def(false),
|
readonly: propTypes.bool.def(false),
|
||||||
modelValue: propTypes.string.def('')
|
modelValue: propTypes.string.def(''),
|
||||||
|
directory: propTypes.string.def('editor-default')
|
||||||
})
|
})
|
||||||
|
|
||||||
const emit = defineEmits(['change', 'update:modelValue'])
|
const emit = defineEmits(['change', 'update:modelValue'])
|
||||||
@@ -115,9 +116,9 @@ const editorConfig = computed((): IEditorConfig => {
|
|||||||
['uploadImage']: {
|
['uploadImage']: {
|
||||||
server: getUploadUrl(),
|
server: getUploadUrl(),
|
||||||
// 单个文件的最大体积限制,默认为 2M
|
// 单个文件的最大体积限制,默认为 2M
|
||||||
maxFileSize: 5 * 1024 * 1024,
|
maxFileSize: 10 * 1024 * 1024,
|
||||||
// 最多可上传几个文件,默认为 100
|
// 最多可上传几个文件,默认为 100
|
||||||
maxNumberOfFiles: 10,
|
maxNumberOfFiles: 100,
|
||||||
// 选择文件时的类型限制,默认为 ['image/*'] 。如不想限制,则设置为 []
|
// 选择文件时的类型限制,默认为 ['image/*'] 。如不想限制,则设置为 []
|
||||||
allowedFileTypes: ['image/*'],
|
allowedFileTypes: ['image/*'],
|
||||||
|
|
||||||
@@ -133,6 +134,19 @@ const editorConfig = computed((): IEditorConfig => {
|
|||||||
|
|
||||||
// form-data fieldName,后端接口参数名称,默认值wangeditor-uploaded-image
|
// form-data fieldName,后端接口参数名称,默认值wangeditor-uploaded-image
|
||||||
fieldName: 'file',
|
fieldName: 'file',
|
||||||
|
// 附加参数
|
||||||
|
meta: {
|
||||||
|
directory: `${props.directory}-image`
|
||||||
|
},
|
||||||
|
metaWithUrl: false,
|
||||||
|
|
||||||
|
// uppy 配置项
|
||||||
|
uppyConfig: {
|
||||||
|
onBeforeFileAdded: (newFile: any) => {
|
||||||
|
newFile.id = `${newFile.id}-${Date.now()}`
|
||||||
|
return newFile
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// 上传之前触发
|
// 上传之前触发
|
||||||
onBeforeUpload(file: File) {
|
onBeforeUpload(file: File) {
|
||||||
@@ -163,7 +177,7 @@ const editorConfig = computed((): IEditorConfig => {
|
|||||||
['uploadVideo']: {
|
['uploadVideo']: {
|
||||||
server: getUploadUrl(),
|
server: getUploadUrl(),
|
||||||
// 单个文件的最大体积限制,默认为 10M
|
// 单个文件的最大体积限制,默认为 10M
|
||||||
maxFileSize: 10 * 1024 * 1024,
|
maxFileSize: 1024 * 1024 * 1024,
|
||||||
// 最多可上传几个文件,默认为 100
|
// 最多可上传几个文件,默认为 100
|
||||||
maxNumberOfFiles: 10,
|
maxNumberOfFiles: 10,
|
||||||
// 选择文件时的类型限制,默认为 ['video/*'] 。如不想限制,则设置为 []
|
// 选择文件时的类型限制,默认为 ['video/*'] 。如不想限制,则设置为 []
|
||||||
@@ -181,6 +195,19 @@ const editorConfig = computed((): IEditorConfig => {
|
|||||||
|
|
||||||
// form-data fieldName,后端接口参数名称,默认值wangeditor-uploaded-image
|
// form-data fieldName,后端接口参数名称,默认值wangeditor-uploaded-image
|
||||||
fieldName: 'file',
|
fieldName: 'file',
|
||||||
|
// 附加参数
|
||||||
|
meta: {
|
||||||
|
directory: `${props.directory}-video`
|
||||||
|
},
|
||||||
|
metaWithUrl: false,
|
||||||
|
|
||||||
|
// uppy 配置项
|
||||||
|
uppyConfig: {
|
||||||
|
onBeforeFileAdded: (newFile: any) => {
|
||||||
|
newFile.id = `${newFile.id}-${Date.now()}`
|
||||||
|
return newFile
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// 上传之前触发
|
// 上传之前触发
|
||||||
onBeforeUpload(file: File) {
|
onBeforeUpload(file: File) {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ const props = defineProps({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
const { copy } = useClipboard() // 初始化 copy 到粘贴板
|
const { copy } = useClipboard({ legacy: true }) // 初始化 copy 到粘贴板
|
||||||
const contentRef = ref()
|
const contentRef = ref()
|
||||||
|
|
||||||
const md = new MarkdownIt({
|
const md = new MarkdownIt({
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
import * as FileApi from '@/api/infra/file'
|
import * as FileApi from '@/api/infra/file'
|
||||||
import { UploadRawFile, UploadRequestOptions, UploadProgressEvent } from 'element-plus/es/components/upload/src/upload'
|
import {
|
||||||
|
UploadRawFile,
|
||||||
|
UploadRequestOptions,
|
||||||
|
UploadProgressEvent
|
||||||
|
} from 'element-plus/es/components/upload/src/upload'
|
||||||
import axios, { AxiosProgressEvent } from 'axios'
|
import axios, { AxiosProgressEvent } from 'axios'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -19,7 +23,7 @@ export const useUpload = (directory?: string) => {
|
|||||||
// 文件上传进度监听
|
// 文件上传进度监听
|
||||||
const uploadProgressHandler = (evt: AxiosProgressEvent) => {
|
const uploadProgressHandler = (evt: AxiosProgressEvent) => {
|
||||||
const upEvt: UploadProgressEvent = Object.assign(evt.event)
|
const upEvt: UploadProgressEvent = Object.assign(evt.event)
|
||||||
upEvt.percent = evt.progress ? (evt.progress * 100) : 0
|
upEvt.percent = evt.progress ? evt.progress * 100 : 0
|
||||||
options.onProgress(upEvt) // 触发 el-upload 的 on-progress
|
options.onProgress(upEvt) // 触发 el-upload 的 on-progress
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,7 +37,7 @@ export const useUpload = (directory?: string) => {
|
|||||||
return axios
|
return axios
|
||||||
.put(presignedInfo.uploadUrl, options.file, {
|
.put(presignedInfo.uploadUrl, options.file, {
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': options.file.type
|
'Content-Type': options.file.type || 'application/octet-stream'
|
||||||
},
|
},
|
||||||
onUploadProgress: uploadProgressHandler
|
onUploadProgress: uploadProgressHandler
|
||||||
})
|
})
|
||||||
@@ -80,7 +84,7 @@ function createFile(vo: FileApi.FilePresignedUrlRespVO, file: UploadRawFile, fil
|
|||||||
url: vo.url,
|
url: vo.url,
|
||||||
path: vo.path,
|
path: vo.path,
|
||||||
name: fileName,
|
name: fileName,
|
||||||
type: file.type,
|
type: file.type || 'application/octet-stream',
|
||||||
size: file.size
|
size: file.size
|
||||||
}
|
}
|
||||||
FileApi.createFile(fileVo)
|
FileApi.createFile(fileVo)
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ watch(
|
|||||||
// 拷贝
|
// 拷贝
|
||||||
const copyConfig = async () => {
|
const copyConfig = async () => {
|
||||||
const { copy, copied, isSupported } = useClipboard({
|
const { copy, copied, isSupported } = useClipboard({
|
||||||
|
legacy: true,
|
||||||
source: `
|
source: `
|
||||||
// 面包屑
|
// 面包屑
|
||||||
breadcrumb: ${appStore.getBreadcrumb},
|
breadcrumb: ${appStore.getBreadcrumb},
|
||||||
@@ -296,7 +297,7 @@ const clear = () => {
|
|||||||
$prefix-cls: #{$namespace}-setting;
|
$prefix-cls: #{$namespace}-setting;
|
||||||
|
|
||||||
.#{$prefix-cls} {
|
.#{$prefix-cls} {
|
||||||
|
z-index: 1200; /* 修正没有z-index会被表格层覆盖,值不要超过4000 */
|
||||||
border-radius: 6px 0 0 6px;
|
border-radius: 6px 0 0 6px;
|
||||||
z-index: 1200;/*修正没有z-index会被表格层覆盖,值不要超过4000*/
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -8,7 +8,15 @@ const router = createRouter({
|
|||||||
history: createWebHistory(import.meta.env.VITE_BASE_PATH), // createWebHashHistory URL带#,createWebHistory URL不带#
|
history: createWebHistory(import.meta.env.VITE_BASE_PATH), // createWebHashHistory URL带#,createWebHistory URL不带#
|
||||||
strict: true,
|
strict: true,
|
||||||
routes: remainingRouter as RouteRecordRaw[],
|
routes: remainingRouter as RouteRecordRaw[],
|
||||||
scrollBehavior: () => ({ left: 0, top: 0 })
|
scrollBehavior: () => {
|
||||||
|
// 新开标签时、返回标签时,滚动条回到顶部,否则会保留上次标签的滚动位置。
|
||||||
|
const scrollbarWrap = document.querySelector('.v-layout-content-scrollbar .el-scrollbar__wrap')
|
||||||
|
if (scrollbarWrap) {
|
||||||
|
// scrollbarWrap.scrollTo({ left: 0, top: 0, behavior: 'auto' })
|
||||||
|
scrollbarWrap.scrollTop = 0
|
||||||
|
}
|
||||||
|
return { left: 0, top: 0 }
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
export const resetRouter = (): void => {
|
export const resetRouter = (): void => {
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ import userAvatarDefaultImg from '@/assets/imgs/avatar.gif'
|
|||||||
import roleAvatarDefaultImg from '@/assets/ai/gpt.svg'
|
import roleAvatarDefaultImg from '@/assets/ai/gpt.svg'
|
||||||
|
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
const { copy } = useClipboard() // 初始化 copy 到粘贴板
|
const { copy } = useClipboard({ legacy: true }) // 初始化 copy 到粘贴板
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
|
|
||||||
// 判断“消息列表”滚动的位置(用于判断是否需要滚动到消息最下方)
|
// 判断“消息列表”滚动的位置(用于判断是否需要滚动到消息最下方)
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
import { useClipboard } from '@vueuse/core'
|
import { useClipboard } from '@vueuse/core'
|
||||||
|
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
const { copied, copy } = useClipboard() // 粘贴板
|
const { copied, copy } = useClipboard({ legacy: true }) // 粘贴板
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
content: {
|
content: {
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ const makeTemplate = () => {
|
|||||||
/** 复制 **/
|
/** 复制 **/
|
||||||
const copy = async (text: string) => {
|
const copy = async (text: string) => {
|
||||||
const textToCopy = JSON.stringify(text, null, 2)
|
const textToCopy = JSON.stringify(text, null, 2)
|
||||||
const { copy, copied, isSupported } = useClipboard({ source: textToCopy })
|
const { copy, copied, isSupported } = useClipboard({ legacy: true, source: textToCopy })
|
||||||
if (!isSupported) {
|
if (!isSupported) {
|
||||||
message.error(t('common.copyError'))
|
message.error(t('common.copyError'))
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ const handleFiles = (datas: CodegenApi.CodegenPreviewVO[]) => {
|
|||||||
|
|
||||||
/** 复制 **/
|
/** 复制 **/
|
||||||
const copy = async (text: string) => {
|
const copy = async (text: string) => {
|
||||||
const { copy, copied, isSupported } = useClipboard({ source: text })
|
const { copy, copied, isSupported } = useClipboard({ legacy: true, source: text })
|
||||||
if (!isSupported) {
|
if (!isSupported) {
|
||||||
message.error(t('common.copyError'))
|
message.error(t('common.copyError'))
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -136,6 +136,7 @@ import { fileSizeFormatter } from '@/utils'
|
|||||||
import { dateFormatter } from '@/utils/formatTime'
|
import { dateFormatter } from '@/utils/formatTime'
|
||||||
import * as FileApi from '@/api/infra/file'
|
import * as FileApi from '@/api/infra/file'
|
||||||
import FileForm from './FileForm.vue'
|
import FileForm from './FileForm.vue'
|
||||||
|
import { useClipboard } from '@vueuse/core'
|
||||||
|
|
||||||
defineOptions({ name: 'InfraFile' })
|
defineOptions({ name: 'InfraFile' })
|
||||||
|
|
||||||
@@ -186,29 +187,15 @@ const openForm = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 复制到剪贴板方法 */
|
/** 复制到剪贴板方法 */
|
||||||
const copyToClipboard = (text: string) => {
|
const copyToClipboard = async (text: string) => {
|
||||||
if (navigator.clipboard && window.isSecureContext) {
|
const { copy, copied, isSupported } = useClipboard({ legacy: true, source: text })
|
||||||
navigator.clipboard
|
if (!isSupported) {
|
||||||
.writeText(text)
|
message.error(t('common.copyError'))
|
||||||
.then(() => {
|
return
|
||||||
message.success('复制成功')
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
message.error('复制失败')
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
// 兼容不支持 clipboard 的情况
|
|
||||||
try {
|
|
||||||
const textarea = document.createElement('textarea')
|
|
||||||
textarea.value = text
|
|
||||||
document.body.appendChild(textarea)
|
|
||||||
textarea.select()
|
|
||||||
document.execCommand('copy')
|
|
||||||
document.body.removeChild(textarea)
|
|
||||||
message.success('复制成功')
|
|
||||||
} catch (error) {
|
|
||||||
message.error('复制失败')
|
|
||||||
}
|
}
|
||||||
|
await copy()
|
||||||
|
if (unref(copied)) {
|
||||||
|
message.success(t('common.copySuccess'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,8 +39,10 @@
|
|||||||
import DeviceForm from '@/views/iot/device/device/DeviceForm.vue'
|
import DeviceForm from '@/views/iot/device/device/DeviceForm.vue'
|
||||||
import { ProductVO } from '@/api/iot/product/product'
|
import { ProductVO } from '@/api/iot/product/product'
|
||||||
import { DeviceVO } from '@/api/iot/device/device'
|
import { DeviceVO } from '@/api/iot/device/device'
|
||||||
|
import { useClipboard } from '@vueuse/core'
|
||||||
|
|
||||||
const message = useMessage()
|
const message = useMessage()
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
const { product, device } = defineProps<{ product: ProductVO; device: DeviceVO }>()
|
const { product, device } = defineProps<{ product: ProductVO; device: DeviceVO }>()
|
||||||
@@ -54,11 +56,14 @@ const openForm = (type: string, id?: number) => {
|
|||||||
|
|
||||||
/** 复制到剪贴板方法 */
|
/** 复制到剪贴板方法 */
|
||||||
const copyToClipboard = async (text: string) => {
|
const copyToClipboard = async (text: string) => {
|
||||||
try {
|
const { copy, copied, isSupported } = useClipboard({ legacy: true, source: text })
|
||||||
await navigator.clipboard.writeText(text)
|
if (!isSupported) {
|
||||||
message.success('复制成功')
|
message.error(t('common.copyError'))
|
||||||
} catch (error) {
|
return
|
||||||
message.error('复制失败')
|
}
|
||||||
|
await copy()
|
||||||
|
if (unref(copied)) {
|
||||||
|
message.success(t('common.copySuccess'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -140,8 +140,10 @@ import { DeviceVO } from '@/api/iot/device/device'
|
|||||||
import { DeviceApi, IotDeviceAuthInfoVO } from '@/api/iot/device/device'
|
import { DeviceApi, IotDeviceAuthInfoVO } from '@/api/iot/device/device'
|
||||||
import Map from '@/components/Map/index.vue'
|
import Map from '@/components/Map/index.vue'
|
||||||
import { ref, computed } from 'vue'
|
import { ref, computed } from 'vue'
|
||||||
|
import { useClipboard } from '@vueuse/core'
|
||||||
|
|
||||||
const message = useMessage() // 消息提示
|
const message = useMessage() // 消息提示
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
|
|
||||||
const { product, device } = defineProps<{ product: ProductVO; device: DeviceVO }>() // 定义 Props
|
const { product, device } = defineProps<{ product: ProductVO; device: DeviceVO }>() // 定义 Props
|
||||||
const emit = defineEmits(['refresh']) // 定义 Emits
|
const emit = defineEmits(['refresh']) // 定义 Emits
|
||||||
@@ -165,11 +167,14 @@ const getLocationString = () => {
|
|||||||
|
|
||||||
/** 复制到剪贴板方法 */
|
/** 复制到剪贴板方法 */
|
||||||
const copyToClipboard = async (text: string) => {
|
const copyToClipboard = async (text: string) => {
|
||||||
try {
|
const { copy, copied, isSupported } = useClipboard({ legacy: true, source: text })
|
||||||
await navigator.clipboard.writeText(text)
|
if (!isSupported) {
|
||||||
message.success('复制成功')
|
message.error(t('common.copyError'))
|
||||||
} catch (error) {
|
return
|
||||||
message.error('复制失败')
|
}
|
||||||
|
await copy()
|
||||||
|
if (unref(copied)) {
|
||||||
|
message.success(t('common.copySuccess'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,18 +54,23 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import ProductForm from '@/views/iot/product/product/ProductForm.vue'
|
import ProductForm from '@/views/iot/product/product/ProductForm.vue'
|
||||||
import { ProductApi, ProductVO } from '@/api/iot/product/product'
|
import { ProductApi, ProductVO } from '@/api/iot/product/product'
|
||||||
|
import { useClipboard } from '@vueuse/core'
|
||||||
|
|
||||||
const message = useMessage()
|
const message = useMessage()
|
||||||
|
const { t } = useI18n() // 国际化
|
||||||
|
|
||||||
const { product } = defineProps<{ product: ProductVO }>() // 定义 Props
|
const { product } = defineProps<{ product: ProductVO }>() // 定义 Props
|
||||||
|
|
||||||
/** 复制到剪贴板方法 */
|
/** 复制到剪贴板方法 */
|
||||||
const copyToClipboard = async (text: string) => {
|
const copyToClipboard = async (text: string) => {
|
||||||
try {
|
const { copy, copied, isSupported } = useClipboard({ legacy: true, source: text })
|
||||||
await navigator.clipboard.writeText(text)
|
if (!isSupported) {
|
||||||
message.success('复制成功')
|
message.error(t('common.copyError'))
|
||||||
} catch (error) {
|
return
|
||||||
message.error('复制失败')
|
}
|
||||||
|
await copy()
|
||||||
|
if (unref(copied)) {
|
||||||
|
message.success(t('common.copySuccess'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user