Commit e9f58828 authored by lvtz's avatar lvtz

fix

parent f2fda00a
......@@ -46,6 +46,11 @@ Page({
page: 1,
perPage: 10,
classList: [],
circleTotal: 0,
circlelistLoading: false,
circlehasmore: true,
circlePage: 1,
circlePerpage: 10,
sid: 0,
id: 0,
selectStudentShow: false, // 选择学生点评
......@@ -117,9 +122,7 @@ Page({
my: my || 0,
id,
});
this.getClassList();
this.getClassList('init');
},
/**
......@@ -186,10 +189,20 @@ Page({
onShareAppMessage: function () {
},
getClassList() {
getClassList(type) {
console.log(type,this.data.circlehasmore,this.data.circlelistLoading)
if (!this.data.circlehasmore) {
return;
}
if (this.data.circlelistLoading) {
return
}
this.setData({
circlelistLoading: true
})
erpClassListGet({
page: this.data.page,
perPage: 999,
page: this.data.circlePage,
perPage: 10,
school_id: this.data.sid,
my: this.data.my
}).then((res) => {
......@@ -197,19 +210,75 @@ Page({
code,
data
} = res;
wx.hideLoading();
this.setData({
circlelistLoading: false
})
if (code != 200) { // 失败的处理
} else {
data.list = data.list.map((itme) => {
return {
id: itme.id,
title: itme.title
}
})
this.setData({
classList: data.list,
selectClass: this.data.id ? data.list.find(ele => ele.id == this.data.id) : data.list[0]
})
this.getGalleryList('init');
if (data.total==0) {
wx.showModal({
title: '提示',
content: '您还没有班级,请先创建班级',
showCancel: false,
confirmColor: '#65B8F4',
success:function(){
wx.navigateTo({
url: `/business/pages/circleeditor/index?sid=${that.data.sid}&id=0`
})
}
})
return;
}
if (data.total) {
this.data.circleTotal = data.total;
}
switch(type){
case 'init':
data.list = data.list.map((itme) => {
return {
id: itme.id,
title: itme.title
}
})
this.setData({
classList: data.list,
selectClass: this.data.id ? data.list.find(ele => ele.id == this.data.id) : data.list[0]
})
this.getGalleryList('init');
if (data.total > this.data.classList.length) {
this.data.circlePage = this.data.circlePage + 1;
} else { // 没有更多了
this.setData({
circlehasmore: false
})
}
break;
case 'up': // 页面上拉刷新
let list = this.data.classList;
let _listGet = data.list.map(item=>{
return {
id: item.id,
title: item.title
}
});
let _list = list.concat(_listGet);
this.setData({
classList: _list
})
if (data.total > this.data.classList.length) {
this.data.circlePage = this.data.circlePage + 1;
} else { // 没有更多了
this.setData({
circlehasmore: false
})
}
break;
default:
break;
}
}
}).catch((e) => {
this.setData({
......@@ -1064,4 +1133,10 @@ Page({
[`galleryList[${bigindex}][${index}]`]: clock,
})
},
scrolltolowerClass(e) {
console.log(this.data.circlehasmore)
if (this.data.circlehasmore) {
this.getClassList('up')
}
},
})
\ No newline at end of file
......@@ -91,7 +91,7 @@
</view>
<view class="select-student-dailog" wx:if="{{selectClassShow}}" bindtap="hideSelectClass" data-flag="{{1}}">
<view class="dailog-content dailog-class-content">
<scroll-view class="student-list class-list" scroll-y="true">
<scroll-view class="student-list class-list" scroll-y="true" lower-threhold="200" bindscrolltolower="scrolltolowerClass">
<view class="class-item {{selectClass.id == item.id ? 'act-class' : ''}}" wx:for="{{classList}}" wx:key="index" data-item="{{item}}" bindtap="selectClassHandle">{{item.title}}</view>
</scroll-view>
<view class="line-16"></view>
......
export default {
imageRoot: 'https://cdn.img.shangjiadao.cn/qingxiao/daka/images/',
// host: 'https://qxapi.qingxiao.online/daka',
// host2: 'https://wx.m.shangjiadao.cn',
host: 'https://qxapi.qingxiao.online/daka',
host2: 'https://wx.m.shangjiadao.cn',
storageVersion: '4.0',
imageVersion: '20191104',
host: 'https://clock.wp53.cn',
host2: 'https://test.wp53.cn',
// host: 'https://clock.wp53.cn',
// host2: 'https://test.wp53.cn',
appId: 'wxc1246ea029394785',
miniProgram: {
clock: 'wxdeee20e52a1fd7ee'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment