|
|
|
// subpages/understandJs/pages/archives/archives.js
|
|
|
|
const api = require('../../../../utils/understandJs')
|
|
|
|
Page({
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面的初始数据
|
|
|
|
*/
|
|
|
|
data: {
|
|
|
|
pageIndex: 1,
|
|
|
|
pageSize: 10,
|
|
|
|
deptList: [],
|
|
|
|
nodata: false,
|
|
|
|
loadMoreType: 'none',
|
|
|
|
loadMoreVisible: false,
|
|
|
|
swiperBannerList: [],
|
|
|
|
indicatorDots: false, //指示点
|
|
|
|
autoplay: true, //true,//自动播放
|
|
|
|
circular: true, //衔接滑动
|
|
|
|
interval: 5000, //自动播放间隔时长(ms)
|
|
|
|
duration: 500, //幻灯片切换时长(ms)
|
|
|
|
currentSwiper: 0,
|
|
|
|
showTitle: true, //视频标题
|
|
|
|
dictType: 'notice_yjfu_lbzx', // 居务公开,老兵在线
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
*/
|
|
|
|
onLoad: function (options) {
|
|
|
|
this.setData({
|
|
|
|
dictType: options.modulecode
|
|
|
|
})
|
|
|
|
if (options.modulecode == 'notice_jwgk') {
|
|
|
|
wx.setNavigationBarTitle({
|
|
|
|
title: '居务公开'
|
|
|
|
})
|
|
|
|
this.getBannerList('8')
|
|
|
|
} else if (options.modulecode == 'notice_yjfu_lbzx') {
|
|
|
|
wx.setNavigationBarTitle({
|
|
|
|
title: '老兵在线'
|
|
|
|
})
|
|
|
|
this.getBannerList('7')
|
|
|
|
}
|
|
|
|
this.getFullDictInfo()
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
|
*/
|
|
|
|
onHide: function () {
|
|
|
|
this.setData({
|
|
|
|
searchContent: ''
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
|
*/
|
|
|
|
onReachBottom: function () {
|
|
|
|
this.setData({
|
|
|
|
loadMoreVisible: true
|
|
|
|
})
|
|
|
|
if (this.data.loadMoreType === 'loading') {
|
|
|
|
this.setData({
|
|
|
|
pageIndex: this.data.pageIndex + 1,
|
|
|
|
pageSize: this.data.pageSize,
|
|
|
|
})
|
|
|
|
this.getFullDictInfo()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
getFullDictInfo () {
|
|
|
|
const dictType = this.data.dictType
|
|
|
|
api.modulelist(dictType).then(res => {
|
|
|
|
this.setData({
|
|
|
|
deptList: res.data,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
// api.getFullDictInfo(dictType).then(res => {
|
|
|
|
// console.log(res)
|
|
|
|
// this.setData({
|
|
|
|
// deptList: [...this.data.deptList,...res.data],
|
|
|
|
// loadMoreType: res.data.length === this.data.pageSize ? 'loading' : 'none',
|
|
|
|
// loadMoreVisible: res.data.length === this.data.pageSize ? false : true
|
|
|
|
// })
|
|
|
|
// if (this.data.deptList.length == 0) {
|
|
|
|
// this.setData({
|
|
|
|
// nodata: true,
|
|
|
|
// loadMoreType: 'none',
|
|
|
|
// loadMoreVisible: false,
|
|
|
|
// })
|
|
|
|
// }
|
|
|
|
// }).catch(err => {
|
|
|
|
// this.setData({
|
|
|
|
// deptList: [],
|
|
|
|
// nodata: true,
|
|
|
|
// loadMoreType: 'none',
|
|
|
|
// loadMoreVisible: false,
|
|
|
|
// })
|
|
|
|
// console.log(err)
|
|
|
|
// })
|
|
|
|
},
|
|
|
|
getBannerList: function(bannerNum) {
|
|
|
|
let that = this
|
|
|
|
api.bannerList(bannerNum).then(function(res) {
|
|
|
|
// console.log('res==', res.data)
|
|
|
|
that.setData({
|
|
|
|
swiperBannerList: res.data
|
|
|
|
})
|
|
|
|
})
|
|
|
|
},
|
|
|
|
swiperChange: function(e) {
|
|
|
|
wx.createVideoContext('video'+this.data.currentSwiper).pause()
|
|
|
|
this.setData({
|
|
|
|
currentSwiper: e.detail.current,
|
|
|
|
autoplay: true
|
|
|
|
})
|
|
|
|
},
|
|
|
|
bindplay() {
|
|
|
|
this.setData({
|
|
|
|
autoplay: false
|
|
|
|
})
|
|
|
|
wx.getNetworkType({
|
|
|
|
success (res) {
|
|
|
|
const networkType = res.networkType
|
|
|
|
if (res.networkType != 'wifi') {
|
|
|
|
wx.showToast({
|
|
|
|
title: '当前为非WI-FI环境,请注意流量消耗',
|
|
|
|
icon: 'none',
|
|
|
|
duration: 3000
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
bindended() {
|
|
|
|
this.setData({
|
|
|
|
autoplay: true
|
|
|
|
})
|
|
|
|
},
|
|
|
|
bindcontrolstoggle(e) {
|
|
|
|
this.setData({
|
|
|
|
showTitle: e.detail.show
|
|
|
|
})
|
|
|
|
},
|
|
|
|
/**
|
|
|
|
* 跳转页面
|
|
|
|
*/
|
|
|
|
navigateToDict (e) {
|
|
|
|
console.log(e.currentTarget.dataset.dict)
|
|
|
|
wx.navigateTo({
|
|
|
|
url: `../laobingzaixianDict/laobingzaixianDict?dictName=${e.currentTarget.dataset.dict.name}&dictType=${this.data.dictType}&dictValue=${e.currentTarget.dataset.dict.moduleCode}`
|
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|