From 761f19cf22811fe63088c52f4fe10bccaf77461c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=99=BD=E4=BA=86=E4=B8=AA=E7=99=BD?= <543593352@qq.com>
Date: Wed, 20 Nov 2024 14:32:40 +0800
Subject: [PATCH] =?UTF-8?q?=E4=B9=A0=E9=A2=98=E4=B8=8A=E4=BC=A0=EF=BC=9A?=
=?UTF-8?q?=E5=BE=85=E5=AE=8C=E5=96=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/api/education/knowledgePoint.js | 65 +
.../questionUpload/index.vue | 78 +-
.../questionUpload/ocrImg2ExamQues.js | 1 +
.../questionUpload/quesItem/index.vue | 1747 +++++++++++++++++
4 files changed, 1885 insertions(+), 6 deletions(-)
create mode 100644 src/renderer/src/api/education/knowledgePoint.js
create mode 100644 src/renderer/src/views/classTask/newClassTaskAssign/questionUpload/quesItem/index.vue
diff --git a/src/renderer/src/api/education/knowledgePoint.js b/src/renderer/src/api/education/knowledgePoint.js
new file mode 100644
index 0000000..0db8521
--- /dev/null
+++ b/src/renderer/src/api/education/knowledgePoint.js
@@ -0,0 +1,65 @@
+
+import request from '@/utils/request'
+// 查询知识点列表
+export function listKnowlegepoint(query) {
+ return request({
+ url: '/point/list',
+ method: 'get',
+ params: query
+ })
+ }
+
+
+// 查询一级知识点查下级所有层级
+export function childKnowlegepoint(query) {
+ return request({
+ url: '/point/child/list',
+ method: 'get',
+ params: query
+ })
+}
+
+ // 新增
+export function addKnowlegepoint(data) {
+ return request({
+ url: '/point/add',
+ method: 'post',
+ data: data
+ })
+}
+
+ // 更新
+ export function updateKnowlegepoint(data) {
+ return request({
+ url: '/point/update',
+ method: 'post',
+ data: data
+ })
+ }
+
+// 绑定
+export function bindKnowlegepoint(data) {
+ return request({
+ url: '/point/evalution/bind',
+ method: 'post',
+ data: data
+ })
+}
+
+// 查询章节知识点关系
+export function getBindlist(query) {
+ return request({
+ url: '/point/bind/list',
+ method: 'get',
+ params: query
+ })
+}
+
+// 删除
+export function delKnowlegepoint(data) {
+ return request({
+ url: '/point/bind/delete',
+ method: 'post',
+ data: data
+ })
+}
\ No newline at end of file
diff --git a/src/renderer/src/views/classTask/newClassTaskAssign/questionUpload/index.vue b/src/renderer/src/views/classTask/newClassTaskAssign/questionUpload/index.vue
index 31731e6..c58711b 100644
--- a/src/renderer/src/views/classTask/newClassTaskAssign/questionUpload/index.vue
+++ b/src/renderer/src/views/classTask/newClassTaskAssign/questionUpload/index.vue
@@ -55,7 +55,18 @@
-
+
+
@@ -72,14 +83,28 @@ import { editListItem } from '@/hooks/useClassTask'
import { useGetHomework } from '@/hooks/useGetHomework'
import { sessionStore } from '@/utils/store'
import { useRouter, useRoute } from 'vue-router'
-import useUserStore from '@/store/modules/user'
+
import { ocrImg2ExamByManualUpl, ocrImg2ItemByManualUpl } from "@/views/classTask/newClassTaskAssign/questionUpload/ocrImg2ExamQues";
+import QuesItem from "@/views/classTask/newClassTaskAssign/questionUpload/quesItem/index.vue";
+
+// const Remote = require('@electron/remote')
+// const fs = require('fs');
+// const path = require('path');
+import useUserStore from '@/store/modules/user'
const userStore = useUserStore().user
const route = useRoute();
const { proxy } = getCurrentInstance()
const props = defineProps({
})
+const activeParams = reactive({
+ version: {},
+ lession: {},
+ tab: '国家体系',
+ evalidArr: [],//选择的课程id数组
+ versionList: [],//教材版本list
+ lessionList: [],//课文list
+});
const propsQueryCourseObj = route.query.courseObj;//作业布置的内容对象
const courseObj = reactive({
@@ -120,6 +145,7 @@ const cropOption = reactive({
})
+
onMounted(() => {
console.log('propsQueryCourseObj', JSON.parse(propsQueryCourseObj));
if(propsQueryCourseObj&&JSON.parse(propsQueryCourseObj)){
@@ -146,7 +172,22 @@ const initHomeWork = async()=> {
// taskList.value = res;
// tasklist_loading.value = false;
}
-
+const getBase64 = (file) =>{
+ return new Promise(function (resolve, reject) {
+ let reader = new FileReader();
+ let imgResult = "";
+ reader.readAsDataURL(file);
+ reader.onload = function () {
+ imgResult = reader.result;
+ };
+ reader.onerror = function (error) {
+ reject(error);
+ };
+ reader.onloadend = function () {
+ resolve(imgResult);
+ };
+ });
+}
/**
* @desc: 上传本地图片
* @return: {*}
@@ -162,10 +203,35 @@ const handleImportImg = (uploadFile) => {
}
console.log('uploadFile', uploadFile);
// 假设你在渲染进程中
-
+ getBase64(uploadFile.raw).then(res => {
+ console.log('res-------', res);
+
+
+ // 在 Electron 主进程中使用 URL.createObjectURL
+ // const base64Data = 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/...'; // Base64 编码的图片数据
+ // const base64Data = res; // Base64 编码的图片数据
+ // const buffer = Buffer.from(base64Data.split(',')[1], 'base64');
+ // const filePath = path.join(Remote.app.getPath('userData'), 'image.jpg');
+ // console.log(filePath,'???????????????????');
+ // fs.writeFileSync(filePath, buffer);
+ // const buf = fs.readFileSync(filePath)
+ // console.log(buf);
+ // const uint8Buffer = Uint8Array.from(buf)
+ // cropOption.img = window.URL.createObjectURL(new Blob([uint8Buffer]));
+ // cropOption.img = URL.createObjectURL(new Blob([fs.readFileSync(filePath)]));
+ // cropOption.img = URL.createObjectURL(new Blob([buffer]));
+ cropOption.img = res;
+ console.log(cropOption.img);
+
+
+
+ // cropOption.img = window.URL.createObjectURL(new Blob([res]));
+ // console.log(cropOption.img);
+ })
// cropOption.img = window.URL.createObjectURL(uploadFile.raw);
- cropOption.img = window.URL.createObjectURL(new Blob([uploadFile.raw]));
- console.log(cropOption.img);
+ // cropOption.img = window.URL.createObjectURL(new Blob([uploadFile.raw]));
+ // cropOption.img = window.URL.createObjectURL(new Blob([uploadFile.raw]));
+ // console.log(cropOption.img);
ElMessage.success('上传成功');
};
/**
diff --git a/src/renderer/src/views/classTask/newClassTaskAssign/questionUpload/ocrImg2ExamQues.js b/src/renderer/src/views/classTask/newClassTaskAssign/questionUpload/ocrImg2ExamQues.js
index 4a0dd23..5e72245 100644
--- a/src/renderer/src/views/classTask/newClassTaskAssign/questionUpload/ocrImg2ExamQues.js
+++ b/src/renderer/src/views/classTask/newClassTaskAssign/questionUpload/ocrImg2ExamQues.js
@@ -1,5 +1,6 @@
import { ElMessageBox, ElMessage } from "element-plus";
import qs from "qs";
+import axios from 'axios'
import { pyOCRAPI } from "@/api/education/entpcoursework";
diff --git a/src/renderer/src/views/classTask/newClassTaskAssign/questionUpload/quesItem/index.vue b/src/renderer/src/views/classTask/newClassTaskAssign/questionUpload/quesItem/index.vue
new file mode 100644
index 0000000..7a36cb8
--- /dev/null
+++ b/src/renderer/src/views/classTask/newClassTaskAssign/questionUpload/quesItem/index.vue
@@ -0,0 +1,1747 @@
+
+
+
+
+
+
+
+ 温馨提示:填空题题目的填空位置,下划线请连续输入3-10个 _
+ 符号。eg:今天___好日子。
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 秒
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 取消
+ 确定上传
+
+
+
+
+
+
\ No newline at end of file