Przeglądaj źródła

消息一键已读

xiaohaizhao 1 rok temu
rodzic
commit
46b177ae7b

+ 30 - 1
pages/index/message/index.js

@@ -39,7 +39,7 @@ Component({
         "method": "queryMessage",
         content: this.data.content
       }).then(res => {
-        console.log("xiaox",res)
+        console.log("xiaox", res)
         this.selectComponent("#ListBox").setHeight("#tabs", this);
         this.selectComponent('#ListBox').RefreshToComplete();
         if (res.msg != '成功') return wx.showToast({
@@ -63,6 +63,35 @@ Component({
       })
       this.getlist(true);
     },
+    onAllRead() {
+      wx.showModal({
+        title: '提示',
+        content: '是否确定阅读所有消息',
+        complete: (res) => {
+          if (res.confirm) {
+            console.log("s")
+            _Http.basic({
+              "classname": "system.message.Message",
+              "method": "readAllMessage",
+              content: {}
+            }).then(res => {
+              console.log("一键阅读", res)
+              wx.showToast({
+                title: res.msg != '成功' ? res.msg : "操作成功",
+                icon: "none"
+              });
+              getApp().globalData.socketCallback()
+              this.setData({
+                list: this.data.list.map(v => {
+                  v.isread = 1;
+                  return v
+                })
+              })
+            })
+          }
+        }
+      })
+    },
     callback({
       detail
     }) {

+ 6 - 6
pages/index/message/index.scss

@@ -1,13 +1,14 @@
-
 /* 未读 */
 .unread {
+	display: flex;
 	width: 750rpx;
-	height: 34rpx;
-	text-align: center;
+	height: 54rpx;
 	font-size: 24rpx;
 	font-family: PingFang SC-Regular, PingFang SC;
 	color: #999999;
-	margin: 12rpx 0 -5rpx 0;
+	align-items: center;
+	justify-content: space-between;
+	padding: 0 36rpx;
 }
 
 page {
@@ -20,5 +21,4 @@ page {
 	font-size: 28rpx !important;
 	font-family: PingFang SC-Bold, PingFang SC !important;
 	font-weight: bold !important;
-}
-
+}

+ 5 - 2
pages/index/message/index.wxml

@@ -1,9 +1,12 @@
-<van-tabs id='tabs' wx:if="{{tabshow}}" active="{{ content.type }}" color='var(--assist)' tab-active-class='tab-active-class' bind:change="tabChange">
+<van-tabs wx:if="{{tabshow}}" active="{{ content.type }}" color='var(--assist)' tab-active-class='tab-active-class' bind:change="tabChange">
     <van-tab title="应用消息" name='应用' />
     <van-tab title="系统消息" name='系统' />
 </van-tabs>
+<view id='tabs' class="unread">
+    <text>总共{{total}}条</text>
+    <text bindtap="onAllRead">一键已读</text>
+</view>
 <Yl_ListBox id="ListBox" height="{{height}}" bind:getlist='getlist'>
-    <view class="unread">总共{{total}}条</view>
     <list list="{{list}}" bindcallback="callback" />
     <Yl_Empty wx:if="{{!list.length}}" />
     <view style="height: 180rpx;" />

+ 1 - 1
pages/index/message/modules/list/index.scss

@@ -7,7 +7,7 @@
 	border-radius: 16rpx;
 	overflow: hidden;
 	background: #ffffff;
-	margin: 20rpx auto 0;
+	margin: 0 auto 20rpx;
 	padding: 20rpx 30rpx;
 
 	.title {