Browse Source

新增加载下一页

master
liutong 1 year ago
parent
commit
e790d04f6d
  1. 299
      pages/student/timetable/index.vue

299
pages/student/timetable/index.vue

@ -9,47 +9,19 @@
<view class="main_section">
<view class="section_1">
<view class="ul">
<view class="li">
<text>周日</text>
<text>14</text>
<text></text>
</view>
<view class="li">
<text>周一</text>
<text>14</text>
<text></text>
</view>
<view class="li">
<text>周二</text>
<text>14</text>
<text></text>
</view>
<view class="li">
<text>周日</text>
<text class="today"></text>
<text class=""></text>
</view>
<view class="li">
<text>周一</text>
<text>14</text>
<text class="select_plan"></text>
</view>
<view class="li">
<text>周二</text>
<text>14</text>
<text></text>
</view>
<view class="li">
<text>周二</text>
<text>14</text>
<text></text>
<view class="li" v-for="(v,k) in dateList" :key="k" @click="selectDate(v.date)">
<text>{{v.name}}</text>
<text :class="[filteredData.schedule_date == v.date ? 'today':'']">{{today == v.date ? '今':v.today}}</text>
<text :class="[today == v.date ?'select_plan':'']"></text>
</view>
</view>
</view>
<view class="section_2">
<view class="item_box">
XXX体育场馆
{{venuesInfo.name}}
</view>
<view class="item_box" style="text-align: right;color: #F59A23;" @click="more">
更多
@ -57,49 +29,15 @@
</view>
<view class="section_3">
<scroll-view
class="section_3"
scroll-y="true"
:lower-threshold="lowerThreshold"
@scrolltolower="loadMoreData"
style="height: 100vh;"
>
<view class="ul">
<view class="li" @click="openViewCourseInfo({id:1})">
<view class="top_box">
<view class="center_box">
<view>班级少年班</view>
<view>时间2020-05-25 15:30 - 17:30</view>
<view>课室302
</view>
<view>课程篮球少儿课
</view>
</view>
<view class="right_box">
<view class="tag" style="background:#fad24e;">上课中</view>
<!-- <view class="tag" style="background:#1cd188;">待上课</view>-->
</view>
</view>
<view class="bottom_box">
<view class="hint">
已签到学生 (15/34)
</view>
<view class="list_box">
<view class="list">
<view class="itme">
<image src="http://www.firstui.cn:4000/vipdoc/img/img_logo.png"></image>
</view>
<view class="itme">
<image src="http://www.firstui.cn:4000/vipdoc/img/img_logo.png"></image>
</view>
<view class="itme">
<image src="http://www.firstui.cn:4000/vipdoc/img/img_logo.png"></image>
</view>
<view class="itme">
<image src="http://www.firstui.cn:4000/vipdoc/img/img_logo.png"></image>
</view>
</view>
<view class="btn">
详情
</view>
</view>
</view>
</view>
<view class="li" @click="openViewCourseInfo({id:2})">
<view v-for="(v,k) in tableList" :key="k" class="li" @click="openViewCourseInfo({id:v.id})">
<view class="top_box">
<view class="center_box">
<view>班级少年班</view>
@ -140,7 +78,10 @@
</view>
</view>
</view>
</view>
</scroll-view>
<!-- 加载状态-->
<!-- <fui-loading :isFixed="true" srcCol="/static/icon-img/loading_white.png" text="正在加载..." v-if="loading"></fui-loading>-->
</view>
<!-- 底部导航-->
@ -149,7 +90,7 @@
</template>
<script>
// import user from '@/api/user.js';
import memberApi from '@/api/member.js';
import AQTabber from "@/components/AQ/AQTabber.vue"
@ -159,75 +100,161 @@ export default {
},
data() {
return {
formData:{},
//
show_course:false,//
//
course_name:'课程',//
options_course: [
{
text: '请选择课程',
value: '',
checked: true
}, {
text: '羽毛球课程1',
value: '1'
}, {
text: '篮球课程2',
value: '2'
}
],
//
show_classroom:false,//
//
classroom_name:'课室',//
options_classroom: [
{
text: '请选择课室',
value: '',
checked: true
}, {
text: '羽毛球201',
value: '1'
}, {
text: '篮球室101',
value: '2'
}
],
loading:false,//
lowerThreshold: 100,//
isReachedBottom: false,//|true=|false=
//
filteredData:{
page:1,//
limit:10,//
total:10,//
schedule_date:'',//
venue_id:'',//id
},
tableList:[],//
venuesInfo:{},//
//
today: '',
dateList:[]//
}
},
onLoad() {
},
onShow() {
this.init()//
},
//
async onPullDownRefresh() {
//
let schedule_date = this.filteredData.schedule_date
console.log('eee',schedule_date)
await this.loadData()
this.filteredData.schedule_date = schedule_date
await this.getList()
},
methods: {
//
clickCourse(e){
console.log(e)
this.course_name = e.text
this.show_course = true
//
async init(){
await this.getDate()
await this.getList()
await this.getDateList(); //
console.log(1111,this.dateList)
},
//
filterTapCourse() {
//
this.$refs.ref_course.show()
this.show_course = true;
//
async getDate() {
let date = new Date();
let year = date.getFullYear();
let month = String(date.getMonth() + 1).padStart(2, '0'); //
let day = String(date.getDate()).padStart(2, '0'); //
let hour = date.getHours();
let minute = date.getMinutes();
let second = date.getSeconds();
let res = `${year}-${month}-${day}`; //
this.today = res;
this.filteredData.schedule_date = res;
},
//
async getDateList() {
const days = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
const dateList = [];
const today = new Date(); //
// 24
for (let i = -2; i <= 4; i++) {
const date = new Date(today);
date.setDate(today.getDate() + i); //
let dayOfWeek = days[date.getDay()]; //
let formattedDateArr = this.formatDate(date); //
let formattedDate = `${formattedDateArr[0]}-${formattedDateArr[1]}-${formattedDateArr[2]}`; //
dateList.push({
name: dayOfWeek,
date: formattedDate,
today: formattedDateArr[2],//
});
}
this.dateList = dateList
},
// YYYY-MM-DD
formatDate(date) {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return [
year, month, day
]
},
//
clickClassroom(e){
console.log(e)
this.classroom_name = e.text
this.show_classroom = true
//()
loadMoreData() {
//
if (!this.isReachedBottom) {
this.isReachedBottom = true;//
this.getList();
}
},
//
filterTapClassroom() {
//
this.$refs.ref_classroom.show()
this.show_classroom = true;
//
async loadData() {
this.isReachedBottom = false; // 便
this.filteredData = {
page:1,//
limit:10,//
total:10,//
schedule_date:'',//
venue_id:'',//id
}
},
//
async getList(){
this.loading = true
let data = {...this.filteredData}
//
if(this.filteredData.page * this.filteredData.limit > this.filteredData.total || this.filteredData.limit > this.filteredData.total ){
this.loading = false
uni.showToast({
title: '暂无更多',
icon: 'none'
})
return
}
let res = await memberApi.courseList(data)
this.loading = false
this.isReachedBottom = false;
if (res.code != 1){
uni.showToast({
title: res.msg,
icon: 'none'
})
return
}
this.tableList = res.data.list.data
//
this.venuesInfo = res.data.venues_info
this.total = res.data.list.total
this.page++
},
//
async selectDate(date){
this.loadData()
this.filteredData.schedule_date = date
this.getList()
},
//
openViewCourseInfo(item){

Loading…
Cancel
Save