From 397f66b39c34ed63700c680dfe3ba6d7d7814e49 Mon Sep 17 00:00:00 2001
From: odc.xiaohui <xiaohui@Q1>
Date: 星期五, 07 四月 2023 13:11:21 +0800
Subject: [PATCH] 修改报案人删除

---
 miniprogram/pages/manager/group/message/index.ts |  235 ++++++++++++++++++++++++++++++++++------------------------
 1 files changed, 137 insertions(+), 98 deletions(-)

diff --git a/miniprogram/pages/manager/group/message/index.ts b/miniprogram/pages/manager/group/message/index.ts
index af5a021..1e7e9a3 100644
--- a/miniprogram/pages/manager/group/message/index.ts
+++ b/miniprogram/pages/manager/group/message/index.ts
@@ -4,9 +4,17 @@
 
 Page({
     data: {
-        inter:1,
-        overLayList:{},
-        showOverlay:false,
+        messageId: '',
+        sheetShow: false,
+        actions: [
+            {
+                name: '娓呴櫎姝ゆ潯娑堟伅',
+                color: '#ee0a24',
+            },
+        ],
+        inter: 1,
+        overLayList: {},
+        showOverlay: false,
         messageList: [],
         isShow: false,
         height: null,
@@ -14,7 +22,7 @@
         scrollTop: 0,
         isInput: 1,
         value: "",
-        groupId:null,
+        groupId: null,
     },
     // getDetail(e) {
     //     console.log(e)
@@ -22,55 +30,80 @@
     //         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,
@@ -79,8 +112,8 @@
         }
 
     },
-    sendMsg(){
-       
+    sendMsg() {
+
         wx.request(
             {
                 url: message.globalData.url + "/wx/group/manager/sendMsg",
@@ -88,8 +121,8 @@
                 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(
@@ -108,33 +141,33 @@
                                 }
                                 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鐨刪eight瀹氫綅锛� */
-                                    wx.pageScrollTo({
-                                      scrollTop: rect.height
-                                    })
-                                  }).exec()
+
+                                    .boundingClientRect(function (rect) {
+                                        console.log('rectheight', rect);
+
+                                        /* 灏嗛〉闈㈢Щ鍔ㄥ埌鏈�搴曢儴锛堢敤xxx鐨刪eight瀹氫綅锛� */
+                                        wx.pageScrollTo({
+                                            scrollTop: rect.height
+                                        })
+                                    }).exec()
                             }
                         })
                 }
-            }) 
+            })
     },
     inputWenzi: function (e) {
         this.setData({
@@ -151,7 +184,10 @@
             })
         }
     },
-    getmessage(){
+    getmessageList(){
+
+    },
+    getmessage() {
         wx.request(
             {
                 url: message.globalData.url + "/wx/message",
@@ -168,53 +204,56 @@
                     }
                     this.setData({
                         messageList: res.data.data,
-                        
+
                     })
                     console.log(this.data.messageList)
                     try {
                         wx.setStorageSync('time', 'time')
-                      } catch (e) { }
+                    } catch (e) { }
                     // wx.setStorageSync('time','time')
                     this.setData({
-                        isInput : 2
+                        isInput: 2
                     })
-                       
-                    
-                  
+
+
+
                     wx.createSelectorQuery().select('#chat')
-                    
-                    .boundingClientRect(function(rect){
-                        console.log('rectheight',rect);
-                        
-                        /* 灏嗛〉闈㈢Щ鍔ㄥ埌鏈�搴曢儴锛堢敤xxx鐨刪eight瀹氫綅锛� */
-                        wx.pageScrollTo({
-                          scrollTop: rect.height
-                        })
-                      }).exec()
+
+                        .boundingClientRect(function (rect) {
+                            console.log('rectheight', rect);
+
+                            /* 灏嗛〉闈㈢Щ鍔ㄥ埌鏈�搴曢儴锛堢敤xxx鐨刪eight瀹氫綅锛� */
+                            wx.pageScrollTo({
+                                scrollTop: rect.height
+                            })
+                        }).exec()
                 }
             })
     },
-    endInter(){
+    endInter() {
         let thit = this
         clearInterval(thit.data.inter)
-      },
-      onUnload () {
+    },
+    onUnload() {
+        console.log('娓呴櫎瀹氭椂鍣�');
+        
         this.endInter()
-      },
-      onHide(){
+    },
+    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
@@ -231,9 +270,9 @@
         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",
@@ -253,18 +292,18 @@
                     })
                     console.log(this.data.messageList)
                     wx.createSelectorQuery().select('#chat')
-                    .boundingClientRect(function(rect){
-                        console.log('rectheight',rect);
-                        /* 灏嗛〉闈㈢Щ鍔ㄥ埌鏈�搴曢儴锛堢敤xxx鐨刪eight瀹氫綅锛� */
-                        wx.pageScrollTo({
-                          scrollTop: rect.height
-                        })
-                      }).exec()
+                        .boundingClientRect(function (rect) {
+                            console.log('rectheight', rect);
+                            /* 灏嗛〉闈㈢Щ鍔ㄥ埌鏈�搴曢儴锛堢敤xxx鐨刪eight瀹氫綅锛� */
+                            wx.pageScrollTo({
+                                scrollTop: rect.height
+                            })
+                        }).exec()
                 }
             })
-            let that = this
-            that.data.inter = setInterval(function(){
-                that.getmessage()
-             },10000)
+        let that = this
+        that.data.inter = setInterval(function () {
+            that.getmessage()
+        }, 10000)
     }
 })

--
Gitblit v1.8.0