|
@ -5,14 +5,16 @@ Page({ |
|
|
* 页面的初始数据 |
|
|
* 页面的初始数据 |
|
|
*/ |
|
|
*/ |
|
|
data: { |
|
|
data: { |
|
|
pageindex: 1, |
|
|
pageIndex: 1, |
|
|
pagesize: 10, |
|
|
pageSize: 10, |
|
|
searchContent: '', |
|
|
searchContent: '', |
|
|
deptId:'', |
|
|
deptId:'', |
|
|
archivesList: [], |
|
|
archivesList: [], |
|
|
nodata: false, |
|
|
nodata: false, |
|
|
loadMoreType: 'none', |
|
|
loadMoreType: 'none', |
|
|
loadMoreVisible: false |
|
|
loadMoreVisible: false, |
|
|
|
|
|
deptName: '', |
|
|
|
|
|
listType: 0 //档案列表样式 1-搜索样式 0-无搜索样式
|
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -22,7 +24,9 @@ Page({ |
|
|
console.log(options) |
|
|
console.log(options) |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
searchContent: options.searchContent, |
|
|
searchContent: options.searchContent, |
|
|
deptId: options.deptId |
|
|
deptId: options.deptId, |
|
|
|
|
|
deptName: options.dept, |
|
|
|
|
|
listType: options.searchContent.length |
|
|
}) |
|
|
}) |
|
|
wx.setNavigationBarTitle({ |
|
|
wx.setNavigationBarTitle({ |
|
|
title: options.dept |
|
|
title: options.dept |
|
@ -37,22 +41,14 @@ Page({ |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
searchFile () { |
|
|
searchFile () { |
|
|
console.log(this.data.searchContent) |
|
|
this.data.archivesList = [] |
|
|
if(!this.data.searchContent.length) { |
|
|
|
|
|
wx.showToast({ |
|
|
|
|
|
title: '不能为空', |
|
|
|
|
|
icon: 'loading', |
|
|
|
|
|
duration: 2000 |
|
|
|
|
|
}) |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
this.search(this.data.deptId, this.data.searchContent) |
|
|
this.search(this.data.deptId, this.data.searchContent) |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
search(deptId, keywords) { |
|
|
search(deptId, keywords) { |
|
|
let params = { |
|
|
let params = { |
|
|
pageindex: this.data.pageindex, |
|
|
pageIndex: this.data.pageIndex, |
|
|
pagesize: this.data.pagesize, |
|
|
pageSize: this.data.pageSize, |
|
|
deptId, |
|
|
deptId, |
|
|
searchContent: keywords |
|
|
searchContent: keywords |
|
|
} |
|
|
} |
|
@ -60,6 +56,7 @@ Page({ |
|
|
console.log('搜索接口', res); |
|
|
console.log('搜索接口', res); |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
archivesList: [...this.data.archivesList,...res.data], |
|
|
archivesList: [...this.data.archivesList,...res.data], |
|
|
|
|
|
nodata: false, |
|
|
loadMoreType: res.data.length === this.data.pageSize ? 'loading' : 'none', |
|
|
loadMoreType: res.data.length === this.data.pageSize ? 'loading' : 'none', |
|
|
loadMoreVisible: res.data.length === this.data.pageSize ? false : true |
|
|
loadMoreVisible: res.data.length === this.data.pageSize ? false : true |
|
|
}) |
|
|
}) |
|
@ -69,6 +66,16 @@ Page({ |
|
|
loadMoreType: 'none', |
|
|
loadMoreType: 'none', |
|
|
loadMoreVisible: false, |
|
|
loadMoreVisible: false, |
|
|
}) |
|
|
}) |
|
|
|
|
|
} else if (keywords != '') { |
|
|
|
|
|
let reg = new RegExp(keywords,'g') |
|
|
|
|
|
this.data.archivesList.forEach(item => { |
|
|
|
|
|
item.title = item.title.replace(reg,'<span style="color:red">'+keywords+'</span>') |
|
|
|
|
|
item.archivesNum = item.archivesNum.replace(reg,'<span style="color:red">'+keywords+'</span>') |
|
|
|
|
|
}) |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
archivesList: this.data.archivesList |
|
|
|
|
|
}) |
|
|
|
|
|
console.log(this.data.archivesList) |
|
|
} |
|
|
} |
|
|
}).catch(err => { |
|
|
}).catch(err => { |
|
|
this.setData({ |
|
|
this.setData({ |
|
|