This commit is contained in:
@fawn-nine
2024-08-08 16:41:29 +08:00
parent 784e771fb8
commit c753ab18a3
10 changed files with 1131 additions and 384 deletions

View File

@@ -2,65 +2,142 @@
<view>
<!-- 公共组件-每个页面必须引入 -->
<public-module></public-module>
<z-nav-bar title="主任教学">
<!-- <view class="curseSet" slot="right" @click="shuomingPage('/pages/course/courseSet',tagId,pid)"> -->
<!-- <uni-icons type="info" size="24"></uni-icons> 课程说明</view> -->
</z-nav-bar>
<z-nav-bar title="我的班级">
</z-nav-bar>
<!-- <view class="tabsBox" :class="[fixed ? 'fixed' : '' ]">
<u-tabs v-if="tabList.length > 0" :class="['tabList']" @click="fatherClick" :current="curTagId"
:activeStyle="activeStyle" :scrollable="scrollable" :list="tabList"
itemStyle="padding-left: 15px; background-color:#fff; padding-right: 15px; height: 50px;"></u-tabs>
</view> -->
</view> -->
<view class="containerBg">
<view class="subCate flex" v-if="subList.length> 0">
<text :class="['item',subTabId == item.id ? 'active' : '']" v-for="(item, index) in subList"
<view class="subCate flex" v-if="subList1.length> 0">
<text :class="['item',subTabId == item.id ? 'active' : '']" v-for="(item, index) in subList1"
@click="curseClick(item)" :key="index">{{item.title}}</text>
</view>
<view class="learnBox box">
<view class="newBox" v-if="classList.length > 0">
<view class="item flexbox" v-for="(item, index) in classList" :key="index" @click="onPageJump('/pages/miniClass/classInfo',item.id)">
<!-- <view class="imgcontainer" :style="{backgroundImage:surl(item.image)}"> -->
<view class="imgcontainer" v-if="item.icon != ''">
<image :src="item.icon" mode="aspectFit"></image>
</view>
<view class="imgcontainer defaultImg" v-else>
<image src="@/static/my_04.png" mode="aspectFit"></image>
</view>
<view class="buyItems" >
<view class="">
<text >联合班</text>
<text v-show="item.type == 0">普通班</text>
<text v-show="item.type == 1">联合班</text>
<text v-show="item.type == 2">精英班</text>
<text class="txt555" @click="onPageJump('/pages/miniClass/classInfo',item.id)">
{{item.title}}
</text>
</view>
<view class="jianjie">
目标学员人数{{item.number}}
<view class="" v-show="subTabId == 0">
<view class="" v-if="preClassList.length > 0">
<!-- 待开班 -->
<uni-section class="mb-10 nobg" title="待开班" type="line"></uni-section>
<view class="888">
<view class="newBox" v-if="preClassList.length > 0">
<view class="item flexbox" v-for="(item, index) in preClassList" :key="index"
@click="onPageJump('/pages/miniClass/classInfo',item.id)">
<!-- <view class="imgcontainer" :style="{backgroundImage:surl(item.image)}"> -->
<view class="imgcontainer" v-if="item.icon != ''">
<image :src="item.icon" mode="aspectFit"></image>
</view>
<view class="imgcontainer defaultImg" v-else>
<image src="@/static/my_04.png" mode="aspectFit"></image>
</view>
<view class="buyItems">
<view class="">
<text v-show="item.classModel.type == 0">普通班</text>
<text v-show="item.classModel.type == 1">联合班</text>
<text v-show="item.classModel.type == 2">精英班</text>
<text class="txt555" @click="onPageJump('/pages/miniClass/classInfo',item.id)">
{{item.title}}
</text>
</view>
<view class="jianjie">
目标学员人数{{item.number}}
</view>
<!-- <view class="jianjie" v-html="item.content">
</view> -->
<view class="btn_box">
<!-- <text @click="enterClass" v-show="item.state == '0'">一键加入</text> -->
<text class="seeInfo">进入班级</text>
</view>
</view>
</view>
<!-- <view class="jianjie" v-html="item.content">
</view> -->
<view class="btn_box" >
<!-- <text @click="enterClass" v-show="item.state == '0'">一键加入</text> -->
<text class="seeInfo">进入班级</text>
</view>
</view>
</view>
</view>
</view>
<u-divider v-else text="暂无数据"></u-divider>
<!-- <u-divider v-show="status == 2" text="已加载全部"></u-divider>
<u-divider v-show="status == 3" text="暂无数据"></u-divider>
<u-divider v-show="status == 1" text="加载中..."></u-divider> -->
</view>
<view>
<!-- <u-back-top scroll-top="100"></u-back-top> -->
<u-back-top :scroll-top="scrollTop" bottom="150" :customStyle='bgiStyle'
:iconStyle="iconStyle"></u-back-top>
<view class="" v-if="learningClassList.length > 0">
<uni-section class="mb-10 nobg" title="学习中" type="line"></uni-section>
<view class="learnBox box">
<view class="newBox" v-if="learningClassList.length > 0">
<view class="item flexbox" v-for="(item, index) in learningClassList" :key="index"
@click="onPageJump('/pages/miniClass/classInfo',item.id)">
<!-- <view class="imgcontainer" :style="{backgroundImage:surl(item.image)}"> -->
<view class="imgcontainer" v-if="item.icon != ''">
<image :src="item.icon" mode="aspectFit"></image>
</view>
<view class="imgcontainer defaultImg" v-else>
<image src="@/static/my_04.png" mode="aspectFit"></image>
</view>
<view class="buyItems">
<view class="">
<text v-show="item.classModel.type == 0">普通班</text>
<text v-show="item.classModel.type == 1">联合班</text>
<text v-show="item.classModel.type == 2">精英班</text>
<text class="txt555" @click="onPageJump('/pages/miniClass/classInfo',item.id)">
{{item.title}}
</text>
</view>
<view class="jianjie">
目标学员人数{{item.number}}
</view>
<!-- <view class="jianjie" v-html="item.content">
</view> -->
<view class="btn_box">
<!-- <text @click="enterClass" v-show="item.state == '0'">一键加入</text> -->
<text class="seeInfo">进入班级</text>
</view>
</view>
</view>
</view>
</view>
</view>
<u-divider v-if="preClassList.length == 0 && learningClassList.length == 0" text="暂无数据"></u-divider>
</view>
<z-navigation></z-navigation>
<!-- <music-play :playData="playData"></music-play> -->
<!-- 过期班级 -->
<view class="" v-show="subTabId == 2">
<view class="learnBox box">
<view class="newBox" v-if="classList.length > 0">
<view class="item flexbox" v-for="(item, index) in classList" :key="index"
@click="onPageJump('/pages/miniClass/classInfo',item.id)">
<!-- <view class="imgcontainer" :style="{backgroundImage:surl(item.image)}"> -->
<view class="imgcontainer" v-if="item.icon != ''">
<image :src="item.icon" mode="aspectFit"></image>
</view>
<view class="imgcontainer defaultImg" v-else>
<image src="@/static/my_04.png" mode="aspectFit"></image>
</view>
<view class="buyItems">
<view class="">
<text v-show="item.classModel.type == 0">普通班</text>
<text v-show="item.classModel.type == 1">联合班</text>
<text v-show="item.classModel.type == 2">精英班</text>
<text class="txt555" @click="onPageJump('/pages/miniClass/classInfo',item.id)">
{{item.title}}
</text>
</view>
<view class="jianjie">
目标学员人数{{item.number}}
</view>
<!-- <view class="jianjie" v-html="item.content">
</view> -->
<view class="btn_box">
<!-- <text @click="enterClass" v-show="item.state == '0'">一键加入</text> -->
<text class="seeInfo">进入班级</text>
</view>
</view>
</view>
</view>
<u-divider v-else text="暂无数据"></u-divider>
</view>
<view>
<!-- <u-back-top scroll-top="100"></u-back-top> -->
<u-back-top :scroll-top="scrollTop" bottom="150" :customStyle='bgiStyle'
:iconStyle="iconStyle"></u-back-top>
</view>
</view>
</view>
<z-navigation></z-navigation>
</view>
</template>
@@ -75,16 +152,27 @@
data() {
return {
playData: {},
addType:undefined, // 小班类型
range:[
{ value: '0', text: "普通小班",name:"普通小班"},
{ value: '1', text: "联合班" ,name:"普通小班"},
{ value: '2', text: "精英班" ,name:"普通小班"},
addType: undefined, // 小班类型
range: [{
value: '0',
text: "普通小班",
name: "普通小班"
},
{
value: '1',
text: "联合班",
name: "普通小班"
},
{
value: '2',
text: "精英班",
name: "普通小班"
},
],
tagId: null,
pid:null,
pid: null,
fixed: false,
pupShow:false,
pupShow: false,
fatherTabId: null,
subTabId: null, //
bgiStyle: {
@@ -103,17 +191,43 @@
// backgroundColor: '#258feb'
},
subList: [{title:'待开班',id:'0'},{title:'已开班',id:'1'},{title:'已结班',id:'2'}],
subList1: [{
title: '进行中',
id: '0'
}, {
title: '已结班',
id: '2'
}],
subList: [{
title: '待开班',
id: '0'
}, {
title: '已开班',
id: '1'
}, {
title: '已结班',
id: '2'
}],
scrollable: false,
pageTitle: '',
tabList: [
{name:'普通小班', id:'0'},{name:'联合班', id:'1'},{name:'精英班',id:'2'}],
tabList: [{
name: '普通小班',
id: '0'
}, {
name: '联合班',
id: '1'
}, {
name: '精英班',
id: '2'
}],
curTagId: 0,
classList: [],
classList: [], // 已结班
preClassList: [], // 待开班
learningClassList: [], // 在学习的班级
status: 3, // 0 不显示, 1 加载中2 加载全部完成3 暂无数据
page: 1,
flag: true, // 函数是否执行完
};
},
//第一次加载
@@ -126,7 +240,7 @@
this.pageTitle = e.title
this.pid = e.pid
console.log(e, '传入分类id')
this.getData()
// this.getData()
// this.getCateList(this.tagId)
},
onPageScroll(e) {
@@ -160,6 +274,7 @@
onShow() {
// 隐藏原生的tabbar
// uni.hideTabBar();
this.getLearingClassList()
},
components: {
musicPlay
@@ -167,63 +282,29 @@
//方法
methods: {
// 加入班级
enterClass(){
enterClass() {
},
selectChange(e){
selectChange(e) {
console.log("e:", e);
},
closePup(){
closePup() {
this.pupShow = false
},
surl(imageurl) {
return `url(${imageurl})`
},
goCreateClass(){
console.log('this.addType',this.addType);
if(this.addType != undefined){
uni.navigateTo({
url:`/pages/miniClass/addClass?type=${this.addType}&name=add`
})
}else{
uni.showToast({
title:'请选择班级的类型',
icon:'none'
})
return
}
},
fatherClick(e) {
console.log('点击', e)
this.page = 1
// var item = e
this.curTagId = e.id
this.subTabId = this.subList[0].id
this.getData(this.subTabId);
},
curseClick(item) {
this.subTabId = item.id
this.classList = []
this.page = 1
this.getData(this.subTabId);
},
getData(id) {
if (!this.flag) {
console.log('正在执行,未完成')
return
}
this.status = 1
this.flag = false
// 待开班
getPreClassList() {
uni.showLoading({
title:'正在加载'
title: "加载中"
})
$http.request({
url: "common/class/MyClassList",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
"state": this.subTabId, //小班状态0待开班1已开班2完成
"type": '' // 班类型 0小班 1联合班 2精英班
"state": '0', //小班状态0待开班1已开班2完成
"type": '' // 班类型 0小班 1联合班 2精英班
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
@@ -232,11 +313,122 @@
.then(res => {
if (res.code == 0) {
if (res.result.length > 0) {
this.classList = res.result
}else{
this.preClassList = res.result
} else {
this.preClassList = []
}
}
uni.hideLoading()
this.getData()
}).catch(e => {
uni.hideLoading()
this.getData()
console.log(e, '数据报错')
// this.status = 3
uni.showToast({
title: `获取数据失败`,
icon: 'error'
})
});
},
// 学习中
getLearingClassList() {
uni.showLoading({
title: "加载中"
})
$http.request({
url: "common/class/MyClassList",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
"state": '1', //小班状态0待开班1已开班2完成
"type": '' // 班类型 0小班 1联合班 2精英班
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then(res => {
if (res.code == 0) {
if (res.result.length > 0) {
this.learningClassList = res.result
} else {
this.learningClassList = []
}
}
this.getPreClassList()
uni.hideLoading()
}).catch(e => {
uni.hideLoading()
this.getPreClassList()
console.log(e, '数据报错')
// this.status = 3
uni.showToast({
title: `获取数据失败`,
icon: 'error'
})
});
},
goCreateClass() {
console.log('this.addType', this.addType);
if (this.addType != undefined) {
uni.navigateTo({
url: `/pages/miniClass/addClass?type=${this.addType}&name=add`
})
} else {
uni.showToast({
title: '请选择班级的类型',
icon: 'none'
})
return
}
},
fatherClick(e) {
console.log('点击', e)
this.page = 1
// var item = e
this.curTagId = e.id
this.subTabId = this.subList[0].id
this.getData(this.subTabId);
},
curseClick(item) {
this.subTabId = item.id
// this.classList = []
// this.page = 1
// this.getData(this.subTabId);
},
getData(id) {
if (!this.flag) {
console.log('正在执行,未完成')
return
}
this.status = 1
this.flag = false
uni.showLoading({
title: '正在加载'
})
$http.request({
url: "common/class/MyClassList",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
"state": '2', //小班状态0待开班1已开班2完成
"type": '' // 班类型 0小班 1联合班 2精英班
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then(res => {
if (res.code == 0) {
if (res.result.length > 0) {
this.classList = res.result
} else {
this.classList = []
}
}
this.flag = true
}
uni.hideLoading()
@@ -246,20 +438,20 @@
console.log(e, '数据报错')
// this.status = 3
uni.showToast({
title:`获取数据失败`,
icon:'error'
title: `获取数据失败`,
icon: 'error'
})
});
},
// 跳转
onPageJump(url,id,have) {
onPageJump(url, id, have) {
// console.log('进来了',url,id);
uni.navigateTo({
url: `${url}?id=${id}&have=${have}`
});
},
shuomingPage(url,id,pid){
shuomingPage(url, id, pid) {
uni.navigateTo({
url: `${url}?id=${id}&pid=${pid}`
});
@@ -269,43 +461,65 @@
</script>
<style lang="scss" scoped>
@import '@/style/mixin.scss';
/deep/.uni-select__selector{
top:unset;
bottom:calc(100% + 12px) ;
}
/deep/.uni-select{
border: none;
}
/deep/.uni-select__input-text{
font-size:14px;
color:#7f7f7f //修改为你的字体颜色
}
/deep/.uni-select__input-placeholder{
font-size:14px;
color:#7f7f7f //修改为你的字体颜色
}
/deep/.uni-popper__arrow{
top:unset;
bottom: -6px;
transform: rotate(180deg);
}
/deep/.uni-popper__arrow::after{
top:0
}
.box6{
.btnBox{justify-content: center;}
/deep/.uni-select__selector {
top: unset;
bottom: calc(100% + 12px);
}
/deep/.uni-select {
border: none;
}
/deep/.uni-select__input-text {
font-size: 14px;
color: #7f7f7f //修改为你的字体颜色
}
/deep/.uni-select__input-placeholder {
font-size: 14px;
color: #7f7f7f //修改为你的字体颜色
}
/deep/.uni-popper__arrow {
top: unset;
bottom: -6px;
transform: rotate(180deg);
}
/deep/.uni-popper__arrow::after {
top: 0
}
.nobg {
background-color: transparent !important;
}
.box6 {
.btnBox {
justify-content: center;
}
}
.containerBg {
// background-color: $containerColor;
background-color: #f6f6f8;
padding: 0 20rpx;
}
.curseSet{margin-right: 20rpx; font-size: 28rpx; display: flex; align-items: center;}
.curseSet {
margin-right: 20rpx;
font-size: 28rpx;
display: flex;
align-items: center;
}
.fixed {
position: fixed;
z-index: 1; width: 100%; background-color: #fff;
z-index: 1;
width: 100%;
background-color: #fff;
}
.newBox {
@@ -334,21 +548,36 @@
height: 200rpx;
}
}
.btn_box{ text-align: right;
text{
.btn_box {
text-align: right;
text {
border-radius: 20rpx;
padding: 3px 5px; @include theme("btn_bg");
font-size: 28rpx; color: #fff;
padding: 3px 5px;
@include theme("btn_bg");
font-size: 28rpx;
color: #fff;
}
.seeInfo {
background-color: #fff;
background-image: none;
border: 1px solid #666;
color: #333;
margin-left: 20rpx;
}
.seeInfo{background-color:#fff; background-image: none; border: 1px solid #666; color: #333; margin-left: 20rpx;}
}
.buyItems {
width: 60%;
}
.jianjie {
line-height: 30rpx; height: 60rpx; overflow: hidden;
overflow: hidden!important;
line-height: 30rpx;
height: 60rpx;
overflow: hidden;
overflow: hidden !important;
margin-top: 10rpx;
font-size: 24rpx;
@include bov();
@@ -364,16 +593,18 @@
}
.subCate {
padding-top:10px;
padding-top: 10px;
padding-bottom: 10px;
display: flex;
.item {
.item {
border: 1px solid #bfcad9;
display: inline-block;
text-align: center;
font-size: 26rpx;
background-color: #fff;
border-radius: 4px; width: 100%;
border-radius: 4px;
width: 100%;
color: #333;
margin-right: 16rpx;
padding: 14rpx 30rpx;
@@ -401,7 +632,7 @@
.imgcontainer {
background-color: $imgBg;
}
.box {
// background-color: #fff;
min-height: calc(100vh - 270rpx);