diff --git a/app.js b/app.js index 4d0768d..19d0114 100644 --- a/app.js +++ b/app.js @@ -1,12 +1,24 @@ // app.js App({ - onLaunch: function () { - //显示红字,badge - }, + onLaunch: function (options) { + //获取设备顶部窗口的高度(不同设备窗口高度不一样,根据这个来设置自定义导航栏的高度) + //这个最初我是在组件中获取,但是出现了一个问题,当第一次进入小程序时导航栏会把 + //页面内容盖住一部分,当打开调试重新进入时就没有问题,这个问题弄得我是莫名其妙 + //虽然最后解决了,但是花费了不少时间 + const menuButtonInfo = wx.getMenuButtonBoundingClientRect() + wx.getSystemInfo({ + success: (res) => { + this.globalData.height = res.statusBarHeight + this.globalData.deviceInfo.statusHeight = res.statusBarHeight + this.globalData.deviceInfo.navigationHeight = menuButtonInfo.height + (menuButtonInfo.top - res.statusBarHeight) * 2 + } + }) + }, globalData: { - userInfo: null - }, - globalData: { - userInfo: null + userInfo: null, + deviceInfo: { + statusHeight: 20, + navigationHeight: 40 + } } }) diff --git a/app.json b/app.json index f24ea38..b9762d0 100644 --- a/app.json +++ b/app.json @@ -24,8 +24,8 @@ "navigationBarTextStyle": "black" }, "tabBar": { - "color": "#2c2c2c", - "selectedColor": "#e40031", + "color": "#333333", + "selectedColor": "#3A80E7", "backgroundColor": "#FFFFFF", "borderStyle": "white", "list": [ diff --git a/components/loadMore/loadMore.js b/components/loadMore/loadMore.js new file mode 100644 index 0000000..cb75b8c --- /dev/null +++ b/components/loadMore/loadMore.js @@ -0,0 +1,13 @@ +"use strict"; +Component({ + properties: { + loadType: { + type: String, + value: 'more' + }, + loadVisible: { + type: Boolean, + value: false + } + } +}); diff --git a/components/loadMore/loadMore.json b/components/loadMore/loadMore.json new file mode 100644 index 0000000..bbde8dc --- /dev/null +++ b/components/loadMore/loadMore.json @@ -0,0 +1,3 @@ +{ + "component": true + } \ No newline at end of file diff --git a/components/loadMore/loadMore.wxml b/components/loadMore/loadMore.wxml new file mode 100644 index 0000000..0a8c65e --- /dev/null +++ b/components/loadMore/loadMore.wxml @@ -0,0 +1,9 @@ + + + + 加载中... + + + 没有更多了~ + + \ No newline at end of file diff --git a/components/loadMore/loadMore.wxss b/components/loadMore/loadMore.wxss new file mode 100644 index 0000000..699ec9c --- /dev/null +++ b/components/loadMore/loadMore.wxss @@ -0,0 +1,33 @@ +.load-more { + width: 100%; + height: 100rpx; + } + + .load-more .more-data { + width: 100%; + height: 100%; + display: flex; + align-items: center; + justify-content: center; + } + .load-more .more-data image { + width: 35rpx; + height: 35rpx; + margin-right: 10rpx; + } + .load-more .more-data .content { + font-size: 28rpx; + color: #999; + } + + .load-more .no-data { + width: 100%; + height: 100%; + text-align: center; + line-height: 100rpx; + } + .load-more .no-data .content { + font-size: 28rpx; + color: #999; + } + \ No newline at end of file diff --git a/components/noData/nodata.js b/components/noData/nodata.js new file mode 100644 index 0000000..91056e2 --- /dev/null +++ b/components/noData/nodata.js @@ -0,0 +1,14 @@ +"use strict"; +Component({ + properties: { + isShow: { + type: Boolean + }, + top:{ + type:Boolean, + value:false + } + }, + data: {}, + methods: {} +}); diff --git a/components/noData/nodata.json b/components/noData/nodata.json new file mode 100644 index 0000000..bbde8dc --- /dev/null +++ b/components/noData/nodata.json @@ -0,0 +1,3 @@ +{ + "component": true + } \ No newline at end of file diff --git a/components/noData/nodata.wxml b/components/noData/nodata.wxml new file mode 100644 index 0000000..73be09c --- /dev/null +++ b/components/noData/nodata.wxml @@ -0,0 +1,6 @@ + + + + 暂无数据~ + + diff --git a/components/noData/nodata.wxss b/components/noData/nodata.wxss new file mode 100644 index 0000000..16c8f37 --- /dev/null +++ b/components/noData/nodata.wxss @@ -0,0 +1,20 @@ +/* components/nodata/nodata.wxss */ +.box{ + width: 100%; + height: auto; + box-sizing: border-box; + text-align: center; + margin-top: 100rpx; +} +.image{ + width: 450rpx; + height: 240rpx; +} +.text{ + width: 100%; + height: auto; + font-size: 28rpx; + color: #BCBCBC; + display: block; + margin: 0 auto; +} \ No newline at end of file diff --git a/images/delete.png b/images/delete.png new file mode 100644 index 0000000..0f2ab23 Binary files /dev/null and b/images/delete.png differ diff --git a/images/home/information.png b/images/home/information.png index 5807cd6..9085597 100644 Binary files a/images/home/information.png and b/images/home/information.png differ diff --git a/images/home/informationSelected.png b/images/home/informationSelected.png index 5ce8e3c..1a508d0 100644 Binary files a/images/home/informationSelected.png and b/images/home/informationSelected.png differ diff --git a/images/home/message.png b/images/home/message.png index 1c1a286..2992d37 100644 Binary files a/images/home/message.png and b/images/home/message.png differ diff --git a/images/home/messageSelected.png b/images/home/messageSelected.png index 7cc758c..d00f096 100644 Binary files a/images/home/messageSelected.png and b/images/home/messageSelected.png differ diff --git a/images/home/mine.png b/images/home/mine.png index bb9278a..c648e22 100644 Binary files a/images/home/mine.png and b/images/home/mine.png differ diff --git a/images/home/mineSelected.png b/images/home/mineSelected.png index dfbfd6d..f9837fc 100644 Binary files a/images/home/mineSelected.png and b/images/home/mineSelected.png differ diff --git a/images/home/work.png b/images/home/work.png index ec78b39..bc87ba4 100644 Binary files a/images/home/work.png and b/images/home/work.png differ diff --git a/images/home/workSelected.png b/images/home/workSelected.png index e0946b6..5d17413 100644 Binary files a/images/home/workSelected.png and b/images/home/workSelected.png differ diff --git a/images/house.png b/images/house.png new file mode 100644 index 0000000..3efaf53 Binary files /dev/null and b/images/house.png differ diff --git a/images/loading.gif b/images/loading.gif new file mode 100644 index 0000000..915c198 Binary files /dev/null and b/images/loading.gif differ diff --git a/images/message/header_bg.png b/images/message/header_bg.png new file mode 100644 index 0000000..901d521 Binary files /dev/null and b/images/message/header_bg.png differ diff --git a/images/resi.png b/images/resi.png new file mode 100644 index 0000000..d97ccce Binary files /dev/null and b/images/resi.png differ diff --git a/images/satisfaction.png b/images/satisfaction.png new file mode 100644 index 0000000..986d407 Binary files /dev/null and b/images/satisfaction.png differ diff --git a/images/select.png b/images/select.png new file mode 100644 index 0000000..9e0cc87 Binary files /dev/null and b/images/select.png differ diff --git a/images/tag.png b/images/tag.png new file mode 100644 index 0000000..cc7b36e Binary files /dev/null and b/images/tag.png differ diff --git a/pages/index/index.js b/pages/index/index.js index 0bc1771..f36ef7f 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -1,48 +1,80 @@ // index.js // 获取应用实例 const app = getApp() - +import {getIntelligentMessage} from "../../utils/api" Page({ data: { - motto: 'Hello World', - userInfo: {}, - hasUserInfo: false, - canIUse: wx.canIUse('button.open-type.getUserInfo'), - canIUseGetUserProfile: false, - canIUseOpenData: wx.canIUse('open-data.type.userAvatarUrl') && wx.canIUse('open-data.type.userNickName') // 如需尝试获取用户信息可改为false + selectList:['全部信息','居民信息采集','房屋信息采集','社区满意度自评'], + selectValue:0, + pageSize:10, + pageNo:1, + tableData:[], + lowerThreshold:'10', + loadMoreVisible:false, + loadMoreType: "none", + nodata:false }, // 事件处理函数 - bindViewTap() { - wx.navigateTo({ - url: '../logs/logs' - }) - }, + onLoad() { - if (wx.getUserProfile) { - this.setData({ - canIUseGetUserProfile: true + this.setData({ + statusHeight: app.globalData.deviceInfo.statusHeight, + navigationHeight: app.globalData.deviceInfo.navigationHeight, }) - } + this.getIntelligentMessage() }, - getUserProfile(e) { - // 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认,开发者妥善保管用户快速填写的头像昵称,避免重复弹窗 - wx.getUserProfile({ - desc: '展示用户信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 - success: (res) => { - console.log(res) + +onScrollToLower(e){ + console.log(e); + if (this.data.loadMoreType === 'more') { this.setData({ - userInfo: res.userInfo, - hasUserInfo: true + loadMoreVisible: true, }) + this.data.pageNo += 1 + this.getIntelligentMessage() } +}, + getIntelligentMessage(){ + this.setData({ + loadMoreVisible: true, + nodata: false, + loadMoreType: "more", + }) + const parm = { + type:this.data.selectValue == 0? null :this.data.selectValue - 1, + readFlag:0, + limit:this.data.pageSize, + page:this.data.pageNo + } + if(!parm.type) delete parm.type + getIntelligentMessage(parm).then(res=>{ + console.log(res); + this.setData({ + loadMoreType: res.data.list.length === this.data.pageSize ? 'more' : 'none', + tableData: this.data.tableData.concat(res.data.list), + }) + console.log(this.data.loadMoreType); + console.log(res.data.list.length); + if (this.data.tableData.length == 0) { + this.setData({ + loadMoreVisible: false, + nodata: true + }) + } + }).catch(err=>{ + console.log(err); + this.setData({ + loadMoreVisible: false, + nodata: true, + }) }) }, - getUserInfo(e) { - // 不推荐使用getUserInfo获取用户信息,预计自2021年4月13日起,getUserInfo将不再弹出弹窗,并直接返回匿名的用户个人信息 - console.log(e) + + handleChangeFilter(e){ this.setData({ - userInfo: e.detail.userInfo, - hasUserInfo: true + selectValue:e.detail.value, + tableData:[], }) + this.getIntelligentMessage() } }) diff --git a/pages/index/index.json b/pages/index/index.json index f9587da..94a782d 100644 --- a/pages/index/index.json +++ b/pages/index/index.json @@ -1,4 +1,7 @@ { - "usingComponents": {}, - "navigationBarTitleText": "消息" + "navigationStyle": "custom", + "usingComponents": { + "load-more": "../../components/loadMore/loadMore", + "no-data": "../../components/noData/nodata" + } } \ No newline at end of file diff --git a/pages/index/index.wxml b/pages/index/index.wxml index e69de29..a944791 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -0,0 +1,40 @@ + + + + 消息 + + + 消息展示平台 + 快速查看 + + + + + + {{selectValue == 1?'居民信息采集':selectValue == 2?'房屋信息采集':selectValue == 3?'社区满意度自评':'全部信息'}} + + + 全部已读 + + + + + {{item.content}} + + + + + {{item.msgType == 'resident_base_info'?'居民信息采集':item.msgType == 'community_house'?'房屋信息采集':'满意度测评'}} + + + + 测评打分:{{item.deptName || '--'}} + + {{item.createdTime}} + + + + + + + \ No newline at end of file diff --git a/pages/index/index.wxss b/pages/index/index.wxss index eb64203..9aa1134 100644 --- a/pages/index/index.wxss +++ b/pages/index/index.wxss @@ -1,19 +1,182 @@ /**index.wxss**/ -.userinfo { - display: flex; - flex-direction: column; - align-items: center; - color: #aaa; +page { + width: 100%; + min-height: 100vh; + overflow: hidden auto ; + background-color: #f7f7f7; + } +.header { + width: 100%; + height: 464rpx; + /* position: fixed; + top: 0; + left: 0; + z-index: 1000; */ } - -.userinfo-avatar { - overflow: hidden; - width: 128rpx; - height: 128rpx; - margin: 20rpx; - border-radius: 50%; +.header .header-bg { + width: 100%; + height: 444rpx; + position: absolute; + height: 100%; + z-index: -999; +} +.header .navigation { + width: 100%; + display: flex; + align-items: center; + justify-content: center; + color: #333333; + font-size: 32rpx; + position: relative; + z-index: 100; +} +.header .content{ + margin: 140rpx 0 0 69rpx; +} +.header .content .h2{ + font-size: 44rpx; + font-family: PingFang SC; + font-weight: 800; + color: #333333; + margin-bottom: 40rpx; +} +.header .content .tag{ + width: 170rpx; + height: 50rpx; + position: relative; + line-height: 48rpx; + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #FFFFFF; + padding-left: 15rpx; +} +.header .content .tag image { + width: 170rpx; + height: 50rpx; + position: absolute; + top: 0; + left: 0; + z-index: -888; +} +.select{ + width: 100%; + height: 90rpx; + background-color: #fff; + display: flex; + justify-content: space-between; + box-sizing: border-box; + padding: 0 40rpx; + align-items: center; +} +.select view { + display: flex; + align-items: center; + font-size: 30rpx; + font-family: PingFang SC; + font-weight: 500; + color: #3A80E7; +} +.select view image{ + width: 16rpx; + height: 16rpx; + margin: 0 9rpx; +} +.select .delete { + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #999999; +} +.select .delete image{ + width: 30rpx; + height: 30rpx; +} +.content{ + width: 100%; + /* height: calc(100vh - 560rpx); + overflow-y: scroll; */ + padding:0 20rpx ; + box-sizing: border-box; +} +.content .scroll { + height: calc(100vh - 560rpx); + overflow-y: scroll; +} +.content .card{ + width: 100%; + background-color: #fff; + display: flex; + height: 236rpx; + flex-direction: column; + border-radius: 20rpx; + padding: 0 30rpx; + box-sizing: border-box; + margin-top: 20rpx; + overflow: hidden; +} +.blue{ + color:#5693EE; +} +.yellow{ + color:#E2944D; +} +.cyan{ + color: #2EB4F2 ; +} +.cyanBg{ + background: rgba(56,189,253,0.1); +} +.yellowBg{ + background: rgba(248,188,122,0.1); +} +.blueBg{ + background: rgba(86,147,238,0.1); +} +.gray{ + color: #999999 !important; +} +.content .card .title{ + font-size: 32rpx; + height: 90rpx; + line-height: 90rpx; + border-bottom: 1px solid #EAEAEA; + font-family: PingFang SC; + font-weight: 500; + color: #333333; + margin-bottom: 24rpx; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; } -.usermotto { - margin-top: 200px; +.content .card .type { + width: fit-content; + display: flex; + font-size: 26rpx; + border-radius: 4rpx; + background-color: rgba(56,189,253,0.1); + padding: 8rpx 10rpx; +} +.content .type image { + width: 30rpx; + height: 30rpx; +} +.content .card .type text{ + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} +.content .card .bottom{ + display: flex; + justify-content: space-between; + align-items: center; + font-size: 28rpx; + font-family: PingFang SC; + color: #999999; + margin-top: 27rpx; +} +.content .card .bottom .flex_box{ + display: flex; + justify-content: left; } \ No newline at end of file diff --git a/pages/login/login.js b/pages/login/login.js index aafeaa0..94d2273 100644 --- a/pages/login/login.js +++ b/pages/login/login.js @@ -100,6 +100,7 @@ Page({ wx.login({ success: (res) => { parm.wxCode = res.code + console.log(parm.wxCode); userLoginlog(parm).then((res)=>{ wx.hideLoading() console.log(res); @@ -107,6 +108,7 @@ Page({ wx.switchTab({ url: '/pages/work/work', }) + wx.setStorageSync('token', res.data.token) }else{ wx.showToast({ title: res.msg, diff --git a/pages/login/login.wxss b/pages/login/login.wxss index c3ac3ca..4e4c0b5 100644 --- a/pages/login/login.wxss +++ b/pages/login/login.wxss @@ -43,6 +43,7 @@ page { background: #F5F5FA; border-radius: 47rpx; padding-left: 80rpx; + font-size: 32rpx; } .login image { width: 46rpx; diff --git a/utils/api.js b/utils/api.js index a754768..1cbdf37 100644 --- a/utils/api.js +++ b/utils/api.js @@ -1,11 +1,11 @@ var fly = require('./request.js') module.exports = { - getInvitation:getInvitation, + getIntelligentMessage:getIntelligentMessage, userLoginlog:userLoginlog, } -function getInvitation(id){ - return fly.get(`app-user/user/ma/v3/getInvitation/${id}`) +function getIntelligentMessage(param){ + return fly.get(`message/intelligentMessage/page`,param) } /** *小程序用户登录日志