boluo-app-main/src/utils/share.ts
2025-05-15 01:02:00 +08:00

26 lines
887 B
TypeScript

import type { ShareAppMessageReturn } from '@tarojs/taro';
import { PageUrl } from '@/constants/app';
import { getJumpUrl } from './route';
const imageUrl = 'https://neighbourhood.cn/share_d.jpg';
const getRandomCount = () => {
const date = new Date();
const year = date.getFullYear();
const month = date.getMonth();
const day = date.getDate();
const seed = (year + month + day) * day;
return (seed % 300) + 500;
};
export const getCommonShareMessage = (useCapture: boolean = true, inviteCode?: string): ShareAppMessageReturn => {
console.log('share share message', getJumpUrl(PageUrl.Job, inviteCode ? { c: inviteCode } : undefined));
return {
title: `昨天新增了${getRandomCount()}条主播通告,宝子快来看看`,
path: getJumpUrl(PageUrl.Job, inviteCode ? { c: inviteCode } : undefined),
imageUrl: useCapture ? undefined : imageUrl,
};
};