diff --git a/pages/article/article-detail.vue b/pages/article/article-detail.vue index 5d8927f..9ef3aaf 100644 --- a/pages/article/article-detail.vue +++ b/pages/article/article-detail.vue @@ -28,8 +28,11 @@ import { onLoad } from "@dcloudio/uni-app"; import api from "@/utils/api.js"; import { ref } from "vue"; +import { storeToRefs } from "pinia"; +import useAccountStore from "@/store/account.js"; const env = __VITE_ENV__; const corpId = env.MP_CORP_ID; +const { account } = storeToRefs(useAccountStore()); const loading = ref(true); const error = ref(""); const articleData = ref({ @@ -40,6 +43,16 @@ const articleData = ref({ let articleId = ""; +const markArticleRead = async () => { + const unionid = account.value?.unionid; + if (!unionid || !articleId) return; + try { + await api("addArticleReadRecord", { corpId, articleId, unionid }, false); + } catch (err) { + console.warn("markArticleRead failed:", err?.message || err); + } +}; + // 处理富文本内容,使图片自适应 const processRichTextContent = (html) => { if (!html) return ""; @@ -107,6 +120,7 @@ const loadArticle = async () => { onLoad((options) => { if (options.id) { articleId = options.id; + markArticleRead(); loadArticle(); } else { error.value = "文章信息不完整"; diff --git a/pages/article/article-list.vue b/pages/article/article-list.vue index 6cf29d1..ed0c095 100644 --- a/pages/article/article-list.vue +++ b/pages/article/article-list.vue @@ -11,16 +11,25 @@ ? 'bg-orange-100 text-orange-500 border-orange-500' : 'bg-white text-gray-600 border-gray-200' ]" - @click="activeTab = tab.value" + @click="selectTab(tab.value)" > {{ tab.name }} - + + + 加载中... + + + + + + + - {{ item.type }} + 宣教文章 @@ -44,86 +53,168 @@ class="text-sm mr-2" :class="item.status === 'UNREAD' ? 'text-red-500' : 'text-gray-400'" > - {{ item.status === 'UNREAD' ? '未阅读' : '查看' }} + {{ item.status === 'UNREAD' ? '未阅读' : '已阅读' }} - - - 人员: - {{ item.person }} + + 人员: + {{ item.person || '-' }} - - - 团队: - {{ item.team }} + + + 团队: + {{ item.team || '-' }} - 发送时间: {{ item.time }} + 发送时间: {{ item.time || '-' }} + + + + 加载中... + + + + 没有更多了 + diff --git a/pages/survey/survey-list.vue b/pages/survey/survey-list.vue index e213a83..1613e69 100644 --- a/pages/survey/survey-list.vue +++ b/pages/survey/survey-list.vue @@ -11,16 +11,25 @@ ? 'bg-orange-100 text-orange-500 border-orange-500' : 'bg-white text-gray-600 border-gray-200' ]" - @click="activeTab = tab.value" + @click="selectTab(tab.value)" > {{ tab.name }} - + + + 加载中... + + + + + + + - {{ item.type }} + 问卷调查 @@ -38,93 +47,166 @@ - + - - {{ item.status === 'UNFILLED' ? '未填写' : '查看' }} - - + 查看 + - - - 人员: - {{ item.person }} + + 人员: + {{ item.person || '-' }} - - - 团队: - {{ item.team }} + + + 团队: + {{ item.team || '-' }} - 发送时间: {{ item.time }} + 发送时间: {{ item.time || '-' }} + + + + 加载中... + + + + 没有更多了 + \ No newline at end of file + +.field-label { + flex-shrink: 0; + white-space: nowrap; +} + +.loading-container, +.empty-container { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + padding: 100rpx 0; +} + +.loading-text { + margin-top: 20rpx; + font-size: 28rpx; + color: #999; +} + +.loading-more, +.no-more { + display: flex; + align-items: center; + justify-content: center; + padding: 30rpx 0; + font-size: 24rpx; + color: #999; + gap: 10rpx; +} + diff --git a/utils/api.js b/utils/api.js index bec6614..7a1dd49 100644 --- a/utils/api.js +++ b/utils/api.js @@ -31,7 +31,9 @@ const urlsConfig = { getArticleCateList: 'getArticleCateList', getArticleList: 'getArticleList', getArticle: 'getArticle', - addArticleSendRecord: 'addArticleSendRecord' + addArticleSendRecord: 'addArticleSendRecord', + addArticleReadRecord: 'addArticleReadRecord', + getMiniAppReceivedArticleList: 'getMiniAppReceivedArticleList' }, member: { addCustomer: 'add', @@ -63,6 +65,9 @@ const urlsConfig = { createConsultGroup: "createConsultGroup", cancelConsultApplication: "cancelConsultApplication", getGroupList: "getGroupList" + }, + survery: { + getMiniAppReceivedSurveryList: 'getMiniAppReceivedSurveryList' } } const urls = Object.keys(urlsConfig).reduce((acc, path) => {