瀏覽代碼

调整菜单只保留置顶功能

bayi 2 年之前
父節點
當前提交
6605c6abeb
共有 4 個文件被更改,包括 16 次插入15 次删除
  1. 9 4
      pages/message/index.js
  2. 3 3
      pages/message/index.less
  3. 3 3
      pages/message/index.wxml
  4. 1 5
      pages/message/index.wxss

+ 9 - 4
pages/message/index.js

@@ -14,8 +14,8 @@ Page({
       top: 0,
       left: 0
     },
+    menuH: 0,
     authorityMsg: {},
-
     uid: ''
   },
   onLoad(options) {
@@ -31,6 +31,11 @@ Page({
     }
     this.getAuthorityMsg()
     this.resetData()
+    wx.createSelectorQuery().select('.menu').boundingClientRect((rect) => {
+      this.setData({
+        menuH: rect.height
+      })
+    }).exec()
   },
   async getAuthorityMsg() {
     let authorityMsg = await getAuthorityMsg()
@@ -41,7 +46,6 @@ Page({
   },
   loadMore() {
     this.getData(getMessageRecord)
-    console.log(this.list);
   },
   setSearch({
     detail
@@ -78,8 +82,9 @@ Page({
     } = e
     let remainingW = app.globalData.windowWidth - touches[0].clientX
     let remainingH = app.globalData.windowHeight - touches[0].clientY
+    let menuH = this.data.menuH
     let wFlag = remainingW - 145 > 0
-    let hFlag = remainingH - 200 > 0
+    let hFlag = remainingH - menuH + 10 > 0
     let {
       receiverUid,
       senderUid
@@ -88,7 +93,7 @@ Page({
       targetId: receiverUid != this.data.uid ? receiverUid : senderUid,
       menu: {
         show: true,
-        top: hFlag ? touches[0].clientY : touches[0].clientY - 100,
+        top: hFlag ? touches[0].clientY : touches[0].clientY - menuH,
         left: wFlag ? touches[0].clientX : touches[0].clientX - 135
       }
     })

+ 3 - 3
pages/message/index.less

@@ -131,8 +131,8 @@ page {
   .menu {
     position: fixed;
     width: 278rpx;
-    height: 180rpx;
-    padding: 0rpx 20rpx;
+    // height: 180rpx;
+    padding: 20rpx 20rpx;
     box-sizing: border-box;
     border-radius: 24rpx;
     background-color: white;
@@ -152,7 +152,7 @@ page {
     }
 
     .menu-one {
-      border-bottom: 1rpx solid #D8D8D8;
+      // border-bottom: 1rpx solid #D8D8D8;
 
       .icon {
         width: 22rpx;

+ 3 - 3
pages/message/index.wxml

@@ -73,13 +73,13 @@
     </view>
   </view>
   <view class="menuBg" bind:touchstart="cancelMenu" wx:if="{{menu.show}}"></view>
-  <view class="menu" wx:if="{{menu.show}}" style="top:{{menu.top}}px;left:{{menu.left}}px">
+  <view class="menu" style="display: {{menu.show?'block':'none'}}; top:{{menu.top}}px;left:{{menu.left}}px">
     <view class="menu-one" bindtap="msgTopping">
       <image src="/static/istop.png" class="icon" /> 置顶该聊天
     </view>
-    <view bindtap="delMessage">
+    <!--     <view bindtap="delMessage">
       <image src="/static/del.png" class="icon" />
       删除该聊天
-    </view>
+    </view> -->
   </view>
 </view>

+ 1 - 5
pages/message/index.wxss

@@ -109,8 +109,7 @@ page {
 .messagePage .menu {
   position: fixed;
   width: 278rpx;
-  height: 180rpx;
-  padding: 0rpx 20rpx;
+  padding: 20rpx 20rpx;
   box-sizing: border-box;
   border-radius: 24rpx;
   background-color: white;
@@ -127,9 +126,6 @@ page {
   height: 30rpx;
   margin-right: 16rpx;
 }
-.messagePage .menu .menu-one {
-  border-bottom: 1rpx solid #D8D8D8;
-}
 .messagePage .menu .menu-one .icon {
   width: 22rpx;
   height: 28rpx;