feat: update
This commit is contained in:
parent
ed99c7b1ae
commit
451add0e7d
@ -7,16 +7,16 @@ import { REFRESH_UNREAD_COUNT_TIME } from '@/constants/message';
|
||||
import http from '@/http';
|
||||
import store from '@/store';
|
||||
import { requestUnreadMessageCount } from '@/utils/message';
|
||||
import { getInviteCode } from '@/utils/partner';
|
||||
import { getInviteCode, getInviteCodeFromQuery } from '@/utils/partner';
|
||||
import qiniuUpload from '@/utils/qiniu-upload';
|
||||
import { requestUserInfo, updateLastLoginTime } from '@/utils/user';
|
||||
|
||||
import './app.less';
|
||||
|
||||
function App({ children }: PropsWithChildren<BL.Anything>) {
|
||||
useLaunch(async () => {
|
||||
useLaunch(async ({ query }) => {
|
||||
console.log('App launched.');
|
||||
await http.init();
|
||||
await http.init(getInviteCodeFromQuery(query));
|
||||
requestUserInfo().then(userInfo => {
|
||||
if (userInfo.isPartner) {
|
||||
getInviteCode();
|
||||
|
@ -61,6 +61,10 @@
|
||||
font-weight: 400;
|
||||
font-size: 28px;
|
||||
line-height: 40px;
|
||||
|
||||
&.grey {
|
||||
color: @blColorG2
|
||||
}
|
||||
}
|
||||
|
||||
&__title {
|
||||
|
@ -142,12 +142,18 @@ export default function PartnerIntro() {
|
||||
</div>
|
||||
</div>
|
||||
<div className={`${PREFIX}__block`}>
|
||||
<div className={`${PREFIX}__title`}>群主特别通道</div>
|
||||
<div className={`${PREFIX}__title`}>分享方法</div>
|
||||
<div className={`${PREFIX}__card`}>
|
||||
<div className={`${PREFIX}__body`}>分享小程序任意页面到群、朋友圈、好友即可</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className={`${PREFIX}__block`}>
|
||||
<div className={`${PREFIX}__title`}>合伙人交流群</div>
|
||||
<div className={`${PREFIX}__card ${PREFIX}__special`}>
|
||||
<div className={`${PREFIX}__body`}>如果您是主播群群主,请务必添加播络小伙计</div>
|
||||
<div className={`${PREFIX}__body`}>我们会为您提供专属服务,让您的收益最大化</div>
|
||||
<div className={`${PREFIX}__h1`}>加入播络合伙人交流群</div>
|
||||
<div className={`${PREFIX}__body grey`}>学习分享邀请经验,一起赚钱</div>
|
||||
<Button className={`${PREFIX}__service`} onClick={handleOpenService}>
|
||||
点击添加播络伙计
|
||||
点击加入
|
||||
</Button>
|
||||
</div>
|
||||
<div className={`${PREFIX}__tip`}>注:收益不设时限,可重复享有,播络保留活动最终解释权</div>
|
||||
|
@ -41,14 +41,18 @@
|
||||
height: 131px;
|
||||
width: 100%;
|
||||
background: #fff;
|
||||
padding: 24px 32px;
|
||||
padding: 24px 32px 0 32px;
|
||||
box-sizing: border-box;
|
||||
font-size: 28px;
|
||||
|
||||
&-border {
|
||||
border-bottom: 1px solid #e6e7e8;
|
||||
}
|
||||
|
||||
&-content {
|
||||
.flex-row();
|
||||
width: 100%;
|
||||
border-bottom: 1px solid #e6e7e8;
|
||||
padding-bottom: 24px;
|
||||
}
|
||||
|
||||
&-time-id {
|
||||
|
@ -12,6 +12,8 @@ import './index.less';
|
||||
const PREFIX = 'partner-invite-list';
|
||||
const log = logWithPrefix(PREFIX);
|
||||
|
||||
const FIRST_PAGE = 0;
|
||||
|
||||
function PartnerList(props: {
|
||||
refreshDisabled?: boolean;
|
||||
visible?: boolean;
|
||||
@ -20,10 +22,12 @@ function PartnerList(props: {
|
||||
onListEmpty?: () => void;
|
||||
}) {
|
||||
const { className, listHeight, refreshDisabled, visible = true, onListEmpty } = props;
|
||||
const [hasMore, setHasMore] = useState(true);
|
||||
const [refreshing, setRefreshing] = useState(false);
|
||||
const [loadingMore, setLoadingMore] = useState(false);
|
||||
const [loadMoreError, setLoadMoreError] = useState(false);
|
||||
const [dataList, setDataList] = useState<InviteUserInfo[]>([]);
|
||||
const currentPage = useRef<number>(FIRST_PAGE);
|
||||
const onListEmptyRef = useRef(onListEmpty);
|
||||
|
||||
const handleRefresh = useCallback(async () => {
|
||||
@ -31,19 +35,44 @@ function PartnerList(props: {
|
||||
try {
|
||||
setRefreshing(true);
|
||||
setLoadMoreError(false);
|
||||
const list = await requestData();
|
||||
setDataList(list);
|
||||
!list.length && onListEmptyRef.current?.();
|
||||
const { content, totalPages } = await requestData({ page: 1 });
|
||||
setDataList(content);
|
||||
currentPage.current = 1;
|
||||
setHasMore(currentPage.current < totalPages);
|
||||
!content.length && onListEmptyRef.current?.();
|
||||
log('pull refresh success');
|
||||
} catch (e) {
|
||||
setDataList([]);
|
||||
setHasMore(false);
|
||||
setLoadMoreError(true);
|
||||
currentPage.current = FIRST_PAGE;
|
||||
log('pull refresh failed');
|
||||
} finally {
|
||||
setRefreshing(false);
|
||||
}
|
||||
}, []);
|
||||
|
||||
const handleLoadMore = useCallback(async () => {
|
||||
log('start load more', hasMore);
|
||||
if (!hasMore) {
|
||||
return;
|
||||
}
|
||||
setLoadMoreError(false);
|
||||
setLoadingMore(true);
|
||||
try {
|
||||
const { totalPages, content } = await requestData({ page: currentPage.current + 1 });
|
||||
setDataList([...dataList, ...content]);
|
||||
currentPage.current = currentPage.current + 1;
|
||||
setHasMore(currentPage.current < totalPages);
|
||||
log('load more success');
|
||||
} catch (e) {
|
||||
setLoadMoreError(true);
|
||||
log('load more failed');
|
||||
} finally {
|
||||
setLoadingMore(false);
|
||||
}
|
||||
}, [dataList, hasMore]);
|
||||
|
||||
useEffect(() => {
|
||||
onListEmptyRef.current = onListEmpty;
|
||||
}, [onListEmpty]);
|
||||
@ -62,11 +91,14 @@ function PartnerList(props: {
|
||||
setDataList([]);
|
||||
setLoadingMore(true);
|
||||
setLoadMoreError(false);
|
||||
const list = await requestData();
|
||||
setDataList(list);
|
||||
!list.length && onListEmptyRef.current?.();
|
||||
const { totalPages, content } = await requestData({ page: 1 });
|
||||
setDataList(content);
|
||||
currentPage.current = 1;
|
||||
setHasMore(currentPage.current < totalPages);
|
||||
!content.length && onListEmptyRef.current?.();
|
||||
} catch (e) {
|
||||
setDataList([]);
|
||||
setHasMore(false);
|
||||
setLoadMoreError(true);
|
||||
} finally {
|
||||
log('visible changed, refresh list data end');
|
||||
@ -90,8 +122,8 @@ function PartnerList(props: {
|
||||
disabled={refreshDisabled}
|
||||
>
|
||||
<List
|
||||
hasMore={false}
|
||||
onLoad={() => {}}
|
||||
hasMore={hasMore}
|
||||
onLoad={handleLoadMore}
|
||||
loading={loadingMore || refreshing}
|
||||
disabled={loadMoreError}
|
||||
fixedHeight={typeof listHeight !== 'undefined'}
|
||||
@ -99,13 +131,15 @@ function PartnerList(props: {
|
||||
>
|
||||
{dataList.map(item => (
|
||||
<div className={`${PREFIX}__item`} key={item.id || item.userId}>
|
||||
<div className={`${PREFIX}__item-content`}>
|
||||
<div className={`${PREFIX}__item-time-id`}>
|
||||
<div className={`${PREFIX}__item-time`}>{formatTimestamp(item.created)}</div>
|
||||
<div className={`${PREFIX}__item-id`}>{formatUserId(item.userId)}</div>
|
||||
<div className={`${PREFIX}__item-border`}>
|
||||
<div className={`${PREFIX}__item-content`}>
|
||||
<div className={`${PREFIX}__item-time-id`}>
|
||||
<div className={`${PREFIX}__item-time`}>{formatTimestamp(item.created)}</div>
|
||||
<div className={`${PREFIX}__item-id`}>{formatUserId(item.userId)}</div>
|
||||
</div>
|
||||
<div className={`${PREFIX}__item-created`}>{item.isCreateResume ? '已创建' : '未创建'}</div>
|
||||
<div className={`${PREFIX}__item-joined`}>{item.isPartner ? '已加入' : '未加入'}</div>
|
||||
</div>
|
||||
<div className={`${PREFIX}__item-created`}>{item.isCreateResume ? '已创建' : '未创建'}</div>
|
||||
<div className={`${PREFIX}__item-joined`}>{item.isPartner ? '已加入' : '未加入'}</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
|
@ -96,7 +96,7 @@ function ProfitList(props: IPartnerProfitListProps) {
|
||||
style={listHeight ? { height: `${listHeight}px` } : undefined}
|
||||
>
|
||||
{dataList.map(item => {
|
||||
const isChat = type === ProfitType.CHAT_SHARE || item.earnType.toString().toLowerCase().indexOf('chat');
|
||||
const isChat = type === ProfitType.CHAT_SHARE || item.earnType.toString().toLowerCase().indexOf('chat') > -1;
|
||||
return (
|
||||
<div className={`${PREFIX}__row`} key={item.id}>
|
||||
<div className={`${PREFIX}__row-content`}>
|
||||
|
@ -28,6 +28,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
&__help-icon {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
margin-left: 2px;
|
||||
position: relative;
|
||||
top: 6px;
|
||||
}
|
||||
|
||||
&__title {
|
||||
height: 72px;
|
||||
width: 100%;
|
||||
|
@ -1,7 +1,10 @@
|
||||
import { Image } from '@tarojs/components';
|
||||
|
||||
import { Tabs } from '@taroify/core';
|
||||
|
||||
import PartnerKanban from '@/components/partner-kanban';
|
||||
import { ProfitType } from '@/types/partner';
|
||||
import Toast from '@/utils/toast';
|
||||
|
||||
import ProfitList from './ProfitList';
|
||||
|
||||
@ -21,22 +24,64 @@ function TableTitle() {
|
||||
}
|
||||
|
||||
export default function PartnerProfit() {
|
||||
const handleClickHelpChat = () => {
|
||||
Toast.info('主播被开聊14天后会显示收益');
|
||||
};
|
||||
const handleClickHelpPay = () => {
|
||||
Toast.info('会员支付15日后结算收益');
|
||||
};
|
||||
const handleClickHelpInvite = () => {
|
||||
Toast.info('所邀合伙人获得收益后自动获得收益');
|
||||
};
|
||||
return (
|
||||
<div className={PREFIX}>
|
||||
<div className={`${PREFIX}__top`}>
|
||||
<PartnerKanban />
|
||||
</div>
|
||||
<div className={`${PREFIX}__main`}>
|
||||
<Tabs className={`${PREFIX}__tabs`}>
|
||||
<Tabs.TabPane title="推荐主播收益">
|
||||
<Tabs className={`${PREFIX}__tabs`} ellipsis={false}>
|
||||
<Tabs.TabPane
|
||||
title={
|
||||
<>
|
||||
推荐主播收益
|
||||
<Image
|
||||
className={`${PREFIX}__help-icon`}
|
||||
src={require('@/statics/svg/help.svg')}
|
||||
onClick={handleClickHelpChat}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
>
|
||||
<TableTitle />
|
||||
<ProfitList type={ProfitType.CHAT_SHARE} />
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane title="推荐会员权益">
|
||||
<Tabs.TabPane
|
||||
title={
|
||||
<>
|
||||
推荐会员权益
|
||||
<Image
|
||||
className={`${PREFIX}__help-icon`}
|
||||
src={require('@/statics/svg/help.svg')}
|
||||
onClick={handleClickHelpPay}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
>
|
||||
<TableTitle />
|
||||
<ProfitList type={ProfitType.PAYMENT_SHARE} />
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane title="推荐合伙人收益">
|
||||
<Tabs.TabPane
|
||||
title={
|
||||
<>
|
||||
推荐合伙人收益
|
||||
<Image
|
||||
className={`${PREFIX}__help-icon`}
|
||||
src={require('@/statics/svg/help.svg')}
|
||||
onClick={handleClickHelpInvite}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
>
|
||||
<TableTitle />
|
||||
<ProfitList type={ProfitType.INDIRECT_MEMBER_REFERRAL} />
|
||||
</Tabs.TabPane>
|
||||
|
@ -2,53 +2,53 @@ export enum ProfitStatus {
|
||||
/**
|
||||
* 待处理/待计算 (例如,等待上游数据或条件满足)
|
||||
*/
|
||||
PENDING_CALCULATION = 0,
|
||||
PENDING_CALCULATION = 'PENDING_CALCULATION',
|
||||
|
||||
/**
|
||||
* 待直接结算/待直接分账 (例如,T+7 到账)
|
||||
* 这种类型的佣金会计入银行账户,而非平台余额
|
||||
*/
|
||||
DIRECT_SETTLEMENT_PENDING = 1,
|
||||
DIRECT_SETTLEMENT_PENDING = 'DIRECT_SETTLEMENT_PENDING',
|
||||
|
||||
/**
|
||||
* 直接结算已完成/直接分账已完成
|
||||
*/
|
||||
DIRECT_SETTLEMENT_PROCESSING = 2,
|
||||
DIRECT_SETTLEMENT_PROCESSING = 'DIRECT_SETTLEMENT_PROCESSING',
|
||||
|
||||
/**
|
||||
* 间接收益已结算到合伙人余额 (例如,主播推荐奖金进入可提现余额)
|
||||
*/
|
||||
INDIRECT_SETTLED_TO_BALANCE = 3,
|
||||
INDIRECT_SETTLED_TO_BALANCE = 'INDIRECT_SETTLED_TO_BALANCE',
|
||||
|
||||
/**
|
||||
* 佣金已取消 (例如,订单退款,不满足条件等)
|
||||
*/
|
||||
CANCELLED = 4,
|
||||
CANCELLED = 'CANCELLED',
|
||||
|
||||
/**
|
||||
* 佣金处理失败
|
||||
*/
|
||||
FAILED = 5,
|
||||
FAILED = 'FAILED',
|
||||
|
||||
/**
|
||||
* 其他状态
|
||||
*/
|
||||
OTHER = 6,
|
||||
OTHER = 'OTHER',
|
||||
|
||||
/**
|
||||
* 已完成
|
||||
*/
|
||||
FINISHED = 7,
|
||||
FINISHED = 'FINISHED',
|
||||
}
|
||||
|
||||
// 如果需要为每个枚举值添加描述,可以使用一个单独的映射对象
|
||||
export const ProfitStatusDescriptions: { [key in ProfitStatus]: string } = {
|
||||
[ProfitStatus.PENDING_CALCULATION]: '',
|
||||
[ProfitStatus.DIRECT_SETTLEMENT_PENDING]: '待分账',
|
||||
[ProfitStatus.DIRECT_SETTLEMENT_PROCESSING]: '',
|
||||
[ProfitStatus.INDIRECT_SETTLED_TO_BALANCE]: '',
|
||||
[ProfitStatus.CANCELLED]: '',
|
||||
[ProfitStatus.FAILED]: '',
|
||||
[ProfitStatus.OTHER]: '',
|
||||
[ProfitStatus.FINISHED]: '已分账',
|
||||
export const ProfitStatusDescriptions = {
|
||||
PENDING_CALCULATION: '',
|
||||
DIRECT_SETTLEMENT_PENDING: '待分账',
|
||||
DIRECT_SETTLEMENT_PROCESSING: '',
|
||||
INDIRECT_SETTLED_TO_BALANCE: '',
|
||||
CANCELLED: '',
|
||||
FAILED: '',
|
||||
OTHER: '',
|
||||
FINISHED: '已分账',
|
||||
};
|
||||
|
@ -107,14 +107,14 @@ class Http {
|
||||
url: BASE_URL + url,
|
||||
data,
|
||||
method: method,
|
||||
header: { 'content-type': contentType /*, 'user-Id': '588002047871053824' */ },
|
||||
header: { 'content-type': contentType /*'user-Id': '588002047871053824' */ },
|
||||
};
|
||||
return this.request(option);
|
||||
};
|
||||
|
||||
async init() {
|
||||
async init(inviteCode?: string) {
|
||||
if (isTokenExpired()) {
|
||||
await refreshToken();
|
||||
await refreshToken(inviteCode);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import Taro from '@tarojs/taro';
|
||||
|
||||
import { getRoleType } from '@/utils/app';
|
||||
import { getRoleTypeWithDefault } from '@/utils/app';
|
||||
import { isDev } from '@/utils/common';
|
||||
|
||||
import { getToken } from './utils';
|
||||
@ -20,7 +20,7 @@ const tokenInterceptor: Taro.interceptor = (chain: Taro.Chain) => {
|
||||
|
||||
const roleInterceptor: Taro.interceptor = (chain: Taro.Chain) => {
|
||||
const requestParams = chain.requestParams;
|
||||
const roleType = getRoleType();
|
||||
const roleType = getRoleTypeWithDefault();
|
||||
requestParams.header = {
|
||||
...requestParams.header,
|
||||
'role-type': roleType,
|
||||
|
@ -24,10 +24,10 @@ const clearToken = () => {
|
||||
Taro.setStorageSync(TOKEN_EXPIRES_TIME, 0);
|
||||
};
|
||||
|
||||
const requestToken = (): Promise<string> => {
|
||||
const requestToken = (inviteCode?: string): Promise<string> => {
|
||||
return getCode()
|
||||
.then(code => {
|
||||
return http.post<LoginResponse>(API.LOGIN, { data: { code } }).then(data => {
|
||||
return http.post<LoginResponse>(API.LOGIN, { data: { code, inviteCode } }).then(data => {
|
||||
const newToken = data?.token || '';
|
||||
const expires = data?.expires || 0;
|
||||
if (newToken) {
|
||||
@ -47,12 +47,12 @@ const requestToken = (): Promise<string> => {
|
||||
|
||||
export const isTokenExpired = () => (Taro.getStorageSync(TOKEN_EXPIRES_TIME) || 0) < Date.now();
|
||||
|
||||
export const refreshToken = () => {
|
||||
export const refreshToken = (inviteCode?: string) => {
|
||||
if (_fetchTokenPromise) {
|
||||
return _fetchTokenPromise;
|
||||
}
|
||||
clearToken();
|
||||
_fetchTokenPromise = requestToken();
|
||||
_fetchTokenPromise = requestToken(inviteCode);
|
||||
return _fetchTokenPromise;
|
||||
};
|
||||
|
||||
|
@ -27,8 +27,7 @@ import { logWithPrefix } from '@/utils/common';
|
||||
import { getLastSelectMyJobId, requestJobManageList, setLastSelectMyJobId } from '@/utils/job';
|
||||
import { getWxLocation } from '@/utils/location';
|
||||
import { requestUnreadMessageCount } from '@/utils/message';
|
||||
import { getInviteCodeFromQueryAndUpdate } from '@/utils/partner';
|
||||
import { getPageQuery, navigateTo } from '@/utils/route';
|
||||
import { navigateTo } from '@/utils/route';
|
||||
import { getCommonShareMessage } from '@/utils/share';
|
||||
import Toast from '@/utils/toast';
|
||||
import './index.less';
|
||||
@ -165,9 +164,6 @@ export default function AnchorPage() {
|
||||
}, [location]);
|
||||
|
||||
useLoad(async () => {
|
||||
const query = getPageQuery();
|
||||
getInviteCodeFromQueryAndUpdate(query);
|
||||
|
||||
try {
|
||||
const { jobResults = [] } = await requestJobManageList({ status: JobManageStatus.Open });
|
||||
if (!jobResults.length) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { useLoad, useShareAppMessage } from '@tarojs/taro';
|
||||
import { useShareAppMessage } from '@tarojs/taro';
|
||||
|
||||
import { useCallback } from 'react';
|
||||
|
||||
@ -8,8 +8,6 @@ import { GROUPS } from '@/constants/group';
|
||||
import useInviteCode from '@/hooks/use-invite-code';
|
||||
import { openCustomerServiceChat } from '@/utils/common';
|
||||
import { getCurrentCityCode } from '@/utils/location';
|
||||
import { getInviteCodeFromQueryAndUpdate } from '@/utils/partner';
|
||||
import { getPageQuery } from '@/utils/route';
|
||||
import { getCommonShareMessage } from '@/utils/share';
|
||||
import './index.less';
|
||||
|
||||
@ -18,11 +16,6 @@ const PREFIX = 'group-v2-page';
|
||||
export default function GroupV2() {
|
||||
const inviteCode = useInviteCode();
|
||||
|
||||
useLoad(() => {
|
||||
const query = getPageQuery();
|
||||
getInviteCodeFromQueryAndUpdate(query);
|
||||
});
|
||||
|
||||
useShareAppMessage(() => getCommonShareMessage(true, inviteCode));
|
||||
|
||||
const handleSelectCity = useCallback(cityCode => {
|
||||
|
@ -28,7 +28,6 @@ import { getJobTitle, getJobSalary, postPublishJob, requestJobDetail } from '@/u
|
||||
import { calcDistance, isValidLocation } from '@/utils/location';
|
||||
import { requestProfileDetail } from '@/utils/material';
|
||||
import { isChatWithSelf, postCreateChat } from '@/utils/message';
|
||||
import { getInviteCodeFromQueryAndUpdate } from '@/utils/partner';
|
||||
import { getJumpUrl, getPageQuery, navigateTo } from '@/utils/route';
|
||||
import { getCommonShareMessage } from '@/utils/share';
|
||||
import { formatDate } from '@/utils/time';
|
||||
@ -219,8 +218,7 @@ export default function JobDetail() {
|
||||
}, []);
|
||||
|
||||
useLoad(async () => {
|
||||
const query = getPageQuery<Pick<JobDetails, 'id'> & { c: string }>();
|
||||
getInviteCodeFromQueryAndUpdate(query);
|
||||
const query = getPageQuery<Pick<JobDetails, 'id'>>();
|
||||
const jobId = query?.id;
|
||||
if (!jobId) {
|
||||
return;
|
||||
|
@ -17,7 +17,6 @@ import { Coordinate } from '@/types/location';
|
||||
import { logWithPrefix } from '@/utils/common';
|
||||
import { getWxLocation, isNotNeedAuthorizeLocation, requestLocation } from '@/utils/location';
|
||||
import { requestUnreadMessageCount } from '@/utils/message';
|
||||
import { getInviteCodeFromQueryAndUpdate } from '@/utils/partner';
|
||||
import { getJumpUrl, getPageQuery, navigateTo } from '@/utils/route';
|
||||
import { getCommonShareMessage } from '@/utils/share';
|
||||
import Toast from '@/utils/toast';
|
||||
@ -109,7 +108,6 @@ export default function Job() {
|
||||
if (type === SortType.CREATE_TIME) {
|
||||
setSortType(type);
|
||||
}
|
||||
getInviteCodeFromQueryAndUpdate(query);
|
||||
if (await isNotNeedAuthorizeLocation()) {
|
||||
log('not need authorize location');
|
||||
requestLocation();
|
||||
|
@ -21,7 +21,6 @@ import { collectEvent } from '@/utils/event';
|
||||
import { requestHasPublishedJob, requestJobDetail } from '@/utils/job';
|
||||
import { getMaterialShareMessage, requestReadProfile, requestShareProfile } from '@/utils/material';
|
||||
import { isChatWithSelf, postCreateChat } from '@/utils/message';
|
||||
import { getInviteCodeFromQueryAndUpdate } from '@/utils/partner';
|
||||
import { getPageQuery, navigateBack, navigateTo, redirectTo } from '@/utils/route';
|
||||
import Toast from '@/utils/toast';
|
||||
import './index.less';
|
||||
@ -142,7 +141,6 @@ export default function MaterialViewPage() {
|
||||
|
||||
useLoad(async () => {
|
||||
const context = getPageQuery<IViewContext | IShareContext>();
|
||||
getInviteCodeFromQueryAndUpdate(context as BL.Anything);
|
||||
try {
|
||||
const profileDetail = await requestProfile(context);
|
||||
setProfile(profileDetail);
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { useShareAppMessage } from '@tarojs/taro';
|
||||
|
||||
import { Button, Tabs } from '@taroify/core';
|
||||
import { useCallback } from 'react';
|
||||
|
||||
@ -6,6 +7,7 @@ import HomePage from '@/components/home-page';
|
||||
import SearchCity from '@/components/search-city';
|
||||
import UserBatchPublish from '@/components/user-batch-publish';
|
||||
import { GROUPS } from '@/constants/group';
|
||||
import useInviteCode from '@/hooks/use-invite-code';
|
||||
import { openCustomerServiceChat } from '@/utils/common';
|
||||
import { getCurrentCityCode } from '@/utils/location';
|
||||
import { getCommonShareMessage } from '@/utils/share';
|
||||
@ -14,6 +16,8 @@ import './index.less';
|
||||
const PREFIX = 'page-biz-service';
|
||||
|
||||
export default function BizService() {
|
||||
const inviteCode = useInviteCode();
|
||||
|
||||
const handleOpenService = useCallback(() => {
|
||||
openCustomerServiceChat('https://work.weixin.qq.com/kfid/kfcd60708731367168d');
|
||||
}, []);
|
||||
@ -23,7 +27,7 @@ export default function BizService() {
|
||||
openCustomerServiceChat(group.serviceUrl);
|
||||
}
|
||||
}, []);
|
||||
useShareAppMessage(() => getCommonShareMessage());
|
||||
useShareAppMessage(() => getCommonShareMessage(true, inviteCode));
|
||||
|
||||
return (
|
||||
<HomePage>
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { RoleType, PageUrl } from '@/constants/app';
|
||||
import { PageUrl, RoleType } from '@/constants/app';
|
||||
import { CollectEventName } from '@/constants/event';
|
||||
import { ANCHOR_TAB_LIST, COMPANY_TAB_LIST } from '@/hooks/use-config';
|
||||
import http from '@/http';
|
||||
import { API } from '@/http/api';
|
||||
import store from '@/store';
|
||||
import { changeRoleType, changeHomePage } from '@/store/actions';
|
||||
import { changeHomePage, changeRoleType } from '@/store/actions';
|
||||
import { selectRoleType } from '@/store/selector';
|
||||
import { sleep } from '@/utils/common';
|
||||
import { collectEvent } from '@/utils/event';
|
||||
@ -18,7 +18,9 @@ const postSwitchRoleType = (appMode: RoleType) => {
|
||||
|
||||
export const getRoleType = () => selectRoleType(store.getState());
|
||||
|
||||
export const isAnchorMode = () => getRoleType() === RoleType.Anchor;
|
||||
export const getRoleTypeWithDefault = () => getRoleType() || RoleType.Anchor;
|
||||
|
||||
export const isAnchorMode = () => getRoleTypeWithDefault() === RoleType.Anchor;
|
||||
|
||||
export const isCompanyMode = () => getRoleType() === RoleType.Company;
|
||||
|
||||
|
@ -18,7 +18,7 @@ import {
|
||||
IChatActionDetail,
|
||||
ChatWatchRequest,
|
||||
} from '@/types/message';
|
||||
import { getRoleType } from '@/utils/app';
|
||||
import { getRoleTypeWithDefault } from '@/utils/app';
|
||||
import { logWithPrefix, oncePromise } from '@/utils/common';
|
||||
import { collectEvent } from '@/utils/event';
|
||||
import { navigateTo } from '@/utils/route';
|
||||
@ -60,12 +60,12 @@ export const requestMessageList = oncePromise(async () => {
|
||||
});
|
||||
|
||||
export const requestChatDetail = (chatId: string) => {
|
||||
const data = { chatId, roleType: getRoleType() };
|
||||
const data = { chatId, roleType: getRoleTypeWithDefault() };
|
||||
return http.post<IChatInfo>(API.MESSAGE_CHAT, { data, contentType: 'application/x-www-form-urlencoded' });
|
||||
};
|
||||
|
||||
export const requestNewChatMessages = (params: GetNewChatMessagesRequest) => {
|
||||
const data = { ...params, roleType: getRoleType() };
|
||||
const data = { ...params, roleType: getRoleTypeWithDefault() };
|
||||
return http.post<IChatMessage[]>(API.MESSAGE_CHAT_NEW, { data });
|
||||
};
|
||||
|
||||
|
@ -5,6 +5,7 @@ import http from '@/http';
|
||||
import { API } from '@/http/api';
|
||||
import store from '@/store';
|
||||
import { setInviteCode } from '@/store/actions/partner';
|
||||
import { IPaginationRequest } from '@/types/common';
|
||||
import {
|
||||
GetProfitRequest,
|
||||
InviteUserInfo,
|
||||
@ -51,8 +52,11 @@ export const getPartnerQrcode = async () => {
|
||||
export const getPartnerProfitStat = async () => {
|
||||
return await http.post<PartnerProfitsState>(API.GET_PROFIT_STAT);
|
||||
};
|
||||
export const getPartnerInviteList = async () => {
|
||||
return await http.post<InviteUserInfo[]>(API.GET_INVITE_LIST);
|
||||
export const getPartnerInviteList = async (data: IPaginationRequest) => {
|
||||
return await http.post<{ content: InviteUserInfo[]; totalPages: number }>(API.GET_INVITE_LIST, {
|
||||
data,
|
||||
contentType: 'application/x-www-form-urlencoded',
|
||||
});
|
||||
};
|
||||
export const dispatchUpdateInviteCode = (code: string) => store.dispatch(setInviteCode(code));
|
||||
export const getInviteCode = async () => {
|
||||
@ -77,7 +81,7 @@ export const formatMoney = (cents: number) => {
|
||||
};
|
||||
export function formatTimestamp(timestamp: string): string {
|
||||
// 创建 Date 对象
|
||||
const date = new Date(timestamp);
|
||||
const date = new Date(/^\d+$/.test(timestamp) ? Number(timestamp) : timestamp);
|
||||
|
||||
// 获取年、月、日、时、分、秒
|
||||
const YYYY = date.getFullYear();
|
||||
|
Loading…
Reference in New Issue
Block a user