qingnianyexiao2.0/packageA/center/teacherClass.vue
2025-04-01 09:03:51 +08:00

509 lines
9.9 KiB
Vue

<template>
<view class="box flex justify-center align-items flex-column">
<view class="search flex align-items">
<span class="dashed">
<image src="../../static/center/search.png" mode=""></image>
</span>
<span class="line-search"></span>
<input type="text" placeholder="搜索教师课程" v-model="keywords" class="input" placeholder-class="plasty" />
<span class="searchBtn" @click.stop="search()">搜索</span>
</view>
<view class="con-center flex flex-column justify-center align-items">
<view class="centerBox flex justify-start align-items flex-column" v-if="list.length != 0">
<view class="flex w-100 center flex-column" style="align-items: center;" v-for="(item,index) in list"
:key="index" @click.stop="openUrl('/pages/center/detail?id='+item.id)" >
<view class="flex" style="width: 690rpx;">
<image :src="item.headimage" mode="" style="width: 280rpx; height: 200rpx;border-radius: 12rpx;"></image>
<view class="flex flex-column rightBox">
<span class="name">{{item.title}}</span>
<!-- <span class="line-row"></span> -->
<span class="minge">{{'开始时间 ' + item.start_time_text}}</span>
<span class="minge">{{'结束时间 ' + item.end_time_text}}</span>
<span class="money" v-if="item.feel == 0">
<span>课程价格:</span>
{{'¥' + item.price}}</span>
<span class="charge" v-if="item.feel == 1" >
免费
</span>
</view>
</view>
<!-- <span class="error" v-if="item.auth_status == 2">审核失败:{{item.reason}}</span> -->
<span class="box-line"></span>
</view>
</view>
<view class="" v-else>
<u-empty
mode="list"
icon="http://cdn.uviewui.com/uview/empty/list.png"
>
</u-empty>
</view>
</view>
<u-loadmore :status="loadStatus" />
</view>
</template>
<script>
export default {
data() {
return {
size: 13,
page: 1,
limit: 10,
loadStatus: 'loading',
list: [],
last_page:0,
keywords:''
};
},
// onLoad() {
// this.getList();
// },
onShow() {
this.page = 1
this.list = []
this.getList();
},
onReachBottom() {
if (this.page < this.last_page) {
this.page++;
this.getList();
}
},
methods: {
openUrl(url) {
uni.navigateTo({
url: url
})
},
search(){
this.resetLists()
this.getList()
},
resetLists(){
this.page = 1;
this.list = [];
this.loadStatus = 'loading'
},
// 获取课程列表
getList() {
// if (this.loadStatus === 'nomore') return;
uni.$u.http.get('/api/school/classes/classes_list', {
params: {
page: this.page,
limit: this.limit,
order: 'normal',
keywords:this.keywords,
teacher_id:this.id,
is_expire: 2
}
}).then(res => {
if (res.code == 1) {
this.last_page = res.data.list.last_page
this.list = [...this.list, ...res.data.list.data];
if (this.list.length >= res.data.list.total) {
this.loadStatus = 'nomore';
} else {
this.loadStatus = 'loading';
}
} else {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
});
this.loadStatus = 'loading';
}
}).catch(error => {
console.error('请求失败', error);
this.loadStatus = 'loading';
});
},
}
}
</script>
<style lang="scss" scoped>
.box {
background: linear-gradient(to bottom, #F1F2F8 0%, #FFFFFF 5%, #FFFFFF 100%);
.con-center {
width: 690rpx;
margin-top: 25rpx;
.centerBack {
position: fixed;
width: 100%;
height: 100%;
top: 25rpx;
left: 0;
z-index: -1;
}
.header {
height: 50rpx;
margin-top: 37rpx;
.s-header {
width: 104rpx;
height: 50rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 400;
font-size: 28rpx;
color: #9E9E9E;
line-height: 26rpx;
}
.s-header.selected {
width: 104rpx;
height: 50rpx;
background: #008CFF;
border-radius: 12rpx 12rpx 12rpx 12rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 800;
font-size: 28rpx;
color: #FFFFFF;
line-height: 26rpx;
}
}
}
}
.w-100 {
width: 100%;
}
.flex {
display: flex;
}
.flex-start {
align-items: flex-start;
}
.justify-center {
justify-content: center;
}
.align-items {
align-items: center;
}
.flex-column {
flex-flow: column;
}
.justify-start {
justify-content: start;
}
.line {
margin-top: 12rpx;
width: 690rpx;
height: 1rpx;
background: #008CFF;
border-radius: 0rpx 0rpx 0rpx 0rpx;
}
.centerBox {
width: 690rpx;
.error {
width: 100%;
word-break: break-all;
}
.box-line {
width: 400rpx;
height: 1rpx;
background: #D9D9D9;
border-radius: 0rpx 0rpx 0rpx 0rpx;
margin-top: 52rpx;
}
.center {
margin: 32rpx 0 32rpx 0;
}
.rightBox {
margin-left: 24rpx;
width: 378rpx;
.line-row {
width: 382rpx;
height: 1rpx;
background: #D9D9D9;
box-shadow: 1rpx 1rpx 0rpx 0rpx rgba(102, 102, 102, 0.25);
margin: 14rpx 0 6rpx 0;
}
.name {
font-weight: 800;
font-size: 36rpx;
color: #343434;
margin-bottom: 24rpx;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
/* 设置行数 */
overflow: hidden;
text-overflow: ellipsis;
word-break: break-all;
/* 防止单词被截断 */
}
.minge {
font-weight: 500;
font-size: 24rpx;
color: #7A7A7A;
margin-bottom: 14rpx;
}
.pass {
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 26rpx;
color: #34DC12;
}
.full {
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 24rpx;
color: #FF2323;
}
.money {
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 24rpx;
color: #FF2323;
span {
font-weight: 500;
font-size: 24rpx;
color: #7A7A7A;
}
}
.Cancel {
width: 138rpx;
height: 48rpx;
border-radius: 12rpx 12rpx 12rpx 12rpx;
background: #008CFF;
font-family: PingFang SC, PingFang SC;
font-weight: 800;
font-size: 24rpx;
color: #FFFFFF;
line-height: 32rpx;
letter-spacing: 4px;
display: flex;
align-items: center;
justify-content: center;
align-self: flex-end;
}
.make {
width: 138rpx;
height: 48rpx;
background: #008CFF;
border-radius: 12rpx 12rpx 12rpx 12rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 800;
font-size: 24rpx;
color: #FFFFFF;
line-height: 32rpx;
letter-spacing: 4px;
display: flex;
align-items: center;
justify-content: center;
align-self: flex-end;
margin-left: 16rpx;
}
.QR {
width: 138rpx;
height: 48rpx;
background: #4974FF;
box-shadow: 2rpx 2rpx 0rpx 0rpx rgba(0, 0, 0, 0.4);
border-radius: 8rpx 8rpx 8rpx 8rpx;
font-weight: 400;
font-size: 26rpx;
color: #EAEAEA;
display: flex;
align-items: center;
justify-content: center;
align-self: flex-end;
margin-top: 50rpx;
}
}
}
.charge {
font-family: PingFang SC, PingFang SC;
font-weight: 800;
font-size: 28rpx;
color: #FF2323;
line-height: 32rpx;
}
.search {
margin-top: 24rpx;
width: 690rpx;
height: 64rpx;
background: #FFFFFF;
box-shadow: 2rpx 2rpx 0rpx 0rpx rgba(0, 0, 0, 0.4);
border-radius: 8rpx 8rpx 8rpx 8rpx;
border: 2rpx solid #008CFF;
.dashed {
image {
width: 52rpx;
height: 52rpx;
}
}
.line-search {
width: 2rpx;
height: 42rpx;
background: #008CFF;
border-radius: 0rpx 0rpx 0rpx 0rpx;
}
.input {
// border: 4rpx solid #EAEAEA;
padding-left: 12rpx;
height: 100%;
width: 100%;
}
/deep/ .input-placeholder {
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 32rpx;
color: #C0C0C0;
line-height: 32rpx;
text-align: left;
font-style: normal;
text-transform: none;
}
.searchBtn{
width: 128rpx;
height: 64rpx;
background: #008CFF;
border-radius: 5rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 32rpx;
color: #FFFFFF;
display: flex;
justify-content: center;
align-items: center;
}
}
.popup {
.header {
margin-left: 24rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 800;
font-size: 42rpx;
color: #008CFF;
margin-top: 34rpx;
width: 690rpx;
}
.line-row {
width: 690rpx;
height: 1rpx;
background: #D9D9D9;
margin: 11rpx 0 31rpx 0;
}
.pop-center {
.left {}
.right {
margin-left: 30rpx;
.title {
width: 340rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 800;
font-size: 34rpx;
color: #343434;
}
}
}
.line-short {
width: 400rpx;
height: 1rpx;
background: #D9D9D9;
}
.popList {
justify-content: space-between;
width: 600rpx;
margin-top: 32rpx;
.hei {
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 26rpx;
color: #343434;
}
}
.pop-btn {
width: 690rpx;
margin-top: 62rpx;
justify-content: space-around;
.Cancel {
width: 306rpx;
height: 80rpx;
border-radius: 401rpx 401rpx 401rpx 401rpx;
border: 2rpx solid #008CFF;
font-family: PingFang SC, PingFang SC;
font-weight: 800;
font-size: 34rpx;
color: #008CFF;
}
.Confirm {
width: 306rpx;
height: 80rpx;
background: #008CFF;
border-radius: 401rpx 401rpx 401rpx 401rpx;
font-family: PingFang SC, PingFang SC;
font-weight: 800;
font-size: 34rpx;
color: #FFFFFF;
}
}
}
.hui {
font-family: PingFang SC, PingFang SC;
font-weight: 500;
font-size: 24rpx;
color: #7A7A7A;
}
.white-space {
overflow: hidden;
/* 确保超出容器的文本被隐藏 */
white-space: nowrap;
/* 确保文本在一行内显示 */
text-overflow: ellipsis;
/* 使用省略号表示被截断的文本 */
}
</style>