Compare commits

..

No commits in common. "97f55ca3333ede03db0a0e5fbee60f86340b7148" and "dcabb80757f9a66a8c59827b92fe0c1c1f17d178" have entirely different histories.

15 changed files with 39 additions and 384 deletions

View File

@ -4,7 +4,7 @@
* @date 2024-11-26
*/
import { toRaw } from 'vue'
import type { Result } from './types' // 接口类型
import { Result } from '@/types' // 接口类型
import msgUtils from '@/plugins/modal' // 消息工具
import * as API_entpcoursefile from '@/api/education/entpcoursefile' // 相关api
import * as API_smarttalk from '@/api/file' // 相关api

View File

@ -2,7 +2,7 @@
* @description api store循环引用
* @author zdg
*/
import type { Result } from './types' // 接口类型
import { Result } from '@/types' // 接口类型
import msgUtils from '@/plugins/modal' // 消息工具
import * as API_entpcoursefile from '@/api/education/entpcoursefile' // 相关api

View File

@ -125,7 +125,6 @@ import {
User,
Switch,
More,
Material
} from '@icon-park/vue-next'
export interface Icons {
@ -256,7 +255,6 @@ export const icons: Icons = {
IconUser: User,
IconSwitch: Switch,
IconMore: More,
IconMaterial: Material
}
export default {

View File

@ -1,173 +0,0 @@
<template>
<header class="flex material-header">
<span>选择素材</span>
<i class="iconfont icon-guanbi" @click="onClose"></i>
</header>
<div class="flex material-list" v-loading="loading">
<div class="flex material-item" v-for="item in list" :key="item.id" >
<div class="flex">
<el-image :src="fileUrl(item)" class="img" />
<el-text truncated>{{ item.fileShowName }}</el-text>
</div>
<el-button type="primary" @click="onInsert(item)">插入</el-button>
</div>
</div>
</template>
<script setup>
import { ref, reactive, onMounted, computed } from 'vue';
import { sessionStore } from '@/utils/store'
import { getSmarttalkPage } from '@/api/file'
import { getFileSuffix, urlToBase64 } from '@/utils/ruoyi.js'
const emit = defineEmits(['insertMaterial', 'close'])
const curNode = reactive({})
let params = {
textbookId: '',
levelFirstId: '',
levelSecondId: null,
fileSource: '个人',
fileRoot: '备课',
orderByColumn: 'uploadTime',
isAsc: 'desc',
pageSize: 500
}
const suffixAry = [ 'jpeg','jpg','png','gif','mp3','mp4','avi','mov']
const videoSuffix = ['mp3','mp4','avi','mov']
const list = ref([])
const loading = ref(false)
const init = () => {
loading.value = true
getSmarttalkPage(params).then(res => {
loading.value = false
if(res.rows && res.rows.length){
//
list.value = res.rows.filter( item => suffixAry.indexOf(getFileSuffix(item.fileShowName)) != -1)
}
})
}
const fileUrl = computed(() => (item) =>{
if(videoSuffix.indexOf(getFileSuffix(item.fileShowName)) != -1){
return item.coverPic
}
else{
return item.fileFullPath
}
})
//
const onInsert = async (item) =>{
if(videoSuffix.indexOf(getFileSuffix(item.fileShowName)) != -1){
emit('insertMaterial',{ type: 'video', data: item.fileFullPath })
}
else{
const base64 = await urlToBase64(item.fileFullPath)
emit('insertMaterial',{ type: 'img', data: base64 })
}
}
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 = () =>{
emit('close')
}
onMounted(() => {
let data = sessionStore.get('subject.curNode')
Object.assign(curNode, data);
params.textbookId = curNode.rootid
if (curNode.parentNode) {
params.levelFirstId = curNode.parentNode.id
params.levelSecondId = curNode.id
}
else {
params.levelFirstId = curNode.id
}
init()
})
</script>
<style lang="scss" scoped>
.material-header {
font-size: 17px;
font-weight: bold;
margin-bottom: 20px;
justify-content: space-between;
align-items: center;
.icon-guanbi{
font-size: 20px;
cursor: pointer;
}
}
.material-list{
flex-direction: column;
min-height: 150px;
max-height: 500px;
overflow-y: auto
}
.material-item {
align-items: center;
margin-bottom: 10px;
font-size: 14px;
justify-content: space-between;
.img{
width: 100px;
height: 100px;
margin-right: 20px;
}
}
</style>

View File

@ -82,7 +82,6 @@
<IconVideoTwo class="handler-item" v-tooltip="'插入音视频'" />
</Popover>
<IconPreviewOpen class="handler-item" v-tooltip="'插入试题'" @click="classWorkTaskVisible = true" />
<IconMaterial class="handler-item" v-tooltip="'插入素材'" @click="materiaVisible = true"/>
</div>
<div class="right-handler">
@ -113,21 +112,16 @@
/>
</Modal>
<el-dialog v-model="classWorkTaskVisible" append-to-body :show-close="false" width="70%">
<Modal
v-model:visible="classWorkTaskVisible"
:width="880"
>
<QuestToPPTist
class="class-work-task-modal"
@close="classWorkTaskVisible = false"
@update="data => { onhtml2canvas(data); classWorkTaskVisible = false }"
/>
</el-dialog>
<Modal
v-model:visible="materiaVisible"
:width="880">
<MaterialDialog @close="materiaVisible = false" @insertMaterial="insertMaterial"/>
</Modal>
</div>
</template>
@ -155,7 +149,6 @@ import Divider from '../../../components/Divider.vue'
import Popover from '../../../components/Popover.vue'
import PopoverMenuItem from '../../../components/PopoverMenuItem.vue'
import QuestToPPTist from '@/views/classTask/newClassTaskAssign/questToPPTist/index.vue'
import MaterialDialog from './MaterialDialog.vue'
const mainStore = useMainStore()
const { creatingElement, creatingCustomShape, showSelectPanel, showSearchPanel, showNotesPanel } = storeToRefs(mainStore)
@ -207,7 +200,6 @@ const classWorkTaskVisible = ref(false)
const textTypeSelectVisible = ref(false)
const shapeMenuVisible = ref(false)
const moreVisible = ref(false)
const materiaVisible = ref(false)
//
const drawText = (vertical = false) => {
@ -254,23 +246,6 @@ const toggleSraechPanel = () => {
const toggleNotesPanel = () => {
mainStore.setNotesPanelState(!showNotesPanel.value)
}
//
interface MaterialParams {
type: string,
data: string
}
const insertMaterial = (item: MaterialParams) =>{
const { type, data } = item
if(type == 'video'){
createVideoElement(data)
}
else{
createImageElement(data)
}
materiaVisible.value = false
}
</script>
<style lang="scss" scoped>
@ -388,7 +363,7 @@ const insertMaterial = (item: MaterialParams) =>{
}
}
.class-work-task-modal{
height: 70vh;
height: 80vh;
}
@media screen and (width <= 1200px) {

View File

@ -154,15 +154,13 @@ const topImgWrapperPositionStyle = computed(() => {
const topImgPositionStyle = computed(() => {
const bottomWidth = imgPosition.value.width
const bottomHeight = imgPosition.value.height
console.log("底层图片位置大小(遮罩区域图片)", imgPosition.value)
const { top, left, width, height } = topImgWrapperPosition.value
console.log("width", ((bottomWidth / width * 100) - (left * (100 / width))) + '%')
console.log("height", bottomHeight / height * 100 + '%')
return {
left: -left * (100 / width) + '%',
top: -top * (100 / height) + '%',
width: ((bottomWidth / width * 100) - (left * (100 / width))) + '%' ,
width: bottomWidth / width * 100 + '%',
height: bottomHeight / height * 100 + '%',
}
})
@ -230,7 +228,6 @@ const updateRange = () => {
width: parseInt(topImgPositionStyle.value.width),
height: parseInt(topImgPositionStyle.value.height),
}
console.log('retPosition', retPosition)
const widthScale = 100 / retPosition.width
const heightScale = 100 / retPosition.height
@ -478,7 +475,7 @@ const scaleClipRange = (e: MouseEvent, type: OperateResizeHandlers) => {
isMouseDown = false
document.onmousemove = null
document.onmouseup = null
console.log('----------------------------------')
updateRange()
setTimeout(() => isSettingClipRange.value = false, 0)

View File

@ -36,13 +36,13 @@ export const processList = (row, aloneOption=false) => {
row[i].method = jjj.method
row[i].discuss = jjj.discuss
//row[i].discusscollapse = false;
if (row[i].examdate && row[i].examdate != "") {
if (row[i].examdate !== null && row[i].examdate !== undefined) {
row[i].examdate = row[i].examdate.substring(0, 10)
}
// 具体题型数据结构处理
if (row[i].worktype == '复合题') {
// 复合题 - 旧格式
// 旧类型
if (row[i].title.indexOf('!@#$%') !== -1) {
// 1.选项解析替换
const options = JSON.parse(row[i].workdesc)
@ -129,9 +129,7 @@ export const processList = (row, aloneOption=false) => {
row[i].workanswerFormat = answer
} else {
// 复合题 - 现格式
// 处理[题干显示] - 不再需要处理(头部已处理)
// 处理[题干显示] - 不再需要处理
// row[i].titleFormat = row[i].title; // 仅占位提示
/**
@ -224,7 +222,6 @@ export const processList = (row, aloneOption=false) => {
row[i].workanswerFormat = workAnswerHtml
}
} else if (
/** 主观题/非基础题(其中主要为第三方的各类解答题) */
row[i].worktype == '主观题' ||
(row[i].worktype !== '单选题' &&
row[i].worktype !== '多选题' &&
@ -239,7 +236,7 @@ export const processList = (row, aloneOption=false) => {
row[i].workanswerFormat = JSON.parse(row[i].workanswer)
}
} else {
// 基础题: 单选题|多选题|填空题|判断题|主观题?(待确认是否归在这里)
// 单选题|多选题|填空题|判断题|主观题?(待确认是否归在这里)
// 通用选项结构 ['ABC123','ABC123'] | ['ABC123','ABC123'] | [](填空题无选项) | [](判断题无选项)
let workDescArr = []
if (

View File

@ -258,45 +258,16 @@ export const getFileName = (filename) => {
return filename.replace(/\.[^/.]+$/, "");
}
/**
* 根据图片的url转换对应的base64值
* @param { String } url http://xxxx/xxx.png
* @returns base64取值
*/
export const urlToBase64 = (url) => {
return new Promise((resolve, reject) => {
if (!url) {
reject('请传入url内容')
}
if (/\.(png|jpe?g|gif|svg)(\?.*)?$/.test(url)) {
// 图片地址
let image = new Image()
// 设置跨域问题
image.setAttribute('crossOrigin', 'anonymous')
// 图片地址
image.src = url +"?v=" + Math.random(); // 处理缓存,fix缓存bug,有缓存,浏览器会报错;
image.onload = () => {
let canvas = document.createElement('canvas')
const ctx = canvas.getContext('2d')
canvas.width = image.width
canvas.height = image.height
ctx.drawImage(image, 0, 0, image.width, image.height)
// 获取图片后缀
const ext = url.substring(url.lastIndexOf('.') + 1).toLowerCase()
// 转base64
const dataUrl = canvas.toDataURL(`image/${ext}`)
resolve(dataUrl || '')
canvas = null // 清除canvas元素
image = null // 清除img元素
}
} else {
// 非图片地址
reject('非(png/jpe?g/gif/svg等)图片地址');
}
})
// 清除当前选中的教材 章节 相关信息
export const clearBookInfo = () =>{
//当前选中的教材
localStorage.removeItem('curBook')
// 当前选中的节点
localStorage.removeItem('curNode')
// 所有章节单元数据
localStorage.removeItem('unitList')
// 所有教材数据
localStorage.removeItem('subjectList')
// 展开的节点
localStorage.removeItem('defaultExpandedKeys')
}

View File

@ -19,7 +19,7 @@
</el-col>
<el-col :span="7">
<el-form-item label="年份" label-width="70">
<el-select v-model="entpCourseWorkQueryParams.yearStr" placeholder="请选择">
<el-select v-model="entpCourseWorkQueryParams.yearStr" placeholder="请选择" >
<el-option v-for="(item, index) in entpCourseWorkYearList" :key="index" :label="item.label" :value="item.value"></el-option>
</el-select>
</el-form-item>

View File

@ -68,7 +68,7 @@ defineExpose({
.page-resource {
user-select: none;
height: 100%;
height: calc(100% - 55px);
display: flex;
flex-direction: row;
flex-wrap: nowrap;

View File

@ -16,16 +16,6 @@
<el-table-column align="center" prop="worktype" width="100"></el-table-column>
<el-table-column align="center" prop="worktag" width="120"></el-table-column>
</el-table>
<!-- 分页-->
<div style="height: 48px;">
<el-pagination
v-show="paginationParams.total > 0"
v-model:page="paginationParams.pageNum"
v-model:limit="paginationParams.pageSize"
:total="paginationParams.total"
:style="{ position: 'relative', 'padding': '8px 20px 0 0' }"
@change="changePageNum" />
</div>
<!-- 试题详细信息 -->
<examDetailsDrawer ref="examDetailsDrawerRef"></examDetailsDrawer>
@ -64,13 +54,11 @@ const { proxy } = getCurrentInstance()
const props = defineProps({
listExamQuestion: {type: Array},
loading: {type: Boolean},
paginationParams: {type: Object},
loading: {type: Boolean}
})
const activeExamInfoDrawer = ref(false);
const activeExam = ref({});
const emit = defineEmits(['updatePageNum'])
const showExamAnalyseDrawer = (row) => {
nextTick(() => {
@ -81,17 +69,13 @@ const showExamAnalyseDrawer = (row) => {
})
}
const changePageNum = (pageNum) => {
emit('updatePageNum', pageNum);
}
</script>
<style lang="scss" scoped>
.table-main {
width: 100%;
height: calc(100% - 48px);
height: 100%;
text-align: left;
.main-title {

View File

@ -47,13 +47,10 @@
</el-select>
</div>
<!-- <div :style="{'width': (viewportWidth - 400) + 'px','height': (viewportHeight-38) + 'px','overflow-y': 'auto'}"> -->
<div style="width: 100%; height: 100%; overflow-y: auto; border-radius: 10px;">
<div :style="{'width': (viewportWidth - 400) + 'px','height': (viewportHeight-38) + 'px','overflow-y': 'auto'}">
<examReview
:loading="loading"
:listExamQuestion="listExamQuestion"
:paginationParams="paginationParams"
@updatePageNum="updatePageNum"
v-if="curTask.viewkey=='真题回顾' "
/>
@ -80,15 +77,12 @@ import ChooseTextbook from '@/components/choose-textbook/index.vue'
import {listEntpcoursework, listEntpcourseworkNew} from '@/api/education/entpCourseWork'
import { processList } from '@/hooks/useProcessList'
import { JYApiListCT} from "@/utils/examQuestion/jyeoo"
import useClassTaskStore from '@/store/modules/classTask'
import examReview from './container/examReview.vue'
import pointAnalysis from './container/pointAnalysis.vue'
import examMocks from './container/examMocks.vue'
import { ElMessage } from 'element-plus'
const classTaskStore = useClassTaskStore();
const {proxy} = getCurrentInstance();
const sourceStore = useResoureStore();
const viewportHeight = ref(0);
@ -97,11 +91,6 @@ const viewportWidth = ref(0);
const curNode = ref({});
//
const listExamQuestion = ref([]);
const paginationParams = reactive({
pageNum: 1,
pageSize: 10,
total: 0,
});
const loading = ref(false);
const curTask = reactive({
viewkey: '真题回顾',
@ -118,22 +107,6 @@ const listWorkType = ref([{
value: 0,
}]);
/**
* @desc: 翻页
* @return: {*}
* @param {*} pageNum
*/
const updatePageNum = (pageNum) => {
paginationParams.pageNum = pageNum;
queryExamQuestionByParams();
}
/**
* @desc: 具体获取试题及格式化
* @return: {*}
* @param {*} params
*/
const getCourseWorkList = async (params) => {
const res = await listEntpcourseworkNew(params);
if(res.data == null) {
@ -142,14 +115,7 @@ const getCourseWorkList = async (params) => {
return;
}
listExamQuestion.value = res.data;
//
const total = parseInt(res.msg)
if (!isNaN(total)) {
paginationParams.total = total;
} else {
console.error('无法将 res.msg 转换为数字');
paginationParams.total = 0; //
}
// queryParams.total = res.total;
//
processList(listExamQuestion.value);
}
@ -166,8 +132,7 @@ const getData = async (data) => {
loading.value = true;
// 1.
//getWorkType(data.node);
listWorkType.value = classTaskStore.entpCourseWorkTypeList;
getWorkType(data.node);
// 2.
curNode.value = data.node;
@ -201,8 +166,6 @@ const getData = async (data) => {
edusubject: curNode.value.edusubject,
edustage: curNode.value.edustage,
sectionName: curNode.value.itemtitle,
currentPage: paginationParams.pageNum,
pageSize: paginationParams.pageSize,
}
await getCourseWorkList(params);
loading.value = false;
@ -218,7 +181,6 @@ const changeTaskView = (item, key) => {
curTask.viewkey = item;
}
// 使, classTaskStore
const getWorkType = async (data) => {
const selName = `${data.edustage}${data.edusubject}`
const curName = `${curNode.value.edustage}${curNode.value.edusubject}`
@ -269,8 +231,6 @@ const queryExamQuestionByParams = async () => {
edusubject: curNode.value.edusubject,
edustage: curNode.value.edustage,
sectionName: curNode.value.itemtitle,
currentPage: paginationParams.pageNum,
pageSize: paginationParams.pageSize,
}
await getCourseWorkList(params);
loading.value = false;

View File

@ -129,6 +129,7 @@ const dataset_id = ref('')
//
const onSuccess = async (response) => {
console.log(response, 'response')
let data = {
url: response.url,
dataset_id: dataset_id.value
@ -173,10 +174,13 @@ const clickItem = (index, item) => {
const prevItem = reactive({})
const onPrevItem = (item) => {
console.log(item)
Object.assign(prevItem, item)
prevVisible.value = true
}
onMounted(() => {
let data = sessionStore.get('subject.curNode')
Object.assign(curNode, data);

View File

@ -1,33 +0,0 @@
<template>
<el-dialog v-model="open" v-bind="dAttrs">
<el-progress type="dashboard" v-bind="$attrs.pg" />
</el-dialog>
</template>
<script setup>
//
import { computed, useAttrs } from 'vue'
const attrs = useAttrs()
const props = defineProps({
visible: { //
type: Boolean,
default: false
},
})
//
const emit = defineEmits(['update:visible'])
// -
const open = computed({
get: () => props.visible,
set: val => emit('update:visible', val)
})
//
const dAttrs = computed(() => {
const attrsNew = { ...attrs }
delete attrsNew.pg
return attrsNew
})
</script>
<style lang="scss" scoped>
</style>

View File

@ -50,7 +50,6 @@
<EditDialog v-model="isEdit" :item="curItem" />
<AdjustDialog v-model="isAdjust" :item="curItem" />
<PptDialog @add-success="addAiPPT" :dataList="resultList" v-model="pptDialog"/>
<progress-dialog v-model:visible="pgDialog.visible" v-bind="pgDialog" />
</template>
<script setup>
@ -59,7 +58,6 @@ import { sessionStore } from '@/utils/store'
import emitter from '@/utils/mitt'
import EditDialog from './edit-dialog.vue'
import AdjustDialog from './adjust-dialog.vue'
import progressDialog from './progress-dialog.vue'
import { completion, tempResult } from '@/api/mode/index.js'
// import { dataSetJson } from '@/utils/comm.js'
import * as commUtils from '@/utils/comm.js'
@ -79,22 +77,7 @@ const resultList = ref([])
const courseObj = reactive({
node: null, //
})
const pgDialog = reactive({ // -
visible: false,
title: 'PPT解析中...',
width: 300,
showClose: false,
draggable: true,
beforeClose: done => {}, // -
pg: { // -
percentage: 0, //
color: [
{ color: '#1989fa', percentage: 50 }, //
{ color: '#e6a23c', percentage: 80 }, //
{ color: '#5cb87a', percentage: 100 }, // 绿
]
}
})
emitter.on('changeMode', (item) => {
console.log(item, 'item')
resultList.value = item.child
@ -132,8 +115,6 @@ const params = reactive(
const addAiPPT = async(res) => {
let node = courseObj.node
if (!node) return msgUtils.msgWarning('请选择章节?')
pgDialog.visible = true
pgDialog.pg.percentage = 0
//TODO resPPT
const params = { evalid: node.id, edituserid: userStore.id, pageSize: 1 }
const resEnpt = await HTTP_SERVER_API('getCourseList', params)
@ -148,16 +129,10 @@ const addAiPPT = async(res) => {
const resPptJson = await PPTXFileToJson(buffer)
const { def, slides, ...content } = resPptJson
// || 线
let completed = 0
const total = slides.length
for( let o of slides ) {
completed++
await toRousrceUrl(o)
//
pgDialog.pg.percentage = Math.floor(completed / total * 100)
}
pgDialog.pg.percentage = 0
pgDialog.visible = false
// return
// ppt-
const p_params = {parentContent: JSON.stringify(content)}
const parentid = await HTTP_SERVER_API('addEntpcoursefile', p_params)