feat:合并

This commit is contained in:
lixg
2023-01-10 16:37:59 +08:00
5 changed files with 55 additions and 19 deletions

View File

@@ -31,7 +31,10 @@
name="uploadFile" name="uploadFile"
:multiple="false" :multiple="false"
@change="handleChange" @change="handleChange"
:data="{ :data=" courseType==1?{
stageId: Number(courseId),
type: 3
}:{
targetId: Number(courseId), targetId: Number(courseId),
type: 3 type: 3
}" }"
@@ -196,6 +199,18 @@ export default {
//上传文件 //上传文件
const handleChange = (info) => { const handleChange = (info) => {
console.log("info", info); console.log("info", info);
if(info){
var FileExt = info.file.name.replace(/.+\./, "");
if (['xls','xlsx'].indexOf(FileExt.toLowerCase()) === -1){
state.fileList = [];
state.uploadpercent = -1;
message.destroy()
message.error("请上传正确的文件格式")
return
}
}
state.addLoading = true; state.addLoading = true;
state.uploadErr = false; state.uploadErr = false;
state.uploadpercent = parseInt(info.file.percent); state.uploadpercent = parseInt(info.file.percent);

View File

@@ -134,8 +134,10 @@
</div> </div>
</div> </div>
</div> </div>
<div> <div v-if="errNum">
<div class="downloadErr">下载失败数据</div> <div class="downloadErr" @click="downloadEeeorData">
下载失败数据
</div>
</div> </div>
</div> </div>
<div <div
@@ -205,6 +207,10 @@ export default {
type: Number, type: Number,
default: null, default: null,
}, },
getStudent: {
type: Function,
default: null,
},
}, },
setup(props, ctx) { setup(props, ctx) {
const state = reactive({ const state = reactive({
@@ -217,7 +223,11 @@ export default {
fileList: [], fileList: [],
succNum: 0, //成功数据数 succNum: 0, //成功数据数
errNum: 0, //失败数据数 errNum: 0, //失败数据数
importHomeWorkData: {}, //传参 downloadErrUrl: null, //下载失败数据
locationHref:
location.href.indexOf("http://") !== -1
? "http://111.231.196.214:12016/"
: location.href.slice(0, location.href.indexOf("/m")) + "/upload/",
}); });
const closeDrawer = () => { const closeDrawer = () => {
ctx.emit("update:eScorevisible", false); ctx.emit("update:eScorevisible", false);
@@ -232,20 +242,17 @@ export default {
//上传文件 //上传文件
const handleChange = (info) => { const handleChange = (info) => {
const isType = if (info) {
info.file.name.indexOf(".xlsx") !== -1 || var FileExt = info.file.name.replace(/.+\./, "");
info.file.name.indexOf(".xls") != -1; if (["xls", "xlsx"].indexOf(FileExt.toLowerCase()) === -1) {
console.log("info11111", info, isType); state.fileList = [];
if (!isType) { state.uploadpercent = -1;
message.destroy(); message.destroy();
message.error("仅支持xls、xlsx格式!"); message.error("请上传正确的文件格式");
return; return;
} }
state.importHomeWorkData = { }
// stageId:props.stageId,
// targetId:props.targetId,
type: props.type,
};
state.addLoading = true; state.addLoading = true;
state.uploadpercent = parseInt(info.file.percent); state.uploadpercent = parseInt(info.file.percent);
console.log("我是文件上传的进度---------->", info.file.percent); console.log("我是文件上传的进度---------->", info.file.percent);
@@ -271,11 +278,14 @@ export default {
} }
state.succNum = res.data.data.successNum; state.succNum = res.data.data.successNum;
state.errNum = res.data.data.failedNum; state.errNum = res.data.data.failedNum;
state.downloadErrUrl = res.data.data.url;
props.getStudent && props.getStudent();
clearInterval(timer); clearInterval(timer);
} }
} }
}) })
.catch((err) => { .catch((err) => {
state.addLoading = false;
clearInterval(timer); clearInterval(timer);
console.log("查询导入状态失败", err); console.log("查询导入状态失败", err);
}); });
@@ -327,6 +337,14 @@ export default {
state.uploadpercent = -1; state.uploadpercent = -1;
state.uploadErr = false; //上传失败 state.uploadErr = false; //上传失败
}; };
// 下载失败数据
const downloadEeeorData = () => {
console.log(state.locationHref + state.downloadErrUrl);
if (state.downloadErrUrl !== "") {
window.open(state.locationHref + state.downloadErrUrl);
}
};
return { return {
...toRefs(state), ...toRefs(state),
afterVisibleChange, afterVisibleChange,
@@ -336,6 +354,7 @@ export default {
beforeUpload, beforeUpload,
handleUpload, handleUpload,
removeUpload, removeUpload,
downloadEeeorData,
}; };
}, },
}; };

View File

@@ -134,6 +134,7 @@
v-model:eScorevisible="Evisible" v-model:eScorevisible="Evisible"
:type="1" :type="1"
:id="datasource.projectTaskId" :id="datasource.projectTaskId"
v-model:getStudent="getStudent"
/> />
<!-- 查看作业抽屉 --> <!-- 查看作业抽屉 -->
<CKWork v-model:CWvisible="CWvisible" /> <CKWork v-model:CWvisible="CWvisible" />

View File

@@ -174,7 +174,7 @@
<!-- 二维码签到弹窗 --> <!-- 二维码签到弹窗 -->
<SignQR v-model:signQRvisible="signQRvisible" /> <SignQR v-model:signQRvisible="signQRvisible" />
<!-- 导入学员抽屉 --> <!-- 导入学员抽屉 -->
<imp-stu v-model:AddImpStuvisible="AddImpStuvisible" /> <imp-stu v-model:AddImpStuvisible="AddImpStuvisible" :courseId="datasource.courseId" :courseType="1"/>
<!-- 批量签到弹窗 --> <!-- 批量签到弹窗 -->
<a-modal <a-modal
v-model:visible="copyModal" v-model:visible="copyModal"

View File

@@ -129,6 +129,7 @@
v-model:eScorevisible="Evisible" v-model:eScorevisible="Evisible"
:type="2" :type="2"
:id="datasource.routerTaskId" :id="datasource.routerTaskId"
v-model:getStudent="getStudent"
/> />
<!-- 查看作业抽屉 --> <!-- 查看作业抽屉 -->
<CKWork v-model:CWvisible="CWvisible" /> <CKWork v-model:CWvisible="CWvisible" />