|
|
@ -149,8 +149,8 @@ |
|
|
|
|
|
|
|
|
//上传接口地址 |
|
|
//上传接口地址 |
|
|
uploadApiUrl: ``, |
|
|
uploadApiUrl: ``, |
|
|
uploadImageApiUrl: `${Api_url}/file/image`, |
|
|
uploadImageApiUrl: `${Api_url}/memberUploadImage`,//图片上传接口 |
|
|
uploadVideoApiUrl: `${Api_url}/file/video`, |
|
|
uploadVideoApiUrl: `${Api_url}/memberUploadVideo`,//视频上传接口 |
|
|
|
|
|
|
|
|
member_info: {},//学生信息 |
|
|
member_info: {},//学生信息 |
|
|
|
|
|
|
|
|
@ -386,15 +386,15 @@ |
|
|
|
|
|
|
|
|
// 上传作业 |
|
|
// 上传作业 |
|
|
async submitJob(item) { |
|
|
async submitJob(item) { |
|
|
let type = item.content_type // 作业类型1图片2视频 |
|
|
let type = item.content_type // 作业类型1图片2视频3文本 |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
// 等待上传文件的返回结果 |
|
|
// 等待上传文件的返回结果 |
|
|
let uploadRes = await this.uploadFile(type) |
|
|
let uploadRes = await this.uploadFile(type) |
|
|
// console.log('上传结果', uploadRes) |
|
|
console.log('上传结果', uploadRes) |
|
|
|
|
|
|
|
|
// 检查上传结果 |
|
|
// 检查上传结果 |
|
|
if (!uploadRes.data.path) { |
|
|
if (!uploadRes.data.url) { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -402,22 +402,28 @@ |
|
|
let data = { |
|
|
let data = { |
|
|
id: item.id, // 作业列表id |
|
|
id: item.id, // 作业列表id |
|
|
student_file: uploadRes.data.path, // 附件 |
|
|
student_file: uploadRes.data.path, // 附件 |
|
|
student_file_type: type, // 作业类型1图片2视频 |
|
|
resources_id:this.member_info.id, // 学生资源id |
|
|
student_content: '', // 内容 |
|
|
content_text:uploadRes.data.url |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 提交作业 |
|
|
// 提交作业 |
|
|
await this.assignmentsSubmit(data) |
|
|
await this.assignmentsSubmit(data) |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
console.error('上传或提交作业失败:', error) |
|
|
console.error('上传或提交作业失败:', error) |
|
|
alert('上传或提交作业失败') |
|
|
//alert('上传或提交作业失败') |
|
|
|
|
|
//提示 |
|
|
|
|
|
uni.showToast({ |
|
|
|
|
|
title: '上传或提交作业失败', |
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
}) |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// 上传单文件(视频/图片) type=作业类型1图片2视频 |
|
|
// 上传单文件(视频/图片) type=作业类型1图片2视频3文本 |
|
|
async uploadFile(type) { |
|
|
async uploadFile(type) { |
|
|
return new Promise((resolve, reject) => { |
|
|
return new Promise((resolve, reject) => { |
|
|
if (type == 1) { |
|
|
if (type == 1) { |
|
|
|
|
|
//图片作业 |
|
|
this.uploadApiUrl = this.uploadImageApiUrl |
|
|
this.uploadApiUrl = this.uploadImageApiUrl |
|
|
uni.chooseImage({ |
|
|
uni.chooseImage({ |
|
|
count: 1, |
|
|
count: 1, |
|
|
@ -437,7 +443,8 @@ |
|
|
reject(error) |
|
|
reject(error) |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
} else { |
|
|
} else if(type == 2){ |
|
|
|
|
|
//视频作业 |
|
|
this.uploadApiUrl = this.uploadVideoApiUrl |
|
|
this.uploadApiUrl = this.uploadVideoApiUrl |
|
|
uni.chooseVideo({ |
|
|
uni.chooseVideo({ |
|
|
count: 1, |
|
|
count: 1, |
|
|
@ -506,12 +513,11 @@ |
|
|
// 提交作业接口 |
|
|
// 提交作业接口 |
|
|
async assignmentsSubmit(item) { |
|
|
async assignmentsSubmit(item) { |
|
|
let data = { |
|
|
let data = { |
|
|
id: item.id, // 作业列表id |
|
|
resources_id:item.resources_id, // 学生资源id |
|
|
student_file: item.student_file, // 附件 |
|
|
id:item.id, |
|
|
student_file_type: item.student_file_type, // 作业类型1图片2视频 |
|
|
content_text:item.content_text |
|
|
student_content: item.student_content, // 内容 |
|
|
|
|
|
} |
|
|
} |
|
|
let res = await memberApi.assignmentsSubmit(data) |
|
|
let res = await apiRoute.xy_assignmentSubmitObj(data) |
|
|
if (res.code != 1) { |
|
|
if (res.code != 1) { |
|
|
uni.showToast({ |
|
|
uni.showToast({ |
|
|
title: res.msg, |
|
|
title: res.msg, |
|
|
@ -832,7 +838,6 @@ |
|
|
margin-top: 20rpx; |
|
|
margin-top: 20rpx; |
|
|
border-radius: 15rpx; |
|
|
border-radius: 15rpx; |
|
|
.video{ |
|
|
.video{ |
|
|
border: 1px solid red; |
|
|
|
|
|
width: 100%; |
|
|
width: 100%; |
|
|
border-radius: 15rpx; |
|
|
border-radius: 15rpx; |
|
|
} |
|
|
} |
|
|
|