fix: 问题修复

This commit is contained in:
huxuejian 2026-05-29 15:27:34 +08:00
parent 6951e9d023
commit bfdde46cc3
2 changed files with 40 additions and 5 deletions

View File

@ -22,7 +22,15 @@
</view>
</view>
<template #footer>
<button-footer :showConfirm="showStar" cancelText="关闭" @cancel="back()">
<view v-if="canSend || showStar" class="relative z-10 px-15 py-12 shadow-up flex items-center">
<view v-if="showStar" class="flex-grow text-base text-white text-center py-10 rounded"
:class="article.star ? 'bg-deep-gray' : 'bg-success'" @click="starArticle()">
{{ article.star ? '取消收藏' : '收藏' }}
</view>
<view v-if="canSend" class="flex-grow text-base text-white text-center py-10 rounded bg-primary"
:class="showStar ? 'ml-10' : ''" @click="send()">发送</view>
</view>
<!-- <button-footer :showConfirm="showStar" cancelText="关闭" @cancel="back()">
<template #confirm>
<view class="flex justify-center items-center h-full border-primary rounded bg-primary" @click="star()">
<uni-icons class="flex-shrinl-0" :type="article.star ? 'star-filled' : 'star'" color="#FFD700"
@ -30,7 +38,7 @@
<view class="text-base text-white">{{ article.star ? '已收藏' : '收藏' }}</view>
</view>
</template>
</button-footer>
</button-footer> -->
</template>
</full-page>
@ -63,7 +71,9 @@ const article = ref({});
const accountStore = useAccountStore();
const { doctorInfo, account } = storeToRefs(accountStore);
const userId = computed(() => doctorInfo.value?.userid || "");
const { useLoad } = useGuard()
const { useLoad } = useGuard();
const canSend = ref(false);
const eventName = ref("");
const showStar = computed(() => {
const isMine = article.value && article.value.creatorSignature && article.value.creatorSignature.person && article.value.creatorSignature.person.userId === userId.value;
@ -135,7 +145,8 @@ const loadArticle = async () => {
}
};
async function star() {
async function starArticle() {
console.log(11111)
showLoading();
const res = await api("starArticle", { articleId: articleId, userId: userId.value, star: !article.value.star });
hideLoading();
@ -147,12 +158,19 @@ async function star() {
}
}
function send() {
uni.$emit(eventName.value);
back()
}
function back() {
uni.navigateBack();
}
useLoad((options) => {
if (options.id) {
canSend.value = options.canSend === 'YES';
eventName.value = options.eventName;
articleId = options.id;
loadArticle();
} else {
@ -244,4 +262,16 @@ useLoad((options) => {
height: auto !important;
display: block;
}
.ml-10 {
margin-left: 20rpx;
}
.bg-deep-gray {
background-color: #bbb;
}
.z-10 {
z-index: 10;
}
</style>

View File

@ -281,9 +281,14 @@ const processRichTextContent = (html) => {
//
const previewArticle = async (article) => {
const eventName = `previewArticle_${Date.now()}`
uni.navigateTo({
url: `/pages/message/article-detail?id=${article._id}`,
url: `/pages/message/article-detail?id=${article._id}&eventName=${eventName}&canSend=${isSelectMode.value ? '' : 'YES'}`,
});
uni.$once(eventName, () => {
console.log('预览文章:', article)
handlePrimaryAction(article);
})
};
//