Browse Source

锦水档案模块完善

master
ZhaoTongYao 5 years ago
parent
commit
8b5d43f07e
  1. 2
      app.json
  2. 2
      project.config.json
  3. 117
      subpages/understandJs/pages/archives/archives.js
  4. 6
      subpages/understandJs/pages/archives/archives.json
  5. 31
      subpages/understandJs/pages/archives/archives.wxml
  6. 41
      subpages/understandJs/pages/archives/archives.wxss
  7. 107
      subpages/understandJs/pages/archivesDept/archivesDept.js
  8. 7
      subpages/understandJs/pages/archivesDept/archivesDept.json
  9. 29
      subpages/understandJs/pages/archivesDept/archivesDept.wxml
  10. 92
      subpages/understandJs/pages/archivesDept/archivesDept.wxss
  11. 80
      subpages/understandJs/pages/archivesDetail/archivesDetail.js
  12. 4
      subpages/understandJs/pages/archivesDetail/archivesDetail.json
  13. 2
      subpages/understandJs/pages/archivesDetail/archivesDetail.wxml
  14. 1
      subpages/understandJs/pages/archivesDetail/archivesDetail.wxss
  15. 17
      utils/understandJs.js

2
app.json

@ -121,6 +121,8 @@
"pages/delicious/delicious",
"pages/sclerotia/sclerotia",
"pages/archives/archives",
"pages/archivesDept/archivesDept",
"pages/archivesDetail/archivesDetail",
"pages/noticeDetail/noticeDetail"
]
}

2
project.config.json

@ -22,7 +22,7 @@
"disablePlugins": [],
"outputPath": ""
},
"useCompilerModule": true,
"useCompilerModule": false,
"userConfirmedUseCompilerModuleSwitch": false,
"useIsolateContext": true
},

117
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}`
})
}
})

6
subpages/understandJs/pages/archives/archives.json

@ -1,3 +1,7 @@
{
"navigationBarTitleText": "锦水档案"
"navigationBarTitleText": "锦水档案",
"usingComponents": {
"load-more": "../../../../components/loadMore/loadMore",
"no-data":"../../../../components/nodata/nodata"
}
}

31
subpages/understandJs/pages/archives/archives.wxml

@ -1,9 +1,9 @@
<view class="mian">
<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="输入档案关键字"></input>
<input placeholder-class="placeholder-style" placeholder="输入档案关键字" bindinput="bindInputValue" value="{{searchContent}}"></input>
</view>
<button class="item-right" bindtap="searchFile">搜索</button>
</view>
@ -11,19 +11,18 @@
</view>
<view class="dept-list">
<view
wx:for="{{deptList}}"
wx:for-index="index"
wx:for-item="item"
wx:key="index"
class="list-item" bindtap="navigateToDept" data-dept-id="{{item.deptId}}" data-dept="{{item.dept}}">
<view class="list-name">{{item.dept}}</view>
</view>
</view>
<load-more loadMoreType="{{loadMoreType}}" loadMoreVisible="{{loadMoreVisible}}"></load-more>
<no-data isShow="{{nodata}}"></no-data>
<!-- <view class="list-item">
<view class="list-name">玫瑰街道医疗物质采购档案</view>
<view class="list-position">
<image src="../../images/wenjian.png"></image>
<view class="list-position-name">存放位置:玫瑰街道档案室</view>
</view>
</view>
<view class="list-item">
<view class="list-name">玫瑰街道医疗物质采购档案</view>
<view class="list-position">
<image src="../../images/wenjian.png"></image>
<view class="list-position-name">存放位置:玫瑰街道档案室</view>
</view>
</view> -->

41
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;
}

107
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)
}
}
})

7
subpages/understandJs/pages/archivesDept/archivesDept.json

@ -0,0 +1,7 @@
{
"usingComponents": {
"load-more": "../../../../components/loadMore/loadMore",
"no-data":"../../../../components/nodata/nodata"
},
"navigationBarTitleText": ""
}

29
subpages/understandJs/pages/archivesDept/archivesDept.wxml

@ -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>

92
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;
}

80
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 () {
}
})

4
subpages/understandJs/pages/archivesDetail/archivesDetail.json

@ -0,0 +1,4 @@
{
"usingComponents": {},
"navigationBarTitleText": "档案内容"
}

2
subpages/understandJs/pages/archivesDetail/archivesDetail.wxml

@ -0,0 +1,2 @@
<!--subpages/understandJs/pages/archivesDetail/archivesDetail.wxml-->
<view>{{archiveContent}}</view>

1
subpages/understandJs/pages/archivesDetail/archivesDetail.wxss

@ -0,0 +1 @@
/* subpages/understandJs/pages/archivesDetail/archivesDetail.wxss */

17
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}`)
}
Loading…
Cancel
Save