This commit is contained in:
xd 2025-06-05 22:47:41 +08:00
parent ed99c7b1ae
commit 6805b590c7
17 changed files with 144 additions and 56 deletions

View File

@ -16,7 +16,19 @@
"coverView": false,
"showShadowRootInWxmlPanel": false,
"packNpmRelationList": [],
"ignoreUploadUnusedFiles": true
"ignoreUploadUnusedFiles": true,
"compileWorklet": false,
"uglifyFileName": false,
"uploadWithSourceMap": true,
"packNpmManually": false,
"minifyWXSS": true,
"minifyWXML": true,
"localPlugins": false,
"disableUseStrict": false,
"useCompilerPlugins": false,
"condition": false,
"swc": false,
"disableSWC": true
},
"compileType": "miniprogram",
"srcMiniprogramRoot": "dist/",
@ -30,5 +42,6 @@
"ignore": [],
"include": []
},
"appid": "wxf0724a83f8e377d2"
"appid": "wxf0724a83f8e377d2",
"simulatorPluginLibVersion": {}
}

View File

@ -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();

View File

@ -61,6 +61,10 @@
font-weight: 400;
font-size: 28px;
line-height: 40px;
&.grey {
color: @blColorG2
}
}
&__title {

View File

@ -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>

View File

@ -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 {

View File

@ -99,6 +99,7 @@ function PartnerList(props: {
>
{dataList.map(item => (
<div className={`${PREFIX}__item`} key={item.id || item.userId}>
<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>
@ -108,6 +109,7 @@ function PartnerList(props: {
<div className={`${PREFIX}__item-joined`}>{item.isPartner ? '已加入' : '未加入'}</div>
</div>
</div>
</div>
))}
<ListPlaceholder hasMore={false} loadingMore={loadingMore} loadMoreError={loadMoreError} />
</List>

View File

@ -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`}>

View File

@ -28,6 +28,14 @@
}
}
&__help-icon {
width: 28px;
height: 28px;
margin-left: 2px;
position: relative;
top: 6px;
}
&__title {
height: 72px;
width: 100%;

View File

@ -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>

View File

@ -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: '已分账',
};

View File

@ -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);
}
}

View File

@ -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,

View File

@ -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;
};

View File

@ -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>

View File

@ -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;

View File

@ -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 });
};

View File

@ -77,7 +77,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();