acdr-ui/dist/dev/mp-weixin/pages/message/message-list.js.map

1 line
4.1 KiB
Plaintext

{"version":3,"file":"message-list.js","sources":["../../../../../src/pages/message/message-list.vue","../../../../../uniPage:/cGFnZXMvbWVzc2FnZS9tZXNzYWdlLWxpc3QudnVl"],"sourcesContent":["<route lang=\"json5\">\r\n{\r\n style: {\r\n navigationBarTitleText: '消息列表',\r\n },\r\n}\r\n</route>\r\n<template>\r\n <view v-if=\"messages.length > 0\" class=\"message-list\">\r\n <view v-for=\"message in messages\" :key=\"message.id\" class=\"message-card\">\r\n <view class=\"message-header\">\r\n <text class=\"message-title\">{{ message.title }}</text>\r\n <text class=\"message-date\">{{ message.createTime }}</text>\r\n </view>\r\n <view class=\"message-content\">\r\n {{ truncateString(message.content) }}\r\n </view>\r\n </view>\r\n </view>\r\n <view v-else>\r\n <EmptyState />\r\n </view>\r\n</template>\r\n\r\n<script lang=\"js\" setup>\r\nimport { truncateString } from '@/utils/strings'\r\nimport { httpGet, httpPost } from '@/utils/http'\r\nimport { toast } from '@/utils/commUtils'\r\nimport { useMessageStore } from '@/store/message'\r\nimport EmptyState from '@/components/EmptyState.vue'\r\n\r\nconst messages = ref([])\r\nconst useMessage = useMessageStore()\r\n\r\nconst messageList = async () => {\r\n try {\r\n const res = await httpGet('/notifications/list')\r\n if (res.code == 200) {\r\n messages.value = res.data\r\n } else {\r\n toast(res.message)\r\n }\r\n } catch (e) {\r\n toast(e.data?.message || '消息请求失败')\r\n }\r\n}\r\n\r\n// 把所有未读的消息标记为已读\r\nconst markAllAsRead = async () => {\r\n try {\r\n const messageIdList = useMessage.messages.unreadMessages.map((item) => item.id)\r\n const res = await httpPost('/notifications/readList', messageIdList)\r\n if (res.code == 200) {\r\n // toast(\"消息阅读成功\")\r\n } else {\r\n toast(res.message)\r\n }\r\n } catch (e) {\r\n toast(e.data?.message || '消息阅读失败')\r\n }\r\n}\r\n\r\nonLoad(async () => {\r\n await messageList()\r\n await markAllAsRead()\r\n})\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n.message-list {\r\n display: flex;\r\n flex-direction: column;\r\n gap: 10px;\r\n padding: 10px;\r\n margin: 20px;\r\n}\r\n\r\n.message-card {\r\n position: relative; /* 为了定位通知数字 */\r\n padding: 15px;\r\n background-color: #fff; /* 白色背景 */ /* 圆角边框 */\r\n border-radius: 5px;\r\n box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* 添加阴影效果 */\r\n}\r\n\r\n.message-header {\r\n display: flex;\r\n align-items: center;\r\n justify-content: space-between;\r\n margin-bottom: 5px;\r\n}\r\n\r\n.message-title {\r\n font-weight: bold;\r\n color: #333; /* 标题颜色加深 */\r\n}\r\n\r\n.message-date {\r\n font-size: 0.8rem;\r\n color: #999; /* 日期使用更淡的颜色 */\r\n}\r\n\r\n.message-notification {\r\n position: absolute;\r\n top: 10px;\r\n right: 10px; /* 通知数字定位在右上角 */\r\n padding: 2px 6px;\r\n font-size: 0.75rem;\r\n color: white;\r\n background-color: red;\r\n border-radius: 50%;\r\n}\r\n\r\n.message-content {\r\n color: #666; /* 内容文字颜色 */\r\n}\r\n</style>\r\n","import MiniProgramPage from 'D:/App/Work/addr/acdr-ui/src/pages/message/message-list.vue'\nwx.createPage(MiniProgramPage)"],"names":["ref","useMessageStore","httpGet","toast","httpPost","onLoad"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAA,aAAA,MAAA;;;;AAEA,UAAA,WAAAA,cAAA,IAAA,EAAA;AACA,UAAA,aAAAC,cAAAA,gBAAA;AAEA,UAAA,cAAA,MAAA;;AACA,UAAA;AACA,cAAA,MAAA,MAAAC,WAAA,QAAA,qBAAA;AACA,YAAA,IAAA,QAAA,KAAA;AACA,mBAAA,QAAA,IAAA;AAAA,QACA,OAAA;AACAC,0BAAA,MAAA,IAAA,OAAA;AAAA,QACA;AAAA,MACA,SAAA,GAAA;AACAA,wBAAAA,QAAA,OAAA,SAAA,mBAAA,YAAA,QAAA;AAAA,MACA;AAAA,IACA;AAGA,UAAA,gBAAA,MAAA;;AACA,UAAA;AACA,cAAA,gBAAA,WAAA,SAAA,eAAA,IAAA,CAAA,SAAA,KAAA,EAAA;AACA,cAAA,MAAA,MAAAC,oBAAA,2BAAA,aAAA;AACA,YAAA,IAAA,QAAA,KAAA;AAAA,QAEA,OAAA;AACAD,0BAAA,MAAA,IAAA,OAAA;AAAA,QACA;AAAA,MACA,SAAA,GAAA;AACAA,wBAAAA,QAAA,OAAA,SAAA,mBAAA,YAAA,QAAA;AAAA,MACA;AAAA,IACA;AAEAE,kBAAAA,OAAA,MAAA;AACA,YAAA,YAAA;AACA,YAAA,cAAA;AAAA,IACA,EAAA;;;;;;;;;;;;;;;;;;AChEA,GAAG,WAAW,eAAe;"}