Commit 2209307c authored by 张伯涛's avatar 张伯涛

课程管理接口初步调整

parent 4349254d
import request from '@/utils/request' import request from '@/utils/request'
import Qs from "qs";
// 课程管理列表查询 // 课程管理列表查询
export function queryBLessonsByPagination(query) { export function queryBLessonsByPagination(query) {
...@@ -16,3 +17,119 @@ export function queryBChaptersWithoutAuth(query) { ...@@ -16,3 +17,119 @@ export function queryBChaptersWithoutAuth(query) {
params: query params: query
}) })
} }
// 查询课程方向下拉
export function queryDirectionsList(query) {
return request({
url: '/bdirection/queryDirectionsList',
method: 'get',
params: query
})
}
// 课程管理新增
export function blessonAdd(data) {
data = Qs.stringify(data)
return request({
url: '/blesson/add',
method: 'post',
data,
headers: {}
})
}
// 课程管理删除
export function blessonRemove(data) {
data = Qs.stringify(data)
return request({
url: '/blesson/remove',
method: 'post',
data,
headers: {}
})
}
// 课程管理导入
export function excelImport(data) {
return request({
url: '/blesson/excelImport',
method: 'post',
headers: {
'Content-Type': 'multipart/form-data'
},
transformRequest: [(data) => {
return data
}],
data
})
}
// 课程管理恢复封面
export function defaultUrl(data) {
data = Qs.stringify(data)
return request({
url: '/blesson/defaultUrl',
method: 'post',
data,
headers: {}
})
}
// 课程管理修改封面
export function picImport(data) {
data = Qs.stringify(data)
return request({
url: '/blesson/picImport',
method: 'post',
data,
headers: {}
})
}
// 课程管理-目录添加章
export function bchapterAdd(data) {
data = Qs.stringify(data)
return request({
url: '/bchapter/add',
method: 'post',
data,
headers: {}
})
}
// 课程管理-目录删除节
export function bchapterRemove(data) {
data = Qs.stringify(data)
return request({
url: '/bchapter/remove',
method: 'post',
data,
headers: {}
})
}
// 课程管理-目录章节上移
export function updateTopChapter(data) {
data = Qs.stringify(data)
return request({
url: '/bchapter/updateTopChapter',
method: 'post',
data,
headers: {}
})
}
// 课程管理-目录章节下移
export function updateDownChapter(data) {
data = Qs.stringify(data)
return request({
url: '/bchapter/updateDownChapter',
method: 'post',
data,
headers: {}
})
}
// 6.导入
export function uploadVideo(data) {
return request({
url: '/bvideo/uploadVideo',
method: 'post',
headers: {
'Content-Type': 'multipart/form-data'
},
transformRequest: [(data) => {
return data
}],
data
})
}
...@@ -227,7 +227,13 @@ import EduVideo from '@/components/Tools/EduVideo' ...@@ -227,7 +227,13 @@ import EduVideo from '@/components/Tools/EduVideo'
import EduPpt from '@/components/Tools/EduPpt' import EduPpt from '@/components/Tools/EduPpt'
import EduPdf from '@/components/Tools/EduPdf' import EduPdf from '@/components/Tools/EduPdf'
import EduFile from '@/components/Tools/EduFile' import EduFile from '@/components/Tools/EduFile'
import {queryBChaptersWithoutAuth, queryBLessonsByPagination} from '@/api/courseManagement/indexApi' import {
queryBChaptersWithoutAuth,
blessonAdd,
bchapterAdd,
bchapterRemove,
updateTopChapter, updateDownChapter, uploadVideo
} from '@/api/courseManagement/indexApi'
export default { export default {
name: "courseCatalogues", name: "courseCatalogues",
components:{ components:{
...@@ -426,40 +432,38 @@ export default { ...@@ -426,40 +432,38 @@ export default {
console.log('修改目录标题'); console.log('修改目录标题');
let bid = $this.attr('data-bid'); let bid = $this.attr('data-bid');
let chapterName = $this.val(); let chapterName = $this.val();
_this.eduUtil.ajaxPostUtil( const params = {
'BChapter/add', businessId: bid,
{ pid: -1,
businessId: bid, lessonOrSl: '1',
pid: -1, lessonId: _this.lessonId,
lessonOrSl: '1', chapterName: chapterName
lessonId: _this.lessonId, }
chapterName: chapterName bchapterAdd(params).then(res => {
}, if (res.code === 200) {
function (res) { _this.$notify({
if (res.code === 200) { title: '成功',
_this.$notify({ message: res.message,
title: '成功', type: 'success'
message: res.message, });
type: 'success' $this.prev('input[type=hidden]').val($this.val());
}); _this.$emit('refreshData');
$this.prev('input[type=hidden]').val($this.val()); } else {
_this.$emit('refreshData'); _this.$notify({
} else { title: '提示',
_this.$notify({ message: res.message,
title: '提示', type: 'warning'
message: res.message, });
type: 'warning' $this.val($this.prev('input[type=hidden]').val());
}); }
$this.val($this.prev('input[type=hidden]').val()); $this.prop('disabled',true);
} }).catch((err) => {
$this.prop('disabled',true); _this.$notify({
}, function (err) { title: '失败',
// _this.$notify({ message: '网络错误',
// title: '失败', type: 'error'
// message: '网络错误',
// type: 'error'
// });
}); });
})
} }
}else{ }else{
$this.prop('disabled',true); $this.prop('disabled',true);
...@@ -477,39 +481,37 @@ export default { ...@@ -477,39 +481,37 @@ export default {
let bid = $this.attr('data-bid'); let bid = $this.attr('data-bid');
let pid = $this.attr('data-pid'); let pid = $this.attr('data-pid');
let chapterName = $this.val(); let chapterName = $this.val();
_this.eduUtil.ajaxPostUtil( const params = {
'BChapter/add', businessId: bid,
{ pid: pid,
businessId: bid, lessonOrSl: '1',
pid: pid, lessonId: _this.lessonId,
lessonOrSl: '1', chapterName: chapterName
lessonId: _this.lessonId, }
chapterName: chapterName bchapterAdd(params).then(res => {
}, if (res.code === 200) {
function (res) { _this.$notify({
if (res.code === 200) { title: '成功',
_this.$notify({ message: res.message,
title: '成功', type: 'success'
message: res.message, });
type: 'success' $this.prev('input[type=hidden]').val($this.val());
}); } else {
$this.prev('input[type=hidden]').val($this.val()); _this.$notify({
} else { title: '提示',
_this.$notify({ message: res.message,
title: '提示', type: 'warning'
message: res.message, });
type: 'warning' $this.val($this.prev('input[type=hidden]').val());
}); }
$this.val($this.prev('input[type=hidden]').val()); $this.prop('disabled',true);
} }).catch((err) => {
$this.prop('disabled',true); _this.$notify({
}, function (err) { title: '失败',
// _this.$notify({ message: '网络错误',
// title: '失败', type: 'error'
// message: '网络错误',
// type: 'error'
// });
}); });
})
} }
}else{ }else{
$this.prop('disabled',true); $this.prop('disabled',true);
...@@ -563,11 +565,11 @@ export default { ...@@ -563,11 +565,11 @@ export default {
//关闭loading //关闭loading
loading.close(); loading.close();
}).catch(function() { }).catch(function() {
// _this.$notify({ _this.$notify({
// title: '失败', title: '失败',
// message: '网络错误', message: '网络错误',
// type: 'error' type: 'error'
// }); });
loading.close(); loading.close();
}) })
} }
...@@ -584,31 +586,28 @@ export default { ...@@ -584,31 +586,28 @@ export default {
spinner: 'el-icon-loading', spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.5)', background: 'rgba(0, 0, 0, 0.5)',
}); });
const url = 'BChapter/add'; const params = {
this.eduUtil.ajaxPostUtil(url, lessonId: this.lessonId,
{ lessonOrSl: '1',
lessonId: this.lessonId, chapterName: this.chapterForm.text,
lessonOrSl: '1', pid: -1
chapterName: this.chapterForm.text, }
pid: -1 bchapterAdd(params).then(res => {
}, loading.close();
function (res) { _this.$notify({
loading.close(); title: '成功',
_this.$notify({ message: res.message,
title: '成功', type: 'success'
message: res.message,
type: 'success'
});
_this.loadCatalog(_this.lessonId, _this.classHours);
}
, function (err) {
loading.close();
// _this.$notify({
// title: '失败',
// message: '网络错误',
// type: 'error'
// });
}); });
_this.loadCatalog(_this.lessonId, _this.classHours);
}).catch((err) => {
loading.close();
_this.$notify({
title: '失败',
message: '网络错误',
type: 'error'
});
})
this.viewSwitch.chapterForm = false; this.viewSwitch.chapterForm = false;
this.formClear(); this.formClear();
}else{ }else{
...@@ -670,22 +669,18 @@ export default { ...@@ -670,22 +669,18 @@ export default {
spinner: 'el-icon-loading', spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.5)', background: 'rgba(0, 0, 0, 0.5)',
}); });
this.eduUtil.ajaxPostUtil( const params = {
'BLesson/add', businessId:_this.lessonId,
{ classHour:_this.classHours,
businessId:_this.lessonId, lessonName:_this.lessonName,
classHour:_this.classHours, code:_this.code,
lessonName:_this.lessonName, directionId:_this.directionId
code:_this.code, }
directionId:_this.directionId blessonAdd(params).then(res => {
},res =>{ loading.close();
//console.log(res); }).catch((err) => {
loading.close(); loading.close();
},err =>{ })
//console.log(err);
loading.close();
}
);
}).catch(() => { }).catch(() => {
return false; return false;
}); });
...@@ -700,35 +695,33 @@ export default { ...@@ -700,35 +695,33 @@ export default {
spinner: 'el-icon-loading', spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.5)', background: 'rgba(0, 0, 0, 0.5)',
}); });
_this.eduUtil.ajaxPostUtil('BChapter/add', const params = {
{ lessonId:_this.lessonId,
lessonId:_this.lessonId, lessonOrSl:'1',
lessonOrSl:'1', pid:_this.sectionForm.chapterId,
pid:_this.sectionForm.chapterId, chapterName:_this.sectionForm.text,
chapterName:_this.sectionForm.text, isTest:_this.sectionForm.stuMeansValue,
isTest:_this.sectionForm.stuMeansValue, classHour:_this.sectionForm.classHours,
classHour:_this.sectionForm.classHours, experimentType:_this.sectionForm.stuMeansFile
experimentType:_this.sectionForm.stuMeansFile }
}, bchapterAdd(params).then(res => {
function(res){ loading.close();
loading.close(); _this.$notify({
_this.$notify({ title: '成功',
title: '成功', message: res.message,
message: res.message, type: 'success'
type: 'success'
});
_this.viewSwitch.sectionForm = false;
_this.loadCatalog(_this.lessonId);
},
function(err){
loading.close();
// _this.$notify({
// title: '失败',
// message: '网络错误',
// type: 'error'
// });
_this.viewSwitch.sectionForm = false;
}); });
_this.viewSwitch.sectionForm = false;
_this.loadCatalog(_this.lessonId);
}).catch((err) => {
loading.close();
_this.$notify({
title: '失败',
message: '网络错误',
type: 'error'
});
_this.viewSwitch.sectionForm = false;
})
} }
} else { } else {
...@@ -781,55 +774,12 @@ export default { ...@@ -781,55 +774,12 @@ export default {
background: 'rgba(0, 0, 0, 0.5)', background: 'rgba(0, 0, 0, 0.5)',
customClass: 'myLoading' customClass: 'myLoading'
}); });
const params = {
this.eduUtil.ajaxPostUtil( id:_this.currentChapterId,
'BChapter/remove', lessonOrSl:1
{ }
id:_this.currentChapterId, bchapterRemove(params).then(res => {
lessonOrSl:1 loading.close();
},
function(res){
loading.close();
if(res.code === 200) {
_this.$notify({
title: '成功',
message: res.message,
type: 'success'
});
_this.loadCatalog(_this.lessonId, _this.classHours);
}else{
loading.close();
_this.$notify({
title: '提示',
message: res.message,
type: 'warning'
});
}
},function(err){
loading.close();
// _this.$notify({
// title: '失败',
// message: '网络错误',
// type: 'error'
// });
}
);
}).catch(() => {
//无操作
})
},
//章节上移
chapterUp(bid,pid,sort){
let _this = this;
this.eduUtil.ajaxPostUtil(
'BChapter/updateTopChapter',
{
businessId:bid,
pid:pid,
sort:sort,
lessonId:_this.lessonId
},
function(res){
if(res.code === 200) { if(res.code === 200) {
_this.$notify({ _this.$notify({
title: '成功', title: '成功',
...@@ -838,57 +788,88 @@ export default { ...@@ -838,57 +788,88 @@ export default {
}); });
_this.loadCatalog(_this.lessonId, _this.classHours); _this.loadCatalog(_this.lessonId, _this.classHours);
}else{ }else{
loading.close();
_this.$notify({ _this.$notify({
title: '提示', title: '提示',
message: res.message, message: res.message,
type: 'warning' type: 'warning'
}); });
} }
}, }).catch((err) => {
function(err){ loading.close();
// _this.$notify({ _this.$notify({
// title: '失败', title: '失败',
// message: '网络错误', message: '网络错误',
// type: 'error' type: 'error'
// }); });
})
}).catch(() => {
//无操作
})
},
//章节上移
chapterUp(bid,pid,sort){
let _this = this;
const params = {
businessId:bid,
pid:pid,
sort:sort,
lessonId:_this.lessonId
}
updateTopChapter(params).then(res => {
if(res.code === 200) {
_this.$notify({
title: '成功',
message: res.message,
type: 'success'
});
_this.loadCatalog(_this.lessonId, _this.classHours);
}else{
_this.$notify({
title: '提示',
message: res.message,
type: 'warning'
});
} }
); }).catch((err) => {
_this.$notify({
title: '失败',
message: '网络错误',
type: 'error'
});
})
}, },
//章节下移 //章节下移
chapterDown(bid,pid,sort){ chapterDown(bid,pid,sort){
let _this = this; let _this = this;
this.eduUtil.ajaxPostUtil( const params = {
'BChapter/updateDownChapter', businessId:bid,
{ pid:pid,
businessId:bid, sort:sort,
pid:pid, lessonId:_this.lessonId
sort:sort, }
lessonId:_this.lessonId updateDownChapter(params).then(res => {
}, if(res.code === 200) {
function(res){ _this.$notify({
if(res.code === 200) { title: '成功',
_this.$notify({ message: res.message,
title: '成功', type: 'success'
message: res.message, });
type: 'success' _this.loadCatalog(_this.lessonId, _this.classHours);
}); }else{
_this.loadCatalog(_this.lessonId, _this.classHours); _this.$notify({
}else{ title: '提示',
_this.$notify({ message: res.message,
title: '提示', type: 'warning'
message: res.message, });
type: 'warning'
});
}
},
function(err){
// _this.$notify({
// title: '失败',
// message: '网络错误',
// type: 'error'
// });
} }
); }).catch((err) => {
_this.$notify({
title: '失败',
message: '网络错误',
type: 'error'
});
})
}, },
//更改课时 //更改课时
changeHour(secHour,bid,pid,chapterName,index,indexChild){ changeHour(secHour,bid,pid,chapterName,index,indexChild){
...@@ -905,20 +886,18 @@ export default { ...@@ -905,20 +886,18 @@ export default {
_this.classHours = parseInt(_this.classHours); _this.classHours = parseInt(_this.classHours);
_this.classHours += 1; _this.classHours += 1;
//更新总课时 //更新总课时
_this.eduUtil.ajaxPostUtil( const params ={
'BLesson/add', businessId:_this.lessonId,
{ classHour:_this.classHours,
businessId:_this.lessonId, lessonName:_this.lessonName,
classHour:_this.classHours, code:_this.code,
lessonName:_this.lessonName, directionId:_this.directionId
code:_this.code, }
directionId:_this.directionId blessonAdd(params).then(res => {
},res =>{
// console.log(res); }).catch((err) => {
},err =>{ console.log(err);
console.log(err); })
}
);
}).catch(() => { }).catch(() => {
if (secHour == 1){ if (secHour == 1){
this.chapterList[index].childList[indexChild].classHour = "0" this.chapterList[index].childList[indexChild].classHour = "0"
...@@ -931,42 +910,39 @@ export default { ...@@ -931,42 +910,39 @@ export default {
//请求更新课时 //请求更新课时
function updateClassHours(){ function updateClassHours(){
if (!_this.updateCancel){ if (!_this.updateCancel){
_this.eduUtil.ajaxPostUtil( const params ={
'BChapter/add', businessId:bid,
{ pid:pid,
businessId:bid, lessonOrSl:1,
pid:pid, lessonId:_this.lessonId,
lessonOrSl:1, chapterName:chapterName,
lessonId:_this.lessonId, classHour:secHour
chapterName:chapterName, }
classHour:secHour bchapterAdd(params).then(res => {
}, if(res.code===200){
function(res){ _this.$notify({
if(res.code===200){ title: '成功',
_this.$notify({ message: res.message,
title: '成功', type: 'success',
message: res.message, duration:'1200'
type: 'success', });
duration:'1200' secHour==1? _this.classCurrent +=1:_this.classCurrent -=1;
}); }else{
secHour==1? _this.classCurrent +=1:_this.classCurrent -=1; _this.$notify({
}else{ title: '提示',
_this.$notify({ message: res.message,
title: '提示', type: 'warning',
message: res.message, duration:'1200'
type: 'warning', });
duration:'1200'
});
}
},function(err){
// _this.$notify({
// title: '失败',
// message: '网络错误',
// type: 'err',
// duration:'1200'
// });
} }
) }).catch((err) => {
_this.$notify({
title: '失败',
message: '网络错误',
type: 'err',
duration:'1200'
});
})
}else{ }else{
_this.updateCancel = false _this.updateCancel = false
} }
...@@ -1109,40 +1085,39 @@ export default { ...@@ -1109,40 +1085,39 @@ export default {
}); });
let bid = this.teaMeans.businessId; let bid = this.teaMeans.businessId;
let _this = this; let _this = this;
_this.eduUtil.ajaxPostUtil( const params ={
'BChapter/add',{ businessId:bid,
businessId:bid, experimentType:_this.teaMeans.expType,
experimentType:_this.teaMeans.expType, lessonOrSl:1,
lessonOrSl:1, isTest:_this.teaMeans.stuMeans,
isTest:_this.teaMeans.stuMeans, chapterName:_this.teaMeans.chapterName
chapterName:_this.teaMeans.chapterName }
},res=>{ bchapterAdd(params).then(res => {
loading.close(); loading.close();
if(res.code===200){ if(res.code===200){
_this.$notify({ _this.$notify({
'title':'成功', 'title':'成功',
'message':res.message, 'message':res.message,
'type':'success' 'type':'success'
}); });
_this.teaMeans.isShow = false; _this.teaMeans.isShow = false;
_this.loadCatalog(_this.lessonId); _this.loadCatalog(_this.lessonId);
}else{ }else{
loading.close();
_this.$notify({
'title':'提示',
'message':res.message,
'type':'warning'
});
}
},err=>{
loading.close(); loading.close();
// _this.$notify({ _this.$notify({
// 'title':'失败', 'title':'提示',
// 'message':'网络错误', 'message':res.message,
// 'type':'error' 'type':'warning'
// }); });
} }
); }).catch((err) => {
loading.close();
_this.$notify({
'title':'失败',
'message':'网络错误',
'type':'error'
});
})
}, },
confirmUpload(){ confirmUpload(){
let type = this.resForm.type; let type = this.resForm.type;
...@@ -1223,26 +1198,25 @@ export default { ...@@ -1223,26 +1198,25 @@ export default {
background: 'rgba(0, 0, 0, 0.5)', background: 'rgba(0, 0, 0, 0.5)',
customClass: 'myLoading' customClass: 'myLoading'
}); });
_this.eduUtil.ajaxPostFileUtil(_this,'BVideo/uploadVideo',{ var formData = new FormData() // 当前为空
type:type, formData.append('type', type)
chapterId:_this.resForm.businessId, formData.append('chapterId', _this.resForm.businessId)
file:file, formData.append('file', file)
lessonId:_this.lessonId formData.append('lessonId', _this.lessonId)
},res =>{ uploadVideo(formData).then(res => {
loading.close(); loading.close();
if(res.code===200&&_this.progress===100){ if(res.code===200&&_this.progress===100){
_this.success(res); _this.success(res);
_this.resForm.resView = false; _this.resForm.resView = false;
_this.resForm.filelist = []; _this.resForm.filelist = [];
_this.loadCatalog(_this.lessonId); _this.loadCatalog(_this.lessonId);
}else{ }else{
_this.warning(res); _this.warning(res);
}
},err =>{
loading.close();
_this.error(err);
} }
); }).catch((err) => {
loading.close();
_this.error(err);
})
} }
}, },
//ajax成功的提示 //ajax成功的提示
...@@ -1263,11 +1237,11 @@ export default { ...@@ -1263,11 +1237,11 @@ export default {
}, },
//ajax错误的提示 //ajax错误的提示
error(err){ error(err){
// this.$notify({ this.$notify({
// title: '失败', title: '失败',
// message: '网络错误', message: '网络错误',
// type: "error" type: "error"
// }); });
}, },
//返回 //返回
goBack(){ goBack(){
......
...@@ -228,7 +228,14 @@ ...@@ -228,7 +228,14 @@
<script> <script>
import CurCat from '../courseManagement/courseCatalogues.vue' import CurCat from '../courseManagement/courseCatalogues.vue'
import {queryBLessonsByPagination} from '@/api/courseManagement/indexApi' import {
queryBLessonsByPagination,
queryDirectionsList,
blessonAdd,
blessonRemove,
excelImport,
defaultUrl, picImport,
} from '@/api/courseManagement/indexApi'
import commonField from "@/utils/commonField"; import commonField from "@/utils/commonField";
export default { export default {
name: "index", name: "index",
...@@ -400,24 +407,22 @@ export default { ...@@ -400,24 +407,22 @@ export default {
getCourseDirection() { getCourseDirection() {
let that = this; let that = this;
that.fullscreenLoading=true; that.fullscreenLoading=true;
that.eduUtil.ajaxGetUtil('BDirection/queryDirectionsList', {}, queryDirectionsList().then(res => {
function (res) { for (let i = 0; i < res.data.length; i++) {
for (let i = 0; i < res.data.length; i++) { let obj = {};
let obj = {}; obj.value = res.data[i].id;
obj.value = res.data[i].id; obj.label = res.data[i].text;
obj.label = res.data[i].text; that.courseDirection[i] = obj;
that.courseDirection[i] = obj;
}
that.fullscreenLoading=false;
}, function (err) {
that.fullscreenLoading=false;
that.$notify({
title: '失败',
message: '网络错误,课程方向获取失败',
type: 'error'
})
} }
) that.fullscreenLoading=false;
}).catch((err) => {
that.fullscreenLoading=false;
that.$notify({
title: '失败',
message: '网络错误,课程方向获取失败',
type: 'error'
})
});
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
...@@ -489,31 +494,30 @@ export default { ...@@ -489,31 +494,30 @@ export default {
if (valid) { if (valid) {
that.fullscreenLoading = true; that.fullscreenLoading = true;
that.dialogFormVisible = false; that.dialogFormVisible = false;
that.eduUtil.ajaxPostUtil('BLesson/add', { const params = {
'code': that.form.id, code: that.form.id,
'lessonName': that.form.name, lessonName: that.form.name,
'classHour': that.form.totalStuHours, classHour: that.form.totalStuHours,
'directionId': that.form.couDire, directionId: that.form.couDire,
'credits': that.form.credit credits: that.form.credit
}, }
function (res) { blessonAdd(params).then(res => {
let type = res.code; let type = res.code;
let message = res.message; let message = res.message;
type = (type == 200) ? "success" : "warning"; type = (type == 200) ? "success" : "warning";
that.$notify({ that.$notify({
title: type=='success'?'成功':'提示', title: type=='success'?'成功':'提示',
message: message, message: message,
type: type type: type
}); });
that.fullscreenLoading = false; that.fullscreenLoading = false;
if(type=='success') { if(type=='success') {
that.loadData(); that.loadData();
} }
}).catch((err) => {
}, function (err) { that.fullscreenLoading = false;
that.fullscreenLoading = false; console.log(err);
console.log(err); })
})
} else { } else {
that.fullscreenLoading = false; that.fullscreenLoading = false;
console.log('error submit!!'); console.log('error submit!!');
...@@ -560,38 +564,35 @@ export default { ...@@ -560,38 +564,35 @@ export default {
dom.value='' dom.value=''
_this.fullscreenLoading = false; _this.fullscreenLoading = false;
}else{ }else{
_this.eduUtil.ajaxPostUtil( var formData = new FormData() // 当前为空
'BLesson/excelImport', formData.append('importFile', dom.files[0])
{importFile:dom.files[0]}, excelImport(formData).then(res => {
function (res){ console.log(res);
console.log(res); dom.value=''
dom.value='' _this.fullscreenLoading = false;
_this.fullscreenLoading = false; if(res.code === 200){
if(res.code === 200){ _this.$notify({
_this.$notify({ title: '成功',
title: '成功', message: res.message,
message: res.message, type: 'success'
type: 'success' });
}); _this.loadData();
_this.loadData(); }else{
}else{
_this.$notify({
title: '失败',
message: res.message,
type: 'error'
});
}
},
function (err) {
dom.value=''
_this.$notify({ _this.$notify({
title: '失败', title: '失败',
message: err.message, message: res.message,
type: 'error' type: 'error'
}); });
_this.fullscreenLoading = false;
} }
); }).catch((err) => {
dom.value=''
_this.$notify({
title: '失败',
message: err.message,
type: 'error'
});
_this.fullscreenLoading = false;
})
} }
} }
, ,
...@@ -633,9 +634,10 @@ export default { ...@@ -633,9 +634,10 @@ export default {
// alert(index); // alert(index);
this.fullscreenLoading = true; this.fullscreenLoading = true;
var that = this; var that = this;
this.eduUtil.ajaxPostUtil('BLesson/defaultUrl', { const params = {
code: that.tableData[index].tcode code: that.tableData[index].tcode
}, function (res) { }
defaultUrl(params).then(res => {
that.fullscreenLoading = false; that.fullscreenLoading = false;
if (res.code) { if (res.code) {
that.$notify({ that.$notify({
...@@ -651,10 +653,9 @@ export default { ...@@ -651,10 +653,9 @@ export default {
type: 'warning' type: 'warning'
}); });
} }
}).catch((err) => {
}, function (err) {
console.log(err) console.log(err)
}); })
}, },
...@@ -677,10 +678,11 @@ export default { ...@@ -677,10 +678,11 @@ export default {
}); });
}else { }else {
_this.fullscreenLoading = true; _this.fullscreenLoading = true;
_this.eduUtil.ajaxPostUtil('BLesson/picImport', { const params = {
importFile: cover, importFile: cover,
code: _this.teacode, code: _this.teacode,
}, res => { }
picImport(params).then(res => {
_this.fullscreenLoading = false; _this.fullscreenLoading = false;
_this.dialogVisible = false; _this.dialogVisible = false;
let type = res.code; let type = res.code;
...@@ -693,8 +695,7 @@ export default { ...@@ -693,8 +695,7 @@ export default {
}); });
_this.loadData(); _this.loadData();
_this.filelist = []; _this.filelist = [];
}).catch((err) => {
}, err => {
_this.fullscreenLoading = false; _this.fullscreenLoading = false;
console.log(err); console.log(err);
}) })
...@@ -729,32 +730,31 @@ export default { ...@@ -729,32 +730,31 @@ export default {
}); });
}else{ }else{
that.fullscreenLoading = true; that.fullscreenLoading = true;
that.eduUtil.ajaxPostUtil('BLesson/add', { const params = {
businessId: that.bussid[index], businessId: that.bussid[index],
code: that.formLabelAlign.id, code: that.formLabelAlign.id,
lessonName: that.formLabelAlign.region, lessonName: that.formLabelAlign.region,
credits: that.formLabelAlign.credit, credits: that.formLabelAlign.credit,
directionId: that.formLabelAlign.couDire, directionId: that.formLabelAlign.couDire,
classHour: that.formLabelAlign.totalStuHours classHour: that.formLabelAlign.totalStuHours
}, (function (response) { }
that.fullscreenLoading = false; blessonAdd(params).then(response => {
// alert(JSON.stringify(response)); that.fullscreenLoading = false;
let type = response.code; // alert(JSON.stringify(response));
let message = response.message; let type = response.code;
//type = that.eduUtil.tip_custom(type); let message = response.message;
type = (type === 200) ? "success" : "error"; //type = that.eduUtil.tip_custom(type);
that.$notify({ type = (type === 200) ? "success" : "error";
title: '成功', that.$notify({
message: message, title: '成功',
type: type message: message,
}); type: type
that.loadData(); });
$('.el-popover').css("display", "none"); that.loadData();
}) $('.el-popover').css("display", "none");
, (function (err) { }).catch((err) => {
console.log(err); console.log(err);
}) })
)
} }
} else { } else {
that.fullscreenLoading = false; that.fullscreenLoading = false;
...@@ -792,29 +792,25 @@ export default { ...@@ -792,29 +792,25 @@ export default {
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
that.fullscreenLoading = true; that.fullscreenLoading = true;
that.eduUtil.ajaxPostUtil('BLesson/remove', const params = {
{ id: that.bussid[index]
id: that.bussid[index] }
blessonRemove(params).then(response => {
} that.fullscreenLoading = false;
, (function (response) { // alert(JSON.stringify(response));
that.fullscreenLoading = false; var type = response.code;
// alert(JSON.stringify(response)); var message = response.message;
var type = response.code; type = (type == 200 && message == "操作成功") ? "success" : "error";
var message = response.message; that.$notify({
type = (type == 200 && message == "操作成功") ? "success" : "error"; title: '成功',
that.$notify({ message: message,
title: '成功', type: type
message: message, });
type: type that.loadData();
}); }).catch((err) => {
that.loadData(); that.fullscreenLoading = false;
}) console.log(err);
, (function (err) { })
that.fullscreenLoading = false;
console.log(err);
})
);
}).catch((err) => { }).catch((err) => {
that.$notify({ that.$notify({
title: '失败', title: '失败',
......
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