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