mirror of
https://gitee.com/elegant_wings/dbd-meeting-wx-small.git
synced 2025-06-21 16:39:37 +08:00
75 lines
1.9 KiB
JavaScript
75 lines
1.9 KiB
JavaScript
var app = getApp()
|
|
Page({
|
|
data: {
|
|
DOMAIN_NAME: app.IMG_NAME,
|
|
bannerList: [],
|
|
noticeList: [],
|
|
indicatorDots: true,
|
|
autoplay: true,
|
|
interval: 3000,
|
|
duration: 1000,
|
|
},
|
|
onLoad() {
|
|
let that = this
|
|
app.AjaxRequest('get', {
|
|
'content-type': 'application/json',
|
|
'Authorization': 'Bearer ' + app.Getopenid()
|
|
}, '/policy/bannerList', {},
|
|
function (res) {
|
|
if (res.code == 0) {
|
|
that.setData({
|
|
bannerList: res.data
|
|
})
|
|
}
|
|
})
|
|
app.AjaxRequest('get', {
|
|
'content-type': 'application/json',
|
|
'Authorization': 'Bearer ' + app.Getopenid()
|
|
}, '/policy/list', {},
|
|
function (res) {
|
|
if (res.code == 0) {
|
|
that.setData({
|
|
noticeList: res.data
|
|
})
|
|
}
|
|
})
|
|
},
|
|
//轮播高度自适应——获取图片高度
|
|
imgHeight: function (e) {
|
|
var winWid = wx.getSystemInfoSync().windowWidth; //获取当前屏幕的宽度
|
|
var imgh = e.detail.height; //图片高度
|
|
var imgw = e.detail.width; //图片宽度
|
|
var swiperH = winWid * imgh / imgw + "px"
|
|
this.setData({
|
|
Height: swiperH //设置高度
|
|
})
|
|
},
|
|
navdetail(e) {
|
|
let that = this
|
|
let index = e.currentTarget.dataset.index
|
|
app.AjaxRequest('POST', {
|
|
'content-type': 'application/json',
|
|
'Authorization': 'Bearer ' + app.Getopenid()
|
|
}, '/policy/addHits?id=' + that.data.bannerList[index].id, {}, function (res) {})
|
|
wx.navigateTo({
|
|
url: '../notice/detail/detail',
|
|
success(res) {
|
|
res.eventChannel.emit('toHome', {
|
|
data: that.data.bannerList[index]
|
|
})
|
|
}
|
|
})
|
|
},
|
|
navdetaillist(e) {
|
|
let that = this
|
|
let index = e.currentTarget.dataset.index
|
|
wx.navigateTo({
|
|
url: '../notice/detail/detail',
|
|
success(res) {
|
|
res.eventChannel.emit('toHome', {
|
|
data: that.data.noticeList[index]
|
|
})
|
|
}
|
|
})
|
|
}
|
|
}) |