Compare commits
4 Commits
c2d5f2e99a
...
b4864bc109
Author | SHA1 | Date |
---|---|---|
lyc | b4864bc109 | |
lyc | a379176496 | |
lyc | eaa14b1666 | |
lyc | 99c26145d8 |
|
@ -19,7 +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 { getFileSuffix } from '@/utils/ruoyi.js'
|
||||||
|
|
||||||
const emit = defineEmits(['insertMaterial', 'close'])
|
const emit = defineEmits(['insertMaterial', 'close'])
|
||||||
|
|
||||||
|
@ -62,12 +63,15 @@ const fileUrl = computed(() => (item) =>{
|
||||||
|
|
||||||
// 插入
|
// 插入
|
||||||
const onInsert = async (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){
|
if(videoSuffix.indexOf(getFileSuffix(item.fileShowName)) != -1){
|
||||||
emit('insertMaterial',{ type: 'video', data: item.fileFullPath })
|
emit('insertMaterial',{ type: 'video', file })
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
const base64 = await urlToBase64(item.fileFullPath)
|
emit('insertMaterial',{ type: 'img', file })
|
||||||
emit('insertMaterial',{ type: 'img', data: base64 })
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,7 @@
|
||||||
<Modal
|
<Modal
|
||||||
v-model:visible="imgVisible"
|
v-model:visible="imgVisible"
|
||||||
:width="1300">
|
:width="1300">
|
||||||
<TextCreateImg hasPPt @insertImg="(url: string) => { createImageElement(url); imgVisible = false }" />
|
<TextCreateImg hasPPt @insertImg="insertImg" />
|
||||||
</Modal>
|
</Modal>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -165,6 +165,7 @@ import { PPTApi } from '../../../api'
|
||||||
import TextCreateImg from '@/components/ai-kolors/index.vue'
|
import TextCreateImg from '@/components/ai-kolors/index.vue'
|
||||||
import { toPng } from 'html-to-image' // 引入html-to-image库
|
import { toPng } from 'html-to-image' // 引入html-to-image库
|
||||||
|
|
||||||
|
|
||||||
const mainStore = useMainStore()
|
const mainStore = useMainStore()
|
||||||
const { creatingElement, creatingCustomShape, showSelectPanel, showSearchPanel, showNotesPanel } = storeToRefs(mainStore)
|
const { creatingElement, creatingCustomShape, showSelectPanel, showSearchPanel, showNotesPanel } = storeToRefs(mainStore)
|
||||||
const { canUndo, canRedo } = storeToRefs(useSnapshotStore())
|
const { canUndo, canRedo } = storeToRefs(useSnapshotStore())
|
||||||
|
@ -280,21 +281,31 @@ const toggleNotesPanel = () => {
|
||||||
// 插入素材
|
// 插入素材
|
||||||
interface MaterialParams {
|
interface MaterialParams {
|
||||||
type: string,
|
type: string,
|
||||||
data: string
|
file: any
|
||||||
}
|
}
|
||||||
const insertMaterial = (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
|
||||||
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 文生图
|
// 文生图
|
||||||
const imgVisible = ref(false)
|
const imgVisible = ref(false)
|
||||||
|
const insertImg = async (file: any) =>{
|
||||||
|
PPTApi.toRousrceUrl(file).then(data=>{
|
||||||
|
createImageElement(data)
|
||||||
|
imgVisible.value = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
@ -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=');
|
||||||
|
@ -495,6 +492,7 @@ export default {
|
||||||
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();
|
||||||
|
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
|
@ -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);
|
||||||
|
|
|
@ -44,7 +44,6 @@ const breadList = ref([])
|
||||||
watch(
|
watch(
|
||||||
() => router.currentRoute.value,
|
() => router.currentRoute.value,
|
||||||
(newValue) => {
|
(newValue) => {
|
||||||
console.log(newValue)
|
|
||||||
const { showBread } = newValue.meta
|
const { showBread } = newValue.meta
|
||||||
if (showBread) {
|
if (showBread) {
|
||||||
isShowBack.value = true
|
isShowBack.value = true
|
||||||
|
|
|
@ -96,7 +96,6 @@ const pgDialog = reactive({ // 弹窗-进度条
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
emitter.on('changeMode', (item) => {
|
emitter.on('changeMode', (item) => {
|
||||||
console.log(item, 'item')
|
|
||||||
resultList.value = item.child
|
resultList.value = item.child
|
||||||
// conversation()
|
// conversation()
|
||||||
getTempResult(item.id)
|
getTempResult(item.id)
|
||||||
|
@ -106,7 +105,6 @@ emitter.on('changeMode', (item) => {
|
||||||
// 查询模板结果
|
// 查询模板结果
|
||||||
const getTempResult = (id) => {
|
const getTempResult = (id) => {
|
||||||
tempResult({ mainModelId: id }).then(res => {
|
tempResult({ mainModelId: id }).then(res => {
|
||||||
console.log(res, 2000)
|
|
||||||
let rows = res.rows
|
let rows = res.rows
|
||||||
if (rows.length > 0) {
|
if (rows.length > 0) {
|
||||||
resultList.value.forEach(item => {
|
resultList.value.forEach(item => {
|
||||||
|
@ -357,7 +355,6 @@ const toRousrceUrl = async(o) => {
|
||||||
const curNode = reactive({})
|
const curNode = reactive({})
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
let data = sessionStore.get('subject.curNode')
|
let data = sessionStore.get('subject.curNode')
|
||||||
console.log('data', sessionStore)
|
|
||||||
Object.assign(curNode, data);
|
Object.assign(curNode, data);
|
||||||
courseObj.node = data
|
courseObj.node = data
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue