15 changed files with 454 additions and 84 deletions
@ -1,74 +1,113 @@ |
|||||
// subpages/understandJs/pages/archives/archives.js
|
// subpages/understandJs/pages/archives/archives.js
|
||||
|
const api = require('../../../../utils/understandJs') |
||||
Page({ |
Page({ |
||||
|
|
||||
/** |
/** |
||||
* 页面的初始数据 |
* 页面的初始数据 |
||||
*/ |
*/ |
||||
data: { |
data: { |
||||
|
searchContent: '', |
||||
|
pageIndex: 1, |
||||
|
pageSize: 10, |
||||
|
deptList: [], |
||||
|
nodata: false, |
||||
|
loadMoreType: 'none', |
||||
|
loadMoreVisible: false |
||||
}, |
}, |
||||
|
|
||||
/** |
/** |
||||
* 生命周期函数--监听页面加载 |
* 生命周期函数--监听页面加载 |
||||
*/ |
*/ |
||||
onLoad: function (options) { |
onLoad: function (options) { |
||||
|
this.archivedepts() |
||||
}, |
|
||||
|
|
||||
/** |
|
||||
* 生命周期函数--监听页面初次渲染完成 |
|
||||
*/ |
|
||||
onReady: function () { |
|
||||
|
|
||||
}, |
|
||||
|
|
||||
/** |
|
||||
* 生命周期函数--监听页面显示 |
|
||||
*/ |
|
||||
onShow: function () { |
|
||||
|
|
||||
}, |
}, |
||||
|
|
||||
/** |
/** |
||||
* 生命周期函数--监听页面隐藏 |
* 生命周期函数--监听页面隐藏 |
||||
*/ |
*/ |
||||
onHide: function () { |
onHide: function () { |
||||
|
this.setData({ |
||||
}, |
searchContent: '' |
||||
|
}) |
||||
/** |
|
||||
* 生命周期函数--监听页面卸载 |
|
||||
*/ |
|
||||
onUnload: function () { |
|
||||
|
|
||||
}, |
|
||||
|
|
||||
/** |
|
||||
* 页面相关事件处理函数--监听用户下拉动作 |
|
||||
*/ |
|
||||
onPullDownRefresh: function () { |
|
||||
|
|
||||
}, |
}, |
||||
|
|
||||
/** |
/** |
||||
* 页面上拉触底事件的处理函数 |
* 页面上拉触底事件的处理函数 |
||||
*/ |
*/ |
||||
onReachBottom: function () { |
onReachBottom: function () { |
||||
|
this.setData({ |
||||
|
loadMoreVisible: true |
||||
|
}) |
||||
|
if (this.data.loadMoreType === 'loading') { |
||||
|
this.setData({ |
||||
|
pageIndex: this.data.pageIndex + 1, |
||||
|
pageSize: this.data.pageSize, |
||||
|
}) |
||||
|
this.archivedepts() |
||||
|
} |
||||
}, |
}, |
||||
|
|
||||
/** |
bindInputValue (e) { |
||||
* 用户点击右上角分享 |
this.setData({ |
||||
*/ |
searchContent: e.detail.value |
||||
onShareAppMessage: function () { |
}) |
||||
|
|
||||
}, |
}, |
||||
|
|
||||
searchFile () { |
searchFile () { |
||||
|
console.log(this.data.searchContent) |
||||
|
if(!this.data.searchContent.length) { |
||||
wx.showToast({ |
wx.showToast({ |
||||
title: '未查询到相关档案', |
title: '不能为空', |
||||
icon: 'none', |
icon: 'loading', |
||||
duration: 2000 |
duration: 2000 |
||||
}) |
}) |
||||
|
return; |
||||
|
} |
||||
|
let that = this |
||||
|
wx.navigateTo({ |
||||
|
url: `../archivesDept/archivesDept?dept=搜索&deptId=&searchContent=${that.data.searchContent}` |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
archivedepts () { |
||||
|
const parmas = { |
||||
|
pageIndex:this.data.pageIndex, |
||||
|
pageSize:this.data.pageSize |
||||
|
} |
||||
|
api.archivedepts(parmas).then(res => { |
||||
|
console.log(res) |
||||
|
this.setData({ |
||||
|
deptList: [...this.data.deptList,...res.data], |
||||
|
loadMoreType: res.data.length === this.data.pageSize ? 'loading' : 'none', |
||||
|
loadMoreVisible: res.data.length === this.data.pageSize ? false : true |
||||
|
}) |
||||
|
if (this.data.deptList.length == 0) {//没有值
|
||||
|
this.setData({ |
||||
|
nodata: true, |
||||
|
loadMoreType: 'none', |
||||
|
loadMoreVisible: false, |
||||
|
}) |
||||
|
} |
||||
|
}).catch(err => { |
||||
|
this.setData({ |
||||
|
deptList: [], |
||||
|
nodata: true, |
||||
|
loadMoreType: 'none', |
||||
|
loadMoreVisible: false, |
||||
|
}) |
||||
|
console.log(err) |
||||
|
}) |
||||
|
}, |
||||
|
/** |
||||
|
* 跳转到档案归属部门 |
||||
|
*/ |
||||
|
navigateToDept (e) { |
||||
|
this.setData({ |
||||
|
searchContent: '' |
||||
|
}) |
||||
|
let that = this |
||||
|
wx.navigateTo({ |
||||
|
url: `../archivesDept/archivesDept?dept=${e.currentTarget.dataset.dept}&deptId=${e.currentTarget.dataset.deptId}&searchContent=${that.data.searchContent}` |
||||
|
}) |
||||
} |
} |
||||
}) |
}) |
@ -1,3 +1,7 @@ |
|||||
{ |
{ |
||||
"navigationBarTitleText": "锦水档案" |
"navigationBarTitleText": "锦水档案", |
||||
|
"usingComponents": { |
||||
|
"load-more": "../../../../components/loadMore/loadMore", |
||||
|
"no-data":"../../../../components/nodata/nodata" |
||||
|
} |
||||
} |
} |
@ -0,0 +1,107 @@ |
|||||
|
// subpages/understandJs/pages/archivesDept/archivesDept.js
|
||||
|
const api = require('../../../../utils/understandJs') |
||||
|
Page({ |
||||
|
/** |
||||
|
* 页面的初始数据 |
||||
|
*/ |
||||
|
data: { |
||||
|
pageindex: 1, |
||||
|
pagesize: 10, |
||||
|
searchContent: '', |
||||
|
deptId:'', |
||||
|
archivesList: [], |
||||
|
nodata: false, |
||||
|
loadMoreType: 'none', |
||||
|
loadMoreVisible: false |
||||
|
}, |
||||
|
|
||||
|
/** |
||||
|
* 生命周期函数--监听页面加载 |
||||
|
*/ |
||||
|
onLoad: function (options) { |
||||
|
console.log(options) |
||||
|
this.setData({ |
||||
|
searchContent: options.searchContent, |
||||
|
deptId: options.deptId |
||||
|
}) |
||||
|
wx.setNavigationBarTitle({ |
||||
|
title: options.dept |
||||
|
}) |
||||
|
this.search(this.data.deptId, this.data.searchContent) |
||||
|
}, |
||||
|
|
||||
|
bindInputValue (e) { |
||||
|
this.setData({ |
||||
|
searchContent: e.detail.value |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
searchFile () { |
||||
|
console.log(this.data.searchContent) |
||||
|
if(!this.data.searchContent.length) { |
||||
|
wx.showToast({ |
||||
|
title: '不能为空', |
||||
|
icon: 'loading', |
||||
|
duration: 2000 |
||||
|
}) |
||||
|
return; |
||||
|
} |
||||
|
this.search(this.data.deptId, this.data.searchContent) |
||||
|
}, |
||||
|
|
||||
|
search(deptId, keywords) { |
||||
|
let params = { |
||||
|
pageindex: this.data.pageindex, |
||||
|
pagesize: this.data.pagesize, |
||||
|
deptId, |
||||
|
searchContent: keywords |
||||
|
} |
||||
|
api.archivelist(params).then(res => { |
||||
|
console.log('搜索接口', res); |
||||
|
this.setData({ |
||||
|
archivesList: [...this.data.archivesList,...res.data], |
||||
|
loadMoreType: res.data.length === this.data.pageSize ? 'loading' : 'none', |
||||
|
loadMoreVisible: res.data.length === this.data.pageSize ? false : true |
||||
|
}) |
||||
|
if (this.data.archivesList.length == 0) {//没有值
|
||||
|
this.setData({ |
||||
|
nodata: true, |
||||
|
loadMoreType: 'none', |
||||
|
loadMoreVisible: false, |
||||
|
}) |
||||
|
} |
||||
|
}).catch(err => { |
||||
|
this.setData({ |
||||
|
archivesList: [], |
||||
|
nodata: true, |
||||
|
loadMoreType: 'none', |
||||
|
loadMoreVisible: false, |
||||
|
}) |
||||
|
console.log(err) |
||||
|
}) |
||||
|
}, |
||||
|
/** |
||||
|
* 跳转到档案详情 |
||||
|
*/ |
||||
|
goToArchivesDetail (e) { |
||||
|
console.log(e.currentTarget.dataset) |
||||
|
wx.navigateTo({ |
||||
|
url: `../archivesDetail/archivesDetail?archiveId=${e.currentTarget.dataset.archiveId}` |
||||
|
}) |
||||
|
}, |
||||
|
/** |
||||
|
* 页面上拉触底事件的处理函数 |
||||
|
*/ |
||||
|
onReachBottom: function () { |
||||
|
this.setData({ |
||||
|
loadMoreVisible: true |
||||
|
}) |
||||
|
if (this.data.loadMoreType === 'loading') { |
||||
|
this.setData({ |
||||
|
pageIndex: this.data.pageIndex + 1, |
||||
|
pageSize: this.data.pageSize, |
||||
|
}) |
||||
|
this.search(this.data.deptId, this.data.searchContent) |
||||
|
} |
||||
|
} |
||||
|
}) |
@ -0,0 +1,7 @@ |
|||||
|
{ |
||||
|
"usingComponents": { |
||||
|
"load-more": "../../../../components/loadMore/loadMore", |
||||
|
"no-data":"../../../../components/nodata/nodata" |
||||
|
}, |
||||
|
"navigationBarTitleText": "" |
||||
|
} |
@ -0,0 +1,29 @@ |
|||||
|
<!--subpages/understandJs/pages/archivesDept/archivesDept.wxml--> |
||||
|
<view class="top"> |
||||
|
<view class="search"> |
||||
|
<view class="item-all"> |
||||
|
<view class="item-left"> |
||||
|
<image src="../../images/search.png"></image> |
||||
|
<input placeholder-class="placeholder-style" placeholder="输入档案关键字" bindinput="bindInputValue" value="{{searchContent}}"></input> |
||||
|
</view> |
||||
|
<button class="item-right" bindtap="searchFile">搜索</button> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class="archives-dept">{{dept}}</view> |
||||
|
<view class="archives-list"> |
||||
|
<view |
||||
|
wx:for="{{archivesList}}" |
||||
|
wx:for-index="index" |
||||
|
wx:for-item="item" |
||||
|
wx:key="index" |
||||
|
class="archives-item" bindtap="goToArchivesDetail" data-archive-id="{{item.id}}"> |
||||
|
<view >档号:{{item.archivesNum}}</view> |
||||
|
<view >题名:{{item.title}}</view> |
||||
|
<view >归档时间:{{item.archiveTime}}</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
|
||||
|
<load-more loadMoreType="{{loadMoreType}}" loadMoreVisible="{{loadMoreVisible}}"></load-more> |
||||
|
|
||||
|
<no-data isShow="{{nodata}}"></no-data> |
@ -0,0 +1,92 @@ |
|||||
|
/* subpages/understandJs/pages/archivesDept/archivesDept.wxss */ |
||||
|
page { |
||||
|
background: #f7f7f7; |
||||
|
} |
||||
|
|
||||
|
.top { |
||||
|
margin-top: 3rpx; |
||||
|
width: 100%; |
||||
|
height: 94rpx; |
||||
|
background: #fff; |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
} |
||||
|
|
||||
|
.search { |
||||
|
/* margin-top: 17rpx; */ |
||||
|
width: calc(100% - 60rpx); |
||||
|
height: 66rpx; |
||||
|
margin-left: 30rpx; |
||||
|
background: rgba(242, 242, 242, 1); |
||||
|
border-radius: 33rpx; |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
justify-content: center; |
||||
|
} |
||||
|
|
||||
|
.search .item-all { |
||||
|
height: 30rpx; |
||||
|
width: 100%; |
||||
|
width: calc(100% - 60rpx); |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
justify-content: space-between; |
||||
|
} |
||||
|
|
||||
|
.search .item-all .item-left { |
||||
|
/* background: red; */ |
||||
|
width: calc(100% - 73rpx); |
||||
|
height: 30rpx; |
||||
|
border-right: 1rpx solid #BFBFBF; |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
justify-content: space-between; |
||||
|
} |
||||
|
|
||||
|
.search .item-all .item-left image { |
||||
|
width: 30rpx; |
||||
|
height: 28rpx; |
||||
|
} |
||||
|
|
||||
|
.search .item-all .item-left input { |
||||
|
width: calc(100% - 41rpx); |
||||
|
height: 30rpx; |
||||
|
font-size: 28rpx; |
||||
|
color: #333; |
||||
|
} |
||||
|
|
||||
|
.placeholder-style { |
||||
|
font-size: 28rpx; |
||||
|
font-weight: 500; |
||||
|
color: rgba(168, 168, 168, 1); |
||||
|
} |
||||
|
|
||||
|
.search .item-all .item-right { |
||||
|
font-size: 28rpx; |
||||
|
font-weight: 500; |
||||
|
color: rgba(51, 51, 51, 1); |
||||
|
} |
||||
|
|
||||
|
button { |
||||
|
width: 53rpx; |
||||
|
height: 28rpx; |
||||
|
padding: 0; |
||||
|
border-radius: 0; |
||||
|
line-height: 28rpx; |
||||
|
} |
||||
|
|
||||
|
button::after { |
||||
|
border-radius: 0px; |
||||
|
border: none; |
||||
|
} |
||||
|
|
||||
|
.archives-list { |
||||
|
width: 690rpx; |
||||
|
margin: 0 auto; |
||||
|
display: flex; |
||||
|
flex-direction: column; |
||||
|
} |
||||
|
.archives-list .archives-item { |
||||
|
border: 1px solid #BFBFBF; |
||||
|
margin-top: 10rpx; |
||||
|
} |
@ -0,0 +1,80 @@ |
|||||
|
// subpages/understandJs/pages/archivesDetail/archivesDetail.js
|
||||
|
const api = require('../../../../utils/understandJs') |
||||
|
Page({ |
||||
|
|
||||
|
/** |
||||
|
* 页面的初始数据 |
||||
|
*/ |
||||
|
data: { |
||||
|
archiveId: '', |
||||
|
archiveContent: '' |
||||
|
}, |
||||
|
|
||||
|
/** |
||||
|
* 生命周期函数--监听页面加载 |
||||
|
*/ |
||||
|
onLoad: function (options) { |
||||
|
console.log(options) |
||||
|
this.setData({ |
||||
|
archiveId: options.archiveId |
||||
|
}) |
||||
|
this.archiveDetail() |
||||
|
}, |
||||
|
|
||||
|
archiveDetail () { |
||||
|
api.archiveDetail(this.data.archiveId).then(res => { |
||||
|
console.log('档案详情', res); |
||||
|
this.setData({ |
||||
|
archiveContent:res.data |
||||
|
}); |
||||
|
}) |
||||
|
}, |
||||
|
/** |
||||
|
* 生命周期函数--监听页面初次渲染完成 |
||||
|
*/ |
||||
|
onReady: function () { |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
/** |
||||
|
* 生命周期函数--监听页面显示 |
||||
|
*/ |
||||
|
onShow: function () { |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
/** |
||||
|
* 生命周期函数--监听页面隐藏 |
||||
|
*/ |
||||
|
onHide: function () { |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
/** |
||||
|
* 生命周期函数--监听页面卸载 |
||||
|
*/ |
||||
|
onUnload: function () { |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
/** |
||||
|
* 页面相关事件处理函数--监听用户下拉动作 |
||||
|
*/ |
||||
|
onPullDownRefresh: function () { |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
/** |
||||
|
* 页面上拉触底事件的处理函数 |
||||
|
*/ |
||||
|
onReachBottom: function () { |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
/** |
||||
|
* 用户点击右上角分享 |
||||
|
*/ |
||||
|
onShareAppMessage: function () { |
||||
|
|
||||
|
} |
||||
|
}) |
@ -0,0 +1,4 @@ |
|||||
|
{ |
||||
|
"usingComponents": {}, |
||||
|
"navigationBarTitleText": "档案内容" |
||||
|
} |
@ -0,0 +1,2 @@ |
|||||
|
<!--subpages/understandJs/pages/archivesDetail/archivesDetail.wxml--> |
||||
|
<view>{{archiveContent}}</view> |
@ -0,0 +1 @@ |
|||||
|
/* subpages/understandJs/pages/archivesDetail/archivesDetail.wxss */ |
Loading…
Reference in new issue