习题上传:待完善

This commit is contained in:
白了个白 2024-11-20 14:32:40 +08:00
parent fcc881a2fa
commit 761f19cf22
4 changed files with 1885 additions and 6 deletions

View File

@ -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
})
}

View File

@ -55,7 +55,18 @@
</div> </div>
<div class="page-right"> <div class="page-right">
<QuesItem ref="refquesItem"
:activeVersion="activeParams.version"
:activeLession="activeParams.lession"
:evalidArr="activeParams.evalidArr"
:curLessionList="curLessionList"
:isCropper="true"
@submit-exam-single-callback="onSubmitExamSingleCallback"
@cancel-exam-single-callback="onCancelExamSingleCallback"
@cropper-exam-form-item="cropperExamFormItem"
:style="{'height':'100%', 'overflow': 'auto', 'padding-top': '10px'}"
>
</QuesItem>
</div> </div>
</div> </div>
</template> </template>
@ -72,14 +83,28 @@ import { editListItem } from '@/hooks/useClassTask'
import { useGetHomework } from '@/hooks/useGetHomework' 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 { 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";
// const Remote = require('@electron/remote')
// const fs = require('fs');
// const path = require('path');
import useUserStore from '@/store/modules/user'
const userStore = useUserStore().user const userStore = useUserStore().user
const route = useRoute(); const route = useRoute();
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const props = defineProps({ const props = defineProps({
}) })
const activeParams = reactive({
version: {},
lession: {},
tab: '国家体系',
evalidArr: [],//id
versionList: [],//list
lessionList: [],//list
});
const propsQueryCourseObj = route.query.courseObj;// const propsQueryCourseObj = route.query.courseObj;//
const courseObj = reactive({ const courseObj = reactive({
@ -120,6 +145,7 @@ const cropOption = reactive({
}) })
onMounted(() => { onMounted(() => {
console.log('propsQueryCourseObj', JSON.parse(propsQueryCourseObj)); console.log('propsQueryCourseObj', JSON.parse(propsQueryCourseObj));
if(propsQueryCourseObj&&JSON.parse(propsQueryCourseObj)){ if(propsQueryCourseObj&&JSON.parse(propsQueryCourseObj)){
@ -146,7 +172,22 @@ const initHomeWork = async()=> {
// taskList.value = res; // taskList.value = res;
// tasklist_loading.value = false; // 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: 上传本地图片 * @desc: 上传本地图片
* @return: {*} * @return: {*}
@ -162,10 +203,35 @@ const handleImportImg = (uploadFile) => {
} }
console.log('uploadFile', 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(uploadFile.raw);
cropOption.img = window.URL.createObjectURL(new Blob([uploadFile.raw])); // cropOption.img = window.URL.createObjectURL(new Blob([uploadFile.raw]));
console.log(cropOption.img); // cropOption.img = window.URL.createObjectURL(new Blob([uploadFile.raw]));
// console.log(cropOption.img);
ElMessage.success('上传成功'); ElMessage.success('上传成功');
}; };
/** /**

View File

@ -1,5 +1,6 @@
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 { pyOCRAPI } from "@/api/education/entpcoursework"; import { pyOCRAPI } from "@/api/education/entpcoursework";