| | |
| | | |
| | | Page({ |
| | | data: { |
| | | overLayList:{}, |
| | | showOverlay:false, |
| | | messageId: '', |
| | | sheetShow: false, |
| | | actions: [ |
| | | { |
| | | name: '清除此条消息', |
| | | color: '#ee0a24', |
| | | }, |
| | | ], |
| | | inter: 1, |
| | | overLayList: {}, |
| | | showOverlay: false, |
| | | messageList: [], |
| | | isShow: false, |
| | | height: null, |
| | |
| | | scrollTop: 0, |
| | | isInput: 1, |
| | | value: "", |
| | | groupId:null, |
| | | groupId: null, |
| | | }, |
| | | // getDetail(e) { |
| | | // console.log(e) |
| | |
| | | // url: '../cause/detail/index?id=' + e.currentTarget.id, |
| | | // }) |
| | | // }, |
| | | onClickHide(e){ |
| | | onCloseSheet() { |
| | | this.setData({ sheetShow: false }); |
| | | }, |
| | | onSelectSheet(event) { |
| | | console.log(this.data.messageId,event); |
| | | if (event.detail.name) { |
| | | wx.request({ |
| | | url: message.globalData.url +'/message/deleteById', |
| | | method: "GET", |
| | | header: { 'token': wx.getStorageSync('token') }, |
| | | data: {id:this.data.messageId}, |
| | | success: (res) => { |
| | | console.log(res); |
| | | this.getmessage() |
| | | } |
| | | }) |
| | | } |
| | | }, |
| | | onSheetText(e) { |
| | | console.log(e); |
| | | this.setData({ sheetShow: true, |
| | | messageId:e.target.dataset.id |
| | | }) |
| | | this.data.messageId = e.target.dataset.id |
| | | this.onSelectSheet(e.target.dataset.id) |
| | | }, |
| | | onClickHide(e) { |
| | | console.log(e) |
| | | this.setData({ |
| | | showOverlay:false |
| | | showOverlay: false |
| | | }) |
| | | }, |
| | | onClickShow(e){ |
| | | onClickShow(e) { |
| | | console.log(e); |
| | | this.setData({ |
| | | overLayList:e |
| | | overLayList: e |
| | | }) |
| | | this.setData({ |
| | | showOverlay:true |
| | | showOverlay: true |
| | | }) |
| | | }, |
| | | groupMenber(){ |
| | | wx.navigateTo({ |
| | | url:'../message/member/index?id='+this.data.groupId |
| | | }) |
| | | }, |
| | | publicty(){ |
| | | wx.navigateTo({ |
| | | url:'../message/publicty/index?id='+this.data.groupId |
| | | }) |
| | | }, |
| | | banSpeech(){ |
| | | wx.navigateTo({ |
| | | url:'../message/Speech/index?id='+this.data.groupId |
| | | }) |
| | | }, |
| | | cause(){ |
| | | wx.navigateTo({ |
| | | url:'../message/cause/index?id='+this.data.groupId |
| | | }) |
| | | }, |
| | | chatRecords(){ |
| | | wx.navigateTo({ |
| | | url:'../message/records/index?id='+this.data.groupId |
| | | }) |
| | | }, |
| | | more() { |
| | | groupMenber() { |
| | | wx.navigateTo({ |
| | | url: '../message/member/index?id=' + this.data.groupId |
| | | }) |
| | | }, |
| | | publicty() { |
| | | wx.navigateTo({ |
| | | url: '../message/publicty/index?id=' + this.data.groupId |
| | | }) |
| | | }, |
| | | banSpeech() { |
| | | wx.navigateTo({ |
| | | url: '../message/Speech/index?id=' + this.data.groupId |
| | | }) |
| | | }, |
| | | cause() { |
| | | wx.navigateTo({ |
| | | url: '../message/cause/index?id=' + this.data.groupId |
| | | }) |
| | | }, |
| | | chatRecords() { |
| | | wx.navigateTo({ |
| | | url: '../message/records/index?id=' + this.data.groupId |
| | | }) |
| | | }, |
| | | more() { |
| | | console.log("进来了", this.data.scrollTop) |
| | | if (this.data.isShow == false) { |
| | | this.setData({ |
| | | isShow: true, |
| | | height: 110 |
| | | }) |
| | | |
| | | |
| | | } else { |
| | | this.setData({ |
| | | isShow: false, |
| | |
| | | } |
| | | |
| | | }, |
| | | sendMsg(){ |
| | | sendMsg() { |
| | | |
| | | wx.request( |
| | | { |
| | | url: message.globalData.url + "/wx/group/manager/sendMsg", |
| | |
| | | header: { 'token': wx.getStorageSync('token') }, |
| | | data: { |
| | | groupId: this.data.groupId, |
| | | id:wx.getStorageSync("id"), |
| | | msg:this.data.value |
| | | id: wx.getStorageSync("id"), |
| | | msg: this.data.value |
| | | }, |
| | | success: (res) => { |
| | | wx.request( |
| | |
| | | } |
| | | this.setData({ |
| | | messageList: res.data.data, |
| | | value:"" |
| | | value: "" |
| | | }) |
| | | console.log(this.data.messageList) |
| | | try { |
| | | wx.setStorageSync('time', 'time') |
| | | } catch (e) { } |
| | | } catch (e) { } |
| | | // wx.setStorageSync('time','time') |
| | | this.setData({ |
| | | isInput : 1 |
| | | isInput: 1 |
| | | }) |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | wx.createSelectorQuery().select('#chat') |
| | | |
| | | .boundingClientRect(function(rect){ |
| | | console.log('rectheight',rect); |
| | | |
| | | /* 将页面移动到最底部(用xxx的height定位) */ |
| | | wx.pageScrollTo({ |
| | | scrollTop: rect.height |
| | | }) |
| | | }).exec() |
| | | |
| | | .boundingClientRect(function (rect) { |
| | | console.log('rectheight', rect); |
| | | |
| | | /* 将页面移动到最底部(用xxx的height定位) */ |
| | | wx.pageScrollTo({ |
| | | scrollTop: rect.height |
| | | }) |
| | | }).exec() |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | }) |
| | | }, |
| | | inputWenzi: function (e) { |
| | | this.setData({ |
| | |
| | | }) |
| | | } |
| | | }, |
| | | getmessageList(){ |
| | | |
| | | }, |
| | | getmessage() { |
| | | wx.request( |
| | | { |
| | | url: message.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 = message.globalData.imageUrl + "/img/" + res.data.data[index].pic; |
| | | } |
| | | } |
| | | this.setData({ |
| | | messageList: res.data.data, |
| | | |
| | | }) |
| | | console.log(this.data.messageList) |
| | | try { |
| | | wx.setStorageSync('time', 'time') |
| | | } catch (e) { } |
| | | // wx.setStorageSync('time','time') |
| | | // this.setData({ |
| | | // isInput: 2 |
| | | // }) |
| | | |
| | | |
| | | |
| | | wx.createSelectorQuery().select('#chat') |
| | | |
| | | .boundingClientRect(function (rect) { |
| | | console.log('rectheight', rect); |
| | | |
| | | /* 将页面移动到最底部(用xxx的height定位) */ |
| | | 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) { |
| | | this.setData({ |
| | | uid:wx.getStorageSync('id') |
| | | uid: wx.getStorageSync('id') |
| | | }) |
| | | |
| | | 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 hours = date.getHours() |
| | | var minutes = date.getMinutes() |
| | | var secends = date.getSeconds() |
| | | var time |
| | | if (month < 10) { |
| | | month = "0" + month |
| | |
| | | if (secends < 10) { |
| | | secends = "0" + secends |
| | | } |
| | | time = date.getFullYear() + "-" + month + "-" + day + " " + hours+":"+minutes+":"+secends |
| | | wx.setStorageSync('time',time) |
| | | this.data.groupId=e.id |
| | | time = date.getFullYear() + "-" + month + "-" + day + " " + hours + ":" + minutes + ":" + secends |
| | | wx.setStorageSync('time', time) |
| | | this.data.groupId = e.id |
| | | wx.request( |
| | | { |
| | | url: message.globalData.url + "/wx/message", |
| | |
| | | }) |
| | | console.log(this.data.messageList) |
| | | wx.createSelectorQuery().select('#chat') |
| | | .boundingClientRect(function(rect){ |
| | | console.log('rectheight',rect); |
| | | /* 将页面移动到最底部(用xxx的height定位) */ |
| | | wx.pageScrollTo({ |
| | | scrollTop: rect.height |
| | | }) |
| | | }).exec() |
| | | .boundingClientRect(function (rect) { |
| | | console.log('rectheight', rect); |
| | | /* 将页面移动到最底部(用xxx的height定位) */ |
| | | wx.pageScrollTo({ |
| | | scrollTop: rect.height |
| | | }) |
| | | }).exec() |
| | | } |
| | | }) |
| | | let that = this |
| | | that.data.inter = setInterval(function () { |
| | | that.getmessage() |
| | | }, 10000) |
| | | } |
| | | }) |