From 4b48bacef8646cee8b66f5e10b0ed7124534e93e Mon Sep 17 00:00:00 2001
From: odc.xiaohui <xiaohui@Q1>
Date: 星期五, 12 五月 2023 17:10:47 +0800
Subject: [PATCH] 首页修改
---
miniprogram/pages/user/group/message/index.ts | 132 +++++++++++++++++++++++++++++++++++++++----
1 files changed, 118 insertions(+), 14 deletions(-)
diff --git a/miniprogram/pages/user/group/message/index.ts b/miniprogram/pages/user/group/message/index.ts
index da8b710..b224609 100644
--- a/miniprogram/pages/user/group/message/index.ts
+++ b/miniprogram/pages/user/group/message/index.ts
@@ -4,6 +4,7 @@
Page({
data: {
+ inter:1,
messageList: [],
isShow: false,
height: null,
@@ -126,15 +127,108 @@
})
}
},
-
+ getBan(){
+ var date = new Date()
+ var month = date.getMonth() + 1
+ var day = date.getDate()
+ var hours = date.getHours()
+ var minutes = date.getMinutes()
+ var secends = date.getSeconds()
+ var time
+ if (month < 10) {
+ month = "0" + month
+ }
+ if (day < 10) {
+ day = "0" + day
+ }
+ if (minutes < 10) {
+ minutes = "0" + minutes
+ }
+ if (hours < 10) {
+ hours = "0" + hours
+ }
+ if (secends < 10) {
+ secends = "0" + secends
+ }
+ time = date.getFullYear() + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + secends
+ var lastTime = wx.getStorageSync('time')
+ wx.request(
+ {
+ url: userMessage.globalData.url + "/wx/user/group/list",
+ method: "GET",
+ data: {
+ id: wx.getStorageSync('id'),
+ newDate: time,
+ lastDate: lastTime
+ },
+ header: { 'token': wx.getStorageSync('token') },
+ success: (res) => {
+ console.log(res.data.data)
+ this.setData({
+ ban:res.data.data[0].ban
+ })
+ }
+ })
+ },
+ getmessage(){
+ wx.request(
+ {
+ url: userMessage.globalData.url + "/wx/message",
+ method: "GET",
+ header: { 'token': wx.getStorageSync('token') },
+ data: {
+ groupId: this.data.groupId
+ },
+ success: (res) => {
+ for (let index = 0; index < res.data.data.length; index++) {
+ if (res.data.data[index].pic != null) {
+ res.data.data[index].pic = userMessage.globalData.imageUrl + "/img/" + res.data.data[index].pic;
+ }
+ }
+ this.setData({
+ messageList: res.data.data,
+
+ })
+ console.log(this.data.messageList)
+ wx.createSelectorQuery().select('#chat')
+ .boundingClientRect(function(rect){
+ console.log('rectheight',rect);
+ /* 灏嗛〉闈㈢Щ鍔ㄥ埌鏈�搴曢儴锛堢敤xxx鐨刪eight瀹氫綅锛� */
+ wx.pageScrollTo({
+ scrollTop: rect.height
+ })
+ }).exec()
+ }
+ })
+ },
+ endInter(){
+ let thit = this
+ clearInterval(thit.data.inter)
+ },
+ onUnload () {
+ console.log('娓呴櫎瀹氭椂鍣�');
+
+ this.endInter()
+ },
+ onHide(){
+ console.log('娓呴櫎瀹氭椂鍣�');
+ this.endInter()
+ },
onLoad(e) {
- var date = new Date()
- var month = date.getMonth() + 1
- var day = date.getDate()
- var hours=date.getHours()
- var minutes=date.getMinutes()
- var secends=date.getSeconds()
- var time
+ this.setData({
+ uid:wx.getStorageSync('id')
+ })
+ console.log(this.data.uid);
+ this.setData({
+ uid:wx.getStorageSync('id')
+ })
+ let date = new Date()
+ let month = date.getMonth() + 1
+ let day = date.getDate()
+ let hours=date.getHours()
+ let minutes=date.getMinutes()
+ let secends=date.getSeconds()
+ let time
if (month < 10) {
month = "0" + month
}
@@ -152,12 +246,14 @@
}
time = date.getFullYear() + "-" + month + "-" + day + " " + hours+":"+minutes+":"+secends
wx.setStorageSync('time',time)
+
this.data.groupId=e.id
- this.data.ban=e.ban
- this.setData({
- ban:e.ban
- })
- console.log("reoId",e.reportId)
+ // this.data.ban=e.ban
+ // this.setData({
+ // ban:e.ban
+ // })
+ this.getBan()
+ console.log("reoId",e.reportId,e)
this.data.reportId=e.reportId
wx.request(
{
@@ -187,5 +283,13 @@
}).exec()
}
})
- }
+ let that = this
+ that.data.inter = setInterval(function(){
+ that.getmessage()
+ },30000)
+ },
+ onShow(){
+ console.log('123');
+
+ },
})
--
Gitblit v1.8.0