Compare commits
6 Commits
c33c0d923e
...
2b5b365e2f
Author | SHA1 | Date |
---|---|---|
baigl | 2b5b365e2f | |
白了个白 | 90ac7a49c7 | |
白了个白 | 75ddbf6f26 | |
白了个白 | de9235751f | |
白了个白 | dfd53637be | |
白了个白 | c01a29bf3f |
|
@ -83,7 +83,7 @@ export const constantRoutes = [
|
||||||
path: 'questionUpload',
|
path: 'questionUpload',
|
||||||
component: () => import('@/views/classTask/newClassTaskAssign/questionUpload/index.vue'),
|
component: () => import('@/views/classTask/newClassTaskAssign/questionUpload/index.vue'),
|
||||||
name: 'questionUpload',
|
name: 'questionUpload',
|
||||||
meta: { title: '习题上传' }
|
meta: { title: '习题上传', showBread: true }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: 'aiKolors',
|
path: 'aiKolors',
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { JYApiListCT, JYApiListOriginYear, JYApiListSO} from "@/utils/examQuesti
|
||||||
|
|
||||||
const useClassTaskStore = defineStore('classTask',{
|
const useClassTaskStore = defineStore('classTask',{
|
||||||
state: () => ({
|
state: () => ({
|
||||||
|
isOpenQuestUploadView: false, // 是否打开习题上传的页面
|
||||||
classListIds: [],
|
classListIds: [],
|
||||||
entpCourseWorkTypeList: [
|
entpCourseWorkTypeList: [
|
||||||
{value: 0, label: "不限"},
|
{value: 0, label: "不限"},
|
||||||
|
|
|
@ -149,10 +149,14 @@ import { useGetHomework } from '@/hooks/useGetHomework'
|
||||||
import { sessionStore } from '@/utils/store'
|
import { sessionStore } from '@/utils/store'
|
||||||
import { useRouter, useRoute } from 'vue-router'
|
import { useRouter, useRoute } from 'vue-router'
|
||||||
import useUserStore from '@/store/modules/user'
|
import useUserStore from '@/store/modules/user'
|
||||||
|
import useClassTaskStore from '@/store/modules/classTask'
|
||||||
|
|
||||||
const userStore = useUserStore().user
|
const userStore = useUserStore().user
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const { proxy } = getCurrentInstance()
|
const { proxy } = getCurrentInstance()
|
||||||
|
const useClassTaskStores = useClassTaskStore();
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
currentCourse: Object,
|
currentCourse: Object,
|
||||||
})
|
})
|
||||||
|
@ -189,6 +193,7 @@ const boardLoading = ref(false);
|
||||||
const fileLoading = ref(false); // 常规作业loading
|
const fileLoading = ref(false); // 常规作业loading
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
console.log("----onMounted-------")
|
||||||
currentRow.value = {id:0};
|
currentRow.value = {id:0};
|
||||||
if(propsQueryCourseObj){
|
if(propsQueryCourseObj){
|
||||||
if(JSON.parse(propsQueryCourseObj)){
|
if(JSON.parse(propsQueryCourseObj)){
|
||||||
|
@ -216,7 +221,28 @@ onMounted(() => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
initHomeWork();
|
initHomeWork();
|
||||||
|
isInToMyQuestion(); // 如果是上传习题后返回的,跳转到个人题库
|
||||||
})
|
})
|
||||||
|
// 是否进入个人题库
|
||||||
|
const isInToMyQuestion = () => {
|
||||||
|
console.log('isOpenQuestUploadView',useClassTaskStores.isOpenQuestUploadView);
|
||||||
|
if(useClassTaskStores.isOpenQuestUploadView){
|
||||||
|
useClassTaskStores.isOpenQuestUploadView = false;
|
||||||
|
|
||||||
|
currentRow.value = {id:1}; // 作业设计
|
||||||
|
activeAptTab.value = "个人题库";
|
||||||
|
//提交内容清空 重置
|
||||||
|
classWorkForm.id = 0;
|
||||||
|
classWorkForm.uniquekey = ""; // 作业唯一标识 作业名称
|
||||||
|
classWorkForm.worktype = "习题训练"; //作业类型
|
||||||
|
classWorkForm.title = ""; // 作业说明
|
||||||
|
classWorkForm.quizlist = []; // 作业习题列表内容
|
||||||
|
classWorkForm.chooseWorkLists = []; // 作业框架梳理list
|
||||||
|
classWorkForm.fileHomeworkList = []; // 常规作业文件列表
|
||||||
|
classWorkForm.whiteboardObj = ""; // 作业资源 - 课堂展示 白板
|
||||||
|
classWorkForm.question = ""; // 作业资源 - 课堂展示 输入的问题
|
||||||
|
}
|
||||||
|
}
|
||||||
watch(() => props.currentCourse, (newVal, oldVal) => {
|
watch(() => props.currentCourse, (newVal, oldVal) => {
|
||||||
if(newVal){
|
if(newVal){
|
||||||
courseObj.textbookId = newVal.textbookId // 版本
|
courseObj.textbookId = newVal.textbookId // 版本
|
||||||
|
|
|
@ -74,7 +74,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import "vue-cropper/dist/index.css";
|
import "vue-cropper/dist/index.css";
|
||||||
import { VueCropper } from "vue-cropper";
|
import { VueCropper } from "vue-cropper";
|
||||||
import { onMounted, ref,watch, reactive, getCurrentInstance,nextTick } from 'vue'
|
import { onMounted, ref,watch, reactive, getCurrentInstance,nextTick, onUnmounted } from 'vue'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
import { cloneDeep } from 'lodash'
|
import { cloneDeep } from 'lodash'
|
||||||
|
|
||||||
|
@ -88,6 +88,8 @@ import { useRouter, useRoute } from 'vue-router'
|
||||||
|
|
||||||
import { ocrImg2ExamByManualUpl, ocrImg2ItemByManualUpl } from "@/views/classTask/newClassTaskAssign/questionUpload/ocrImg2ExamQues";
|
import { ocrImg2ExamByManualUpl, ocrImg2ItemByManualUpl } from "@/views/classTask/newClassTaskAssign/questionUpload/ocrImg2ExamQues";
|
||||||
import QuesItem from "@/views/classTask/newClassTaskAssign/questionUpload/quesItem/index.vue";
|
import QuesItem from "@/views/classTask/newClassTaskAssign/questionUpload/quesItem/index.vue";
|
||||||
|
import useClassTaskStore from '@/store/modules/classTask'
|
||||||
|
|
||||||
|
|
||||||
// const Remote = require('@electron/remote')
|
// const Remote = require('@electron/remote')
|
||||||
// const fs = require('fs');
|
// const fs = require('fs');
|
||||||
|
@ -96,7 +98,9 @@ import useUserStore from '@/store/modules/user'
|
||||||
const userStore = useUserStore().user
|
const userStore = useUserStore().user
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const { proxy } = getCurrentInstance()
|
const { proxy } = getCurrentInstance();
|
||||||
|
const useClassTaskStores = useClassTaskStore();
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -151,6 +155,7 @@ const cropOption = reactive({
|
||||||
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
useClassTaskStores.isOpenQuestUploadView = true; // 打开过习题上传界面
|
||||||
console.log('propsQueryCourseObj', JSON.parse(propsQueryCourseObj));
|
console.log('propsQueryCourseObj', JSON.parse(propsQueryCourseObj));
|
||||||
if(propsQueryCourseObj&&JSON.parse(propsQueryCourseObj)){
|
if(propsQueryCourseObj&&JSON.parse(propsQueryCourseObj)){
|
||||||
courseObj.textbookId = JSON.parse(propsQueryCourseObj).bookObj // 版本
|
courseObj.textbookId = JSON.parse(propsQueryCourseObj).bookObj // 版本
|
||||||
|
@ -161,7 +166,13 @@ onMounted(() => {
|
||||||
}
|
}
|
||||||
initHomeWork();
|
initHomeWork();
|
||||||
})
|
})
|
||||||
|
onUnmounted(()=>{
|
||||||
|
// 延迟1s 关闭习题上传界面,作业管理界面需要根据 isOpenQuestUploadView 来进行判断
|
||||||
|
setTimeout(()=>{
|
||||||
|
useClassTaskStores.isOpenQuestUploadView = false; // 关闭习题上传界面
|
||||||
|
console.log('onUnmounted 习题上传');
|
||||||
|
}, 1000)
|
||||||
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取 entpcourseid 获取作业列表
|
* 获取 entpcourseid 获取作业列表
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { ElMessageBox, ElMessage } from "element-plus";
|
import { ElMessageBox, ElMessage } from "element-plus";
|
||||||
import qs from "qs";
|
import qs from "qs";
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
import request from '@/utils/request'
|
||||||
import { pyOCRAPI } from "@/api/education/entpcoursework";
|
import { pyOCRAPI } from "@/api/education/entpcoursework";
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,6 +17,13 @@ const baidubceConfig = {
|
||||||
'client_secret': 'oWb0M0YWMmZPMQIhIUkJX99ddr7h61qf',
|
'client_secret': 'oWb0M0YWMmZPMQIhIUkJX99ddr7h61qf',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export function getOcrContent(data) {
|
||||||
|
return request({
|
||||||
|
url: '/ocr/exam',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -226,30 +234,36 @@ const ocrImg2Json = async (urlBase64) => {
|
||||||
ElMessage.error("未检测到截图图片, 请截取图片后再识别");
|
ElMessage.error("未检测到截图图片, 请截取图片后再识别");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const resToken = await bdyAPI_getToken();
|
|
||||||
if (resToken.status !== 200) {
|
|
||||||
ElMessage.error("百度智能云用户标识有误");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
const token = resToken.data?.access_token;
|
|
||||||
let base64Code = urlBase64.split(",")[1];
|
let base64Code = urlBase64.split(",")[1];
|
||||||
const query = {
|
const resOcr = await getOcrContent({ base64Code: base64Code });
|
||||||
image: base64Code, //图片地址(base64)
|
if (resOcr.code !== 200) {
|
||||||
line_probability: false, //是否返回每行识别结果的置信度。默认为false
|
ElMessage.error("图片识别错误");
|
||||||
disp_line_poly: false, //是否返回每行的四角点坐标。默认为false
|
|
||||||
words_type: 'handprint_mix', //文字类型。 默认:印刷文字识别 = handwring_only:手写文字识别 = handprint_mix: 手写印刷混排识别
|
|
||||||
layout_analysis: false, //是否分析文档版面:包括layout(图、表、标题、段落、目录);attribute(栏、页眉、页脚、页码、脚注)的分析输出
|
|
||||||
recg_long_division: false, //是否检测并识别手写竖式
|
|
||||||
recg_formula: true, //控制是否检测并识别公式,默认为false
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const resOcr = await bdyAPI_getOcrContent(token, base64Code, query);
|
|
||||||
if (resOcr.status !== 200) {
|
|
||||||
ElMessage.error("百度智能云图片识别错误");
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
// const resToken = await bdyAPI_getToken();
|
||||||
|
// if (resToken.status !== 200) {
|
||||||
|
// ElMessage.error("百度智能云用户标识有误");
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// const token = resToken.data?.access_token;
|
||||||
|
// let base64Code = urlBase64.split(",")[1];
|
||||||
|
// const query = {
|
||||||
|
// image: base64Code, //图片地址(base64)
|
||||||
|
// line_probability: false, //是否返回每行识别结果的置信度。默认为false
|
||||||
|
// disp_line_poly: false, //是否返回每行的四角点坐标。默认为false
|
||||||
|
// words_type: 'handprint_mix', //文字类型。 默认:印刷文字识别 = handwring_only:手写文字识别 = handprint_mix: 手写印刷混排识别
|
||||||
|
// layout_analysis: false, //是否分析文档版面:包括layout(图、表、标题、段落、目录);attribute(栏、页眉、页脚、页码、脚注)的分析输出
|
||||||
|
// recg_long_division: false, //是否检测并识别手写竖式
|
||||||
|
// recg_formula: true, //控制是否检测并识别公式,默认为false
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
// const resOcr = await bdyAPI_getOcrContent(token, base64Code, query);
|
||||||
|
// if (resOcr.status !== 200) {
|
||||||
|
// ElMessage.error("百度智能云图片识别错误");
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
|
||||||
return resOcr;
|
return resOcr;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue