Update message-types.vue

This commit is contained in:
huxuejian 2026-04-21 19:30:06 +08:00
parent 3b76d28edc
commit 902491bc1a

View File

@ -77,8 +77,12 @@
<script setup>
import { computed } from "vue";
import { storeToRefs } from "pinia";
import api from "@/utils/api.js";
import { getParsedCustomMessage } from "@/utils/chat-utils.js";
import { toast } from '@/utils/widget'
import useAccountStore from "@/store/account.js";
// import MessageCard from "./message-card/message-card.vue";
const props = defineProps({
@ -93,6 +97,7 @@ const props = defineProps({
});
defineEmits(["playVoice", "previewImage", "viewDetail"]);
const { account, openid } = storeToRefs(useAccountStore());
//
const isPlaying = computed(() => {
@ -209,6 +214,9 @@ const handleArticleClick = (message) => {
uni.openChannelsActivity({
finderUserName: payloadData.value.wechatChannels.finderUserName,
feedId: payloadData.value.wechatChannels.feedId,
success: () => {
markArticleRead(payloadData.value.sendId, payloadData.value.articleId);
},
fail: err => {
const errMsg = err.errMsg || '';
if (/cancel/i.test(errMsg)) {
@ -273,6 +281,20 @@ function isWechatChannels() {
const wechatChannels = payloadData.value.wechatChannels || {};
return typeof wechatChannels.finderUserName === 'string' && wechatChannels.finderUserName.trim() && typeof wechatChannels.feedId === 'string' && wechatChannels.feedId.trim();
}
async function markArticleRead(sendId, articleId) {
const unionid = account.value?.unionid;
if (!unionid || !articleId) return;
try {
const { success } = await api(
"addArticleReadRecord",
{ corpId: props.corpId, articleId, unionid, sendId },
false
);
} catch (err) {
console.warn("markArticleRead failed:", err?.message || err);
}
};
</script>
<style scoped lang="scss">