浏览代码

:recycle: override dispatch params for material sort

tags/0.9.0
J 4 年前
父节点
当前提交
99603ee4d6
共有 1 个文件被更改,包括 9 次插入8 次删除
  1. 9
    8
      vue-theme/src/pages/list.vue

+ 9
- 8
vue-theme/src/pages/list.vue 查看文件

103
                       .filter(p => p)
103
                       .filter(p => p)
104
                       .pop()
104
                       .pop()
105
         },
105
         },
106
-        _getDispatchParams() {
106
+        _getDispatchParams(perPage) {
107
             return {
107
             return {
108
                 sortType: this._getSortBy(),
108
                 sortType: this._getSortBy(),
109
                 params: {
109
                 params: {
110
-                    limit: this.perPage,
110
+                    limit: perPage ? perPage : this.perPage,
111
                     page: this.page
111
                     page: this.page
112
                 }
112
                 }
113
             }
113
             }
118
             const ignore = [`getMoreEpisodes`, 'getMorePages']
118
             const ignore = [`getMoreEpisodes`, 'getMorePages']
119
 
119
 
120
             let dispatchAction = `getMore${this.pType}`
120
             let dispatchAction = `getMore${this.pType}`
121
+            let params = this._getDispatchParams()
122
+
121
             if(this._getSortBy() == sortTypes.material && this.type == 'artist') {
123
             if(this._getSortBy() == sortTypes.material && this.type == 'artist') {
122
                 dispatchAction = `getAll${this.pType}`
124
                 dispatchAction = `getAll${this.pType}`
125
+                params = this._getDispatchParams(-1)
123
             }
126
             }
124
-            
127
+
125
             let res = null
128
             let res = null
126
             if(this.pType && !ignore.includes(dispatchAction)) {
129
             if(this.pType && !ignore.includes(dispatchAction)) {
127
-                res = await this.$store.dispatch(
128
-                    dispatchAction,
129
-                    this._getDispatchParams()
130
-                )
130
+                res = await this.$store.dispatch(dispatchAction, params)
131
             }
131
             }
132
 
132
 
133
             // Stop trying to load more posts
133
             // Stop trying to load more posts
156
             this.$store.commit('SET_HERO', this._setHeroInfo(page))
156
             this.$store.commit('SET_HERO', this._setHeroInfo(page))
157
         },
157
         },
158
         setIntersectionLoader() {
158
         setIntersectionLoader() {
159
-            if(!this.type) return console.error('cannot setup interseciton handler for undefined type')
159
+            if(!this.type) return console.error('cannot setup intersection handler for undefined type')
160
+            if(this._getSortBy() == sortTypes.material && this.type == 'artist') return console.error('cannot setup intersection handler for material sort')
160
 
161
 
161
             const footerEl = document.querySelector(INTERSECT_SELECTOR)
162
             const footerEl = document.querySelector(INTERSECT_SELECTOR)
162
             if(!footerEl) return
163
             if(!footerEl) return

正在加载...
取消
保存