mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-10 03:16:44 +08:00
feat:合并
This commit is contained in:
@@ -31,8 +31,11 @@
|
||||
name="uploadFile"
|
||||
:multiple="false"
|
||||
@change="handleChange"
|
||||
:data="{
|
||||
targetId: Number(courseId),
|
||||
:data=" courseType==1?{
|
||||
stageId: Number(courseId),
|
||||
type: 3
|
||||
}:{
|
||||
targetId: Number(courseId),
|
||||
type: 3
|
||||
}"
|
||||
:showUploadList="false"
|
||||
@@ -196,6 +199,18 @@ export default {
|
||||
//上传文件
|
||||
const handleChange = (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.uploadErr = false;
|
||||
state.uploadpercent = parseInt(info.file.percent);
|
||||
|
||||
@@ -134,8 +134,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="downloadErr">下载失败数据</div>
|
||||
<div v-if="errNum">
|
||||
<div class="downloadErr" @click="downloadEeeorData">
|
||||
下载失败数据
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
@@ -205,6 +207,10 @@ export default {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
getStudent: {
|
||||
type: Function,
|
||||
default: null,
|
||||
},
|
||||
},
|
||||
setup(props, ctx) {
|
||||
const state = reactive({
|
||||
@@ -217,7 +223,11 @@ export default {
|
||||
fileList: [],
|
||||
succNum: 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 = () => {
|
||||
ctx.emit("update:eScorevisible", false);
|
||||
@@ -232,20 +242,17 @@ export default {
|
||||
|
||||
//上传文件
|
||||
const handleChange = (info) => {
|
||||
const isType =
|
||||
info.file.name.indexOf(".xlsx") !== -1 ||
|
||||
info.file.name.indexOf(".xls") != -1;
|
||||
console.log("info11111", info, isType);
|
||||
if (!isType) {
|
||||
message.destroy();
|
||||
message.error("仅支持xls、xlsx格式!");
|
||||
return;
|
||||
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.importHomeWorkData = {
|
||||
// stageId:props.stageId,
|
||||
// targetId:props.targetId,
|
||||
type: props.type,
|
||||
};
|
||||
|
||||
state.addLoading = true;
|
||||
state.uploadpercent = parseInt(info.file.percent);
|
||||
console.log("我是文件上传的进度---------->", info.file.percent);
|
||||
@@ -271,11 +278,14 @@ export default {
|
||||
}
|
||||
state.succNum = res.data.data.successNum;
|
||||
state.errNum = res.data.data.failedNum;
|
||||
state.downloadErrUrl = res.data.data.url;
|
||||
props.getStudent && props.getStudent();
|
||||
clearInterval(timer);
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
state.addLoading = false;
|
||||
clearInterval(timer);
|
||||
console.log("查询导入状态失败", err);
|
||||
});
|
||||
@@ -327,6 +337,14 @@ export default {
|
||||
state.uploadpercent = -1;
|
||||
state.uploadErr = false; //上传失败
|
||||
};
|
||||
// 下载失败数据
|
||||
const downloadEeeorData = () => {
|
||||
console.log(state.locationHref + state.downloadErrUrl);
|
||||
if (state.downloadErrUrl !== "") {
|
||||
window.open(state.locationHref + state.downloadErrUrl);
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
...toRefs(state),
|
||||
afterVisibleChange,
|
||||
@@ -336,6 +354,7 @@ export default {
|
||||
beforeUpload,
|
||||
handleUpload,
|
||||
removeUpload,
|
||||
downloadEeeorData,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
@@ -134,6 +134,7 @@
|
||||
v-model:eScorevisible="Evisible"
|
||||
:type="1"
|
||||
:id="datasource.projectTaskId"
|
||||
v-model:getStudent="getStudent"
|
||||
/>
|
||||
<!-- 查看作业抽屉 -->
|
||||
<CKWork v-model:CWvisible="CWvisible" />
|
||||
|
||||
@@ -174,7 +174,7 @@
|
||||
<!-- 二维码签到弹窗 -->
|
||||
<SignQR v-model:signQRvisible="signQRvisible" />
|
||||
<!-- 导入学员抽屉 -->
|
||||
<imp-stu v-model:AddImpStuvisible="AddImpStuvisible" />
|
||||
<imp-stu v-model:AddImpStuvisible="AddImpStuvisible" :courseId="datasource.courseId" :courseType="1"/>
|
||||
<!-- 批量签到弹窗 -->
|
||||
<a-modal
|
||||
v-model:visible="copyModal"
|
||||
|
||||
@@ -129,6 +129,7 @@
|
||||
v-model:eScorevisible="Evisible"
|
||||
:type="2"
|
||||
:id="datasource.routerTaskId"
|
||||
v-model:getStudent="getStudent"
|
||||
/>
|
||||
<!-- 查看作业抽屉 -->
|
||||
<CKWork v-model:CWvisible="CWvisible" />
|
||||
|
||||
Reference in New Issue
Block a user