3 changed files with 68 additions and 2 deletions
Split View
Diff Options
-
45pages/agent/ability-list/index.js
-
4pages/agent/ability-list/index.json
-
21pages/agent/ability-list/index.wxml
@ -1,17 +1,58 @@ |
|||
// pages/message/detail/index.js
|
|||
import Scene from '../../index/scene' |
|||
import { getActivityList } from "../../../api/ztb" |
|||
const app = getApp() |
|||
|
|||
Scene({ |
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
|
|||
height: app.globalData.fragmentHeight, |
|||
kg: app.globalData.kg, |
|||
loading: true, |
|||
requesting: false, |
|||
finished: false, |
|||
orderList: [], |
|||
form: { |
|||
pageNum: 1 |
|||
} |
|||
}, |
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad: function (options) { |
|||
|
|||
this.setData({ height: app.globalData.fragmentHeight }) |
|||
this.fetchPapersList() |
|||
}, |
|||
onRefreshList: function () { |
|||
if (this.data.requesting) { |
|||
return |
|||
} |
|||
this.setData({ orderList: [], ['form.pageNum']: 1, loading: true, finished: false }) |
|||
this.fetchPapersList() |
|||
}, |
|||
// 获取特价列表
|
|||
fetchPapersList: function () { |
|||
if (this.data.requesting || this.data.finished) { |
|||
return |
|||
} |
|||
this.data.requesting = true |
|||
getActivityList(this.data.form).then(result => { |
|||
if (result.data.records.length) { |
|||
var respList = result.data.records |
|||
let nowList = `orderList[${this.data.orderList.length}]` |
|||
var num = result.data.current |
|||
var finished = result.data.current >= result.data.pages |
|||
this.setData({ [nowList]: respList, ['form.pageNum']: (num + 1), finished, requesting: false, loading: false }) |
|||
} else { |
|||
this.setData({ requesting: false, finished: true, loading: false }) |
|||
} |
|||
}).catch(err => { |
|||
this.setData({ requesting: false, finished: true, loading: false }) |
|||
}).finally(() => { |
|||
this.refresh = this.refresh || this.selectComponent('#refresh') |
|||
this.refresh.setRefresh(false) |
|||
}) |
|||
} |
|||
}) |
|||
@ -1,5 +1,9 @@ |
|||
{ |
|||
"usingComponents": { |
|||
"refresh-view": "/components/refresh-view/index", |
|||
"van-divider": "/components/divider/index", |
|||
"van-loading": "/components/loading/index", |
|||
"ability-item": "/pages/agent/ability-item/index", |
|||
"notification": "/pages/message/notification/index" |
|||
} |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save