From 8b5d43f07e63e04b9dc72dc884d4ebdfe427baef Mon Sep 17 00:00:00 2001 From: ZhaoTongYao <531131322@qq.com> Date: Tue, 7 Jul 2020 09:34:39 +0800 Subject: [PATCH] =?UTF-8?q?=E9=94=A6=E6=B0=B4=E6=A1=A3=E6=A1=88=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.json | 2 + project.config.json | 2 +- .../understandJs/pages/archives/archives.js | 117 ++++++++++++------ .../understandJs/pages/archives/archives.json | 6 +- .../understandJs/pages/archives/archives.wxml | 31 +++-- .../understandJs/pages/archives/archives.wxss | 41 +++--- .../pages/archivesDept/archivesDept.js | 107 ++++++++++++++++ .../pages/archivesDept/archivesDept.json | 7 ++ .../pages/archivesDept/archivesDept.wxml | 29 +++++ .../pages/archivesDept/archivesDept.wxss | 92 ++++++++++++++ .../pages/archivesDetail/archivesDetail.js | 80 ++++++++++++ .../pages/archivesDetail/archivesDetail.json | 4 + .../pages/archivesDetail/archivesDetail.wxml | 2 + .../pages/archivesDetail/archivesDetail.wxss | 1 + utils/understandJs.js | 17 ++- 15 files changed, 454 insertions(+), 84 deletions(-) create mode 100644 subpages/understandJs/pages/archivesDept/archivesDept.js create mode 100644 subpages/understandJs/pages/archivesDept/archivesDept.json create mode 100644 subpages/understandJs/pages/archivesDept/archivesDept.wxml create mode 100644 subpages/understandJs/pages/archivesDept/archivesDept.wxss create mode 100644 subpages/understandJs/pages/archivesDetail/archivesDetail.js create mode 100644 subpages/understandJs/pages/archivesDetail/archivesDetail.json create mode 100644 subpages/understandJs/pages/archivesDetail/archivesDetail.wxml create mode 100644 subpages/understandJs/pages/archivesDetail/archivesDetail.wxss diff --git a/app.json b/app.json index a93418f..47b7a9d 100644 --- a/app.json +++ b/app.json @@ -121,6 +121,8 @@ "pages/delicious/delicious", "pages/sclerotia/sclerotia", "pages/archives/archives", + "pages/archivesDept/archivesDept", + "pages/archivesDetail/archivesDetail", "pages/noticeDetail/noticeDetail" ] } diff --git a/project.config.json b/project.config.json index 663d584..de6daae 100644 --- a/project.config.json +++ b/project.config.json @@ -22,7 +22,7 @@ "disablePlugins": [], "outputPath": "" }, - "useCompilerModule": true, + "useCompilerModule": false, "userConfirmedUseCompilerModuleSwitch": false, "useIsolateContext": true }, diff --git a/subpages/understandJs/pages/archives/archives.js b/subpages/understandJs/pages/archives/archives.js index 8da410a..3420686 100644 --- a/subpages/understandJs/pages/archives/archives.js +++ b/subpages/understandJs/pages/archives/archives.js @@ -1,74 +1,113 @@ // subpages/understandJs/pages/archives/archives.js +const api = require('../../../../utils/understandJs') Page({ /** * 页面的初始数据 */ data: { - + searchContent: '', + pageIndex: 1, + pageSize: 10, + deptList: [], + nodata: false, + loadMoreType: 'none', + loadMoreVisible: false }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - - }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function () { - - }, - - /** - * 生命周期函数--监听页面显示 - */ - onShow: function () { - + this.archivedepts() }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { - - }, - - /** - * 生命周期函数--监听页面卸载 - */ - onUnload: function () { - - }, - - /** - * 页面相关事件处理函数--监听用户下拉动作 - */ - onPullDownRefresh: function () { - + this.setData({ + searchContent: '' + }) }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { - + this.setData({ + loadMoreVisible: true + }) + if (this.data.loadMoreType === 'loading') { + this.setData({ + pageIndex: this.data.pageIndex + 1, + pageSize: this.data.pageSize, + }) + this.archivedepts() + } }, - /** - * 用户点击右上角分享 - */ - onShareAppMessage: function () { - + bindInputValue (e) { + this.setData({ + searchContent: e.detail.value + }) }, searchFile () { + console.log(this.data.searchContent) + if(!this.data.searchContent.length) { wx.showToast({ - title: '未查询到相关档案', - icon: 'none', + title: '不能为空', + icon: 'loading', 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}` + }) } }) \ No newline at end of file diff --git a/subpages/understandJs/pages/archives/archives.json b/subpages/understandJs/pages/archives/archives.json index 43aa612..5f80f23 100644 --- a/subpages/understandJs/pages/archives/archives.json +++ b/subpages/understandJs/pages/archives/archives.json @@ -1,3 +1,7 @@ { - "navigationBarTitleText": "锦水档案" + "navigationBarTitleText": "锦水档案", + "usingComponents": { + "load-more": "../../../../components/loadMore/loadMore", + "no-data":"../../../../components/nodata/nodata" + } } \ No newline at end of file diff --git a/subpages/understandJs/pages/archives/archives.wxml b/subpages/understandJs/pages/archives/archives.wxml index 7a7bb79..307848d 100644 --- a/subpages/understandJs/pages/archives/archives.wxml +++ b/subpages/understandJs/pages/archives/archives.wxml @@ -1,9 +1,9 @@ - + - + @@ -11,19 +11,18 @@ + + + {{item.dept}} + + + + + - \ No newline at end of file diff --git a/subpages/understandJs/pages/archives/archives.wxss b/subpages/understandJs/pages/archives/archives.wxss index 701c017..b4bf3d9 100644 --- a/subpages/understandJs/pages/archives/archives.wxss +++ b/subpages/understandJs/pages/archives/archives.wxss @@ -2,7 +2,7 @@ page { background: #f7f7f7; } -.mian { +.top { margin-top: 3rpx; width: 100%; height: 94rpx; @@ -80,38 +80,27 @@ button::after { } /* 列表 */ +.dept-list { + display: grid; + grid-template-columns: repeat(2, 1fr); + place-items: center; + gap: 30rpx 0; + width: 690rpx; + padding: 20rpx 0; + margin: 0 auto; +} .list-item { - margin-top: 16rpx; - padding-top: 30rpx; - width: 100%; - height: 170rpx; + width: 300rpx; + height: 200rpx; background: #fff; + display: flex; + justify-content: center; + align-items: center; } .list-item .list-name { - width: calc(100% - 60rpx); - margin-left: 30rpx; font-size: 34rpx; font-weight: 500; color: rgba(51, 51, 51, 1); } -.list-item .list-position { - width: calc(100% - 60rpx); - margin-left: 30rpx; - height: 26rpx; - margin-top: 35rpx; - display: flex; - align-items: center; -} -.list-item .list-position image{ - width: 30rpx; - height: 22rpx; -} -.list-item .list-position .list-position-name{ - margin-left: 10rpx; - font-size:26rpx; - font-weight:500; - color:rgba(170,170,170,1); - line-height:26rpx; -} diff --git a/subpages/understandJs/pages/archivesDept/archivesDept.js b/subpages/understandJs/pages/archivesDept/archivesDept.js new file mode 100644 index 0000000..a3cffbd --- /dev/null +++ b/subpages/understandJs/pages/archivesDept/archivesDept.js @@ -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) + } + } +}) \ No newline at end of file diff --git a/subpages/understandJs/pages/archivesDept/archivesDept.json b/subpages/understandJs/pages/archivesDept/archivesDept.json new file mode 100644 index 0000000..6f1be8c --- /dev/null +++ b/subpages/understandJs/pages/archivesDept/archivesDept.json @@ -0,0 +1,7 @@ +{ + "usingComponents": { + "load-more": "../../../../components/loadMore/loadMore", + "no-data":"../../../../components/nodata/nodata" + }, + "navigationBarTitleText": "" +} \ No newline at end of file diff --git a/subpages/understandJs/pages/archivesDept/archivesDept.wxml b/subpages/understandJs/pages/archivesDept/archivesDept.wxml new file mode 100644 index 0000000..3bc30f5 --- /dev/null +++ b/subpages/understandJs/pages/archivesDept/archivesDept.wxml @@ -0,0 +1,29 @@ + + + + + + + + + + + + +{{dept}} + + + 档号:{{item.archivesNum}} + 题名:{{item.title}} + 归档时间:{{item.archiveTime}} + + + + + + diff --git a/subpages/understandJs/pages/archivesDept/archivesDept.wxss b/subpages/understandJs/pages/archivesDept/archivesDept.wxss new file mode 100644 index 0000000..3d5b04b --- /dev/null +++ b/subpages/understandJs/pages/archivesDept/archivesDept.wxss @@ -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; +} \ No newline at end of file diff --git a/subpages/understandJs/pages/archivesDetail/archivesDetail.js b/subpages/understandJs/pages/archivesDetail/archivesDetail.js new file mode 100644 index 0000000..b506e9e --- /dev/null +++ b/subpages/understandJs/pages/archivesDetail/archivesDetail.js @@ -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 () { + + } +}) \ No newline at end of file diff --git a/subpages/understandJs/pages/archivesDetail/archivesDetail.json b/subpages/understandJs/pages/archivesDetail/archivesDetail.json new file mode 100644 index 0000000..f8e8404 --- /dev/null +++ b/subpages/understandJs/pages/archivesDetail/archivesDetail.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "档案内容" +} \ No newline at end of file diff --git a/subpages/understandJs/pages/archivesDetail/archivesDetail.wxml b/subpages/understandJs/pages/archivesDetail/archivesDetail.wxml new file mode 100644 index 0000000..d8787ea --- /dev/null +++ b/subpages/understandJs/pages/archivesDetail/archivesDetail.wxml @@ -0,0 +1,2 @@ + +{{archiveContent}} diff --git a/subpages/understandJs/pages/archivesDetail/archivesDetail.wxss b/subpages/understandJs/pages/archivesDetail/archivesDetail.wxss new file mode 100644 index 0000000..5293e7e --- /dev/null +++ b/subpages/understandJs/pages/archivesDetail/archivesDetail.wxss @@ -0,0 +1 @@ +/* subpages/understandJs/pages/archivesDetail/archivesDetail.wxss */ \ No newline at end of file diff --git a/utils/understandJs.js b/utils/understandJs.js index eb0482e..f35f894 100644 --- a/utils/understandJs.js +++ b/utils/understandJs.js @@ -3,7 +3,10 @@ module.exports = { modulelist: modulelist, deptinfolist:deptinfolist, noticelist: noticelist, - noticeDetail:noticeDetail + noticeDetail:noticeDetail, + archivedepts:archivedepts, + archivelist:archivelist, + archiveDetail:archiveDetail } // 了解锦水-模块管理接口 function modulelist() { @@ -20,4 +23,16 @@ function noticelist(params) { // 通知详情 function noticeDetail(noticeId) { return fly.get(`news/notice/detail/${noticeId}`) +} +// 了解锦水-锦水档案归属部门列表 +function archivedepts(params) { + return fly.get('custom/archive/depts', params) +} +// 了解锦水-锦水档案列表 +function archivelist(params) { + return fly.get('custom/archive/list', params) +} +// 了解锦水-锦水档案详情 +function archiveDetail(archiveId) { + return fly.get(`custom/archive/detail/${archiveId}`) } \ No newline at end of file