//删除图片
handleRemove(file, fileList) {
console.log(file)
//调用服务端去删除课程图片信息,如果返回false,前端停止删除
//异步调用
return new Promise((resolve,rejct)=>{
courseApi.deleteCoursePic(this.courseid).then(res=>{
if(res.success){
//成功
resolve()
}else{
this.$message.error("删除失败");
//失败
rejct()
}
})
})
},
//post请求
requestPost (url, params = {}) {
return new Promise((resolve, reject) => {
axios.post(url, params).then(res => {
resolve(res.data) //被调用时走then分支,res.data就是then里面的参数
}).catch(error => {
reject(error)
})
})
},