|
|
|
@ -13,7 +13,7 @@ |
|
|
|
|
</template> |
|
|
|
|
<div class="container"> |
|
|
|
|
<div class="header_content"> |
|
|
|
|
<span class="sender">收件人:{{ receiverNames }}</span> |
|
|
|
|
收件人:<span class="sender" v-for="o in sendMessage.receiveUsers" :key="o.id">{{ o.receiverName }}</span> |
|
|
|
|
<span class="time">发送时间:{{ sendMessage.sendTime }}</span> |
|
|
|
|
<!-- <span class="read-status">是否阅读:{{sendMessage.isRead}}</span>--> |
|
|
|
|
</div> |
|
|
|
@ -43,30 +43,32 @@ const back = ()=>{ |
|
|
|
|
router.go(-1) |
|
|
|
|
} |
|
|
|
|
//获取参数 |
|
|
|
|
const sendMessage = ref(route.query) |
|
|
|
|
let item = sessionStorage.getItem('senMsg:Item') |
|
|
|
|
if(item) item =JSON.parse(item) |
|
|
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
|
console.log('Received message:', sendMessage.value); |
|
|
|
|
// 尝试解析 receiveUsers |
|
|
|
|
if (sendMessage.value.receiveUsers && typeof sendMessage.value.receiveUsers[0] === 'string') { |
|
|
|
|
sendMessage.value.receiveUsers = sendMessage.value.receiveUsers.map(user => { |
|
|
|
|
try { |
|
|
|
|
return JSON.parse(user); |
|
|
|
|
} catch (error) { |
|
|
|
|
console.error('Error parsing user:', user, error); |
|
|
|
|
return null; // 或者返回默认值 |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
const sendMessage = ref(item || {}) |
|
|
|
|
// onMounted(() => { |
|
|
|
|
// console.log('Received message:', sendMessage.value); |
|
|
|
|
// // 尝试解析 receiveUsers |
|
|
|
|
// if (sendMessage.value.receiveUsers && typeof sendMessage.value.receiveUsers[0] === 'string') { |
|
|
|
|
// sendMessage.value.receiveUsers = sendMessage.value.receiveUsers.map(user => { |
|
|
|
|
// try { |
|
|
|
|
// return JSON.parse(user); |
|
|
|
|
// } catch (error) { |
|
|
|
|
// console.error('Error parsing user:', user, error); |
|
|
|
|
// return null; // 或者返回默认值 |
|
|
|
|
// } |
|
|
|
|
// }); |
|
|
|
|
// } |
|
|
|
|
// }); |
|
|
|
|
|
|
|
|
|
// 提取收件人的姓名 |
|
|
|
|
const receiverNames = computed(() => { |
|
|
|
|
if (sendMessage.value && sendMessage.value.receiveUsers) { |
|
|
|
|
return sendMessage.value.receiveUsers.map(user => user?.receiverName).join(', '); |
|
|
|
|
} |
|
|
|
|
return ''; |
|
|
|
|
}); |
|
|
|
|
// const receiverNames = computed(() => { |
|
|
|
|
// if (sendMessage.value && sendMessage.value.receiveUsers) { |
|
|
|
|
// return sendMessage.value.receiveUsers.map(user => user?.receiverName).join(', '); |
|
|
|
|
// } |
|
|
|
|
// return ''; |
|
|
|
|
// }); |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
<style scoped> |
|
|
|
|