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