zxl #101
|
@ -11,10 +11,15 @@ import * as API_smarttalk from '@/api/file' // 相关api
|
||||||
import * as useStore from '../store' // pptist-状态管理
|
import * as useStore from '../store' // pptist-状态管理
|
||||||
import { sessionStore } from '@/utils/store' // electron-store 状态管理
|
import { sessionStore } from '@/utils/store' // electron-store 状态管理
|
||||||
import useUserStore from '@/store/modules/user' // 外部-用户信息
|
import useUserStore from '@/store/modules/user' // 外部-用户信息
|
||||||
|
import * as Api_server from '@/api/apiService' // 相关api
|
||||||
|
import * as commUtils from '@/utils/comm.js'
|
||||||
const slidesStore = useStore.useSlidesStore()
|
const slidesStore = useStore.useSlidesStore()
|
||||||
const userStore = useUserStore()
|
const userStore = useUserStore()
|
||||||
|
|
||||||
|
import { getClassWorkList,getStudentClassWorkData } from '@/views/tool/createHomework'
|
||||||
|
import {createWindow} from '@/utils/tool'
|
||||||
|
import { useToolState } from '@/store/modules/tool'
|
||||||
|
const toolStore = useToolState()
|
||||||
/** 工具类 */
|
/** 工具类 */
|
||||||
export class Utils {
|
export class Utils {
|
||||||
static mxData: any = {
|
static mxData: any = {
|
||||||
|
@ -186,6 +191,30 @@ export class PPTApi {
|
||||||
else msgUtils.msgError(res.msg || '更新失败');return false
|
else msgUtils.msgError(res.msg || '更新失败');return false
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 图片|音频|视频 转换为在线地址
|
||||||
|
static toRousrceUrl =async (o:any) => {
|
||||||
|
const formData = new FormData()
|
||||||
|
formData.append('file', o)
|
||||||
|
const res = await Api_server.Other.uploadFile(formData)
|
||||||
|
if (res && res.code == 200){
|
||||||
|
const url = res?.url
|
||||||
|
url &&(o.src = url)
|
||||||
|
return url
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Homework{
|
||||||
|
// 作业弹窗
|
||||||
|
static async showHomework(id: any) {
|
||||||
|
let result = await getClassWorkList(id)
|
||||||
|
result = await getStudentClassWorkData()
|
||||||
|
localStorage.setItem('teachClassWorkItem', JSON.stringify(result[0]));
|
||||||
|
toolStore.isTaskWin=true; // 设置打开批改窗口
|
||||||
|
// emit('closeActive')
|
||||||
|
createWindow('open-taskwin',{url:'/teachClassTask'});
|
||||||
|
}
|
||||||
|
}
|
||||||
export default PPTApi
|
export default PPTApi
|
|
@ -7,19 +7,44 @@
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<template v-if="type === 'video'">
|
<template v-if="type === 'video'">
|
||||||
<Input v-model:value="videoSrc" placeholder="请输入视频地址,e.g. https://xxx.mp4"></Input>
|
<el-tabs :tab-position="'left'" class="demo-tabs" v-model="tabvalue">
|
||||||
<div class="btns">
|
<el-tab-pane label="常规" >
|
||||||
|
<Input v-model:value="videoSrc" style="width:100%" placeholder="请输入视频地址,e.g. https://xxx.mp4"></Input>
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane label="上传" >
|
||||||
|
<FileInput accept="video/*" @change="files => insertImageElementvideo(files)">
|
||||||
|
<div class="updivs">+点击上传视频</div>
|
||||||
|
</FileInput>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="btns" v-if="tabvalue=='0'">
|
||||||
<Button @click="emit('close')" style="margin-right: 10px;">取消</Button>
|
<Button @click="emit('close')" style="margin-right: 10px;">取消</Button>
|
||||||
<Button type="primary" @click="insertVideo()">确认</Button>
|
<Button type="primary" @click="insertVideo()">确认</Button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-if="type === 'audio'">
|
<template v-if="type === 'audio'">
|
||||||
<Input v-model:value="audioSrc" placeholder="请输入音频地址,e.g. https://xxx.mp3"></Input>
|
<el-tabs :tab-position="'left'" class="demo-tabs" v-model="tabvalue1">
|
||||||
<div class="btns">
|
<el-tab-pane label="常规" >
|
||||||
|
<Input v-model:value="audioSrc" style="width:100%" placeholder="请输入音频地址,e.g. https://xxx.mp3"></Input>
|
||||||
|
</el-tab-pane>
|
||||||
|
<el-tab-pane label="上传" >
|
||||||
|
<FileInput accept="audio/*" @change="files => insertImageElementaudio(files)">
|
||||||
|
<div class="updivs">+点击上传音频</div>
|
||||||
|
</FileInput>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
|
||||||
|
<div class="btns" v-if="tabvalue1=='0'">
|
||||||
<Button @click="emit('close')" style="margin-right: 10px;">取消</Button>
|
<Button @click="emit('close')" style="margin-right: 10px;">取消</Button>
|
||||||
<Button type="primary" @click="insertAudio()">确认</Button>
|
<Button type="primary" @click="insertAudio()">确认</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -30,6 +55,8 @@ import message from '../../../utils/message'
|
||||||
import Tabs from '../../../components/Tabs.vue'
|
import Tabs from '../../../components/Tabs.vue'
|
||||||
import Input from '../../../components/Input.vue'
|
import Input from '../../../components/Input.vue'
|
||||||
import Button from '../../../components/Button.vue'
|
import Button from '../../../components/Button.vue'
|
||||||
|
import FileInput from '../../../components/FileInput.vue'
|
||||||
|
import { PPTApi } from '../../../api'
|
||||||
|
|
||||||
type TypeKey = 'video' | 'audio'
|
type TypeKey = 'video' | 'audio'
|
||||||
interface TabItem {
|
interface TabItem {
|
||||||
|
@ -45,9 +72,33 @@ const emit = defineEmits<{
|
||||||
|
|
||||||
const type = ref<TypeKey>('video')
|
const type = ref<TypeKey>('video')
|
||||||
|
|
||||||
const videoSrc = ref('https://mazwai.com/videvo_files/video/free/2019-01/small_watermarked/181004_04_Dolphins-Whale_06_preview.webm')
|
const videoSrc = ref('')
|
||||||
const audioSrc = ref('https://freesound.org/data/previews/614/614107_11861866-lq.mp3')
|
const audioSrc = ref('')
|
||||||
|
// https://freesound.org/data/previews/614/614107_11861866-lq.mp3
|
||||||
|
const tabvalue = ref('0')
|
||||||
|
const tabvalue1 = ref('0')
|
||||||
|
|
||||||
|
const insertImageElementvideo = (files: FileList) => {
|
||||||
|
console.log('files', files)
|
||||||
|
const imageFile = files[0]
|
||||||
|
if (!imageFile) return
|
||||||
|
PPTApi.toRousrceUrl(imageFile).then(data=>{
|
||||||
|
videoSrc.value=data
|
||||||
|
insertVideo()
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const insertImageElementaudio = (files: FileList) => {
|
||||||
|
console.log('files', files)
|
||||||
|
const imageFile = files[0]
|
||||||
|
if (!imageFile) return
|
||||||
|
PPTApi.toRousrceUrl(imageFile).then(data=>{
|
||||||
|
videoSrc.value=data
|
||||||
|
insertAudio()
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
const tabs: TabItem[] = [
|
const tabs: TabItem[] = [
|
||||||
{ key: 'video', label: '视频' },
|
{ key: 'video', label: '视频' },
|
||||||
{ key: 'audio', label: '音频' },
|
{ key: 'audio', label: '音频' },
|
||||||
|
@ -74,4 +125,33 @@ const insertAudio = () => {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
.updivs{
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background: #f5f7fa;
|
||||||
|
border: 1px dashed #d9d9d9;
|
||||||
|
border-radius: 6px;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 100px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.demo-tabs{
|
||||||
|
:deep(.el-tabs__content){
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
div{
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
:deep( .el-tabs__item.is-active) {
|
||||||
|
color: #d14424;
|
||||||
|
}
|
||||||
|
:deep( .el-tabs__item:hover) {
|
||||||
|
color: #d14424;
|
||||||
|
}
|
||||||
|
:deep(.el-tabs__active-bar) {
|
||||||
|
background-color: #d14424;
|
||||||
|
height: 3px;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -161,6 +161,7 @@ import Popover from '../../../components/Popover.vue'
|
||||||
import PopoverMenuItem from '../../../components/PopoverMenuItem.vue'
|
import PopoverMenuItem from '../../../components/PopoverMenuItem.vue'
|
||||||
import QuestToPPTist from '@/views/classTask/newClassTaskAssign/questToPPTist/index.vue'
|
import QuestToPPTist from '@/views/classTask/newClassTaskAssign/questToPPTist/index.vue'
|
||||||
import MaterialDialog from './MaterialDialog.vue'
|
import MaterialDialog from './MaterialDialog.vue'
|
||||||
|
import { PPTApi } from '../../../api'
|
||||||
import TextCreateImg from '@/components/ai-kolors/index.vue'
|
import TextCreateImg from '@/components/ai-kolors/index.vue'
|
||||||
import { toPng, toJpeg } from 'html-to-image' // 引入html-to-image库
|
import { toPng, toJpeg } from 'html-to-image' // 引入html-to-image库
|
||||||
|
|
||||||
|
@ -195,9 +196,16 @@ const {
|
||||||
} = useCreateElement()
|
} = useCreateElement()
|
||||||
|
|
||||||
const insertImageElement = (files: FileList) => {
|
const insertImageElement = (files: FileList) => {
|
||||||
|
console.log('files', files)
|
||||||
const imageFile = files[0]
|
const imageFile = files[0]
|
||||||
if (!imageFile) return
|
if (!imageFile) return
|
||||||
getImageDataURL(imageFile).then(dataURL => createImageElement(dataURL))
|
// 上传图片转为线上地址
|
||||||
|
PPTApi.toRousrceUrl(imageFile).then(data=>{
|
||||||
|
createImageElement(data)
|
||||||
|
})
|
||||||
|
// getImageDataURL(imageFile).then(dataURL => {
|
||||||
|
// createImageElement(dataURL)
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
|
|
||||||
const onhtml2canvas = async (html: HTMLElement) => {
|
const onhtml2canvas = async (html: HTMLElement) => {
|
||||||
|
|
Loading…
Reference in New Issue