fix: 阅读记录调整
This commit is contained in:
parent
a1c80166af
commit
b9c12e0deb
@ -45,13 +45,13 @@ const articleData = ref({
|
||||
let articleId = "";
|
||||
const corpId = ref("");
|
||||
|
||||
const markArticleRead = async () => {
|
||||
const markArticleRead = async (sendId) => {
|
||||
const unionid = account.value?.unionid;
|
||||
if (!unionid || !articleId) return;
|
||||
try {
|
||||
await api(
|
||||
"addArticleReadRecord",
|
||||
{ corpId: corpId.value, articleId, unionid },
|
||||
{ corpId: corpId.value, articleId, unionid, sendId },
|
||||
false
|
||||
);
|
||||
} catch (err) {
|
||||
@ -130,7 +130,7 @@ onLoad((options) => {
|
||||
corpId.value = options.corpId;
|
||||
if (options.id) {
|
||||
articleId = options.id;
|
||||
markArticleRead();
|
||||
markArticleRead(options.sendId || '');
|
||||
loadArticle();
|
||||
} else {
|
||||
error.value = "文章信息不完整";
|
||||
|
||||
@ -98,6 +98,7 @@ const pageSize = 20;
|
||||
const loading = ref(false);
|
||||
const inited = ref(false);
|
||||
const corpId = ref('');
|
||||
const teamId = ref('');
|
||||
|
||||
const selectTab = async (customerId) => {
|
||||
if (activeTab.value === customerId) return;
|
||||
@ -139,6 +140,7 @@ const mapRowToView = (row) => {
|
||||
};
|
||||
|
||||
const loadArticleList = async (reset = false) => {
|
||||
const customerIds = tabs.value.map(i => i.value).filter(Boolean);
|
||||
if (loading.value) return;
|
||||
const unionid = account.value?.unionid;
|
||||
const miniAppId = openid.value || uni.getStorageSync("openid");
|
||||
@ -152,6 +154,12 @@ const loadArticleList = async (reset = false) => {
|
||||
articles.value = [];
|
||||
total.value = 0;
|
||||
}
|
||||
if (customerIds.length === 0) {
|
||||
page.value = 1;
|
||||
articles.value = [];
|
||||
total.value = 0;
|
||||
return
|
||||
}
|
||||
|
||||
loading.value = true;
|
||||
try {
|
||||
@ -161,8 +169,9 @@ const loadArticleList = async (reset = false) => {
|
||||
miniAppId,
|
||||
page: page.value,
|
||||
pageSize,
|
||||
customerIds
|
||||
};
|
||||
if (activeTab.value) params.customerId = activeTab.value;
|
||||
if (activeTab.value) params.customerIds = [activeTab.value];
|
||||
|
||||
const res = await api("getMiniAppReceivedArticleList", params);
|
||||
if (res && res.success) {
|
||||
@ -184,10 +193,11 @@ const loadArticleList = async (reset = false) => {
|
||||
|
||||
function goToDetail(item) {
|
||||
if (!item?.articleId) return;
|
||||
uni.navigateTo({ url: `/pages/article/article-detail?id=${item.articleId}&corpId=${corpId.value}` });
|
||||
uni.navigateTo({ url: `/pages/article/article-detail?sendId=${item._id}&id=${item.articleId}&corpId=${corpId.value}` });
|
||||
}
|
||||
onLoad(opts => {
|
||||
corpId.value = opts.corpId;
|
||||
teamId.value = opts.teamId;
|
||||
})
|
||||
|
||||
onShow(async () => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user