提问
@@ -36,18 +37,69 @@
export default {
data () {
return {
- name: ''
+ search: {
+ current: 1,
+ title: '',
+ size: 20
+ },
+ isMore: false,
+ list: []
}
},
mounted () {
-
+ this.$loading()
+ this.getList()
},
methods: {
- linkTo (url) {
+ linkTo () {
uni.navigateTo({
- url
+ url: './Add'
+ })
+ },
+
+ getMore () {
+ this.current = this.current + 1
+
+ this.getList()
+ },
+
+ update () {
+ this.current = 1
+ this.isMore = false
+
+ this.getList()
+ },
+
+ getList () {
+ if (this.isMore) return
+ this.$http.post(`/app/applearningquestion/list`, null, {
+ params: {
+ ...this.search
+ }
+ }).then(res => {
+ if (res.code == 0) {
+ if (this.search.current > 1) {
+ this.list = [...this.list, ...res.data.records]
+ } else {
+ this.list = res.data.records
+ }
+
+ uni.hideLoading()
+
+ if (res.data.records.length < 20) {
+ this.isMore = true
+
+ return false
+ }
+
+ this.search.current = this.search.current + 1
+ } else {
+ uni.hideLoading()
+ }
+ }).catch(() => {
+ uni.hideLoading()
})
}
}
diff --git a/src/project/fd/AppAnswer/component/Ranking.vue b/src/project/fd/AppAnswer/component/Ranking.vue
index cbfb2eaa..28876de5 100644
--- a/src/project/fd/AppAnswer/component/Ranking.vue
+++ b/src/project/fd/AppAnswer/component/Ranking.vue
@@ -27,12 +27,19 @@
export default {
data () {
return {
-
+ search: {
+ current: 1,
+ title: '',
+ size: 20
+ },
+ isMore: false,
+ list: []
}
},
- mounted: {
-
+ mounted () {
+ this.$loading()
+ this.getList()
},
methods: {
@@ -40,6 +47,37 @@
uni.navigateTo({
url: './IntegralDetail'
})
+ },
+
+ getList () {
+ if (this.isMore) return
+ this.$http.post(`/app/applearningquestion/scoreRanking`, null, {
+ params: {
+ ...this.search
+ }
+ }).then(res => {
+ if (res.code == 0) {
+ if (this.search.current > 1) {
+ this.list = [...this.list, ...res.data.records]
+ } else {
+ this.list = res.data.records
+ }
+
+ uni.hideLoading()
+
+ if (res.data.records.length < 20) {
+ this.isMore = true
+
+ return false
+ }
+
+ this.search.current = this.search.current + 1
+ } else {
+ uni.hideLoading()
+ }
+ }).catch(() => {
+ uni.hideLoading()
+ })
}
}
}