Skip to content

Commit

Permalink
fix: 分享至朋友圈时可以正确显示内容,范围为所有社区
Browse files Browse the repository at this point in the history
  • Loading branch information
fuqihao.foliet committed Dec 14, 2023
1 parent 7b4a4d7 commit ad5ceca
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/apis/plan/plan-interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export interface GetPlanPreviewsReq {
limit?: number;
onlyUserId?: string;
page: number;
[property: string]: any;
onlyCommunityId?: string;
}

export interface GetPlanPreviewsResp {
Expand Down
4 changes: 2 additions & 2 deletions src/components/SchoolSelectBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<image :src="Icons.Location" mode="scaleToFill" class="locationIcon" />
<view class="school-name">
{{
currentSchool !== currentCampus
(currentSchool !== currentCampus
? currentSchool + currentCampus
: currentSchool
: currentSchool) || "MeowChat大家庭"
}}
</view>
<view class="triangle" />
Expand Down
14 changes: 8 additions & 6 deletions src/pages/community/community.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,14 @@ onLoad(() => {
onReady(() => {
uni.hideLoading();
//签到获取小鱼干
userCheckIn().then((res) => {
if (res.getFish) {
gottenFishAmount.value = res.getFishNum;
showToastBox.value = true;
}
});
if (uni.getStorageSync(StorageKeys.UserId)) {
userCheckIn().then((res) => {
if (res.getFish) {
gottenFishAmount.value = res.getFishNum;
showToastBox.value = true;
}
});
}
});
onShow(() => {
Expand Down
7 changes: 4 additions & 3 deletions src/pages/community/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ export function buildLoader(keyword?: string) {
const communityId = uni.getStorageSync(StorageKeys.CommunityId);

const fetch = async () => {
const req: GetMomentPreviewsReq = {
communityId: communityId
};
const req: GetMomentPreviewsReq = {};
if (communityId) {
req.communityId = communityId;
}
if (lastToken) {
req.lastToken = lastToken;
}
Expand Down
13 changes: 8 additions & 5 deletions src/pages/plan/PlanEntries.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ import PlanEntry from "@/pages/plan/PlanEntry.vue";
import { ref, reactive } from "vue";
import { onReachBottom } from "@dcloudio/uni-app";
import { StorageKeys } from "@/utils/const";
const communityId = uni.getStorageSync(StorageKeys.CommunityId);
const getPlanPreviewsReq = reactive<GetPlanPreviewsReq>({
page: 0,
onlyCommunityId: uni.getStorageSync(StorageKeys.CommunityId)
page: 0
});
if (communityId) {
getPlanPreviewsReq.onlyCommunityId = communityId;
}
let allPreviewsLoaded = false;
let isPreviewsLoaded = true;
Expand All @@ -23,12 +26,12 @@ const plans = ref<Plan[]>([]);
const localGetPlanPreviews = async () => {
let res = await getPlanPreviews(getPlanPreviewsReq);
isPreviewsLoaded = false;
for (let i = 0; i < res?.total; i++) {
plans.value.push(res.plans[i]);
for (const plan of res.plans) {
plans.value.push(plan);
}
isPreviewsLoaded = true;
getPlanPreviewsReq.page += 1;
if (res?.total < 10) {
if (res.plans.length) {
allPreviewsLoaded = true;
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/utils/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export async function init() {
const tasks: Promise<void>[] = [];
// 距离token过期不到一天时重新获取token
const expireTime = uni.getStorageSync(StorageKeys.AccessToken).expireTime;
if (!expireTime || expireTime - new Date().getTime() / 1000 < 86400) {
if (!expireTime || expireTime - new Date().getTime() / 1000 < 7 * 86400) {
tasks.push(refreshToken(accountInfo.appId));
}
tasks.push(checkCommunityId());
Expand Down

0 comments on commit ad5ceca

Please sign in to comment.