浏览代码

[edit] read msg

wenliming 3 年之前
父节点
当前提交
bdb0e4a985
共有 3 个文件被更改,包括 58 次插入34 次删除
  1. 8 0
      src/uilts/help.js
  2. 20 20
      src/view/components/popup-transactions.vue
  3. 30 14
      src/view/popup/popup.vue

+ 8 - 0
src/uilts/help.js

@@ -76,4 +76,12 @@ export function scaleNumber(num) {
       val,
       scale
     };
+}
+
+export function getBit (value) {
+  const reg = /([0-9]+\.[0-9]{4})[0-9]*/;
+  let str = value.toString();
+  str = str.replace(reg,"$1");
+  console.log(str);
+  return str;
 }

+ 20 - 20
src/view/components/popup-transactions.vue

@@ -16,7 +16,7 @@
             <div>
                 <div class="cell" v-for="(item, index) in dataList" :key="index">
                     <red-dot class="red-dots"
-                        v-if="item.unReadMsgCount > 0"></red-dot> 
+                        v-if="item.unReadMsgCount > 0 && isReadMsg"></red-dot> 
                     <div class="img-wrapper">
                         <!-- 收入- 任务红包领取 -->
                         <template v-if="item.bizType == 1">
@@ -88,8 +88,8 @@
                                     <template v-if="item.bizData.withdrawStatus == 0 || item.bizData.withdrawStatus == 1">
                                         <div>
                                             <div class="balance">
-                                                <span class="amount">
-                                                    -{{ item.trxAmountValue || 0 }}
+                                                <span class="amount" :title="'-'+item.trxAmountValue">
+                                                    -{{ getBit(item.trxAmountValue) || 0 }}
                                                 </span>
                                                 <span class="name">{{ item.trxAmountCurrencyInfo.tokenSymbol }}</span>
                                                 <img :src="item.trxAmountCurrencyInfo.iconPath" alt="">
@@ -101,7 +101,7 @@
                                     </template>
                                     <template v-else-if="item.bizData.withdrawStatus == 2">
                                         <div class="balance">
-                                            <span class="amount">-{{ item.trxAmountValue || 0 }}</span>
+                                            <span class="amount" :title="'-'+item.trxAmountValue">-{{ getBit(item.trxAmountValue) || 0 }}</span>
                                             <span class="name">{{ item.trxAmountCurrencyInfo.tokenSymbol }}</span>
                                             <img :src="item.trxAmountCurrencyInfo.iconPath" alt="">
                                         </div>
@@ -126,8 +126,8 @@
                                 </template>
                                 <!-- 收入 -->
                                 <template v-else>
-                                    <span class="amount">
-                                        <template v-if="item.bizType == -2">-</template>{{ item.trxAmountValue || 0 }}
+                                    <span class="amount" :title="'-'+item.trxAmountValue">
+                                        <template v-if="item.bizType == -2">-</template>{{ getBit(item.trxAmountValue) || 0 }}
                                     </span>
                                     <span class="name">{{ item.trxAmountCurrencyInfo.tokenSymbol }}</span>
                                     <img :src="item.trxAmountCurrencyInfo.iconPath" alt="">
@@ -150,6 +150,8 @@ import redDot from "@/view/components/red-dot.vue";
 import { transactionsList } from "@/http/account";
 import { readAllMsgByType, getAllMessageInfo } from "@/http/messageApi"
 import { setBadgeInfo, hideBadge } from "@/logic/background/twitter";
+import { getBit } from "@/uilts/help";
+
 var moment = require('moment');
 
 let dataList = ref([]);
@@ -164,6 +166,8 @@ let listReqParams = {
     loadMore: false,
 };
 
+let isReadMsg = ref(false);
+
 const getTransactionsList = () => {
     transactionsList({
         params: listReqParams.params,
@@ -198,23 +202,19 @@ onMounted(() => {
     }).then(res => {
         setMessageCount();
     });
+    setTimeout(() => {
+        isReadMsg.value = false;
+        readAllMsgByType({
+            params: {
+                msgType: 2 // 1:任务红包 2:钱包明细
+            }
+        }).then(res => {
+            setMessageCount();
+        })
+    }, 2000)
     getTransactionsList();
 });
 
-onBeforeUnmount(() => {
-    readAllMsgByType({
-        params: {
-            msgType: 1 // 1:任务红包 2:钱包明细
-        }
-    });
-    readAllMsgByType({
-        params: {
-            msgType: 2
-        }
-    });
-})
-
-
 const setMessageCount = () => {
     getAllMessageInfo({params: {
     }}).then(res => {

+ 30 - 14
src/view/popup/popup.vue

@@ -40,7 +40,7 @@
                             @click="clickListItem(item, index)">
 
                             <red-dot class="red-dots"
-                                v-if="item.unReadMsgCount > 0"></red-dot>
+                                v-if="item.unReadMsgCount > 0 && isReadMsg"></red-dot>
 
                             <div class="img-wrapper">
                                 <!-- 收到红包 -->
@@ -88,7 +88,7 @@
                                                 </template>
                                                 <!-- 已完成 -->
                                                 <template v-else-if="item.status == 1">
-                                                    <span class="blance">{{ item.amount }}</span>
+                                                    <span class="blance" :title="item.amount">{{ getBit(item.amount) }}</span>
                                                     <span class="coin-type">{{ item.currencySymbol || '' }}</span>
                                                     <img :src="item.currencyIconPath" alt="">
                                                 </template>
@@ -99,7 +99,7 @@
                                             </template>
                                             <!-- 发出去的 -->
                                             <template v-else-if="item.type == 2">
-                                                <span class="blance">-{{ item.amount }}</span>
+                                                <span class="blance" :title="'-'+item.amount">-{{ item.amount }}</span>
                                                 <span class="coin-type">{{ item.currencySymbol || '' }}</span>
                                                 <img :src="item.currencyIconPath" alt="">
                                             </template>
@@ -204,7 +204,7 @@
 </template>
 
 <script setup>
-import { ref, onMounted, inject, onBeforeUnmount } from "vue";
+import { ref, onMounted, inject } from "vue";
 
 import popupLogin from "@/view/popup/components/login.vue";
 import popupTransactions from "@/view/components/popup-transactions";
@@ -221,7 +221,10 @@ import { terminatedLuckdrop } from "@/http/redPacket";
 import { setBadgeInfo, hideBadge } from "@/logic/background/twitter";
 import Report from "@/log-center/log";
 import router from "@/router/popup.js";
-import VHead from '@/view/popup/components/head.vue'
+import { getBit } from "@/uilts/help";
+
+import VHead from '@/view/popup/components/head.vue';
+
 
 let withdraw_info = inject('withdraw_info')
 withdraw_info.paypal = {}
@@ -251,6 +254,7 @@ let giveList = ref([]);
 
 // 钱包未读数
 let unReadCountWallet = ref(0);
+let isReadMsg = ref(true);
 
 let giveReqParams = {
     params: {
@@ -271,12 +275,17 @@ withdraw_info.paypal.wallet_withdraw_config = walletWithdrawConfig
 
 
 let moreTabList = ref([
+    {
+        icon: require("@/assets/svg/icon-website.svg"),
+        label: "Website",
+        href: 'https://denet.me'
+    },
     {
         icon: require("@/assets/svg/icon-twitter.svg"),
         label: "Twitter",
         href: 'https://twitter.com/denet2022'
-    }
-    , {
+    },
+    {
         icon: require("@/assets/svg/icon-discord.svg"),
         label: "Discord",
         href: 'https://discord.gg/wZSz9p8ddG'
@@ -320,19 +329,22 @@ onMounted(() => {
     });
     setMessageCount();
     setTimeout(() => {
-        setMessageCount();
-    }, 1600)
+        isReadMsg.value = false;
+        readAllMsg({msgType: 1}, () => {
+            setMessageCount();
+        });
+    }, 2000);
 });
 
-onBeforeUnmount(() => {
+const readAllMsg = ({msgType}, cb) => {
     readAllMsgByType({
         params: {
-            msgType: 1
+            msgType
         }
     }).then(res => {
-        setMessageCount();
+        cb && cb();
     })
-});
+};
 
 const setMessageCount = () => {
     getAllMessageInfo({params: {
@@ -488,6 +500,8 @@ const withdrawBack = () => {
 const showTransactions = () => {
 //     // homeVisibility.value = false;
 //     // transactionsVisibility.value = true;
+
+    readAllMsg({msgType: 1});
     router.push('/transactions')
 };
 
@@ -816,6 +830,8 @@ body {
                             font-weight: 500;
                             font-size: 14px;
                             margin-bottom: 5px;
+                            max-width: 132px;
+                            word-break: break-all;
                         }
 
                         .time {
@@ -841,7 +857,7 @@ body {
                                 .blance {
                                     margin-left: 3px;
                                     display: inline-block;
-                                    max-width: 68px;
+                                    max-width: 80px;
                                     word-break: break-all;
                                     line-height: 18px;
                                     color: #E29A2E;