Commit b37e7ed0 authored by zhengke's avatar zhengke

no message

parent 1c57d044
<template> <template>
<view class="examList-box"> <view class="examList-box">
<view class="examList-import" @click.stop="ImportInformation"> <view class="examList-import" @click="ImportInformation">
<van-icon name="plus" /> <van-icon name="plus" />
<text>导入考试信息</text> <text>导入考试信息</text>
</view> </view>
...@@ -30,11 +30,11 @@ ...@@ -30,11 +30,11 @@
</view> </view>
</view> </view>
</view> </view>
<view class="examList-center-hint flex"> <view class="examList-center-hint flex" v-if="item.FailNum>0">
<view class="examList-hint-left flex"> <view class="examList-hint-left flex">
<van-icon name="warning" /> <van-icon name="warning" />
<view> <view>
导入失败(学员信息不匹配)可点击查看具体情况 导入失败({{item.FailNum}}学员信息不匹配)可点击查看具体情况
</view> </view>
</view> </view>
<view class="examList-hint-right"> <view class="examList-hint-right">
...@@ -44,9 +44,9 @@ ...@@ -44,9 +44,9 @@
</view> </view>
</view> </view>
<van-popup :show="show" :round="true"> <van-popup :show="show" :round="true" @close="closepopup">
<view class="examList-popup-box"> <view class="examList-popup-box">
<van-icon class="examList-popup-closure" name="cross" @click="show=false"/> <van-icon class="examList-popup-closure" name="cross" @click="closepopup"/>
<view class="examList-popup-title">导入考试信息</view> <view class="examList-popup-title">导入考试信息</view>
<view class="examList-popup-content"> <view class="examList-popup-content">
<input v-model="uploadParm.ExamName" class="examList-popup-name" placeholder="请输入考试名称"> <input v-model="uploadParm.ExamName" class="examList-popup-name" placeholder="请输入考试名称">
...@@ -55,6 +55,7 @@ ...@@ -55,6 +55,7 @@
multiple multiple
accept=".excel" accept=".excel"
preview-size="120rpx" preview-size="120rpx"
:before-read="beforeRead"
@after-read="customUpload" @after-read="customUpload"
> >
<view class="examList-popup-fil"> <view class="examList-popup-fil">
...@@ -79,7 +80,7 @@ ...@@ -79,7 +80,7 @@
import { uploadFile } from "@/utils/index"; import { uploadFile } from "@/utils/index";
export default { export default {
props: { props: {
dataList:[] dataList:[],
}, },
components: {}, components: {},
setup(props) { setup(props) {
...@@ -95,8 +96,8 @@ ...@@ -95,8 +96,8 @@
// Uid:726615, // Uid:726615,
// CourseId:44977497, // CourseId:44977497,
Uid:0, Uid:0,
CourseId:0, CourseId:44977497,
ExamName:'考试测试530' ExamName:''
}, },
fileList:[], fileList:[],
Msg:{ Msg:{
...@@ -113,30 +114,96 @@ ...@@ -113,30 +114,96 @@
url: '/pages/index/examDetails?examId=' + item url: '/pages/index/examDetails?examId=' + item
}); });
}, },
closepopup(){
data.show = false
data.uploadParm = {
Uid:'',
CourseId:'',
ExamName: ''
}
},
// 重新导入 // 重新导入
clickReimport(item){ clickReimport(item){
data.uploadParm = { // data.uploadParm.ExamName = item.ExamName
Uid:item.ExamId, // data.uploadParm.Uid = data.userData.Id
CourseId:item.CourseId, // data.uploadParm.CourseId = data.Msg.CourseId
ExamName: item.ExamName // data.uploadParm.ExamName = tem.ExamName
uni.showModal({
title: '提示',
content: '重新导入将要删除该数据,是否继续',
success: function (res) {
if (res.confirm) {
that.DelExamInfo(item)
} else if (res.cancel) {
uni.showToast({
title:'已取消删除',
icon:'none',
duration: 500
})
}
}
});
},
// 删除接口
DelExamInfo(item){
let Msg = {
ExamId: item.ExamId
} }
proxy.$request("/Exam/DelExamInfo", Msg).then(res => {
if(res.Code ==1){
uni.showToast({
title:'删除成功',
icon:'none',
duration: 500
})
data.show = true
}
})
}, },
ImportInformation(){ ImportInformation(){
data.show = true data.show = true
}, },
uploadFilesBefore(){ beforeRead(file){
if(!data.uploadParm.ExamName){
uni.showToast({
title:'请输入考试名称',
icon:'none',
duration: 500
})
return
}
if (file.url.indexOf('xls') ==-1 ||file.url.indexOf('xlsx') ==-1) {
uni.showToast({
title:'请上传 xls/xlsx 格式图片',
icon:'none',
duration: 500
})
return false;
}
return true;
}, },
// 添加导入 // 添加导入
customUpload(event){ customUpload(event){
let host = '' data.userData = uni.getStorageSync('userInfo')
if (process.env.NODE_ENV === "development") {
host = 'http://192.168.10.36:8082/api'
} else {
host = 'https://eduapi.oytour.com/api'
}
const { file } = event.detail; const { file } = event.detail;
that.uploadFileFun(file)
// uploadFile(params, file, (res) => {
// uni.showModal({
// title:res.Message
// })
// });
// return
},
uploadFileFun(file){
if(!data.uploadParm.ExamName){
uni.showToast({
title:'请输入考试名称',
icon:'none',
duration: 500
})
return
}
if(file[0].url.indexOf('xls')==-1||file[0].url.indexOf('xlsx')==-1){ if(file[0].url.indexOf('xls')==-1||file[0].url.indexOf('xlsx')==-1){
uni.showToast({ uni.showToast({
title:'请上传xls、xlsx格式的文件', title:'请上传xls、xlsx格式的文件',
...@@ -145,7 +212,19 @@ ...@@ -145,7 +212,19 @@
}) })
return return
} }
let host = ''
if (process.env.NODE_ENV === "development") {
host = 'http://192.168.10.36:8082/api'
} else {
host = 'https://eduapi.oytour.com/api'
}
data.userData = uni.getStorageSync('userInfo')
data.uploadParm = {
Uid:data.userData.Id,
CourseId:data.uploadParm.CourseId,
ExamName: data.uploadParm.ExamName
}
console.log(data.uploadParm,'-----')
uni.uploadFile({ uni.uploadFile({
url: host + '/Upload/UploadStuExamScore', url: host + '/Upload/UploadStuExamScore',
filePath: file[0].url, filePath: file[0].url,
...@@ -155,24 +234,33 @@ ...@@ -155,24 +234,33 @@
params:JSON.stringify(data.uploadParm) params:JSON.stringify(data.uploadParm)
}, },
success(res) { success(res) {
uni.hideLoading(); if(res.Code ==1){
uni.showToast({
title: res.Code ==1?'导入成功': '导入失败', uni.showToast({
icon:'none', title: '导入成功',
duration: 500 icon:'none',
}) duration: 500
})
uni.hideLoading();
data.uploadParm = {
Uid:'',
CourseId:'',
ExamName: ''
}
}else{
uni.showToast({
title: '导入失败',
icon:'none',
duration: 500
})
uni.hideLoading();
}
this.$parent.getExamPageList();
}, },
fail(err) { fail(err) {
console.log("uploadErr", err) console.log("uploadErr", err)
} }
}); });
// uploadFile(params, file, (res) => {
// uni.showModal({
// title:res.Message
// })
// });
// return
} }
}; };
let that = methods; let that = methods;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment