This commit is contained in:
@fawn-nine
2024-08-23 18:10:27 +08:00
parent 497ab89dae
commit 57d5beaa72
11 changed files with 746 additions and 297 deletions

View File

@@ -2,50 +2,39 @@
<view style="min-height: calc(100vh - 120rpx); background-color: #ebf2f5;">
<z-nav-bar :title="pageName"></z-nav-bar>
<view class="pad20">
<view class="haveNoList">
根据教学时长,至少发布{{minNumber}}条作业
</view>
<view class="" v-if="taskList.length == 0">
<view class="listTitle">
<text>根据教学时长,须至少发布 {{minNumber}} 条作业</text>
</view>
<view class="addTips border_radius_10">
<view class="" >
<view class="flex_box flex_center" >
<text class="PM_font fangshi">生成方式</text><uni-icons type="help" size="18" @click="clickHelp"></uni-icons>
</view>
<view class="btnBox flex_box flex_center">
<text class="zidong border_radius_10" @click="autoCreate()">自动生成</text>
<text class="shoudong border_radius_10" @click="addTask()">手动创建</text>
</view>
</view>
</view>
</view>
<view v-if="taskList.length > 0 ">
<uni-section class="mb-10 mt-10 nobg" :title="'共'+total+'条数据'" type="line"></uni-section>
<view class="submitRecode">
<view class="newBox">
<view class="item " v-for="(item, index) in taskList" @click="clickTask(item)">
<view class="leve1 flex_box">
<text>{{item.title}}</text>
<view class="leve1 flex_box flex_between">
<text style="flex: 1;">{{item.title}}</text>
<text class="edit border_radius_10 small_btn" @click.stop="goEdit(item)">修改</text>
</view>
<view class="leve2 flex_box">
<!-- <view class="item">
<view class="">
<uni-icons type="checkmarkempty" size="18" color="#55aa7f"></uni-icons>
</view>
<view class="">
已交 <b>{{item.otherInfo.setGiveHomeWorkNumber}}</b>
</view>
</view>
<view class="item">
<view class="">
<uni-icons type="closeempty" size="18" color="#ff878d"></uni-icons>
</view>
<view class="">
未交 <b>{{item.otherInfo.setNoGiveHomeWorkNumber}}</b>
</view>
</view>
<view class="item">
<view class="">
<uni-icons type="auth" size="18" color="#55aa7f"></uni-icons>
</view>
<view class="">
已评分 <b>{{item.otherInfo.setGiveScoreNumber}}</b>
</view>
</view> -->
<view class="item flex_box" style="align-items: center;">
<view class="">
<uni-icons type="spinner-cycle" size="18" color="#ff878d"></uni-icons>
</view>
<view class="">
未评分 <b>{{item.otherInfo.setNoGiveScoreNumber}}</b>
</view>
</view>
<view class="leve2 ">
<view class="jianjie" v-html="item.content">
</view>
</view>
<view class="leve3">
<text class="border_radius_10 small_btn add" @click.stop="addTask(item)">在本条后面添加一条</text>
<text class="border_radius_10 small_btn del" @click.stop="delTask(item)">删除</text>
</view>
</view>
</view>
</view>
@@ -72,11 +61,14 @@
pageName: '',
taskList: [],
roleCode:'',
minNumber:undefined
minNumber:undefined,
classState:undefined,
total:0
}
},
onLoad(e) {
console.log('e',e);
this.classState = e.classState
this.classId = e.classId
this.minNumber = e.minNumber
this.pageType = e.type
@@ -107,19 +99,135 @@
this.getList()
// this.getList()
},
onBackPress() {
if (this.showRight || this.showLeft) {
this.$refs.showLeft.close()
this.$refs.showRight.close()
return true
}
},
methods: {
delTask(item){
console.log('删除');
$http.request({
url: "common/class/delClassTask",
method: "POST",
data: {
"taskId": item.id
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then(res => {
if(res.code == 0){
uni.showToast({
title:'删除成功',
icon:'success'
})
setTimeout(()=>{
this.pPage = 0
this.taskList = []
this.getList()
},2000)
}else{
uni.showToast({
title:'删除失败',
icon:'error'
})
}
})
.catch(e => {
uni.showToast({
title:'删除失败',
icon:'error'
})
})
},
// 是否继续自动成操作
confirOption(){
return new Promise((resolve, reject) => {
uni.showModal({
title:'提示',
content:'当前作业列表中存在数据,确定要清空并重新生成新的作业列表吗?',
cancelText:'点错了',
confirmText:'确定',
success: function (res) {
if (res.confirm) {
resolve(true)
} else if (res.cancel) {
resolve(false)
}
}
})
})
},
goAutoCreate(){
$http.request({
url: "common/class/generateClassTask",
method: "POST",
data: {
"classId": this.classId
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then(res => {
if(res.code == 0){
uni.showToast({
title:'生成成功',
icon:'success'
})
setTimeout(()=>{
this.pPage = 0
this.taskList = []
this.getList()
},2000)
}else{
uni.showToast({
title:'生成失败',
icon:'error'
})
}
})
.catch(e => {
uni.showToast({
title:'生成失败',
icon:'error'
})
})
},
async autoCreate(){
console.log('自动创建');
if(this.taskList.length > 0){
var isContinue = await this.confirOption()
if(isContinue){
this.goAutoCreate()
}
}else{
this.goAutoCreate()
}
},
goEdit(item){
uni.navigateTo({
url:`/pages/miniClass/addHomeWork?id=${item.id}&type=${item.type}`
})
},
addTask(item){
uni.navigateTo({
url: `/pages/miniClass/addHomeWork?classId=${this.classId}&sort=${item.sort}`
})
},
clickHelp(){
uni.showModal({
title:'说明',
content:"班内作业您可选择自动生成作业列表,或者手动逐一添加的方式来创建作业,其中需要注意的是如选择自动生成作业列表,会覆盖掉之前已经存在的作业内容。",
showCancel:false,
confirmText:'好的'
})
},
// 点击作业或者医案,进入作业提交情况
clickTask(item){
// console.log('options',options);
uni.navigateTo({
url:`/pages/miniClass/taskDetailForMan?id=${item.id}&roleCode=${this.roleCode}&type=${this.pageType}`
url:`/pages/miniClass/taskDetailForMan?id=${item.id}&roleCode=${this.roleCode}&type=${this.pageType}&classState=${this.classState}`
})
},
getList() {
@@ -149,10 +257,12 @@
})
.then(res => {
if (res.code == 0) {
this.total = 0
if (res.page.records.length > 0) {
console.log('数据获取成功', res.page.records);
var lis = res.page.records
this.taskList = this.taskList.concat(lis)
this.total = res.page.total
// this.taskList = taskLIst1.page.records // 测试数据
if (res.page.pages > this.pPage) {
this.status = 0;
@@ -182,7 +292,18 @@
<style lang="scss" scoped>
@import "@/style/mixin.scss";
.addTips{padding: 20rpx; background-color: #fff; }
.btnBox{
text{padding: 16rpx 10rpx; margin: 20rpx; display: block; color: #fff;}
.zidong{
background-color: #55aa00;
}
.shoudong{background-color:$themeColor;}
}
.fangshi{font-size: 36rpx; color: #666;}
.listTitle{
margin: 20rpx 0;
}
.example-body {
padding: 10px;
}
@@ -223,14 +344,15 @@
margin-bottom: 20rpx;
.leve1 {
align-items: center;
border-bottom: 1px dashed #eee;
padding-bottom: 20rpx;
margin-bottom: 20rpx;
// padding-bottom: 20rpx;
.edit{border:1px solid $themeColor; color: $themeColor;}
// .userName{}
}
.leve2 { justify-content: center;
color: #999; font-size: 24rpx;
.leve2 { justify-content: center; margin-top: 20rpx;
color: #999; font-size: 24rpx;border-top: 1px dashed #eee;
.jianjie{@include bov(2)}
b{font-size: 34rpx; padding: 0 4rpx; font-weight: normal; color: #333; color: red;}
.item{text-align: center; padding-top: 0; padding-bottom: 0; margin-bottom: 0;}
}
@@ -238,8 +360,9 @@
.leve3 {
color: $themeColor;
text-align: center;
padding-top: 10rpx;
padding-top: 10rpx; margin-top: 20rpx; margin-bottom: 10rpx;
.add{color: #ffaa7f; border: 1px solid #ffaa7f;}
.del{color: #ff557f; border: 1px solid #ff557f; margin-left: 20rpx;}
.tips {
width: 100%;
justify-content: space-between;
@@ -266,16 +389,7 @@
}
}
}
// 处理抽屉内容滚动
.scroll-view-box {
flex: 1;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
.info {
padding: 15px;
@@ -290,8 +404,5 @@
.info-content {
padding: 5px 15px;
}
.close {
padding: 10px;
}
</style>