|
@@ -1,28 +1,44 @@
|
|
<template>
|
|
<template>
|
|
<Page title="消息">
|
|
<Page title="消息">
|
|
|
|
+ <template v-slot:headerRight>
|
|
|
|
+ <div class="oneClickRead-box" @click="oneClickRead()">
|
|
|
|
+ <img src="/src/assets/image/oneClickRead.png" alt="">
|
|
|
|
+ 一键已读
|
|
|
|
+ </div>
|
|
|
|
+ </template>
|
|
<template v-slot:body>
|
|
<template v-slot:body>
|
|
- <div v-for="item in messageList">
|
|
|
|
- <div class="p-[10px] bg-white my-[8px]" @click="toDetail(item)">
|
|
|
|
- <span :class="`${item.checked ? 'text-[#07C160]' : 'themeTextColor'}`">{{ item.msg }}</span>
|
|
|
|
|
|
+ <template v-for="item in messageList">
|
|
|
|
+ <div class="rounded bg-white mb-3 py-4 px-5" @click="toDetail(item)">
|
|
|
|
+ <div :class="`${item.checked ? 'opacity-30' : 'pseudoElements'} flex justify-between items-center flex-row relative`">
|
|
|
|
+ <div class="imgBox">
|
|
|
|
+ <img src="/src/assets/image/news.png" alt="">
|
|
|
|
+ </div>
|
|
|
|
+ <div class="flex-1">
|
|
|
|
+ <div class="text-size-in text-[#000]">{{ item.msg }}</div>
|
|
|
|
+ <div class="text-[#B9B9B9]">{{ item.timeStr }}</div>
|
|
|
|
+ </div>
|
|
|
|
+ <van-icon name="arrow" color="#D4D4D4" size="1.2rem" />
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
- </div>
|
|
|
|
|
|
+ </template>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<template v-slot:footer>
|
|
<template v-slot:footer>
|
|
- <Footer />
|
|
|
|
- </template>
|
|
|
|
|
|
+ <Footer />
|
|
|
|
+ </template>
|
|
</Page>
|
|
</Page>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
import { ref } from "vue";
|
|
import { ref } from "vue";
|
|
import { useLifecycle } from "@hooks/useCommon.js";
|
|
import { useLifecycle } from "@hooks/useCommon.js";
|
|
-import { GET_MESSAGE_LIST, ONE_CLICK_READ } from "@hooks/useApi";
|
|
|
|
|
|
+import { GET_MESSAGE_LIST, READ_MESSAGE } from "@hooks/useApi";
|
|
import useShowToast from "@hooks/useToast";
|
|
import useShowToast from "@hooks/useToast";
|
|
import useRouterStore from "@store/useRouterStore.js";
|
|
import useRouterStore from "@store/useRouterStore.js";
|
|
import useInfoStore from "@store/useInfoStore.js";
|
|
import useInfoStore from "@store/useInfoStore.js";
|
|
import requests from "@common/requests";
|
|
import requests from "@common/requests";
|
|
import { routingInfos } from "@utility/generalVariables"
|
|
import { routingInfos } from "@utility/generalVariables"
|
|
|
|
+import dayjs from "dayjs";
|
|
const { toastLoading, toastSuccess, toastFail } = useShowToast();
|
|
const { toastLoading, toastSuccess, toastFail } = useShowToast();
|
|
|
|
|
|
const router = useRouterStore()
|
|
const router = useRouterStore()
|
|
@@ -32,7 +48,12 @@ const messageList = ref([]);
|
|
|
|
|
|
function getMessageList() {
|
|
function getMessageList() {
|
|
requests.post(GET_MESSAGE_LIST, {}).then(({ data = [] }) => {
|
|
requests.post(GET_MESSAGE_LIST, {}).then(({ data = [] }) => {
|
|
- messageList.value = data || []
|
|
|
|
|
|
+ messageList.value = (data || []).map(item => {
|
|
|
|
+ return {
|
|
|
|
+ ...item,
|
|
|
|
+ timeStr: dayjs(item.time).format('YYYY-MM-DD HH:mm')
|
|
|
|
+ }
|
|
|
|
+ })
|
|
userInfo.updateState({
|
|
userInfo.updateState({
|
|
numberOfMessages: data.filter((item) => !item.checked)?.length || ''
|
|
numberOfMessages: data.filter((item) => !item.checked)?.length || ''
|
|
})
|
|
})
|
|
@@ -72,4 +93,37 @@ function longPress(row, item) {
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|
|
|
|
|
|
-<style lang="scss" scoped></style>
|
|
|
|
|
|
+<style lang="scss" scoped>
|
|
|
|
+.imgBox {
|
|
|
|
+ position: relative;
|
|
|
|
+ width: 40px;
|
|
|
|
+ margin-right: 10px;;
|
|
|
|
+ img {
|
|
|
|
+ width: 100%;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.pseudoElements {
|
|
|
|
+ .imgBox::after {
|
|
|
|
+ content: '';
|
|
|
|
+ width: 5px;
|
|
|
|
+ height: 5px;
|
|
|
|
+ border-radius: 50%;
|
|
|
|
+ background: red;
|
|
|
|
+ position: absolute;
|
|
|
|
+ top: 0;
|
|
|
|
+ right: 0;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.oneClickRead-box {
|
|
|
|
+ font-size: 12px;
|
|
|
|
+ color: #747474;
|
|
|
|
+ display: flex;
|
|
|
|
+ align-items: center;
|
|
|
|
+ img {
|
|
|
|
+ margin-right: 3.12px;
|
|
|
|
+ width: 13.55px;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+</style>
|