var app = getApp() var that; Page({ data: { showTissue: false,//显示部门组件 TissueVal: '全公司', isPx: true, page: 1, scroll_top: 0, popupCx: '', }, onLoad() { that = this; dd.setNavigationBar({ title: "累计B分排名" }); this.getData(); }, onShareAppMessage() { return { title: '累计B分排名', desc: '积分排名有变动了,快来看看!', path: 'pages/statistics/B_ranking/B_ranking' }; }, onShow() { if (app.globalData.userData) { if (that.data.page == 1) { dd.hideLoading(); that.getData(); } } else { app.login(app.globalData.corpId, function (is) { if (is) { if (that.data.page == 1) { dd.hideLoading(); that.getData(); } } else { dd.reLaunch({ url: '../../noJurisdiction/noJurisdiction' }) } }, function () { }) } }, openDetail(e) { let item = e.target.dataset.item var data = { pt_id: '3', dept_id: that.data.dept_id, item: item, type: 2, } dd.navigateTo({ url: '../jfDetail/jfDetail?data=' + JSON.stringify(data) }) }, getData(is) { var data = { page: that.data.page, page_size: 20, dept_id: that.data.dept_id, pt_id: 3, sort: that.data.isPx ? 'DESC' : 'ASC', type: 'all', } app.$get('api/integral/statistics/ranking', data, 'application/vnd.test.v2+json').then((res) => { var data = res.data.data.list; data=app.returnDeptName(data); if (is) { if (data.length == 0) { this.setData({ isData: true }) return; } var list = that.data.list; this.setData({ list: list.concat(data) }) } else { this.setData({ list: [] }); this.setData({ list: data, isData: false, }) } }) }, //上啦加载 onScrollToLower() { if (!that.data.isData) { this.setData({ page: ++that.data.page }) this.getData(true); } }, selectIsPx() { this.setData({ isPx: !this.data.isPx, page: 1 }) this.getData(); }, //关闭弹窗 onClose() { this.setData({ showTissue: false, popupCx: '' }) }, //显示部门选择组件 selectTissue() { this.setData({ showTissue: !this.data.showTissue, popupCx: 'container__mask', }) }, //选择部门 onConfirmTissue(data) { if (data) { this.setData({ dept_id: data.id, page: 1, TissueVal: data.name }) } this.getData(); }, });