This commit is contained in:
@fawn-nine
2024-08-20 17:38:17 +08:00
parent 253e0ce0a3
commit 1179b63ae0
12 changed files with 1115 additions and 410 deletions

View File

@@ -271,10 +271,13 @@
...mapState(['userInfo'])
},
//页面显示
onShow() {
async onShow() {
// 隐藏原生的tabbar
// uni.hideTabBar();
this.getLearingClassList()
this.classList = await this.getData('0','2')
this.learningClassList = await this.getData('0','1')
this.preClassList = await this.getData('0','0')
// this.getLearingClassList()
},
components: {
musicPlay
@@ -293,84 +296,8 @@
},
surl(imageurl) {
return `url(${imageurl})`
},
// 待开班
getPreClassList() {
uni.showLoading({
title: "加载中"
})
$http.request({
url: "common/class/MyClassList",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
"state": '0', //小班状态0待开班1已开班2完成
"type": '' // 班类型 0小班 1联合班 2精英班
},
header: { //默认 无 说明:请求头
'Content-Type': 'application/json'
},
})
.then(res => {
if (res.code == 0) {
if (res.result.length > 0) {
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) {
@@ -399,22 +326,25 @@ this.getData()
// this.page = 1
// this.getData(this.subTabId);
},
getData(id) {
if (!this.flag) {
console.log('正在执行,未完成')
return
}
async getData(role,state) {
// if (!this.flag) {
// console.log('正在执行,未完成')
// return
// }
var _list = []
this.status = 1
this.flag = false
// this.flag = false
uni.showLoading({
title: '正在加载'
})
$http.request({
await $http.request({
url: "common/class/MyClassList",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data: {
"state": '2', //小班状态0待开班1已开班2完成
"role": role,
"state": state, //小班状态0待开班1已开班2完成
"type": '' // 班类型 0小班 1联合班 2精英班
},
header: { //默认 无 说明:请求头
@@ -424,17 +354,18 @@ this.getData()
.then(res => {
if (res.code == 0) {
if (res.result.length > 0) {
this.classList = res.result
// this.classList = res.result
_list = res.result
} else {
this.classList = []
// this.classList = []
_list = []
}
this.flag = true
// this.flag = true
}
uni.hideLoading()
}).catch(e => {
uni.hideLoading()
this.flag = true
// this.flag = true
console.log(e, '数据报错')
// this.status = 3
uni.showToast({
@@ -442,6 +373,7 @@ this.getData()
icon: 'error'
})
});
return _list
},
// 跳转
onPageJump(url, id, have) {