2026-01-26 18:08:01 +08:00
|
|
|
|
<template>
|
2026-02-12 14:44:58 +08:00
|
|
|
|
<full-page :customScroll="true" pageStyle="background:#f5f5f5">
|
|
|
|
|
|
<template #header>
|
|
|
|
|
|
<view class="header">
|
|
|
|
|
|
<view class="search-bar">
|
|
|
|
|
|
<uni-icons type="search" size="18" color="#999" />
|
|
|
|
|
|
<input class="search-input" v-model="searchTitle" placeholder="输入内容名称搜索" @input="handleSearch" />
|
|
|
|
|
|
</view>
|
2026-01-26 18:08:01 +08:00
|
|
|
|
</view>
|
2026-02-12 14:44:58 +08:00
|
|
|
|
</template>
|
2026-05-26 17:57:34 +08:00
|
|
|
|
<view v-if="showSearch" class="h-full bg-white">
|
|
|
|
|
|
<scroll-view scroll-y class="h-full" @scrolltolower="getMore" lower-threshold="50">
|
|
|
|
|
|
<view v-if="loading && searchList.length === 0" class="loading-container">
|
|
|
|
|
|
<uni-icons type="spinner-cycle" size="30" color="#999" />
|
|
|
|
|
|
<text class="loading-text">加载中...</text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view v-else-if="searchList.length === 0" class="empty-container">
|
|
|
|
|
|
<empty-data title="暂无文章" />
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view v-else>
|
2026-05-28 16:37:57 +08:00
|
|
|
|
<view v-for="article in searchList" :key="article._id" class="article-item" @click="previewArticle(article)">
|
2026-05-26 17:57:34 +08:00
|
|
|
|
<view>
|
|
|
|
|
|
<view class="flex items-center py-12 px-15">
|
|
|
|
|
|
<view class="text-lg leading-normal font-semibold w-0 flex-grow truncate mr-10">
|
|
|
|
|
|
{{ article.title }}
|
|
|
|
|
|
</view>
|
2026-05-28 16:37:57 +08:00
|
|
|
|
<view v-if="!article.isMine" @click.stop="star(article)">
|
2026-05-26 17:57:34 +08:00
|
|
|
|
<uni-icons class="flex-shrinl-0" :type="article.star ? 'star-filled' : 'star'"
|
|
|
|
|
|
:color="article.star ? '#FFD700' : '#999'" size="20"></uni-icons>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
2026-05-28 16:37:57 +08:00
|
|
|
|
<view class="flex items-center px-15 pb-10">
|
|
|
|
|
|
<view class="mr-10 w-0 flex-growt runcate text-base text-dark">{{ article.authorName }}</view>
|
|
|
|
|
|
<view class="bg-primary text-white text-sm px-10 leading-normal rounded-sm"
|
2026-05-26 17:57:34 +08:00
|
|
|
|
@click.stop="handlePrimaryAction(article)">
|
|
|
|
|
|
{{ isSelectMode ? '选择' : '发送' }}
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view v-if="loading && searchList.length > 0" class="loading-more">
|
|
|
|
|
|
<uni-icons type="spinner-cycle" size="20" color="#999" />
|
|
|
|
|
|
<text>加载中...</text>
|
|
|
|
|
|
</view>
|
2026-01-26 18:08:01 +08:00
|
|
|
|
|
2026-05-26 17:57:34 +08:00
|
|
|
|
<view v-if="!loading && searchList.length >= total" class="no-more">
|
|
|
|
|
|
没有更多了
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view v-if="searchHasMore" class="no-more" @click="getSearchMore()">
|
|
|
|
|
|
加载更多
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</scroll-view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view v-else class="h-full flex">
|
2026-02-12 14:44:58 +08:00
|
|
|
|
<scroll-view scroll-y class="flex-shrink-0 category-sidebar h-full">
|
2026-05-26 17:57:34 +08:00
|
|
|
|
<view v-for="cate in cateList" :key="cate.value" class="category-item"
|
|
|
|
|
|
:class="{ active: currentCateId === cate.value }" @click="selectCategory(cate)">
|
2026-02-12 14:44:58 +08:00
|
|
|
|
{{ cate.label }}
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</scroll-view>
|
2026-05-26 17:57:34 +08:00
|
|
|
|
<scroll-view scroll-y class="w-0 flex-grow bg-white" @scrolltolower="getMore" lower-threshold="50">
|
2026-02-12 14:44:58 +08:00
|
|
|
|
<view v-if="loading && articleList.length === 0" class="loading-container">
|
|
|
|
|
|
<uni-icons type="spinner-cycle" size="30" color="#999" />
|
|
|
|
|
|
<text class="loading-text">加载中...</text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view v-else-if="articleList.length === 0" class="empty-container">
|
|
|
|
|
|
<empty-data title="暂无文章" />
|
|
|
|
|
|
</view>
|
2026-01-26 18:08:01 +08:00
|
|
|
|
|
2026-02-12 14:44:58 +08:00
|
|
|
|
<view v-else>
|
2026-05-28 16:37:57 +08:00
|
|
|
|
<view v-for="article in articleList" :key="article._id" class="article-item" @click="previewArticle(article)">
|
2026-05-26 17:57:34 +08:00
|
|
|
|
<view>
|
|
|
|
|
|
<view class="flex items-center py-12 px-15">
|
|
|
|
|
|
<view class="text-lg leading-normal font-semibold w-0 flex-grow truncate mr-10">
|
|
|
|
|
|
{{ article.title }}
|
|
|
|
|
|
</view>
|
2026-05-28 16:37:57 +08:00
|
|
|
|
<view v-if="!article.isMine" @click.stop="star(article)">
|
2026-05-26 17:57:34 +08:00
|
|
|
|
<uni-icons class="flex-shrinl-0" :type="article.star ? 'star-filled' : 'star'"
|
|
|
|
|
|
:color="article.star ? '#FFD700' : '#999'" size="20"></uni-icons>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
2026-05-28 16:37:57 +08:00
|
|
|
|
<view class="flex items-center px-15 pb-10">
|
|
|
|
|
|
<view class="mr-10 w-0 flex-grow truncate text-base text-dark">{{ article.authorName }}</view>
|
|
|
|
|
|
<view class="bg-primary text-white text-sm px-10 leading-normal rounded-sm"
|
|
|
|
|
|
@click.stop="handlePrimaryAction(article)">
|
|
|
|
|
|
{{ isSelectMode ? '选择' : '发送' }}
|
|
|
|
|
|
</view>
|
2026-05-26 17:57:34 +08:00
|
|
|
|
</view>
|
2026-05-28 16:37:57 +08:00
|
|
|
|
<!-- <view class="border-b"></view>
|
2026-05-26 17:57:34 +08:00
|
|
|
|
<view class="flex items-center justify-between py-10 px-15">
|
|
|
|
|
|
<view class="flex items-center" @click="previewArticle(article)">
|
|
|
|
|
|
<view class="text-base text-primary">文章详情</view>
|
|
|
|
|
|
<uni-icons type="right" color="#0074ff" size="16"></uni-icons>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view class="bg-primary text-white text-base px-15 py-5 rounded-sm"
|
|
|
|
|
|
@click.stop="handlePrimaryAction(article)">
|
|
|
|
|
|
{{ isSelectMode ? '选择' : '发送' }}
|
|
|
|
|
|
</view>
|
2026-05-28 16:37:57 +08:00
|
|
|
|
</view> -->
|
2026-05-26 17:57:34 +08:00
|
|
|
|
<!-- <view class="article-footer">
|
2026-02-12 14:44:58 +08:00
|
|
|
|
<text class="article-date">{{ article.date }}</text>
|
|
|
|
|
|
<button class="send-btn" size="mini" type="primary" @click.stop="handlePrimaryAction(article)">
|
|
|
|
|
|
{{ isSelectMode ? '选择' : '发送' }}
|
|
|
|
|
|
</button>
|
2026-05-26 17:57:34 +08:00
|
|
|
|
</view> -->
|
2026-01-26 18:08:01 +08:00
|
|
|
|
</view>
|
2026-02-12 14:44:58 +08:00
|
|
|
|
</view>
|
2026-01-26 18:08:01 +08:00
|
|
|
|
|
2026-02-12 14:44:58 +08:00
|
|
|
|
<view v-if="loading && articleList.length > 0" class="loading-more">
|
|
|
|
|
|
<uni-icons type="spinner-cycle" size="20" color="#999" />
|
|
|
|
|
|
<text>加载中...</text>
|
|
|
|
|
|
</view>
|
2026-01-26 18:08:01 +08:00
|
|
|
|
|
2026-02-12 14:44:58 +08:00
|
|
|
|
<view v-if="!loading && articleList.length >= total" class="no-more">
|
|
|
|
|
|
没有更多了
|
2026-01-26 18:08:01 +08:00
|
|
|
|
</view>
|
2026-05-26 17:57:34 +08:00
|
|
|
|
<view v-if="hasMore" class="no-more" @click="getMore()">
|
|
|
|
|
|
加载更多
|
|
|
|
|
|
</view>
|
2026-02-12 14:44:58 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</scroll-view>
|
2026-01-26 18:08:01 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
|
2026-02-12 14:44:58 +08:00
|
|
|
|
<template #footer>
|
|
|
|
|
|
<view class="relative shadow-up bg-white">
|
|
|
|
|
|
<view class="p-15 text-center" @click="toService()">
|
|
|
|
|
|
<text class="mr-5 text-base text-gray">如没有符合的内容,请</text>
|
|
|
|
|
|
<text class="text-base text-primary">联系客服</text>
|
2026-01-26 18:08:01 +08:00
|
|
|
|
</view>
|
2026-02-12 14:44:58 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</full-page>
|
|
|
|
|
|
<!-- 文章预览弹窗 -->
|
|
|
|
|
|
<uni-popup ref="previewPopup" type="bottom" :safe-area="false">
|
|
|
|
|
|
<view class="preview-container">
|
|
|
|
|
|
<view class="preview-header">
|
|
|
|
|
|
<text class="preview-title">{{ previewArticleData.title }}</text>
|
|
|
|
|
|
<view class="preview-close" @click="closePreview">
|
|
|
|
|
|
<uni-icons type="closeempty" size="24" color="#333" />
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<scroll-view scroll-y class="preview-content">
|
|
|
|
|
|
<view class="rich-text-wrapper">
|
|
|
|
|
|
<rich-text :nodes="previewArticleData.content"></rich-text>
|
2026-01-26 18:08:01 +08:00
|
|
|
|
</view>
|
2026-02-12 14:44:58 +08:00
|
|
|
|
</scroll-view>
|
|
|
|
|
|
<view class="preview-footer">
|
|
|
|
|
|
<button class="preview-close-btn" @click="closePreview">关闭</button>
|
2026-01-26 18:08:01 +08:00
|
|
|
|
</view>
|
2026-02-12 14:44:58 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</uni-popup>
|
2026-01-26 18:08:01 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2026-05-26 17:57:34 +08:00
|
|
|
|
import { ref, computed, watch } from "vue";
|
|
|
|
|
|
import { storeToRefs } from "pinia";
|
2026-05-28 16:37:57 +08:00
|
|
|
|
import { onLoad, onUnload, onShow } from "@dcloudio/uni-app";
|
2026-01-28 16:35:14 +08:00
|
|
|
|
import api from "@/utils/api.js";
|
2026-01-26 18:08:01 +08:00
|
|
|
|
import useAccountStore from "@/store/account.js";
|
2026-05-26 17:57:34 +08:00
|
|
|
|
import useGuard from "@/hooks/useGuard.js";
|
|
|
|
|
|
import usePageList from "@/hooks/usePageList";
|
2026-02-04 17:09:20 +08:00
|
|
|
|
import { sendArticleMessage } from "@/utils/send-message-helper.js";
|
2026-02-12 14:44:58 +08:00
|
|
|
|
import fullPage from '@/components/full-page.vue';
|
2026-01-26 18:08:01 +08:00
|
|
|
|
import EmptyData from "@/components/empty-data.vue";
|
2026-05-26 17:57:34 +08:00
|
|
|
|
import { toast, loading as showLoading, hideLoading } from "@/utils/widget";
|
|
|
|
|
|
|
2026-01-26 18:08:01 +08:00
|
|
|
|
const accountStore = useAccountStore();
|
2026-01-27 15:07:39 +08:00
|
|
|
|
const env = __VITE_ENV__;
|
2026-01-26 18:08:01 +08:00
|
|
|
|
const corpId = env.MP_CORP_ID;
|
2026-05-26 17:57:34 +08:00
|
|
|
|
const { doctorInfo, account } = storeToRefs(accountStore);
|
|
|
|
|
|
const { useLoad } = useGuard()
|
|
|
|
|
|
const { total, page, pageSize, list: articleList, pages, loading, hasMore } = usePageList();
|
|
|
|
|
|
const { total: searchTotal, page: searchPage, pageSize: searchPageSize, list: searchList, pages: searchPages, loading: searchLoading, hasMore: searchHasMore } = usePageList();
|
|
|
|
|
|
const searchTitle = ref("");
|
|
|
|
|
|
let searchTimer = null;
|
2026-01-27 15:07:39 +08:00
|
|
|
|
|
|
|
|
|
|
// 从页面参数获取群组信息
|
|
|
|
|
|
const pageParams = ref({
|
|
|
|
|
|
groupId: "",
|
2026-01-30 14:25:09 +08:00
|
|
|
|
patientId: "",
|
2026-01-27 15:07:39 +08:00
|
|
|
|
corpId: "",
|
2026-02-04 18:39:53 +08:00
|
|
|
|
teamId: "",
|
2026-01-27 15:07:39 +08:00
|
|
|
|
});
|
2026-05-26 17:57:34 +08:00
|
|
|
|
const currentCateId = ref("my"); // 默认选中"全部"(_id 为空字符串)
|
|
|
|
|
|
const teams = ref([])
|
2026-05-28 16:37:57 +08:00
|
|
|
|
const showRefresh = ref(false);
|
2026-05-26 17:57:34 +08:00
|
|
|
|
|
|
|
|
|
|
const cateList = computed(() => {
|
|
|
|
|
|
const arr = [{ label: '我的文章', value: 'my', type: 'mine' }, { label: '团队文章', value: 'team', type: 'team' }];
|
|
|
|
|
|
if (doctorInfo.value && doctorInfo.value.hospitalId) {
|
|
|
|
|
|
arr.push({ label: doctorInfo.value.hospitalName, value: doctorInfo.value.hospitalId, type: 'firstHospital' });
|
|
|
|
|
|
}
|
|
|
|
|
|
if (doctorInfo.value && doctorInfo.value.secondPracticeHospitalId) {
|
|
|
|
|
|
arr.push({ label: doctorInfo.value.secondPracticeHospitalName, value: doctorInfo.value.secondPracticeHospitalId, type: 'secondHospital' });
|
|
|
|
|
|
}
|
|
|
|
|
|
arr.push({ label: '柚助手', value: 'corp', type: 'yzs' })
|
|
|
|
|
|
return arr;
|
|
|
|
|
|
})
|
|
|
|
|
|
const userId = computed(() => doctorInfo.value?.userid || "");
|
|
|
|
|
|
const showSearch = computed(() => searchTitle.value.trim() !== '')
|
2026-01-26 18:08:01 +08:00
|
|
|
|
|
2026-02-04 18:39:53 +08:00
|
|
|
|
const ensureTeamId = async () => {
|
|
|
|
|
|
if (pageParams.value.teamId) return pageParams.value.teamId;
|
|
|
|
|
|
if (!pageParams.value.groupId) return "";
|
|
|
|
|
|
try {
|
|
|
|
|
|
const res = await api("getGroupListByGroupId", { groupId: pageParams.value.groupId }, false);
|
|
|
|
|
|
const team = res?.data?.team || {};
|
|
|
|
|
|
const resolved = res?.data?.teamId || team.teamId || team._id || "";
|
|
|
|
|
|
if (resolved) pageParams.value.teamId = resolved;
|
|
|
|
|
|
return pageParams.value.teamId;
|
|
|
|
|
|
} catch (err) {
|
|
|
|
|
|
console.error("ensureTeamId failed:", err);
|
|
|
|
|
|
return "";
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-05-26 17:57:34 +08:00
|
|
|
|
|
2026-02-04 15:15:45 +08:00
|
|
|
|
const isSelectMode = ref(false);
|
|
|
|
|
|
const selectEventName = ref("");
|
|
|
|
|
|
|
2026-01-26 18:08:01 +08:00
|
|
|
|
// 搜索关键词
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 预览文章数据
|
|
|
|
|
|
const previewArticleData = ref({
|
|
|
|
|
|
title: "",
|
|
|
|
|
|
content: "",
|
|
|
|
|
|
});
|
|
|
|
|
|
const previewPopup = ref(null);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 选择分类
|
|
|
|
|
|
const selectCategory = (cate) => {
|
2026-05-26 17:57:34 +08:00
|
|
|
|
currentCateId.value = cate.value || "";
|
2026-01-26 18:08:01 +08:00
|
|
|
|
page.value = 1;
|
2026-05-26 17:57:34 +08:00
|
|
|
|
getArticleList();
|
2026-01-26 18:08:01 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 搜索处理
|
|
|
|
|
|
const handleSearch = () => {
|
|
|
|
|
|
if (searchTimer) {
|
|
|
|
|
|
clearTimeout(searchTimer);
|
|
|
|
|
|
}
|
|
|
|
|
|
searchTimer = setTimeout(() => {
|
2026-05-26 17:57:34 +08:00
|
|
|
|
searchPage.value = 1;
|
|
|
|
|
|
searchArticleList();
|
|
|
|
|
|
}, 1000);
|
2026-01-26 18:08:01 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2026-01-27 13:42:59 +08:00
|
|
|
|
// 处理富文本内容,使图片自适应
|
|
|
|
|
|
const processRichTextContent = (html) => {
|
2026-01-27 15:07:39 +08:00
|
|
|
|
if (!html) return "";
|
|
|
|
|
|
|
2026-01-27 13:42:59 +08:00
|
|
|
|
// 给所有 img 标签添加样式
|
|
|
|
|
|
let processedHtml = html.replace(
|
|
|
|
|
|
/<img/gi,
|
|
|
|
|
|
'<img style="max-width:100%;height:auto;display:block;margin:10px 0;"'
|
|
|
|
|
|
);
|
2026-01-27 15:07:39 +08:00
|
|
|
|
|
2026-01-27 13:42:59 +08:00
|
|
|
|
// 移除可能存在的固定宽度样式
|
|
|
|
|
|
processedHtml = processedHtml.replace(
|
|
|
|
|
|
/style="[^"]*width:\s*\d+px[^"]*"/gi,
|
|
|
|
|
|
(match) => {
|
2026-01-27 15:07:39 +08:00
|
|
|
|
return match.replace(/width:\s*\d+px;?/gi, "max-width:100%;");
|
2026-01-27 13:42:59 +08:00
|
|
|
|
}
|
|
|
|
|
|
);
|
2026-01-27 15:07:39 +08:00
|
|
|
|
|
2026-01-27 13:42:59 +08:00
|
|
|
|
// 处理表格,添加自适应样式
|
|
|
|
|
|
processedHtml = processedHtml.replace(
|
|
|
|
|
|
/<table/gi,
|
|
|
|
|
|
'<table style="max-width:100%;overflow-x:auto;display:block;"'
|
|
|
|
|
|
);
|
2026-01-27 15:07:39 +08:00
|
|
|
|
|
2026-01-27 13:42:59 +08:00
|
|
|
|
// 给整体内容添加容器样式
|
|
|
|
|
|
processedHtml = `<div style="width:100%;overflow-x:hidden;word-wrap:break-word;word-break:break-all;">${processedHtml}</div>`;
|
2026-01-27 15:07:39 +08:00
|
|
|
|
|
2026-01-27 13:42:59 +08:00
|
|
|
|
return processedHtml;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-01-26 18:08:01 +08:00
|
|
|
|
// 预览文章
|
|
|
|
|
|
const previewArticle = async (article) => {
|
2026-05-28 16:37:57 +08:00
|
|
|
|
uni.navigateTo({
|
|
|
|
|
|
url: `/pages/message/article-detail?id=${article._id}`,
|
|
|
|
|
|
});
|
2026-01-26 18:08:01 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 关闭预览
|
|
|
|
|
|
const closePreview = () => {
|
|
|
|
|
|
previewPopup.value?.close();
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-02-04 15:15:45 +08:00
|
|
|
|
const selectArticle = (article) => {
|
|
|
|
|
|
if (!selectEventName.value) {
|
|
|
|
|
|
uni.showToast({ title: "缺少 eventName", icon: "none" });
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
uni.$emit(selectEventName.value, article);
|
|
|
|
|
|
uni.navigateBack();
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const handlePrimaryAction = (article) => {
|
|
|
|
|
|
if (isSelectMode.value) return selectArticle(article);
|
|
|
|
|
|
return sendArticle(article);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-01-26 18:08:01 +08:00
|
|
|
|
// 发送文章
|
2026-01-27 15:07:39 +08:00
|
|
|
|
const sendArticle = async (article) => {
|
|
|
|
|
|
try {
|
|
|
|
|
|
const { doctorInfo } = useAccountStore();
|
2026-02-12 14:44:58 +08:00
|
|
|
|
|
2026-02-05 10:43:56 +08:00
|
|
|
|
await ensureTeamId();
|
2026-02-04 17:09:20 +08:00
|
|
|
|
// 使用统一的消息发送助手
|
|
|
|
|
|
const success = await sendArticleMessage(
|
|
|
|
|
|
{
|
|
|
|
|
|
_id: article._id,
|
|
|
|
|
|
title: article.title || "宣教文章",
|
|
|
|
|
|
cover: article.cover || "",
|
|
|
|
|
|
url: article.url || "",
|
|
|
|
|
|
subtitle: article.subtitle || "",
|
2026-04-17 13:51:02 +08:00
|
|
|
|
wechatChannels: article.wechatChannels,
|
2026-02-04 17:09:20 +08:00
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
articleId: article._id,
|
|
|
|
|
|
userId: doctorInfo?.userid,
|
|
|
|
|
|
customerId: pageParams.value.patientId,
|
|
|
|
|
|
corpId: corpId,
|
2026-02-05 10:43:56 +08:00
|
|
|
|
teamId: pageParams.value.teamId,
|
2026-01-30 14:25:09 +08:00
|
|
|
|
}
|
2026-02-04 17:09:20 +08:00
|
|
|
|
);
|
2026-01-30 14:25:09 +08:00
|
|
|
|
|
2026-02-04 17:09:20 +08:00
|
|
|
|
if (success) {
|
2026-01-27 15:07:39 +08:00
|
|
|
|
uni.navigateBack();
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.error("发送文章失败:", error);
|
2026-01-26 18:08:01 +08:00
|
|
|
|
uni.showToast({
|
2026-01-27 15:07:39 +08:00
|
|
|
|
title: error.message || "发送失败",
|
|
|
|
|
|
icon: "none",
|
2026-01-26 18:08:01 +08:00
|
|
|
|
});
|
2026-01-27 15:07:39 +08:00
|
|
|
|
} finally {
|
|
|
|
|
|
loading.value = false;
|
2026-01-26 18:08:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-02-12 14:44:58 +08:00
|
|
|
|
function toService() {
|
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
|
url: '/pages/work/service/contact-service'
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-26 17:57:34 +08:00
|
|
|
|
async function getArticleList() {
|
|
|
|
|
|
if (!userId.value) {
|
|
|
|
|
|
articleList.value = []
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
if (currentCateId.value === 'my') {
|
|
|
|
|
|
getMyArticleList();
|
|
|
|
|
|
} else if (currentCateId.value === 'team') {
|
|
|
|
|
|
getTeamArticleList();
|
|
|
|
|
|
} else if (currentCateId.value === 'corp') {
|
|
|
|
|
|
getSourceCorpArticleList();
|
|
|
|
|
|
} else {
|
|
|
|
|
|
getOrganizationArticleList();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function getTeams() {
|
|
|
|
|
|
const corpId = account.value?.corpId;
|
|
|
|
|
|
const mateId = doctorInfo.value?.userid;
|
|
|
|
|
|
if (!corpId || !mateId) return;
|
|
|
|
|
|
const res = await api('getJoinedTeams', { corpId, mateId });
|
|
|
|
|
|
teams.value = res && Array.isArray(res.data) ? res.data : [];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function getMyArticleList() {
|
|
|
|
|
|
showLoading();
|
|
|
|
|
|
const res = await api("getMyArticles", { userId: userId.value });
|
|
|
|
|
|
hideLoading();
|
|
|
|
|
|
articleList.value = res && Array.isArray(res.list) ? formatArticles(res.list) : [];
|
|
|
|
|
|
pages.value = 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function getTeamArticleList() {
|
|
|
|
|
|
showLoading();
|
|
|
|
|
|
if (teams.value.length === 0) {
|
|
|
|
|
|
await getTeams();
|
|
|
|
|
|
}
|
|
|
|
|
|
const teamIds = teams.value.map(i => i.teamId);
|
|
|
|
|
|
const res = await api("getMyTeamArticles", { userId: userId.value, teamIds, page: page.value, pageSize: pageSize.value });
|
|
|
|
|
|
hideLoading();
|
|
|
|
|
|
articleList.value = res && Array.isArray(res.list) ? formatArticles(res.list) : [];
|
|
|
|
|
|
pages.value = typeof res.pages === 'number' ? res.pages : 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function getOrganizationArticleList() {
|
|
|
|
|
|
showLoading();
|
|
|
|
|
|
const query = {
|
|
|
|
|
|
userId: userId.value,
|
|
|
|
|
|
hospitalId: currentCateId.value,
|
|
|
|
|
|
page: page.value,
|
|
|
|
|
|
pageSize: pageSize.value,
|
|
|
|
|
|
}
|
|
|
|
|
|
const res = await api("getOrganizationArticles", query);
|
|
|
|
|
|
hideLoading();
|
|
|
|
|
|
articleList.value = res && Array.isArray(res.list) ? formatArticles(res.list) : [];
|
|
|
|
|
|
pages.value = typeof res.pages === 'number' ? res.pages : 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function getSourceCorpArticleList() {
|
|
|
|
|
|
showLoading();
|
|
|
|
|
|
const query = {
|
|
|
|
|
|
userId: userId.value,
|
|
|
|
|
|
sourceCorpId: corpId,
|
|
|
|
|
|
page: page.value,
|
|
|
|
|
|
pageSize: pageSize.value,
|
|
|
|
|
|
}
|
|
|
|
|
|
const res = await api("getSourceCorpArticles", query);
|
|
|
|
|
|
hideLoading();
|
|
|
|
|
|
articleList.value = res && Array.isArray(res.list) ? formatArticles(res.list) : [];
|
|
|
|
|
|
pages.value = typeof res.pages === 'number' ? res.pages : 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function searchArticleList() {
|
|
|
|
|
|
if (searchTitle.value.trim() === '') {
|
|
|
|
|
|
searchList.value = [];
|
|
|
|
|
|
searchPages.value = 1;
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
showLoading();
|
|
|
|
|
|
const query = {
|
|
|
|
|
|
userId: userId.value,
|
|
|
|
|
|
page: searchPage.value,
|
|
|
|
|
|
pageSize: searchPageSize.value,
|
|
|
|
|
|
keyword: searchTitle.value.trim(),
|
|
|
|
|
|
}
|
|
|
|
|
|
const res = await api("searchCorpArticles", query);
|
|
|
|
|
|
hideLoading();
|
|
|
|
|
|
searchList.value = res && Array.isArray(res.list) ? formatArticles(res.list) : [];
|
|
|
|
|
|
searchPages.value = typeof res.pages === 'number' ? res.pages : 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
async function star(article) {
|
|
|
|
|
|
showLoading();
|
|
|
|
|
|
const res = await api("starArticle", { articleId: article._id, userId: userId.value, star: !article.star });
|
|
|
|
|
|
hideLoading();
|
|
|
|
|
|
if (res.success) {
|
|
|
|
|
|
article.star = !article.star;
|
2026-05-28 16:37:57 +08:00
|
|
|
|
if (currentCateId.value === 'my') {
|
|
|
|
|
|
getMyArticleList();
|
|
|
|
|
|
}
|
2026-05-26 17:57:34 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
toast(res.message || "操作失败");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function formatArticles(articles) {
|
|
|
|
|
|
return articles.map(article => {
|
|
|
|
|
|
const item = { ...article };
|
|
|
|
|
|
if (article.creatorSignature && article.creatorSignature.type === 'personal') {
|
2026-05-28 16:37:57 +08:00
|
|
|
|
item.isMine = article.creatorSignature.person.userId === userId.value;
|
2026-05-26 17:57:34 +08:00
|
|
|
|
item.authorName = article.creatorSignature.person ? article.creatorSignature.person.userName : '';
|
|
|
|
|
|
} else if (article.creatorSignature && article.creatorSignature.type === 'institution') {
|
|
|
|
|
|
item.authorName = article.creatorSignature.institution ? article.creatorSignature.institution.name : '';
|
|
|
|
|
|
} else if (article.creatorSignature && article.creatorSignature.type === 'department') {
|
|
|
|
|
|
item.authorName = article.creatorSignature.department ? article.creatorSignature.department.name : '';
|
|
|
|
|
|
}
|
|
|
|
|
|
return item;
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function getMore() {
|
|
|
|
|
|
if (hasMore.value && !loading.value) {
|
|
|
|
|
|
page.value++;
|
|
|
|
|
|
getArticleList();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function getSearchMore() {
|
|
|
|
|
|
if (searchHasMore.value && !loading.value) {
|
|
|
|
|
|
searchPage.value++;
|
|
|
|
|
|
searchArticleList();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-26 18:08:01 +08:00
|
|
|
|
|
2026-01-27 15:07:39 +08:00
|
|
|
|
// 页面加载时接收参数
|
|
|
|
|
|
onLoad((options) => {
|
2026-02-04 15:15:45 +08:00
|
|
|
|
isSelectMode.value = String(options?.select || '') === '1';
|
|
|
|
|
|
selectEventName.value = String(options?.eventName || '');
|
2026-01-27 15:07:39 +08:00
|
|
|
|
if (options.groupId) {
|
|
|
|
|
|
pageParams.value.groupId = options.groupId;
|
|
|
|
|
|
}
|
2026-01-30 14:47:52 +08:00
|
|
|
|
if (options.patientId) {
|
2026-01-30 14:25:09 +08:00
|
|
|
|
pageParams.value.patientId = options.patientId;
|
2026-01-27 15:07:39 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (options.corpId) {
|
|
|
|
|
|
pageParams.value.corpId = options.corpId;
|
|
|
|
|
|
}
|
2026-02-04 18:39:53 +08:00
|
|
|
|
if (options.teamId) {
|
|
|
|
|
|
pageParams.value.teamId = options.teamId;
|
|
|
|
|
|
}
|
|
|
|
|
|
ensureTeamId();
|
2026-05-28 16:37:57 +08:00
|
|
|
|
uni.$on('changeArticleStar', (articleId) => {
|
|
|
|
|
|
if (articleList.value.some(i => i._id === articleId)) {
|
|
|
|
|
|
showRefresh.value = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2026-01-27 15:07:39 +08:00
|
|
|
|
});
|
|
|
|
|
|
|
2026-05-28 16:37:57 +08:00
|
|
|
|
useLoad(() => { });
|
|
|
|
|
|
onUnload(() => {
|
|
|
|
|
|
uni.$off('changeArticleStar');
|
|
|
|
|
|
});
|
2026-05-26 17:57:34 +08:00
|
|
|
|
|
2026-05-28 16:37:57 +08:00
|
|
|
|
onShow(() => {
|
|
|
|
|
|
if (showRefresh.value) {
|
|
|
|
|
|
page.value = 1;
|
|
|
|
|
|
getArticleList();
|
|
|
|
|
|
showRefresh.value = false;
|
|
|
|
|
|
}
|
2026-01-26 18:08:01 +08:00
|
|
|
|
});
|
2026-05-28 16:37:57 +08:00
|
|
|
|
|
|
|
|
|
|
|
2026-05-26 17:57:34 +08:00
|
|
|
|
watch(userId, n => {
|
|
|
|
|
|
if (n) {
|
|
|
|
|
|
getArticleList();
|
|
|
|
|
|
}
|
|
|
|
|
|
}, { immediate: true })
|
2026-01-26 18:08:01 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
|
.article-page {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
height: 100vh;
|
|
|
|
|
|
background-color: #f5f5f5;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.header {
|
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
|
padding: 20rpx;
|
|
|
|
|
|
border-bottom: 1px solid #eee;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.search-bar {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
background-color: #f5f5f5;
|
|
|
|
|
|
border-radius: 8rpx;
|
|
|
|
|
|
padding: 16rpx 24rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.search-input {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
margin-left: 16rpx;
|
2026-05-26 11:27:19 +08:00
|
|
|
|
font-size: 30rpx;
|
2026-01-26 18:08:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.content {
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.category-sidebar {
|
|
|
|
|
|
width: 200rpx;
|
|
|
|
|
|
background-color: #f8f8f8;
|
|
|
|
|
|
border-right: 1px solid #eee;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-12 14:44:58 +08:00
|
|
|
|
|
2026-01-26 18:08:01 +08:00
|
|
|
|
|
|
|
|
|
|
.category-item {
|
2026-01-27 13:42:59 +08:00
|
|
|
|
padding: 20rpx 24rpx;
|
2026-05-26 11:27:19 +08:00
|
|
|
|
font-size: 30rpx;
|
2026-01-26 18:08:01 +08:00
|
|
|
|
color: #333;
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
border-bottom: 1px solid #eee;
|
2026-01-27 13:42:59 +08:00
|
|
|
|
transition: all 0.3s ease;
|
|
|
|
|
|
position: relative;
|
2026-01-26 18:08:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.category-item.active {
|
|
|
|
|
|
background-color: #fff;
|
2026-01-27 15:07:39 +08:00
|
|
|
|
color: #0877f1;
|
2026-01-26 18:08:01 +08:00
|
|
|
|
font-weight: bold;
|
2026-01-27 15:07:39 +08:00
|
|
|
|
border-left: 4rpx solid #0877f1;
|
2026-01-26 18:08:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.loading-container,
|
|
|
|
|
|
.empty-container {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
padding: 100rpx 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.loading-text {
|
|
|
|
|
|
margin-top: 20rpx;
|
2026-05-26 11:27:19 +08:00
|
|
|
|
font-size: 30rpx;
|
2026-01-26 18:08:01 +08:00
|
|
|
|
color: #999;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.article-item {
|
|
|
|
|
|
border-bottom: 1px solid #eee;
|
2026-01-27 13:42:59 +08:00
|
|
|
|
transition: background-color 0.2s ease;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.article-item:active {
|
|
|
|
|
|
background-color: #f5f5f5;
|
2026-01-26 18:08:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.article-content {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
2026-01-27 13:42:59 +08:00
|
|
|
|
gap: 16rpx;
|
2026-01-26 18:08:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.article-title {
|
2026-05-26 11:27:19 +08:00
|
|
|
|
font-size: 30rpx;
|
2026-01-26 18:08:01 +08:00
|
|
|
|
color: #333;
|
2026-01-27 13:42:59 +08:00
|
|
|
|
line-height: 1.6;
|
2026-01-26 18:08:01 +08:00
|
|
|
|
word-break: break-all;
|
2026-01-27 13:42:59 +08:00
|
|
|
|
font-weight: 500;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.article-footer {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
gap: 20rpx;
|
2026-01-26 18:08:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.article-date {
|
2026-01-27 13:42:59 +08:00
|
|
|
|
flex: 1;
|
2026-05-26 11:27:19 +08:00
|
|
|
|
font-size: 26rpx;
|
2026-01-26 18:08:01 +08:00
|
|
|
|
color: #999;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.send-btn {
|
2026-01-27 13:42:59 +08:00
|
|
|
|
flex-shrink: 0;
|
2026-05-26 11:27:19 +08:00
|
|
|
|
font-size: 28rpx;
|
2026-01-27 13:42:59 +08:00
|
|
|
|
padding: 8rpx 32rpx;
|
|
|
|
|
|
height: auto;
|
|
|
|
|
|
line-height: 1.4;
|
2026-01-26 18:08:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.loading-more,
|
|
|
|
|
|
.no-more {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
padding: 30rpx 0;
|
2026-05-26 11:27:19 +08:00
|
|
|
|
font-size: 26rpx;
|
2026-01-26 18:08:01 +08:00
|
|
|
|
color: #999;
|
|
|
|
|
|
gap: 10rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.footer {
|
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
|
padding: 20rpx;
|
|
|
|
|
|
border-top: 1px solid #eee;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.cancel-btn {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
|
color: #333;
|
|
|
|
|
|
border: 1px solid #ddd;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 预览弹窗样式 */
|
|
|
|
|
|
.preview-container {
|
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
|
border-radius: 20rpx 20rpx 0 0;
|
|
|
|
|
|
height: 80vh;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.preview-header {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
padding: 30rpx;
|
|
|
|
|
|
border-bottom: 1px solid #eee;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.preview-title {
|
|
|
|
|
|
flex: 1;
|
2026-05-26 11:27:19 +08:00
|
|
|
|
font-size: 34rpx;
|
2026-01-26 18:08:01 +08:00
|
|
|
|
font-weight: bold;
|
|
|
|
|
|
color: #333;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.preview-close {
|
|
|
|
|
|
padding: 10rpx;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.preview-content {
|
|
|
|
|
|
flex: 1;
|
2026-01-27 13:42:59 +08:00
|
|
|
|
padding: 0;
|
2026-01-26 18:08:01 +08:00
|
|
|
|
overflow-y: auto;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-27 13:42:59 +08:00
|
|
|
|
.rich-text-wrapper {
|
|
|
|
|
|
padding: 30rpx;
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* rich-text 内部样式 */
|
|
|
|
|
|
.rich-text-wrapper ::v-deep rich-text {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.rich-text-wrapper ::v-deep rich-text img {
|
|
|
|
|
|
max-width: 100% !important;
|
|
|
|
|
|
height: auto !important;
|
|
|
|
|
|
display: block;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-26 18:08:01 +08:00
|
|
|
|
.preview-footer {
|
|
|
|
|
|
padding: 20rpx;
|
|
|
|
|
|
border-top: 1px solid #eee;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.preview-close-btn {
|
|
|
|
|
|
width: 100%;
|
|
|
|
|
|
background-color: #1890ff;
|
|
|
|
|
|
color: #fff;
|
|
|
|
|
|
}
|
|
|
|
|
|
</style>
|