edti 插入素材
This commit is contained in:
parent
eaa14b1666
commit
a379176496
|
@ -19,8 +19,8 @@
|
|||
import { ref, reactive, onMounted, computed } from 'vue';
|
||||
import { sessionStore } from '@/utils/store'
|
||||
import { getSmarttalkPage } from '@/api/file'
|
||||
import { getFileSuffix, urlToBase64 } from '@/utils/ruoyi.js'
|
||||
import * as commUtils from '@/utils/comm.js'
|
||||
import { getFileSuffix } from '@/utils/ruoyi.js'
|
||||
|
||||
const emit = defineEmits(['insertMaterial', 'close'])
|
||||
|
||||
|
@ -63,12 +63,9 @@ const fileUrl = computed(() => (item) =>{
|
|||
|
||||
// 插入
|
||||
const onInsert = async (item) =>{
|
||||
|
||||
const bolb = commUtils.base64ToBlob(item.fileFullPath)
|
||||
|
||||
const file = commutils.blobToFile(bolb, item.fileShowName)
|
||||
|
||||
|
||||
const res = await fetch(item.fileFullPath)
|
||||
const bolb = await res.blob()
|
||||
const file = commUtils.blobToFile(bolb, item.fileShowName)
|
||||
|
||||
if(videoSuffix.indexOf(getFileSuffix(item.fileShowName)) != -1){
|
||||
emit('insertMaterial',{ type: 'video', file })
|
||||
|
|
|
@ -292,8 +292,9 @@ const insertMaterial = (item: MaterialParams) =>{
|
|||
else{
|
||||
createImageElement(data)
|
||||
}
|
||||
})
|
||||
materiaVisible.value = false
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
// 文生图
|
||||
|
|
|
@ -482,10 +482,7 @@ export default {
|
|||
|
||||
//保存图片到素材库
|
||||
async saveImage(resultIndex, index, url, resultItem) {
|
||||
if(this.hasPPt){
|
||||
this.$emit('insertImg', url)
|
||||
return
|
||||
}
|
||||
|
||||
this.buttonStates[resultIndex][index].disabled = true;
|
||||
this.buttonStates[resultIndex][index].text = "正在保存...";
|
||||
const numberIndex = url.indexOf('filename=');
|
||||
|
@ -495,6 +492,7 @@ export default {
|
|||
try {
|
||||
const blob = await this.getImageBlob(`https://ai.ysaix.com:7853/view?filename=${finalPath}&type=temp`);
|
||||
|
||||
|
||||
const hash = CryptoJS.MD5(blob).toString();
|
||||
|
||||
const formData = new FormData();
|
||||
|
@ -502,7 +500,10 @@ export default {
|
|||
let file = new File([blob], `${resultItem}.png`, {
|
||||
type: 'image/png'
|
||||
})
|
||||
|
||||
if(this.hasPPt){
|
||||
this.$emit('insertImg', file)
|
||||
return
|
||||
}
|
||||
// 添加参数
|
||||
formData.append('md5', hash);
|
||||
formData.append('file', file);
|
||||
|
|
Loading…
Reference in New Issue