|
@@ -1,8 +1,10 @@
|
|
|
<template>
|
|
|
+ <scroll-view scroll-y="true" :scroll-into-view="scrollViewId" @scrolltoupper="onScrollTop" style="height: 100vh;">
|
|
|
<view class="message-list-page">
|
|
|
- <!-- <view class="top-time-box white-wrap">昨天 21:00</view> -->
|
|
|
<view class="list">
|
|
|
- <view class="message-item flex" v-for="item in list" :key="item.Id">
|
|
|
+ <view class="message-item" v-for="item in list" :key="item.Id" :id="`msg${item.Id}`">
|
|
|
+ <view class="top-time-box white-wrap">{{item.msgTime}}</view>
|
|
|
+ <view class="flex">
|
|
|
<image :src="avatar" mode="aspectFill" style="width: 88rpx;height: 88rpx;"></image>
|
|
|
<view class="message-content">
|
|
|
<view style="color:#666;font-size: 12px;">审批小助手</view>
|
|
@@ -21,9 +23,11 @@
|
|
|
<image :src="item.statusImg" mode="aspectFill" class="status-img"></image>
|
|
|
</view>
|
|
|
</view>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
+ </scroll-view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
@@ -40,6 +44,8 @@
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ scrollViewId:'',
|
|
|
+
|
|
|
type: null, //类型对应的数字: 1客户(custome)、2合同(contract)、3用印(seal)
|
|
|
typeName:null,//类型对应的英文 客户(custome)、合同(contract)、用印(seal)
|
|
|
page: 1, //页码
|
|
@@ -53,21 +59,27 @@
|
|
|
this.initPage(options.type)
|
|
|
this.getList()
|
|
|
},
|
|
|
- onPullDownRefresh() {
|
|
|
- this.page=1
|
|
|
- this.finished=false
|
|
|
- this.list=[]
|
|
|
- this.getList()
|
|
|
- setTimeout(()=>{
|
|
|
- uni.stopPullDownRefresh()
|
|
|
- },1500)
|
|
|
- },
|
|
|
- onReachBottom() {
|
|
|
- if(this.finished) return
|
|
|
- this.page++
|
|
|
- this.getList()
|
|
|
- },
|
|
|
+ // onPullDownRefresh() {
|
|
|
+ // this.page=1
|
|
|
+ // this.finished=false
|
|
|
+ // this.list=[]
|
|
|
+ // this.getList()
|
|
|
+ // setTimeout(()=>{
|
|
|
+ // uni.stopPullDownRefresh()
|
|
|
+ // },1500)
|
|
|
+ // },
|
|
|
+ // onReachBottom() {
|
|
|
+ // if(this.finished) return
|
|
|
+ // this.page++
|
|
|
+ // this.getList()
|
|
|
+ // },
|
|
|
methods: {
|
|
|
+ onScrollTop(){
|
|
|
+ if(this.finished) return
|
|
|
+ this.page++
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+
|
|
|
handleGoDetail(e){
|
|
|
if(this.typeName==='custome'){
|
|
|
uni.navigateTo({
|
|
@@ -114,18 +126,56 @@
|
|
|
statusName='已驳回'
|
|
|
break
|
|
|
}
|
|
|
+
|
|
|
+ // 处理消息时间
|
|
|
+ let msgTime=this.handleMsgTime(item.CreateTime)
|
|
|
return {
|
|
|
statusImg:statusImg,
|
|
|
statusName:statusName,
|
|
|
- ...item
|
|
|
+ ...item,
|
|
|
+ msgTime:msgTime
|
|
|
}
|
|
|
})
|
|
|
- this.list = [...this.list, ...arr]
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ this.scrollViewId=`msg${res.data.List[0].Id}`
|
|
|
+ })
|
|
|
+
|
|
|
+ let reArr=arr.reverse()
|
|
|
+ this.list = [...reArr,...this.list]
|
|
|
}
|
|
|
|
|
|
}
|
|
|
},
|
|
|
|
|
|
+ handleMsgTime(e){
|
|
|
+ let timeStr=''
|
|
|
+ // 获取今日
|
|
|
+ const todayTime=new Date()
|
|
|
+
|
|
|
+
|
|
|
+ const time=new Date(e)
|
|
|
+ const year=time.getFullYear()
|
|
|
+ const month = time.getMonth() + 1 > 9 ? time.getMonth()+1 : '0'+(time.getMonth()+1);
|
|
|
+ const day = time.getDate() > 9 ? time.getDate() : "0" + time.getDate();
|
|
|
+ const hours=time.getHours() > 9 ? time.getHours():'0'+time.getHours()
|
|
|
+ const minutes=time.getMinutes()>9 ?time.getMinutes():'0'+time.getMinutes()
|
|
|
+ const seconds=time.getSeconds()>9?time.getSeconds():'0'+time.getSeconds()
|
|
|
+
|
|
|
+ if(year!=todayTime.getFullYear()||(time.getMonth()!=todayTime.getMonth())){
|
|
|
+ timeStr=`${year}.${month}.${day} ${hours}:${minutes}:${seconds}`
|
|
|
+ }else if(time.getDate()+1==todayTime.getDate()){
|
|
|
+ //昨天
|
|
|
+ timeStr=`昨天 ${hours}:${minutes}:${seconds}`
|
|
|
+ }else if(time.getDate()==todayTime.getDate()){
|
|
|
+ timeStr=`今天 ${hours}:${minutes}:${seconds}`
|
|
|
+ }else{
|
|
|
+ timeStr=`${year}.${month}.${day} ${hours}:${minutes}:${seconds}`
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return timeStr
|
|
|
+ },
|
|
|
+
|
|
|
// 初始化界面
|
|
|
initPage(type) {
|
|
|
|
|
@@ -164,21 +214,27 @@
|
|
|
padding: 20rpx;
|
|
|
}
|
|
|
|
|
|
- .top-time-box{
|
|
|
- margin-left: auto;
|
|
|
- margin-right: auto;
|
|
|
- width: 200rpx;
|
|
|
- height: 50rpx;
|
|
|
- line-height: 50rpx;
|
|
|
- font-size: 12px;
|
|
|
- text-align: center;
|
|
|
- border-radius: 25rpx;
|
|
|
- }
|
|
|
+
|
|
|
.list{
|
|
|
padding: 0 36rpx 0 19rpx;
|
|
|
.message-item{
|
|
|
- margin-top: 60rpx;
|
|
|
+ margin-top: 50rpx;
|
|
|
+ }
|
|
|
+ .top-time-box{
|
|
|
+ display: inline-block;
|
|
|
+ padding: 0 20rpx;
|
|
|
+ min-width: 200rpx;
|
|
|
+ height: 50rpx;
|
|
|
+ line-height: 50rpx;
|
|
|
+ font-size: 12px;
|
|
|
+ text-align: center;
|
|
|
+ border-radius: 25rpx;
|
|
|
+ position: relative;
|
|
|
+ left: 50%;
|
|
|
+ transform: translateX(-50%);
|
|
|
+ margin-bottom: 40rpx;
|
|
|
}
|
|
|
+
|
|
|
.message-content{
|
|
|
margin-left: 20rpx;
|
|
|
flex: 1;
|