Compare commits

..

No commits in common. "b4864bc109e7a78cffe79413115b21b316bfe71d" and "c2d5f2e99acde6dd08d4171075c8fdeaf88fac0f" have entirely different histories.

5 changed files with 23 additions and 35 deletions

View File

@ -19,8 +19,7 @@
import { ref, reactive, onMounted, computed } from 'vue';
import { sessionStore } from '@/utils/store'
import { getSmarttalkPage } from '@/api/file'
import * as commUtils from '@/utils/comm.js'
import { getFileSuffix } from '@/utils/ruoyi.js'
import { getFileSuffix, urlToBase64 } from '@/utils/ruoyi.js'
const emit = defineEmits(['insertMaterial', 'close'])
@ -63,15 +62,12 @@ const fileUrl = computed(() => (item) =>{
//
const onInsert = async (item) =>{
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 })
emit('insertMaterial',{ type: 'video', data: item.fileFullPath })
}
else{
emit('insertMaterial',{ type: 'img', file })
const base64 = await urlToBase64(item.fileFullPath)
emit('insertMaterial',{ type: 'img', data: base64 })
}
}

View File

@ -132,7 +132,7 @@
<Modal
v-model:visible="imgVisible"
:width="1300">
<TextCreateImg hasPPt @insertImg="insertImg" />
<TextCreateImg hasPPt @insertImg="(url: string) => { createImageElement(url); imgVisible = false }" />
</Modal>
</div>
</template>
@ -165,7 +165,6 @@ import { PPTApi } from '../../../api'
import TextCreateImg from '@/components/ai-kolors/index.vue'
import { toPng } from 'html-to-image' // html-to-image
const mainStore = useMainStore()
const { creatingElement, creatingCustomShape, showSelectPanel, showSearchPanel, showNotesPanel } = storeToRefs(mainStore)
const { canUndo, canRedo } = storeToRefs(useSnapshotStore())
@ -281,31 +280,21 @@ const toggleNotesPanel = () => {
//
interface MaterialParams {
type: string,
file: any
data: string
}
const insertMaterial = (item: MaterialParams) =>{
const { type, file } = item
PPTApi.toRousrceUrl(file).then(data=>{
if(type == 'video'){
createVideoElement(data)
}
else{
createImageElement(data)
}
materiaVisible.value = false
})
const { type, data } = item
if(type == 'video'){
createVideoElement(data)
}
else{
createImageElement(data)
}
materiaVisible.value = false
}
//
const imgVisible = ref(false)
const insertImg = async (file: any) =>{
PPTApi.toRousrceUrl(file).then(data=>{
createImageElement(data)
imgVisible.value = false
})
}
</script>
<style lang="scss" scoped>

View File

@ -482,7 +482,10 @@ 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=');
@ -491,7 +494,6 @@ export default {
const finalPath = path.substring(0, pngIndex + 4);
try {
const blob = await this.getImageBlob(`https://ai.ysaix.com:7853/view?filename=${finalPath}&type=temp`);
const hash = CryptoJS.MD5(blob).toString();
@ -500,10 +502,7 @@ 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);

View File

@ -44,6 +44,7 @@ const breadList = ref([])
watch(
() => router.currentRoute.value,
(newValue) => {
console.log(newValue)
const { showBread } = newValue.meta
if (showBread) {
isShowBack.value = true

View File

@ -96,6 +96,7 @@ const pgDialog = reactive({ // 弹窗-进度条
}
})
emitter.on('changeMode', (item) => {
console.log(item, 'item')
resultList.value = item.child
// conversation()
getTempResult(item.id)
@ -105,6 +106,7 @@ emitter.on('changeMode', (item) => {
//
const getTempResult = (id) => {
tempResult({ mainModelId: id }).then(res => {
console.log(res, 2000)
let rows = res.rows
if (rows.length > 0) {
resultList.value.forEach(item => {
@ -355,6 +357,7 @@ const toRousrceUrl = async(o) => {
const curNode = reactive({})
onMounted(() => {
let data = sessionStore.get('subject.curNode')
console.log('data', sessionStore)
Object.assign(curNode, data);
courseObj.node = data