Compare commits

..

No commits in common. "ea0e1c91cf2ddb26b01bdc94e4097ba97d3ca0ab" and "33e38f899255e8af0c98562db25bbbdd5d22c990" have entirely different histories.

2 changed files with 66 additions and 22 deletions

View File

@ -21,7 +21,6 @@ import { sessionStore } from '@/utils/store'
import { getSmarttalkPage } from '@/api/file' import { getSmarttalkPage } from '@/api/file'
import * as commUtils from '@/utils/comm.js' import * as commUtils from '@/utils/comm.js'
import { getFileSuffix } from '@/utils/ruoyi.js' import { getFileSuffix } from '@/utils/ruoyi.js'
import { PPTApi } from '../../../api'
const emit = defineEmits(['insertMaterial', 'close']) const emit = defineEmits(['insertMaterial', 'close'])
@ -61,31 +60,73 @@ const fileUrl = computed(() => (item) =>{
} }
}) })
// //
const onInsert = async (item) =>{ const onInsert = async (item) =>{
loading.value = true
const res = await fetch(item.fileFullPath) const res = await fetch(item.fileFullPath)
const bolb = await res.blob() const bolb = await res.blob()
const file = commUtils.blobToFile(bolb, item.fileShowName) const file = commUtils.blobToFile(bolb, item.fileShowName)
try { if(videoSuffix.indexOf(getFileSuffix(item.fileShowName)) != -1){
const data = await PPTApi.toRousrceUrl(file) emit('insertMaterial',{ type: 'video', file })
if(videoSuffix.indexOf(getFileSuffix(item.fileShowName)) != -1){ }
emit('insertMaterial',{ type: 'video', data }) else{
} emit('insertMaterial',{ type: 'img', file })
else{
emit('insertMaterial',{ type: 'img', data })
}
} finally {
loading.value = false
} }
} }
const GetUrlParameters = (parameters) => {
let resData = "";
let url = document.location.toString();
let arrUrl = url.split("?");
//
if (arrUrl.length > 1) {
//
let parametersArr = arrUrl[1].split("&");
//
for (let i = 0; i <= parametersArr.length; i++) {
if (parametersArr[i]) {
//
let parameterStr = parametersArr[i].split("=");
if (parameters == parameterStr[0]) {
resData = parameterStr[1];
break;
}
}
}
}
return resData;
}
const proxyToBase64 = (url)=> {
const dourl = GetUrlParameters(url)
console.log(dourl,'dourl')
return
axios({
url: "/api/logo.png",
method: "get",
responseType: "blob",
}).then((res) => {
const reader = new FileReader();
reader.readAsDataURL(res.data);
reader.onload = () => {
console.log(reader.result);
};
});
}
// //
const onClose = () =>{ const onClose = () =>{
emit('close') emit('close')
} }
onMounted(() => { onMounted(() => {
let data = sessionStore.get('subject.curNode') let data = sessionStore.get('subject.curNode')
Object.assign(curNode, data); Object.assign(curNode, data);

View File

@ -281,17 +281,20 @@ const toggleNotesPanel = () => {
// //
interface MaterialParams { interface MaterialParams {
type: string, type: string,
data: string file: any
} }
const insertMaterial = async (item: MaterialParams) =>{ const insertMaterial = (item: MaterialParams) =>{
const { type, data } = item const { type, file } = item
if(type == 'video'){ PPTApi.toRousrceUrl(file).then(data=>{
createVideoElement(data) if(type == 'video'){
} createVideoElement(data)
else{ }
createImageElement(data) else{
} createImageElement(data)
materiaVisible.value = false }
materiaVisible.value = false
})
} }
// //