const app = getApp() Page({ onShareAppMessage(res) {}, data: { // tabBar param tabBarParam: { selected: 0, color: "#515151", selectedColor: "#217CFF", backgroundColor: "#ffffff", }, // tabBar menu tabBarList: [{ "pagePath": "pages/index/index", "iconPath": "/images/tabbar/home.png", "selectedIconPath": "/images/tabbar/home-select.png", "text": "首页" }, { "pagePath": "pages/parkRepair/parkRepair", "iconPath": "/images/tabbar/openDoor.png", "selectedIconPath": "/images/tabbar/openDoor.png", "text": "开门", "bulge": true, }, { "pagePath": "pages/my/my", "iconPath": "/images/tabbar/my.png", "selectedIconPath": "/images/tabbar/my-select.png", "text": "我的" }, ], IMG_NAME: app.IMG_NAME, indicatorDots: true, autoplay: true, interval: 3000, duration: 1000, bannerList: [{ bannerImg: '' }], menuList: [{ name: "创业活动", img: "/images/hicon/chuangyehuodong.png", path: "/pages/community/community" }, { name: "政策信息", img: "/images/hicon/zhengcexinxi.png", path: "/pages/notice/notice" }, { name: "党建园地", img: "/images/hicon/zhaozhengce.png", //img: "/images/hicon/yuanqugonggao.png", path: "/pages/party/party" }, { name: "租办公室", img: "/images/hicon/zubangongshi.png", path: "/pages/office/office" }, { name: "项目入孵", img: "/images/hicon/xiangmurufu.png", path: "/pages/applyType/applyType" }, { name: "企业入驻", img: "/images/hicon/qiyeruzhu.png", path: "/pages/applyType/applyType" }, { name: "厂房申请", img: "/images/hicon/qianrushenqing.png", path: "/pages/applyType/applyType" }, { name: "园区建议", img: "/images/hicon/yuanqujianyi.png", path: "/pages/complaint/complaint" }, { name: "商业计划书", img: "/images/hicon/wenjuandiaocha.png", path: "/pages/outer/outer" }, /* { name: "园区报修", img: "/images/hicon/zhaozhuanli.png", path: "/pages/parkRepair/parkRepair" }, */ { name: "会议预约", img: "/profile/static/index/menu-hyyy.png", path: "" }, ], homelist: [], background: [{ bg: '/profile/banner/1.jpg', url: '' }, { bg: '/profile/banner/2.jpg', url: '' }] }, // 切换tabbar switchTab(e) { const data = e.currentTarget.dataset console.log('switchTab', data) const url = data.path wx.switchTab({ url: '/' + url }) }, onShow() { let that = this if (wx.getStorageSync('token')) { app.AjaxRequest('get', { 'content-type': 'application/json', 'Authorization': 'Bearer ' + app.Getopenid() }, '/user/profile', {}, function (res) { if (res.code == 0) { that.setData({ parkName: wx.getStorageSync('parkName') }) wx.setStorageSync('MemberInfo', res.data) that.getHotList() } }) } else { wx.reLaunch({ url: '/pages/login/login', }) } }, //轮播高度自适应——获取图片高度 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 //设置高度 }) // this.setData({ // Height: '300rpx' //设置高度 // }) }, getHotList() { let that = this app.AjaxRequest('get', { 'content-type': 'application/json', 'Authorization': 'Bearer ' + app.Getopenid() }, '/menu/bannerList', { isTop: true }, function (res) { that.setData({ homelist: res.data }) }) }, navdateil(e) { var index = e.currentTarget.dataset.index wx.navigateTo({ url: '/pages/detail/detail?list=' + index }) }, navapply(e) { if (wx.getStorageSync('token')) { if (e.currentTarget.dataset.path) { if (e.currentTarget.dataset.path == '/pages/parkRepair/parkRepair') { wx.switchTab({ url: e.currentTarget.dataset.path, }) } else { wx.navigateTo({ url: e.currentTarget.dataset.path + '?name=' + e.currentTarget.dataset.name, }) } } else { wx.showModal({ content: '模块暂未开放,敬请期待', showCancel: false, }) } } else { app.getlogin() } }, navDetail(e) { if (wx.getStorageSync('token')) { wx.navigateTo({ url: e.currentTarget.dataset.uri, }) } else { app.getlogin() } }, navparkList() { wx.navigateTo({ url: '/pages/index/parkList/parkList' }) }, adLoad() { console.log('Banner 广告加载成功') }, adError(err) { console.log('Banner 广告加载失败', err) }, adClose() { console.log('Banner 广告关闭') } })