|
|
|
@ -1,6 +1,5 @@ |
|
|
|
// pages/message/index.js
|
|
|
|
import { getFactoryPrice, getProductList, getMiniProxyList } from "../../api/ztb" |
|
|
|
const request = require('../../../utils/request') //导入模块
|
|
|
|
import { getFactoryPrice, getProductList, getMiniProxyList, getBannerList, getSuccessNotices } from "../../api/ztb" |
|
|
|
const event = require('../../../utils/event') |
|
|
|
const util = require('../../../utils/util') |
|
|
|
const app = getApp() |
|
|
|
@ -63,8 +62,11 @@ Component({ |
|
|
|
this.onRefreshList() |
|
|
|
} |
|
|
|
this.data.firstShow = true |
|
|
|
if(!this.data.noticeList.length){ |
|
|
|
this.fetchBannerList() |
|
|
|
if(!this.data.bannerList.length){ |
|
|
|
getBannerList(1).then(result => { |
|
|
|
this.setData({ bannerList: result.data }) |
|
|
|
}).catch(err => { |
|
|
|
}) |
|
|
|
} |
|
|
|
if(!this.data.noticeList.length){ |
|
|
|
this.fetchNoticeList() |
|
|
|
@ -130,22 +132,12 @@ Component({ |
|
|
|
this.fetchAgentList() |
|
|
|
} |
|
|
|
}, |
|
|
|
fetchBannerList: function(){ |
|
|
|
// /banner/get/banner-list/{type} 获取banner
|
|
|
|
request.get('/recycle-service/banner/get/banner-list/1').then(result => { |
|
|
|
//成功回调
|
|
|
|
this.setData({ bannerList: result.data }) |
|
|
|
}).catch(err => { |
|
|
|
}) |
|
|
|
}, |
|
|
|
fetchNoticeList: function(){ |
|
|
|
if (this.data.loopRequesting) { |
|
|
|
return |
|
|
|
} |
|
|
|
this.data.loopRequesting = true |
|
|
|
// /get/recently-order-success-list获取最近成交订单的列表
|
|
|
|
request.post('/recycle-service/get/recently-order-success-list').then(result => { |
|
|
|
//成功回调
|
|
|
|
getSuccessNotices().then(result => { |
|
|
|
this.data.loopRequesting = false |
|
|
|
this.data.noticeList = [] |
|
|
|
if(result.data && result.data.length){ |
|
|
|
@ -155,7 +147,6 @@ Component({ |
|
|
|
this.setData({noticeList: this.data.noticeList}) |
|
|
|
} |
|
|
|
}).catch(err => { |
|
|
|
//异常回调
|
|
|
|
this.data.loopRequesting = false |
|
|
|
}) |
|
|
|
}, |
|
|
|
|