修改学习作业 页面

This commit is contained in:
daihh
2022-11-16 18:40:19 +08:00
parent 57984216c7
commit b16222a82a
2 changed files with 48 additions and 40 deletions

View File

@@ -13,41 +13,43 @@
<view v-if="info.file && info.file!=''" class="homework-info">
<view class="homework-label">作业附件</view>
<view class="homework-value">
<a :href="fileBaseUrl+info.file" target="_blank">下载作业附件</a>
<a :href="fileBaseUrl+info.file" target="_blank" style="color: #387DF7;">下载作业附件</a>
</view>
</view>
<view class="homework-info">
<view class="homework-label">截止时间</view>
<view class="homework-value" :style="{color:close? 'red':''}">{{info.deadTime? info.deadTime: '无'}}</view>
</view>
<view>
<!-- <view>
<u-divider text="填写作业内容并提交"></u-divider>
</view>
<view class="homework-info" style="margin-right: 43rpx; ">
</view> -->
<view class="homework-info" v-if="info.submitMode!=2">
<view class="homework-label">上传附件</view>
<view class="homework-value">
<view >
<u--textarea :height="200" v-model="answer" placeholder="在此输入内容"></u--textarea>
</view>
<view style="padding-top:10px;">
<u-upload uploadIcon="plus" :fileList="fileList" @afterRead="afterRead" @delete="deleteFile" name="hwfile" :maxCount="1">
</u-upload>
</view>
<u-upload uploadIcon="plus" :fileList="fileList" @afterRead="afterRead" @delete="deleteFile" name="hwfile" :maxCount="1">
</u-upload>
</view>
</view>
<view class="homework-info" v-if="info.submitMode!=1">
<view class="homework-label">作业内容</view>
<view class="homework-value">
<u--textarea :height="200" v-model="answer" placeholder="在此输入内容"></u--textarea>
</view>
</view>
<view class="homework-btn">
<u-button type="primary" @click="submitHomework()" :text="records.length>0?'重新提交':'提交'"></u-button>
</view>
</view>
<!--作业提交记录-->
<view class="hwlist content" v-if="records.length>0">
<view v-for="record in records" :key="record.id">
<view style="display: flex;justify-content: space-between;">
<view style="color: #6b6b6b; ">已提交作业</view>
<view>{{record.endTime}}</view>
<view class="hwlist-row" v-for="record in records" :key="record.id">
<view class="hwlist-info-title">
<view></view>
<view class="hwlist-info-time">{{record.endTime}}</view>
</view>
<view>
<view style="padding: 20upx;">{{record.hwAnswer}}</view>
<view style="padding: 20upx 0upx;">{{record.hwAnswer}}</view>
<view v-if="record.filePath!=''">
<a :href="fileBaseUrl+record.filePath" target="_blank">作业附件</a>
</view>
@@ -127,8 +129,8 @@
contentId:this.content.id
}
apiCourseStudy.myHomeworkList(params).then(rs=>{
if(rs.status==200){
this.records=rs.result;
if(rs.status==200 && rs.result){
this.records=rs.result;
}
})
},
@@ -172,11 +174,11 @@
}
apiCourseStudy.saveHomework(pamars).then(res=>{
if(res.status==200){
this.$refs.messager.show({message:'作业已提交',type:'success'})
//this.$refs.messager.show({message:'作业已提交',type:'success'})
uni.showToast({title:'提交成功',type:'success'})
this.filePath='';
this.answer='';
this.records=[];
this.records.push(res.result);
this.records.push(res.result);
this.$emit("submit", this.content);
}else {
this.$message.error(res.message);
@@ -186,7 +188,7 @@
},
//删除文件
deleteFile(event) {
this[`fileList${event.name}`].splice(event.index, 1)
this.fileList.splice(event.index, 1)
},
//上传附件
async afterRead(event) {
@@ -208,41 +210,47 @@
<style lang="scss" scoped>
.homework {
padding-bottom: 10px;
padding: 0upx 20upx 20upx 20upx;
background-color: #fff;
.homework-info {
margin-right: 30upx;
border-bottom: 1px solid rgba(153,153,153,0.1);
.homework-label {
padding: 60rpx 43px 10rpx 40rpx;
padding-top: 10upx;
font-weight: 650;
font-size: 32rpx;
font-size: 32upx;
color: #444;
}
.homework-value {
padding-left: 70rpx;
padding: 32upx 0upx;
font-weight: 400;
font-size: 28rpx;
font-size: 28upx;
color: #787878;
word-break:break-all;
// background-color: #FFFFFF;
/deep/ .u-upload__button{
background: #fff;
}
// /deep/ textarea{
// //background: #F5F5F5;
// }
}
}
}
.u-textarea{
background-color: #F5F5F5;
}
.hwlist {
margin-bottom: 30px;
.hwlist-row {
display: flex;
line-height: 60upx;
border-bottom: 1px solid #d2d2d2;
.hwlist-time {
a{
text-decoration: none;
}
.hwlist-info-title {
display: flex;
justify-content: space-between;
color: #6b6b6b;
}
.hwlist-info-time {
color: #6c6c6c;
}

View File

@@ -1502,7 +1502,7 @@
}
.playbox{
padding: 10upx;
//background-color: #000000;
background-color: #fff;
}
.contentbox{
padding: 34upx;