|
@@ -10,21 +10,27 @@
|
|
</view>
|
|
</view>
|
|
<view class="content">
|
|
<view class="content">
|
|
<view v-if="data.current === 0">
|
|
<view v-if="data.current === 0">
|
|
- <!--数学-->
|
|
|
|
- <uni-list>
|
|
|
|
- <uni-list-item v-for="item in data.shuxue.list">
|
|
|
|
- <template v-slot:body>
|
|
|
|
- <view class="slot-box">
|
|
|
|
- {{ item }}
|
|
|
|
- <text class="slot-text">{{ item.title }}</text>
|
|
|
|
- <text class="slot-text">{{ item.date }}</text>
|
|
|
|
- <text class="slot-text">错题数:{{ item.count }}题</text>
|
|
|
|
- <button @click="getCuotiData(item)">查看错题</button>
|
|
|
|
- </view>
|
|
|
|
- </template>
|
|
|
|
- </uni-list-item>
|
|
|
|
- <uni-load-more :status="data.shuxue.state" @click="getMore(0)"></uni-load-more>
|
|
|
|
- </uni-list>
|
|
|
|
|
|
+ <scroll-view style="height: 300px;" scroll-y="true" refresher-enabled="true"
|
|
|
|
+ :refresher-triggered="data.shuxue.loading" :refresher-threshold="50"
|
|
|
|
+ refresher-background="lightgreen" @refresherrefresh="onRefresh" @refresherrestore="onRestore"
|
|
|
|
+ @refresherabort="onAbort">
|
|
|
|
+ <!--数学-->
|
|
|
|
+ <uni-list>
|
|
|
|
+ <uni-list-item v-for="item in data.shuxue.list">
|
|
|
|
+ <template v-slot:body>
|
|
|
|
+ <view class="slot-box">
|
|
|
|
+ <!-- 时间 -->
|
|
|
|
+ <text class="slot-text">日期{{ item.date }}</text>
|
|
|
|
+ <!-- 数量 -->
|
|
|
|
+ <text class="slot-text">错题数:{{ item.count }}题</text>
|
|
|
|
+ <button @click="getCuotiData(item)">查看错题</button>
|
|
|
|
+ </view>
|
|
|
|
+ </template>
|
|
|
|
+ </uni-list-item>
|
|
|
|
+ <uni-load-more :status="data.shuxue.state" @click="getMore(0)"
|
|
|
|
+ :contentText="data.shuxue.contentText"></uni-load-more>
|
|
|
|
+ </uni-list>
|
|
|
|
+ </scroll-view>
|
|
</view>
|
|
</view>
|
|
<view v-if="data.current === 1">
|
|
<view v-if="data.current === 1">
|
|
<!--英语-->
|
|
<!--英语-->
|
|
@@ -40,7 +46,8 @@
|
|
</view>
|
|
</view>
|
|
</template>
|
|
</template>
|
|
</uni-list-item>
|
|
</uni-list-item>
|
|
- <uni-load-more :status="data.yingyu.state" @click="getMore(1)"></uni-load-more>
|
|
|
|
|
|
+ <uni-load-more :status="data.yingyu.state" @click="getMore(1)"
|
|
|
|
+ :contentText="data.yingyu.contentText"></uni-load-more>
|
|
</uni-list>
|
|
</uni-list>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
@@ -74,12 +81,14 @@
|
|
list: [],
|
|
list: [],
|
|
loading: false,
|
|
loading: false,
|
|
state: 'more',
|
|
state: 'more',
|
|
|
|
+ state_text: '加载更多'
|
|
},
|
|
},
|
|
yingyu: {
|
|
yingyu: {
|
|
page: 0,
|
|
page: 0,
|
|
list: [],
|
|
list: [],
|
|
loading: false,
|
|
loading: false,
|
|
state: 'more',
|
|
state: 'more',
|
|
|
|
+ state_text: '加载更多'
|
|
},
|
|
},
|
|
wrongList: [],
|
|
wrongList: [],
|
|
})
|
|
})
|
|
@@ -96,68 +105,185 @@
|
|
|
|
|
|
function onChangeTab(e) {
|
|
function onChangeTab(e) {
|
|
if (data.current !== e.currentIndex) {
|
|
if (data.current !== e.currentIndex) {
|
|
- data.current = e.currentIndex
|
|
|
|
|
|
+ data.current = e.currentIndex;
|
|
|
|
+ if (data.current == 0) {
|
|
|
|
+ data.shuxue.page = 0
|
|
|
|
+ } else if (data.current == 1) {
|
|
|
|
+ data.yingyu.page = 0
|
|
|
|
+ }
|
|
|
|
+ refreshData(data.current);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ function refreshData(code) {
|
|
|
|
+ const opt = {
|
|
|
|
+ page: 1,
|
|
|
|
+ size: 10, // 固定查询10条
|
|
|
|
+ cardId: data.current + 1 // 前台索引加1为学科cardId
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (code == 0) {
|
|
|
|
+ data.shuxue.list = [];
|
|
|
|
+ // 数学
|
|
|
|
+ data.shuxue.state = 'loading';
|
|
|
|
+ data.shuxue.page++;
|
|
|
|
+ opt.page = data.shuxue.page;
|
|
|
|
+ } else if (code == 1) {
|
|
|
|
+ data.yingyu.list = [];
|
|
|
|
+ // 英语
|
|
|
|
+ data.yingyu.state = 'loading';
|
|
|
|
+ data.yingyu.page++;
|
|
|
|
+ opt.page = data.yingyu.page;
|
|
|
|
+ }
|
|
|
|
+ getWrongData(opt).then(res => {
|
|
|
|
+ if (code == 0) {
|
|
|
|
+ data.shuxue.list = data.shuxue.list.concat(res.data.data);
|
|
|
|
+ data.shuxue.loading = false;
|
|
|
|
+ } else if (code == 1) {
|
|
|
|
+ data.yingyu.list = data.yingyu.list.concat(res.data.data);
|
|
|
|
+ data.yingyu.loading = false;
|
|
|
|
+ }
|
|
|
|
+ if (code == 0) {
|
|
|
|
+ if (res.data.total >= data.shuxue.list.length) {
|
|
|
|
+ // 数学
|
|
|
|
+ data.shuxue.state = 'no-more';
|
|
|
|
+ data.shuxue.state_text = '没有更多啦';
|
|
|
|
+ data.shuxue.loading = false;
|
|
|
|
+ } else {
|
|
|
|
+ // 数学
|
|
|
|
+ data.shuxue.state = 'more';
|
|
|
|
+ data.shuxue.state_text = '加载更多';
|
|
|
|
+ data.shuxue.loading = false;
|
|
|
|
+ }
|
|
|
|
+ } else if (code == 1) {
|
|
|
|
+ if (res.data.total >= data.yingyu.list.length) {
|
|
|
|
+ // 英语
|
|
|
|
+ data.yingyu.state = 'no-more';
|
|
|
|
+ data.yingyu.state_text = '没有更多啦';
|
|
|
|
+ data.yingyu.loading = false;
|
|
|
|
+ } else {
|
|
|
|
+ // 英语
|
|
|
|
+ data.yingyu.state = 'more';
|
|
|
|
+ data.yingyu.state_text = '加载更多';
|
|
|
|
+ data.yingyu.loading = false;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }).catch(err => {
|
|
|
|
+ if (code == 0) {
|
|
|
|
+ // 数学
|
|
|
|
+ data.shuxue.state = 'more';
|
|
|
|
+ data.shuxue.state_text = '加载更多';
|
|
|
|
+ data.shuxue.loading = false;
|
|
|
|
+ } else if (code == 1) {
|
|
|
|
+ // 英语
|
|
|
|
+ data.yingyu.state = 'more';
|
|
|
|
+ data.yingyu.state_text = '加载更多';
|
|
|
|
+ data.yingyu.loading = false;
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
|
|
function getMore(code) {
|
|
function getMore(code) {
|
|
const opt = {
|
|
const opt = {
|
|
page: 1,
|
|
page: 1,
|
|
size: 10, // 固定查询10条
|
|
size: 10, // 固定查询10条
|
|
|
|
+ cardId: data.current + 1 // 前台索引加1为学科cardId
|
|
}
|
|
}
|
|
|
|
|
|
if (code == 0) {
|
|
if (code == 0) {
|
|
- if (data.shuxue.state == 'no-more') return;
|
|
|
|
- data.shuxue.state = 'loading';
|
|
|
|
|
|
+ if (data.shuxue.state == 'no-more' && !refresh) return;
|
|
// 数学
|
|
// 数学
|
|
|
|
+ data.shuxue.state = 'loading';
|
|
data.shuxue.page++;
|
|
data.shuxue.page++;
|
|
opt.page = data.shuxue.page;
|
|
opt.page = data.shuxue.page;
|
|
} else if (code == 1) {
|
|
} else if (code == 1) {
|
|
- if (data.yingyu.state == 'no-more') return;
|
|
|
|
- data.yingyu.state = 'loading';
|
|
|
|
// 英语
|
|
// 英语
|
|
|
|
+ if (data.yingyu.state == 'no-more' && !refresh) return;
|
|
|
|
+ data.yingyu.state = 'loading';
|
|
data.yingyu.page++;
|
|
data.yingyu.page++;
|
|
opt.page = data.yingyu.page;
|
|
opt.page = data.yingyu.page;
|
|
}
|
|
}
|
|
getWrongData(opt).then(res => {
|
|
getWrongData(opt).then(res => {
|
|
-
|
|
|
|
if (code == 0) {
|
|
if (code == 0) {
|
|
- data.shuxue.list.push(res.data);
|
|
|
|
|
|
+ data.shuxue.list = data.shuxue.list.concat(res.data.data);
|
|
|
|
+ data.shuxue.loading = false;
|
|
} else if (code == 1) {
|
|
} else if (code == 1) {
|
|
- data.yingyu.list.push(res.data);
|
|
|
|
|
|
+ data.yingyu.list = data.yingyu.list.concat(res.data.data);
|
|
|
|
+ data.yingyu.loading = false;
|
|
}
|
|
}
|
|
-
|
|
|
|
- if (res.data.total * res.data.size >= res.data.length) {
|
|
|
|
- if (code == 0) {
|
|
|
|
|
|
+ if (code == 0) {
|
|
|
|
+ if (res.data.total >= data.shuxue.list.length) {
|
|
|
|
+ // 数学
|
|
data.shuxue.state = 'no-more';
|
|
data.shuxue.state = 'no-more';
|
|
- } else if (code == 1) {
|
|
|
|
- data.yingyu.state = 'no-more';
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- if (code == 0) {
|
|
|
|
|
|
+ data.shuxue.state_text = '没有更多啦';
|
|
|
|
+ data.shuxue.loading = false;
|
|
|
|
+ } else {
|
|
|
|
+ // 数学
|
|
data.shuxue.state = 'more';
|
|
data.shuxue.state = 'more';
|
|
- } else if (code == 1) {
|
|
|
|
|
|
+ data.shuxue.state_text = '加载更多';
|
|
|
|
+ data.shuxue.loading = false;
|
|
|
|
+ }
|
|
|
|
+ } else if (code == 1) {
|
|
|
|
+ if (res.data.total >= data.yingyu.list.length) {
|
|
|
|
+ // 英语
|
|
|
|
+ data.yingyu.state = 'no-more';
|
|
|
|
+ data.yingyu.state_text = '没有更多啦';
|
|
|
|
+ data.yingyu.loading = false;
|
|
|
|
+ } else {
|
|
|
|
+ // 英语
|
|
data.yingyu.state = 'more';
|
|
data.yingyu.state = 'more';
|
|
|
|
+ data.yingyu.state_text = '加载更多';
|
|
|
|
+ data.yingyu.loading = false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}).catch(err => {
|
|
}).catch(err => {
|
|
if (code == 0) {
|
|
if (code == 0) {
|
|
|
|
+ // 数学
|
|
data.shuxue.state = 'more';
|
|
data.shuxue.state = 'more';
|
|
|
|
+ data.shuxue.state_text = '加载更多';
|
|
|
|
+ data.shuxue.loading = false;
|
|
} else if (code == 1) {
|
|
} else if (code == 1) {
|
|
|
|
+ // 英语
|
|
data.yingyu.state = 'more';
|
|
data.yingyu.state = 'more';
|
|
|
|
+ data.yingyu.state_text = '加载更多';
|
|
|
|
+ data.yingyu.loading = false;
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
- function getCuotiData(data) {
|
|
|
|
|
|
+ function getCuotiData(item) {
|
|
getWrongInfo({
|
|
getWrongInfo({
|
|
- id: data.id
|
|
|
|
|
|
+ cardId: data.current + 1,
|
|
|
|
+ cdate: item.cdate
|
|
}).then(res => {
|
|
}).then(res => {
|
|
data.wrongList = res.data;
|
|
data.wrongList = res.data;
|
|
wrongRef.value.showPopup();
|
|
wrongRef.value.showPopup();
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ function onRefresh() {
|
|
|
|
+ if (data.current == 0) {
|
|
|
|
+ data.shuxue.page = 0;
|
|
|
|
+ data.shuxue.list = [];
|
|
|
|
+ data.shuxue.loading = true;
|
|
|
|
+ } else if (data.current == 1) {
|
|
|
|
+ data.yingyu.page = 0;
|
|
|
|
+ data.yingyu.list = [];
|
|
|
|
+ data.yingyu.loading = true;
|
|
|
|
+ }
|
|
|
|
+ refreshData(data.current);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function onRestore() {
|
|
|
|
+ data.shuxue.loading = 'restore'; // 需要重置
|
|
|
|
+ console.log("onRestore");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function onAbort() {
|
|
|
|
+ console.log("onAbort");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
onLoad(() => {
|
|
onLoad(() => {
|
|
getMore(data.current);
|
|
getMore(data.current);
|
|
})
|
|
})
|