// pages/publics/government/government.js import { imgUrl } from "../../api/request" Page({ /** * 页面的初始数据 */ data: { // 政府信息公开指南item item1: 0, // 政府信息公开年报item item2: 0, // 图片前缀 imgUrl: imgUrl, governmentList: [{ title: '政府信息公开指南' }, { title: '政府信息公开制度' }, { title: '法定主动公开内容' }, { title: '政府信息公开年报' } ], // 区政府部门 districtGovernmentList: [{ name: '区发展改革委', channelId: '60190', annalsChannelId: '60201' }, { name: '区教委', channelId: '60010', annalsChannelId: '60022' }, { name: '区科技局', channelId: '60039', annalsChannelId: '60050' }, { name: '区经济信息委', channelId: '60448', annalsChannelId: '60460' }, { name: '区民政局', channelId: '60052', annalsChannelId: '60063' }, { name: '区司法局', channelId: '60138', annalsChannelId: '60149' }, { name: '区财政局', channelId: '59969', annalsChannelId: '59981' }, { name: '区人力社保局', channelId: '60310', annalsChannelId: '60329' }, { name: '区生态环境局', channelId: '60367', annalsChannelId: '60385' }, { name: '区住房城乡建委', channelId: '60342', annalsChannelId: '60354' }, { name: '区城市管理局', channelId: '60599', annalsChannelId: '60618' }, { name: '区交通局', channelId: '59997', annalsChannelId: '60008' }, { name: '区农业农村委', channelId: '60065', annalsChannelId: '60076' }, { name: '区商务委', channelId: '60078', annalsChannelId: '60089' }, { name: '区文化旅游委', channelId: '60164', annalsChannelId: '60175' }, { name: '区卫生健康委', channelId: '60261', annalsChannelId: '60276' }, { name: '区退役军人事务局', channelId: '60418', annalsChannelId: '60434' }, { name: '区应急局', channelId: '60493', annalsChannelId: '60515' }, { name: '区审计局', channelId: '60112', annalsChannelId: '60123' }, { name: '区统计局', channelId: '60151', annalsChannelId: '60162' }, { name: '区医保局', channelId: '60203', annalsChannelId: '60223' }, { name: '区信访办', channelId: '60677', annalsChannelId: '60699' }, { name: '区政府外办', channelId: '60471', annalsChannelId: '60491' }, { name: '区民族宗教委', channelId: '60574', annalsChannelId: '60596' }, { name: '区金融办', channelId: '60177', annalsChannelId: '60188' }, { name: '区机关事务局', channelId: '59984', annalsChannelId: '59995' }, { name: '区国资委', channelId: '60524', annalsChannelId: '60537' }, { name: '区大数据发展局', channelId: '60630', annalsChannelId: '60641' }, { name: '区政务办', channelId: '100273', annalsChannelId: '100283' }, { name: '区供销社', channelId: '60284', annalsChannelId: '60306' }, { name: '区征地事务中心', channelId: '60389', annalsChannelId: '60411' }, { name: '区公安分局', channelId: '60655', annalsChannelId: '60672' }], // 乡镇政府 townshipList: [{ name: '南坪镇', channelId: '60279', annalsChannelId: '60308' }, { name: '涂山镇', channelId: '60674', annalsChannelId: '60703' }, { name: '鸡冠石镇', channelId: '60208', annalsChannelId: '60232' }, { name: '峡口镇', channelId: '60462', annalsChannelId: '60488' }, { name: '广阳镇', channelId: '60094', annalsChannelId: '60110' }, { name: '长生桥镇', channelId: '60428', annalsChannelId: '60449' }, { name: '迎龙镇', channelId: '60388', annalsChannelId: '60416' }, { name: '南坪街道', channelId: '60247', annalsChannelId: '60269' }, { name: '花园路街道', channelId: '60496', annalsChannelId: '60522' }, { name: '海棠溪街道', channelId: '60605', annalsChannelId: '60628' }, { name: '铜元局街道', channelId: '60356', annalsChannelId: '60380' }, { name: '龙门浩街道', channelId: '60643', annalsChannelId: '60667' }, { name: '弹子石街道', channelId: '60568', annalsChannelId: '60597' }, { name: '南山街道', channelId: '60317', annalsChannelId: '60340' }, { name: '天文街道', channelId: '60536', annalsChannelId: '60558' }, ], currentTab: 0, // 滚动动画时间 swiperDuration: 1, // 公开信息制度 国家级 nationalSystemList: [], // 公开信息制度 市级 citySystemList: [], // 公开信息制度 区县级 countySystemList: [], // 公开内容 publicContent: [], // 公开内容页码 page: 1, }, // 切换item1 clickItem1(e) { this.setData({ item1: e.currentTarget.dataset.item }) }, // 切换item2 clickItem2(e) { this.setData({ item2: e.currentTarget.dataset.item }) }, // 切换 tabNav(e) { let currentTab = e.currentTarget.dataset.index this.setData({ currentTab }) }, // 切换 handleSwiper(e) { let { current, source } = e.detail if (source === 'autoplay' || source === 'touch') { const currentTab = current this.setData({ currentTab }) } if (this.data.swiperDuration == 1) { this.setData({ swiperDuration: 500 }) } }, gotoArticles(e) { if (e.currentTarget.dataset.channelid) { wx.navigateTo({ url: '/pages/publics/governmentArticles/governmentArticles?channelId=' + e.currentTarget.dataset.channelid, }) } else if (e.currentTarget.dataset.url) { wx.navigateTo({ url: '/pages/publics/publicSystem/publicSystem?url=' + e.currentTarget.dataset.url, }) } }, gotoDetail(e) { if (e.currentTarget.dataset.docid) { let url = e.currentTarget.dataset.url.substring(0, e.currentTarget.dataset.url.lastIndexOf("/") + 1); wx.navigateTo({ url: '/pages/publics/publicContent/publicContent?channelId=' + e.currentTarget.dataset.channelid + '&docId=' + e.currentTarget.dataset.docid + '&url=' + url }) } else if (e.currentTarget.dataset.url) { wx.navigateTo({ url: '/pages/web/web?wxUrl=' + encodeURIComponent(e.currentTarget.dataset.url) }) } else if (e.currentTarget.dataset.channelid) { wx.navigateTo({ url: '/pages/publics/governmentArticlesDetail/governmentArticlesDetail?channelId=' + e.currentTarget.dataset.channelid }) } }, gotoSystemDetail(e) { wx.navigateTo({ url: '/pages/publics/governmentArticlesDetail/governmentArticlesDetail?isFile=false&&channelId=' + e.currentTarget.dataset.channelid + '&&docId=' + e.currentTarget.dataset.docid }) }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { // 获取公开制度国家级数据 this.getNationalSystem(); // 获取公开制度市级数据 this.getCitySystem(); // 获取公开制度区县级数据 this.getCountySystem(); // 获取公开内容数据 this.getPublicContent(); if (options.index) { this.setData({ currentTab: parseInt(options.index) }) } else { this.setData({ swiperDuration: 500 }) } }, // 获取公开制度国家级数据 getNationalSystem() { wx.request({ url: 'https://www.cq.gov.cn/zwgk/zfxxgkzl/zfxxgkzd/gjj/index.json?gjjzd=gjjzd&_=1672192184794', method: 'GET', success: res => { let data = JSON.parse(res.data.substring(res.data.indexOf("(") + 1, res.data.lastIndexOf(")"))); this.setData({ nationalSystemList: data.datas }) } }) }, // 获取公开制度市级数据 getCitySystem() { wx.request({ url: 'https://www.cq.gov.cn/zwgk/zfxxgkzl/zfxxgkzd/sj/index.json?cqsjzd=cqsjzd&_=1672192184795', method: 'GET', success: res => { let data = JSON.parse(res.data.substring(res.data.indexOf("(") + 1, res.data.lastIndexOf(")"))); this.setData({ citySystemList: data.datas }) } }) }, // 获取公开制度区县级数据 getCountySystem() { wx.request({ url: 'https://data.cqna.gov.cn/mini/hlw/send?page=1&limit=20&channelId=107277', method: 'GET', success: res => { res.data.data.DATA.forEach(element => { element.DOCRELTIME = element.DOCRELTIME.split(" ")[0]; }); this.setData({ countySystemList: res.data.data.DATA }) } }) }, // 获取公开内容数据 getPublicContent() { wx.showToast({ title: '加载中', icon: 'loading', duration: 1500 }) wx.request({ url: 'https://data.cqna.gov.cn/mini/hlw/send?limit=20&channelId=132719&page=' + this.data.page, method: 'GET', success: res => { if (res.data.data.DATA.length > 0) { let temp = res.data.data.DATA; temp.forEach(element => { element.DOCRELTIME = element.DOCRELTIME.split(" ")[0]; }); temp = this.data.publicContent.concat(temp); this.setData({ publicContent: temp }) wx.hideToast(); } else { wx.showToast({ title: '已加载全部数据', icon: 'success', duration: 1000 }) } } }) }, // 触底 scrollBottom(e) { this.setData({ page: this.data.page + 1 }) this.getPublicContent() }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, /** * 生命周期函数--监听页面隐藏 */ onHide() { }, /** * 生命周期函数--监听页面卸载 */ onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { return { title: '政府信息公开' } } })