Files
bsmall/pages/index/index.js

53 lines
986 B
JavaScript
Executable File

const api = require("../../api/api")
const app = getApp()
Page({
data: {
marqueeProps: {
loop: true,
leading: 500,
trailing: 800,
fps: 40
},
noticeMode : "link",
adverts : [],
notice : {},
permissions : {}
},
onLoad(){
my.showLoading();
this.getIndex()
},
onShow(){
if (my.canIUse('hideBackHome')) {
my.hideBackHome();
}
},
getIndex(){
api.request({
url : "works",
header: {
"Authorization" : app.globalData.token
},
method: "POST"
}).then(res => {
this.setData({
adverts : res.data.adverts,
notice : res.data.article,
permissions: res.data.permissions
})
my.hideLoading();
my.stopPullDownRefresh();
})
},
onNotice(){
my.navigateTo({
url: '../notice_date/notice_date?id=' + this.data.notice.id
});
},
// 下拉刷新
onPullDownRefresh(){
this.getIndex()
}
});