fix: 通知完善
This commit is contained in:
parent
6dfc0cb1db
commit
10522b0e24
|
|
@ -18,11 +18,11 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="tsx">
|
||||||
import { getList_api } from '@/api/account/notificationRecord';
|
import { getList_api } from '@/api/account/notificationRecord';
|
||||||
import NoticeInfo from './NoticeInfo.vue';
|
import NoticeInfo from './NoticeInfo.vue';
|
||||||
import { getWebSocket } from '@/utils/websocket';
|
import { getWebSocket } from '@/utils/websocket';
|
||||||
import { notification } from 'ant-design-vue';
|
import { notification, Button } from 'ant-design-vue';
|
||||||
import { changeStatus_api } from '@/api/account/notificationRecord';
|
import { changeStatus_api } from '@/api/account/notificationRecord';
|
||||||
import { useUserInfo } from '@/store/userInfo';
|
import { useUserInfo } from '@/store/userInfo';
|
||||||
|
|
||||||
|
|
@ -38,12 +38,40 @@ const subscribeNotice = () => {
|
||||||
.subscribe((resp: any) => {
|
.subscribe((resp: any) => {
|
||||||
total.value += 1;
|
total.value += 1;
|
||||||
notification.open({
|
notification.open({
|
||||||
message: 'Notification Title',
|
message: resp?.payload?.topicName,
|
||||||
description:
|
description: () => (
|
||||||
'This is the content of the notification. This is the content of the notification. This is the content of the notification.',
|
<div
|
||||||
|
class="ellipsis"
|
||||||
|
style={{ cursor: 'pointer' }}
|
||||||
|
onClick={() => {
|
||||||
|
changeStatus_api('_read', [resp.id]);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{resp?.payload?.message}
|
||||||
|
</div>
|
||||||
|
),
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
changeStatus_api('_read', [resp.id]);
|
changeStatus_api('_read', [resp.id]);
|
||||||
},
|
},
|
||||||
|
key: resp.payload.id,
|
||||||
|
btn: (
|
||||||
|
<Button
|
||||||
|
type="primary"
|
||||||
|
size="small"
|
||||||
|
onClick={() => {
|
||||||
|
changeStatus_api('_read', [resp.id]).then(
|
||||||
|
(resp: any) => {
|
||||||
|
if (resp.status === 200) {
|
||||||
|
notification.close(resp.payload.id);
|
||||||
|
getList();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
标记已读
|
||||||
|
</Button>
|
||||||
|
),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue