// pages/school/projectList/index.js const app = getApp() Page({ onListTap(e) { let progressId = e.currentTarget.dataset.progressid let stepCode = e.currentTarget.dataset.stepcode wx.navigateTo({ url: '/pages/project/projectHandle/index?progressId='+progressId+'&stepCode='+stepCode.substring(0,2)+'&canDo=0' }); }, lower(e) { console.log(e); }, //获取去年、今年、明年 getYearList() { var thisYear = new Date().getFullYear(); var lastYear = thisYear - 1; var nextYear = thisYear + 1; this.setData({ yearList: [{ id: -1, name: '全部', active: false }, { id: nextYear, name: nextYear + '年', active: false }, { id: thisYear, name: thisYear + '年', active: false }, { id: lastYear, name: lastYear + '年', active: false } ] }); }, //关闭筛选标签 closeFilterFlag(e) { let _filterTypeObj = this.data.filterTypeObj; let _typeList = this.data.typeList; _typeList[_filterTypeObj.index].active = false; _filterTypeObj.index = 0; _filterTypeObj.tempIndex = 0; _filterTypeObj.value = '0'; let _filterYearObj = this.data.filterYearObj; let _yearList = this.data.yearList; _yearList[_filterYearObj.index].active = false; _filterYearObj.index = 0; _filterYearObj.tempIndex = 0; _filterYearObj.value = '0'; this.setData({ typeList: _typeList, filterTypeObj: _filterTypeObj, yearList: _yearList, filterYearObj: _filterYearObj, filterFlagShow: false, argsYear: 0, argsProTypeId: 0 }); this.getStepList(); }, //筛选确定 filterOK(e) { let flagShow = true; let _filterTypeObj = this.data.filterTypeObj; _filterTypeObj.index = _filterTypeObj.tempIndex; _filterTypeObj.value = _filterTypeObj.tempValue; let _filterYearObj = this.data.filterYearObj; _filterYearObj.index = _filterYearObj.tempIndex; _filterYearObj.value = _filterYearObj.tempValue; if (_filterTypeObj.tempIndex == 0 && _filterYearObj.tempIndex == 0) { flagShow = false; } let typeId = _filterTypeObj.value; let yearId = _filterYearObj.value; this.setData({ arc_show: false, filterTypeObj: _filterTypeObj, filterYearObj: _filterYearObj, filterFlagShow: flagShow, argsProTypeId: typeId, argsYear: yearId }); this.getStepList(); }, // 阻止冒泡 doNothing() {}, //显示筛选弹出层 onShowPopupTap() { this.setData({ arc_show: true }); let _filterTypeObj = this.data.filterTypeObj; let _typeList = this.data.typeList; _typeList[_filterTypeObj.tempIndex].active = false; _typeList[_filterTypeObj.index].active = true; let _filterYearObj = this.data.filterYearObj; let _yearList = this.data.yearList; _yearList[_filterYearObj.tempIndex].active = false; _yearList[_filterYearObj.index].active = true; this.setData({ typeList: _typeList, yearList: _yearList }); }, //隐藏筛选弹出层 onHidePopupTap() { this.setData({ arc_show: false }); let _filterTypeObj = this.data.filterTypeObj; let _typeList = this.data.typeList; _typeList[_filterTypeObj.tempIndex].active = false; _filterTypeObj.tempIndex = _filterTypeObj.index; _filterTypeObj.tempValue = _filterTypeObj.value; let _filterYearObj = this.data.filterYearObj; let _yearList = this.data.yearList; _yearList[_filterYearObj.tempIndex].active = false; _filterYearObj.tempIndex = _filterYearObj.index; _filterYearObj.tempValue = _filterYearObj.value; this.setData({ typeList: _typeList, filterTypeObj: _filterTypeObj, yearList: _yearList, filterYearObj: _filterYearObj, }); }, //点筛选中的项目类型 ontaglintapType(event) { let _filterTypeObj = this.data.filterTypeObj; //获取之前选中的index let tempIndex = _filterTypeObj.tempIndex; //获取当前选中的index let index = event.currentTarget.dataset.index; let _typeList = this.data.typeList; _typeList[tempIndex].active = false _typeList[index].active = true; _filterTypeObj.tempIndex = index _filterTypeObj.tempValue = _typeList[index].id; this.setData({ typeList: _typeList, filterTypeObj: _filterTypeObj }); }, //点筛选中的申报年度 ontaglintapYear(event) { let _filterYearObj = this.data.filterYearObj; //获取之前选中的index let tempIndex = _filterYearObj.tempIndex; //获取当前选中的index let index = event.currentTarget.dataset.index; let _yearList = this.data.yearList; _yearList[tempIndex].active = false _yearList[index].active = true; _filterYearObj.tempIndex = index _filterYearObj.tempValue = _yearList[index].id; this.setData({ yearList: _yearList, filterYearObj: _filterYearObj }); }, /** * 页面的初始数据 */ data: { arc_show: false, filterTypeObj: { index: 0, tempIndex: 0, value: '0', tempValue: '0' }, filterYearObj: { index: 0, tempIndex: 0, value: '0', tempValue: '0' }, yearList: [], typeList: [{ id: 0, name: '全部', active: false }, { id: 1, name: '基础条件装备', active: false }, { id: 2, name: '学科装备', active: false }, { id: 3, name: '信息技术教学装备', active: false }, { id: 4, name: '创新教育装备', active: false } ], stepList: [], argsYear: 0, argsProTypeId: 0, argsStepCode: '01', argsKeyWord: '', argsPage: 1, argsLimit: 100, flagShow:false, }, //获取指定步骤的项目列表,准备申报学校和电教馆使用同一个列表接口(已办) getStepList() { let that = this; wx.request({ url: app.globalData.serverUrl + '/baseService/gtzz/getXmxcList', method: "GET", header: { 'content-type': 'application/json; charset=utf-8', 'cookie': wx.getStorageSync('sessionid') }, data: { year: this.data.argsYear, step_code: this.data.argsStepCode, subject_type_id: this.data.argsProTypeId, keyword: this.data.argsKeyWord, page: this.data.argsPage, limit: this.data.argsLimit }, success(res) { console.log(res); that.setData({ stepList: res.data.data }); } }); }, //选项卡Change事件 segmentChange(e) { this.setData({ argsStepCode: e.detail.cell }); this.getStepList(); }, //搜索 searchKeyWord() { this.getStepList(); }, //监听搜索栏输入的内容 searchInput(e) { this.setData({ argsKeyWord: e.detail.value }); }, searchClear() { this.setData({ argsKeyWord: '' }); this.getStepList(); }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { //获取页面传的参数 this.setData({ argsStepCode: options.code }); //获取筛选中的年份 this.getYearList(); }, /** * 生命周期函数--监听页面显示 */ onShow: function () { //获取列表 this.getStepList(); } })