Compare commits
5 Commits
feat/mater
...
feat/group
| Author | SHA1 | Date | |
|---|---|---|---|
| fde2027588 | |||
| a179654898 | |||
| bc141fcf1b | |||
| 3d2b121b92 | |||
| 7ba04b27ff |
900
pnpm-lock.yaml
generated
900
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -12,4 +12,9 @@ page {
|
||||
.taroify-tabs__wrap__scroll {
|
||||
.base-bg();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Alimama ShuHeiTi';
|
||||
src: url('https://publiccdn.neighbourhood.com.cn/font/almmheiti.ttf');
|
||||
}
|
||||
|
||||
32
src/app.tsx
32
src/app.tsx
@ -1,4 +1,4 @@
|
||||
import { useLaunch } from '@tarojs/taro';
|
||||
import Taro, { useDidShow, useLaunch } from '@tarojs/taro';
|
||||
|
||||
import { PropsWithChildren } from 'react';
|
||||
import { Provider } from 'react-redux';
|
||||
@ -6,8 +6,9 @@ import { Provider } from 'react-redux';
|
||||
import { REFRESH_UNREAD_COUNT_TIME } from '@/constants/message';
|
||||
import http from '@/http';
|
||||
import store from '@/store';
|
||||
import { requestCityOperators } from '@/utils/location';
|
||||
import { requestUnreadMessageCount } from '@/utils/message';
|
||||
import { getInviteCode, getInviteCodeFromQuery } from '@/utils/partner';
|
||||
import { decryptOpenGid, getInviteCode, getInviteCodeFromQuery } from '@/utils/partner';
|
||||
import qiniuUpload from '@/utils/qiniu-upload';
|
||||
import { requestUserInfo, updateLastLoginTime } from '@/utils/user';
|
||||
|
||||
@ -28,6 +29,33 @@ function App({ children }: PropsWithChildren<BL.Anything>) {
|
||||
setInterval(() => requestUnreadMessageCount(), REFRESH_UNREAD_COUNT_TIME);
|
||||
});
|
||||
|
||||
useDidShow(options => {
|
||||
requestCityOperators();
|
||||
|
||||
console.log(options);
|
||||
const inviteCode = getInviteCodeFromQuery(options?.query || {});
|
||||
const authCode = options?.query?.authCode;
|
||||
if (inviteCode || authCode) {
|
||||
Taro.getGroupEnterInfo()
|
||||
.then(info => {
|
||||
decryptOpenGid({
|
||||
inviteCode,
|
||||
authCode,
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-expect-error
|
||||
iv: info.iv,
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-expect-error
|
||||
encryptedData: info.encryptedData,
|
||||
});
|
||||
console.log('哈哈哈', info);
|
||||
})
|
||||
.catch(() => {
|
||||
console.log('没有解析到群', options?.scene);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return <Provider store={store}>{children}</Provider>;
|
||||
}
|
||||
|
||||
|
||||
85
src/components/group-certification-list/index.less
Normal file
85
src/components/group-certification-list/index.less
Normal file
@ -0,0 +1,85 @@
|
||||
@import '@/styles/common.less';
|
||||
|
||||
.group-certification-list {
|
||||
min-height: calc(100vh - 98rpx);
|
||||
&__banner {
|
||||
font-weight: 400;
|
||||
font-size: 24px;
|
||||
height: 74px;
|
||||
padding: 32px 32px 25px;
|
||||
line-height: 36px;
|
||||
color: #999999;
|
||||
background: #F5F6FA;
|
||||
position: fixed;
|
||||
z-index: 1;
|
||||
top: 99px;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
&__title {
|
||||
height: 72px;
|
||||
width: 100%;
|
||||
padding: 0 24px;
|
||||
box-sizing: border-box;
|
||||
line-height: 72px;
|
||||
font-size: 24px;
|
||||
color: rgba(0, 0, 0, 0.5);
|
||||
position: fixed;
|
||||
top: 227rpx;
|
||||
left: 0;
|
||||
z-index: 1;
|
||||
background: #fff;
|
||||
|
||||
&-border {
|
||||
border-bottom: 1px solid #e6e7e8;
|
||||
.flex-row();
|
||||
}
|
||||
|
||||
&-time {
|
||||
padding: 0 8px;
|
||||
flex: 0 0 120px;
|
||||
width: 120px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
&-name {
|
||||
text-align: right;
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
|
||||
&__pull-refresh {
|
||||
margin-top: 72px;
|
||||
}
|
||||
|
||||
&__item {
|
||||
height: 100px;
|
||||
width: 100%;
|
||||
padding: 24px 32px 0 32px;
|
||||
box-sizing: border-box;
|
||||
font-size: 28px;
|
||||
background: #fff;
|
||||
|
||||
&-border {
|
||||
border-bottom: 1px solid #e6e7e8;
|
||||
}
|
||||
|
||||
&-content {
|
||||
.flex-row();
|
||||
width: 100%;
|
||||
padding-bottom: 24px;
|
||||
}
|
||||
|
||||
&-time {
|
||||
padding: 0 8px;
|
||||
flex: 0 0 120px;
|
||||
width: 120px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
&-name {
|
||||
text-align: right;
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
153
src/components/group-certification-list/index.tsx
Normal file
153
src/components/group-certification-list/index.tsx
Normal file
@ -0,0 +1,153 @@
|
||||
import { List, PullRefresh } from '@taroify/core';
|
||||
import classNames from 'classnames';
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
|
||||
import ListPlaceholder from '@/components/list-placeholder';
|
||||
import { AuthedGroupInfo } from '@/types/partner';
|
||||
import { logWithPrefix } from '@/utils/common';
|
||||
import { formatTimestamp, getAuthedGroupList as requestData } from '@/utils/partner';
|
||||
|
||||
import './index.less';
|
||||
|
||||
const PREFIX = 'group-certification-list';
|
||||
const log = logWithPrefix(PREFIX);
|
||||
|
||||
const FIRST_PAGE = 0;
|
||||
|
||||
function GroupCertificationList(props: {
|
||||
refreshDisabled?: boolean;
|
||||
visible?: boolean;
|
||||
listHeight?: number;
|
||||
className?: string;
|
||||
onListEmpty?: () => void;
|
||||
}) {
|
||||
const { className, listHeight, refreshDisabled, visible = true, onListEmpty } = props;
|
||||
const [hasMore, setHasMore] = useState(false);
|
||||
const [refreshing, setRefreshing] = useState(false);
|
||||
const [loadingMore, setLoadingMore] = useState(false);
|
||||
const [loadMoreError, setLoadMoreError] = useState(false);
|
||||
const [dataList, setDataList] = useState<AuthedGroupInfo[]>([]);
|
||||
const currentPage = useRef<number>(FIRST_PAGE);
|
||||
const onListEmptyRef = useRef(onListEmpty);
|
||||
|
||||
const handleRefresh = useCallback(async () => {
|
||||
log('start pull refresh');
|
||||
try {
|
||||
setRefreshing(true);
|
||||
setLoadMoreError(false);
|
||||
const content = await requestData();
|
||||
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 content = await requestData();
|
||||
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]);
|
||||
|
||||
// 初始化数据&配置变更后刷新数据
|
||||
useEffect(() => {
|
||||
// 列表不可见时,先不做处理
|
||||
if (!visible) {
|
||||
log('visible changed, but is not visible, only clear list');
|
||||
return;
|
||||
}
|
||||
|
||||
const refresh = async () => {
|
||||
log('visible changed, start refresh list data');
|
||||
try {
|
||||
setDataList([]);
|
||||
setLoadingMore(true);
|
||||
setLoadMoreError(false);
|
||||
const content = await requestData();
|
||||
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');
|
||||
setLoadingMore(false);
|
||||
}
|
||||
};
|
||||
refresh();
|
||||
}, [visible]);
|
||||
|
||||
return (
|
||||
<div className={PREFIX}>
|
||||
<div className={`${PREFIX}__banner`}>
|
||||
以下均为认证成功的群,没认证成功请先确认是否有拉运营进群,如果在,可以尝试重新分享小程序
|
||||
</div>
|
||||
<div className={`${PREFIX}__title`}>
|
||||
<div className={`${PREFIX}__title-border`}>
|
||||
<div className={`${PREFIX}__title-time`}>认证日期</div>
|
||||
<div className={`${PREFIX}__title-name`}>群名称</div>
|
||||
</div>
|
||||
</div>
|
||||
<PullRefresh
|
||||
className={classNames(`${PREFIX}__pull-refresh`, className)}
|
||||
loading={refreshing}
|
||||
onRefresh={handleRefresh}
|
||||
disabled={refreshDisabled}
|
||||
>
|
||||
<List
|
||||
hasMore={hasMore}
|
||||
onLoad={handleLoadMore}
|
||||
loading={loadingMore || refreshing}
|
||||
disabled={loadMoreError || !visible}
|
||||
fixedHeight={typeof listHeight !== 'undefined'}
|
||||
style={listHeight ? { height: `${listHeight}px` } : undefined}
|
||||
>
|
||||
{dataList.map(item => (
|
||||
<div className={`${PREFIX}__item`} key={item.openGid}>
|
||||
<div className={`${PREFIX}__item-border`}>
|
||||
<div className={`${PREFIX}__item-content`}>
|
||||
<div className={`${PREFIX}__item-time`}>{formatTimestamp(item.authDate, true)}</div>
|
||||
<div className={`${PREFIX}__item-name`}>{item.groupName}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
<ListPlaceholder hasMore={false} loadingMore={loadingMore} loadMoreError={loadMoreError} />
|
||||
</List>
|
||||
</PullRefresh>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default GroupCertificationList;
|
||||
@ -7,12 +7,11 @@ import { useCallback, useState } from 'react';
|
||||
import { RoleType } from '@/constants/app';
|
||||
import { CacheKey } from '@/constants/cache-key';
|
||||
import { CITY_CODE_TO_NAME_MAP } from '@/constants/city';
|
||||
import { GROUPS } from '@/constants/group';
|
||||
import useCityOperators from '@/hooks/use-city-operators';
|
||||
import { getRoleTypeWithDefault } from '@/utils/app';
|
||||
import { openCustomerServiceChat } from '@/utils/common';
|
||||
import { getCurrentCityCode } from '@/utils/location';
|
||||
import { checkCityCode, validCityCode } from '@/utils/user';
|
||||
|
||||
import './index.less';
|
||||
|
||||
const PREFIX = 'join-group-hint';
|
||||
@ -25,13 +24,14 @@ const DEFAULT_GROUP = {
|
||||
export function JoinGroupHint() {
|
||||
const cityCode = getCurrentCityCode();
|
||||
const roleType = getRoleTypeWithDefault();
|
||||
const group = GROUPS.find(g => String(g.cityCode) === cityCode);
|
||||
const cityOperators = useCityOperators();
|
||||
const group = cityOperators.find(g => String(g.cityCode) === cityCode);
|
||||
const [clicked, setClicked] = useState(!!Taro.getStorageSync(CacheKey.JOIN_GROUP_CARD_CLICKED));
|
||||
const handleClick = useCallback(() => {
|
||||
if (group && !checkCityCode(cityCode)) {
|
||||
return;
|
||||
}
|
||||
openCustomerServiceChat(group ? group.serviceUrl : DEFAULT_GROUP.serviceUrl);
|
||||
openCustomerServiceChat(group ? group.groupLink : DEFAULT_GROUP.serviceUrl);
|
||||
Taro.setStorageSync(CacheKey.JOIN_GROUP_CARD_CLICKED, true);
|
||||
setClicked(true);
|
||||
}, [cityCode, group]);
|
||||
|
||||
@ -18,7 +18,7 @@ export default function LoginDialog(props: IProps) {
|
||||
const { title = '使用播络服务前,请先登录', needPhone, onSuccess, onCancel, onBindPhone } = props;
|
||||
|
||||
return (
|
||||
<Dialog open onClose={onCancel}>
|
||||
<Dialog open onClose={onCancel} className={PREFIX}>
|
||||
<Dialog.Content>
|
||||
<div className={`${PREFIX}__container`}>
|
||||
<div className={`${PREFIX}__title`}>{title}</div>
|
||||
|
||||
@ -12,7 +12,7 @@ import './index.less';
|
||||
|
||||
const PREFIX = 'partner-fragment-banner';
|
||||
|
||||
export default function PartnerBanner() {
|
||||
export default function PartnerBanner({ isBoss = false }) {
|
||||
const userInfo = useUserInfo();
|
||||
const needPhone = isNeedPhone(userInfo);
|
||||
const isPartner = userInfo.isPartner;
|
||||
@ -50,7 +50,11 @@ export default function PartnerBanner() {
|
||||
<div className={PREFIX} onClick={handleClick}>
|
||||
<Image
|
||||
className={`${PREFIX}__image`}
|
||||
src="https://publiccdn.neighbourhood.com.cn/img/partner_banner.png"
|
||||
src={
|
||||
isBoss
|
||||
? 'https://publiccdn.neighbourhood.com.cn/img/partner_banner.png'
|
||||
: 'https://publiccdn.neighbourhood.com.cn/img/partner-banner-boss.png'
|
||||
}
|
||||
mode="scaleToFill"
|
||||
/>
|
||||
{needPhone && (
|
||||
@ -60,9 +64,7 @@ export default function PartnerBanner() {
|
||||
)}
|
||||
<div className={`${PREFIX}__close`} onClick={handlePartnerBannerClose} />
|
||||
</div>
|
||||
{visible && (
|
||||
<LoginDialog onCancel={() => setVisible(false)} onSuccess={handleBind} needPhone={needPhone} />
|
||||
)}
|
||||
{visible && <LoginDialog onCancel={() => setVisible(false)} onSuccess={handleBind} needPhone={needPhone} />}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@ -2,26 +2,53 @@
|
||||
@import '@/styles/common.less';
|
||||
|
||||
.partner-intro {
|
||||
padding-top: 112px;
|
||||
padding-bottom: calc(112px + constant(safe-area-inset-bottom));
|
||||
padding-bottom: calc(112px + env(safe-area-inset-bottom));
|
||||
background: #eae5fb;
|
||||
padding-top: 271px;
|
||||
position: relative;
|
||||
padding-bottom: calc(142px + constant(safe-area-inset-bottom));
|
||||
padding-bottom: calc(142px + env(safe-area-inset-bottom));
|
||||
|
||||
&__banner {
|
||||
background: fade(@blHighlightBg, 8);
|
||||
height: 88px;
|
||||
line-height: 88px;
|
||||
text-align: center;
|
||||
font-size: 28px;
|
||||
position: fixed;
|
||||
top: 98px;
|
||||
&__bg {
|
||||
width: 100%;
|
||||
height: 705px;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
width: 100vw;
|
||||
}
|
||||
&__slogan {
|
||||
top: 66px;
|
||||
left: 44px;
|
||||
position: absolute;
|
||||
font-family: 'Alimama ShuHeiTi';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-size: 44px;
|
||||
line-height: 62px;
|
||||
color: #333333;
|
||||
|
||||
> div {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
&-highlight {
|
||||
display: inline-block;
|
||||
padding-left: 12px;
|
||||
padding-right: 9px;
|
||||
font-size: 64px;
|
||||
line-height: 62px;
|
||||
background: linear-gradient(87.53deg, #683DE3 0.4%, #39227D 84.55%);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-clip: text;
|
||||
text-fill-color: transparent;
|
||||
}
|
||||
}
|
||||
|
||||
&__main {
|
||||
padding-left: 24px;
|
||||
padding-right: 24px;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
&__highlight {
|
||||
@ -34,14 +61,73 @@
|
||||
}
|
||||
|
||||
&__block {
|
||||
margin-bottom: 40px;
|
||||
margin-bottom: 12px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
&__swiper {
|
||||
&-wrapper {
|
||||
margin-bottom: 8px;
|
||||
background: #fff;
|
||||
border-radius: 24px;
|
||||
position: relative;
|
||||
border: 1px solid #6d3df5;
|
||||
}
|
||||
|
||||
&-bg {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
&__swiper-item {
|
||||
box-sizing: border-box;
|
||||
height: 130px;
|
||||
padding: 24px 32px;
|
||||
&-time {
|
||||
font-style: normal;
|
||||
font-size: 28px;
|
||||
line-height: 40px;
|
||||
color: #333333;
|
||||
font-weight: 400;
|
||||
position: relative;
|
||||
}
|
||||
&-details {
|
||||
margin-top: 5px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
&-id {
|
||||
font-size: 24px;
|
||||
line-height: 36px;
|
||||
color: #999999;
|
||||
padding-right: 22px;
|
||||
display: inline-block;
|
||||
}
|
||||
&-info {
|
||||
font-size: 28px;
|
||||
line-height: 40px;
|
||||
color: #333333;
|
||||
margin-right: 16px;
|
||||
display: inline-block;
|
||||
&:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.money {
|
||||
color: #ff5051;
|
||||
display: inline-block;
|
||||
padding-left: 8px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&__card {
|
||||
background: #fff;
|
||||
border-radius: 24px;
|
||||
padding: 24px 32px;
|
||||
padding: 68px 32px 44px;
|
||||
}
|
||||
|
||||
&__h1 {
|
||||
@ -51,33 +137,81 @@
|
||||
color: #1d2129;
|
||||
margin-bottom: 16px;
|
||||
margin-top: 32px;
|
||||
position: relative;
|
||||
z-index: 0;
|
||||
|
||||
&.no-dot {
|
||||
&:after {
|
||||
background: transparent;
|
||||
}
|
||||
}
|
||||
|
||||
&:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
&:after {
|
||||
content: '';
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
background: #ffd236;
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
left: -6px;
|
||||
top: -3px;
|
||||
z-index: -1;
|
||||
}
|
||||
}
|
||||
|
||||
&__body {
|
||||
font-weight: 400;
|
||||
font-size: 28px;
|
||||
line-height: 40px;
|
||||
color: @blColor;
|
||||
|
||||
&.grey {
|
||||
color: @blColorG2
|
||||
color: @blColorG2;
|
||||
}
|
||||
|
||||
&.center {
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
&__title {
|
||||
margin-bottom: 24px;
|
||||
margin-left: 48px;
|
||||
margin-right: 48px;
|
||||
font-weight: 500;
|
||||
font-size: 32px;
|
||||
line-height: 32px;
|
||||
|
||||
line-height: 80px;
|
||||
height: 80px;
|
||||
transform: translateY(50%);
|
||||
background: #ffd236;
|
||||
box-shadow: 0px 12px 0px #ffa35d;
|
||||
border-radius: 60px;
|
||||
color: #1d2129;
|
||||
text-align: center;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
&__recommend {
|
||||
display: inline-flex;
|
||||
line-height: 36px;
|
||||
padding: 0 8px;
|
||||
height: 36px;
|
||||
background: rgb(255, 80, 81);
|
||||
border-radius: 4px;
|
||||
font-size: 24px;
|
||||
color: #fff;
|
||||
align-items: center;
|
||||
position: absolute;
|
||||
gap: 6px;
|
||||
right: -25px;
|
||||
top: -18px;
|
||||
}
|
||||
|
||||
&__special {
|
||||
padding: 32px;
|
||||
padding-top: 75px;
|
||||
.flex-column();
|
||||
|
||||
.partner-intro__body {
|
||||
@ -100,6 +234,7 @@
|
||||
&__footer {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
z-index: 2;
|
||||
width: 100vw;
|
||||
background: #ffffff;
|
||||
padding: 12px 32px;
|
||||
@ -112,17 +247,20 @@
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
box-sizing: border-box;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
&__download-button {
|
||||
flex: 1 1;
|
||||
//flex: 1 1;
|
||||
.button(@height: 88px; @fontSize: 32px; @fontWeight: 500; @borderRadius: 44px; @highlight: 0);
|
||||
}
|
||||
|
||||
&__share-button {
|
||||
flex: 2 2;
|
||||
//flex: 2 2;
|
||||
flex: 0 0 406px;
|
||||
width: 406px;
|
||||
.button(@height: 88px; @fontSize: 32px; @fontWeight: 500; @borderRadius: 44px;);
|
||||
margin-left: 32px;
|
||||
//margin-left: 32px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,168 +1,165 @@
|
||||
import { Button, Canvas } from '@tarojs/components';
|
||||
import Taro from '@tarojs/taro';
|
||||
import { Button, Canvas, Image } from '@tarojs/components';
|
||||
|
||||
import { useCallback } from 'react';
|
||||
import { Swiper } from '@taroify/core';
|
||||
import { GoodJob } from '@taroify/icons';
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
|
||||
import { PageUrl } from '@/constants/app';
|
||||
import { EarnType, UserProfitListItem } from '@/types/partner';
|
||||
import { openCustomerServiceChat } from '@/utils/common';
|
||||
import { getCouponQrCode, generateMembershipCoupon } from '@/utils/coupon';
|
||||
import { formatMoney, formatTimestamp, formatUserId, getLastProfitList } from '@/utils/partner';
|
||||
import { navigateTo } from '@/utils/route';
|
||||
|
||||
import './index.less';
|
||||
|
||||
const PREFIX = 'partner-intro';
|
||||
|
||||
export default function PartnerIntro() {
|
||||
const getQrcode = async () => {
|
||||
try {
|
||||
const { code } = await generateMembershipCoupon();
|
||||
const data = await getCouponQrCode(code);
|
||||
const base64 = Taro.arrayBufferToBase64(data);
|
||||
return `data:image/png;base64,${base64}`;
|
||||
} catch (error) {
|
||||
console.error('获取二维码失败', error);
|
||||
Taro.showToast({ title: '获取二维码失败', icon: 'none' });
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
const saveCanvasToTempFile = (): Promise<string> => {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
const query = Taro.createSelectorQuery().select('#posterCanvas');
|
||||
query.fields({ node: true }).exec(async res => {
|
||||
const canvas = res[0].node;
|
||||
const tempFilePath = await Taro.canvasToTempFilePath({
|
||||
canvas,
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 1500, // 实际绘制宽度
|
||||
height: 2668, // 实际绘制高度
|
||||
destWidth: 750, // 目标显示宽度
|
||||
destHeight: 1334, // 目标显示高度
|
||||
fileType: 'png',
|
||||
});
|
||||
|
||||
resolve(tempFilePath.tempFilePath);
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('保存 Canvas 到临时文件失败', error);
|
||||
Taro.showToast({ title: '保存 Canvas 失败', icon: 'none' });
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
};
|
||||
const drawCanvas = (qrCode: string): Promise<string> => {
|
||||
const query = Taro.createSelectorQuery().select('#posterCanvas');
|
||||
return new Promise(resolve => {
|
||||
query.fields({ node: true, size: true }).exec(async res => {
|
||||
const canvas = res[0].node;
|
||||
const ctx = canvas.getContext('2d');
|
||||
|
||||
canvas.width = 550 * 2;
|
||||
canvas.height = 918 * 2;
|
||||
ctx.scale(2, 2);
|
||||
|
||||
// 绘制背景图片
|
||||
const bgImage = canvas.createImage();
|
||||
const poster = 'https://publiccdn.neighbourhood.com.cn/img/share-coupon-poster2.png';
|
||||
bgImage.src = poster;
|
||||
bgImage.onload = () => {
|
||||
ctx.drawImage(bgImage, 0, 0, 550, 918);
|
||||
|
||||
const qrCodeImage = canvas.createImage();
|
||||
qrCodeImage.src = qrCode; // 假设 getQrcode() 返回的是二维码图片的路径
|
||||
qrCodeImage.onload = () => {
|
||||
ctx.drawImage(qrCodeImage, 196, 600, 180, 160); // 绘制二维码,位置和大小
|
||||
saveCanvasToTempFile().then(tempPath => {
|
||||
resolve(tempPath);
|
||||
});
|
||||
};
|
||||
};
|
||||
bgImage.onerror = err => {
|
||||
console.error(err);
|
||||
};
|
||||
});
|
||||
});
|
||||
};
|
||||
const savePoster = async () => {
|
||||
Taro.showLoading({ title: '正在生成海报' });
|
||||
const qrCode = await getQrcode();
|
||||
const filePath = await drawCanvas(qrCode);
|
||||
Taro.hideLoading();
|
||||
|
||||
const res = await Taro.getSetting();
|
||||
const hasPermission = res.authSetting['scope.writePhotosAlbum'];
|
||||
if (hasPermission === false) {
|
||||
Taro.showModal({
|
||||
title: '提示',
|
||||
content: '需要访问相册权限才能保存图片,请前往设置开启权限',
|
||||
showCancel: false,
|
||||
success() {
|
||||
Taro.openSetting();
|
||||
},
|
||||
});
|
||||
} else {
|
||||
try {
|
||||
await Taro.authorize({ scope: 'scope.writePhotosAlbum' });
|
||||
await Taro.saveImageToPhotosAlbum({ filePath });
|
||||
Taro.showToast({ title: '保存成功', icon: 'success' });
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
Taro.showToast({ title: '保存失败', icon: 'none' });
|
||||
}
|
||||
}
|
||||
};
|
||||
const handleConfirm = useCallback(() => {
|
||||
navigateTo(PageUrl.GroupOwnerCertificate);
|
||||
}, []);
|
||||
|
||||
const handleOpenService = useCallback(() => {
|
||||
openCustomerServiceChat('https://work.weixin.qq.com/kfid/kfc4fcf6b109b3771d7');
|
||||
}, []);
|
||||
|
||||
const handleJump = useCallback(() => {
|
||||
navigateTo(PageUrl.PartnerShareVip);
|
||||
}, []);
|
||||
|
||||
const timerRef = useRef<NodeJS.Timeout | null>(null);
|
||||
const [bannerList, setBannerList] = useState<UserProfitListItem[]>([]);
|
||||
|
||||
const getBannerList = useCallback(async () => {
|
||||
if (timerRef.current) {
|
||||
clearTimeout(timerRef.current);
|
||||
timerRef.current = null;
|
||||
}
|
||||
|
||||
const list = await getLastProfitList();
|
||||
setBannerList(list);
|
||||
|
||||
timerRef.current = setTimeout(
|
||||
() => {
|
||||
getBannerList();
|
||||
},
|
||||
3000 * (list.length || 10)
|
||||
);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
getBannerList();
|
||||
|
||||
return () => {
|
||||
if (timerRef.current) {
|
||||
clearTimeout(timerRef.current);
|
||||
timerRef.current = null;
|
||||
}
|
||||
};
|
||||
}, [getBannerList]);
|
||||
return (
|
||||
<div className={PREFIX}>
|
||||
<div className={`${PREFIX}__banner`}>
|
||||
邀请朋友加入播络,高达<span className={`${PREFIX}__highlight`}>75%</span>分成
|
||||
<Image
|
||||
src="https://publiccdn.neighbourhood.com.cn/img/partner-intro-bg.png"
|
||||
className={`${PREFIX}__bg`}
|
||||
mode="aspectFill"
|
||||
/>
|
||||
<div className={`${PREFIX}__slogan`}>
|
||||
<div>邀请朋友加入播络</div>
|
||||
<div>
|
||||
高达<div className={`${PREFIX}__slogan-highlight`}>75%</div>分成
|
||||
</div>
|
||||
</div>
|
||||
<div className={`${PREFIX}__main`}>
|
||||
<div className={`${PREFIX}__swiper-wrapper`}>
|
||||
<Image
|
||||
className={`${PREFIX}__swiper-bg`}
|
||||
src="https://publiccdn.neighbourhood.com.cn/img/partner-swipe-item.png"
|
||||
mode="aspectFill"
|
||||
/>
|
||||
<Swiper className={`${PREFIX}__swiper`} autoplay={3000} touchable={false}>
|
||||
{bannerList.map((item, index) => (
|
||||
<Swiper.Item className={`${PREFIX}__swiper-item`} key={`${item.userId}-${index}`}>
|
||||
<div className={`${PREFIX}__swiper-item-time`}>{formatTimestamp(item.updatedAt)}</div>
|
||||
<div className={`${PREFIX}__swiper-item-details`}>
|
||||
<div className={`${PREFIX}__swiper-item-id`}>{formatUserId(item.userId)}</div>
|
||||
<div className={`${PREFIX}__swiper-item-info`}>
|
||||
{[EarnType.CHAT_ACTIVITY_SHARE_L1, EarnType.CHAT_ACTIVITY_SHARE_L2].includes(item.earnType)
|
||||
? '主播被开聊'
|
||||
: '会员支付'}
|
||||
<div className="money">+{formatMoney(item.amount, 1)}</div>
|
||||
</div>
|
||||
<div className={`${PREFIX}__swiper-item-info`}>
|
||||
累计<div className="money">{formatMoney(item.total, 1)}</div>
|
||||
</div>
|
||||
</div>
|
||||
</Swiper.Item>
|
||||
))}
|
||||
</Swiper>
|
||||
</div>
|
||||
|
||||
<div className={`${PREFIX}__block`}>
|
||||
<div className={`${PREFIX}__title`}>
|
||||
群主认证
|
||||
<div className={`${PREFIX}__recommend`}>
|
||||
<GoodJob />
|
||||
强烈推荐
|
||||
</div>
|
||||
</div>
|
||||
<div className={`${PREFIX}__card ${PREFIX}__special`}>
|
||||
<div className={`${PREFIX}__body`}>
|
||||
<div className="center">
|
||||
完成群主认证后,群成员通过该群访问任何人分享的播络小程序进行注册,你都能获得分成
|
||||
</div>
|
||||
</div>
|
||||
<Button className={`${PREFIX}__service`} onClick={handleConfirm}>
|
||||
立即认证
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<div className={`${PREFIX}__block`}>
|
||||
<div className={`${PREFIX}__title`}>3重收益</div>
|
||||
<div className={`${PREFIX}__card`}>
|
||||
<div className={`${PREFIX}__h1`}>收益一</div>
|
||||
<div className={`${PREFIX}__h1`}>直接分成:</div>
|
||||
<div className={`${PREFIX}__body`}>
|
||||
直接获得被邀请人付款金额的<span className={`${PREFIX}__highlight`}>20%</span>
|
||||
</div>
|
||||
<div className={`${PREFIX}__h1`}>收益二</div>
|
||||
<div className={`${PREFIX}__h1`}>主播分成:</div>
|
||||
<div className={`${PREFIX}__body`}>
|
||||
邀请的主播创建模卡,被企业开聊,每日可获得收益,分成比例高达
|
||||
<span className={`${PREFIX}__highlight`}>50%</span>
|
||||
</div>
|
||||
<div className={`${PREFIX}__h1`}>收益三</div>
|
||||
<div className={`${PREFIX}__h1`}>邀请合伙人:</div>
|
||||
<div className={`${PREFIX}__body`}>
|
||||
邀请朋友加入合伙人,可额外获得所邀合伙人收益的<span className={`${PREFIX}__highlight`}>5%</span>
|
||||
你邀请的人也加入合伙人,你可获得所邀合伙人收益的<span className={`${PREFIX}__highlight`}>5%</span>
|
||||
</div>
|
||||
</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 className={`${PREFIX}__h1`}>方法一:</div>
|
||||
<div>点击下方“赠送会员给好友”,给群员、好友送会员,每周可以送一次</div>
|
||||
<div className={`${PREFIX}__h1`}>方法二:</div>
|
||||
<div>分享通告列表页、通告详情页等页面至群、好友</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className={`${PREFIX}__block`}>
|
||||
<div className={`${PREFIX}__title`}>合伙人交流群</div>
|
||||
<div className={`${PREFIX}__title`}>交流群</div>
|
||||
<div className={`${PREFIX}__card ${PREFIX}__special`}>
|
||||
<div className={`${PREFIX}__h1`}>加入播络合伙人交流群</div>
|
||||
<div className={`${PREFIX}__body grey`}>学习分享邀请经验,一起赚钱</div>
|
||||
<div className={`${PREFIX}__h1 no-dot`}>加入播络合伙人交流群,分享经验</div>
|
||||
<Button className={`${PREFIX}__service`} onClick={handleOpenService}>
|
||||
点击加入
|
||||
</Button>
|
||||
</div>
|
||||
<div className={`${PREFIX}__tip`}>注:收益不设时限,可重复享有,播络保留活动最终解释权</div>
|
||||
</div>
|
||||
</div>
|
||||
<Canvas id="posterCanvas" canvas-id="posterCanvas" type="2d" style="width: 750px; height: 1334px;" />
|
||||
|
||||
<div className={`${PREFIX}__footer`}>
|
||||
<Button className={`${PREFIX}__download-button`} onClick={savePoster}>
|
||||
朋友圈海报
|
||||
</Button>
|
||||
<Button className={`${PREFIX}__share-button`} openType="share">
|
||||
<Button className={`${PREFIX}__share-button`} onClick={handleJump}>
|
||||
赠送会员给好友
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@ -48,8 +48,8 @@ const LIST: Item[] = [
|
||||
{
|
||||
id: ProductSpecId.BOSS_VIP_NEW_2,
|
||||
title: '推荐一月',
|
||||
price: '480播豆',
|
||||
amt: 48,
|
||||
price: '680播豆',
|
||||
amt: 68,
|
||||
badge: '限时体验',
|
||||
contents: [
|
||||
{ content: '-通告每日优先展示', highlight: true },
|
||||
@ -61,8 +61,8 @@ const LIST: Item[] = [
|
||||
{
|
||||
id: ProductSpecId.BOSS_VIP_NEW_3,
|
||||
title: '推荐一季',
|
||||
price: '960播豆',
|
||||
amt: 96,
|
||||
price: '1360播豆',
|
||||
amt: 136,
|
||||
badge: '6.7折',
|
||||
contents: [
|
||||
{ content: '-通告每日优先展示', highlight: true },
|
||||
|
||||
@ -2,9 +2,10 @@ import { BaseEventOrig, InputProps, ScrollView } from '@tarojs/components';
|
||||
import Taro from '@tarojs/taro';
|
||||
|
||||
import { Search } from '@taroify/core';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import { Fragment, useCallback, useEffect, useState } from 'react';
|
||||
|
||||
import { CITY_CODE_TO_NAME_MAP, CITY_INDEXES_LIST, GROUP_CITY_INDEXES_LIST } from '@/constants/city';
|
||||
import { CITY_CODE_TO_NAME_MAP, CITY_INDEXES_LIST } from '@/constants/city';
|
||||
import useCityOperators from '@/hooks/use-city-operators';
|
||||
import { logWithPrefix } from '@/utils/common';
|
||||
|
||||
import './index.less';
|
||||
@ -68,8 +69,19 @@ export default function SearchCity({
|
||||
const [touchAnchor, setTouchAnchor] = useState<string | undefined>();
|
||||
const [touchMoving, setTouchMoving] = useState(false);
|
||||
const [searchResult, setSearchResult] = useState<Item[]>([]);
|
||||
const cityOperators = useCityOperators();
|
||||
const groupCityCodes = cityOperators.map(it => (it.groupLink ? it.cityCode : null)).filter(Boolean);
|
||||
const showSearchList = searchResult.length > 0;
|
||||
const CITY_LIST = forGroup ? GROUP_CITY_INDEXES_LIST : CITY_INDEXES_LIST;
|
||||
const CITY_LIST = forGroup
|
||||
? CITY_INDEXES_LIST.map(({ letter, data }) => {
|
||||
return {
|
||||
letter,
|
||||
data: data.filter(it => groupCityCodes.includes(it.cityCode)),
|
||||
};
|
||||
}).filter(item => item.data.length > 0)
|
||||
: CITY_INDEXES_LIST;
|
||||
|
||||
const HOT_CITY_LIST = forGroup ? HOT_CITY.filter(it => groupCityCodes.includes(`${it.cityCode}`)) : HOT_CITY;
|
||||
|
||||
const handleSearchChange = useCallback((event: BaseEventOrig<InputProps.inputEventDetail>) => {
|
||||
const value = event.detail.value;
|
||||
@ -173,19 +185,25 @@ export default function SearchCity({
|
||||
<div>
|
||||
<div className={`${PREFIX}__position-title`}>当前城市</div>
|
||||
<div className={`${PREFIX}__position-city`}>{CITY_CODE_TO_NAME_MAP.get(currentCity)}</div>
|
||||
<div className={`${PREFIX}__hot-city-title`}>热门城市</div>
|
||||
<div className={`${PREFIX}__hot-city-container`}>
|
||||
{HOT_CITY.map(city => (
|
||||
<div
|
||||
key={city.cityCode}
|
||||
className={`${PREFIX}__hot-city-item`}
|
||||
data-code={city.cityCode}
|
||||
onClick={handleSelectCity}
|
||||
>
|
||||
{city.cityName}
|
||||
{!!HOT_CITY_LIST.length && (
|
||||
<Fragment>
|
||||
<div className={`${PREFIX}__hot-city-title`}>热门城市</div>
|
||||
<div className={`${PREFIX}__hot-city-container`}>
|
||||
{HOT_CITY_LIST.map(city => {
|
||||
return (
|
||||
<div
|
||||
key={city.cityCode}
|
||||
className={`${PREFIX}__hot-city-item`}
|
||||
data-code={city.cityCode}
|
||||
onClick={handleSelectCity}
|
||||
>
|
||||
{city.cityName}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</Fragment>
|
||||
)}
|
||||
<div className={`${PREFIX}__indexes-list`}>
|
||||
{CITY_LIST.map(item => {
|
||||
return (
|
||||
|
||||
@ -35,6 +35,7 @@ export enum OpenSource {
|
||||
UserPage = 'user_page',
|
||||
AnchorPage = 'anchor_page',
|
||||
MaterialViewPage = 'material_view_page',
|
||||
GroupOwnerCertificate = 'group_owner_certificate',
|
||||
}
|
||||
|
||||
export enum PageUrl {
|
||||
@ -77,6 +78,8 @@ export enum PageUrl {
|
||||
WithdrawRecord = 'pages/withdraw-record/index',
|
||||
GroupDelegatePublish = 'pages/group-delegate-publish/index',
|
||||
GiveVip = 'pages/give-vip/index',
|
||||
GroupOwnerCertificate = 'pages/group-owner-certification/index',
|
||||
PartnerShareVip = 'pages/partner-share-vip/index',
|
||||
}
|
||||
|
||||
export enum PluginUrl {
|
||||
|
||||
@ -75,7 +75,7 @@ export const EMPLOY_TYPE_TITLE_MAP = {
|
||||
|
||||
export const JOB_SOURCE_TYPE_TITLE_MAP = {
|
||||
[JobSourceType.All]: '全部',
|
||||
[JobSourceType.BL]: '认证通告',
|
||||
[JobSourceType.BL]: '急招',
|
||||
[JobSourceType.VX]: '群通告',
|
||||
};
|
||||
|
||||
@ -122,10 +122,10 @@ export const JOB_PAGE_TABS = [
|
||||
type: JobSourceType.BL,
|
||||
title: JOB_SOURCE_TYPE_TITLE_MAP[JobSourceType.BL],
|
||||
},
|
||||
{
|
||||
type: JobSourceType.VX,
|
||||
title: JOB_SOURCE_TYPE_TITLE_MAP[JobSourceType.VX],
|
||||
},
|
||||
// {
|
||||
// type: JobSourceType.VX,
|
||||
// title: JOB_SOURCE_TYPE_TITLE_MAP[JobSourceType.VX],
|
||||
// },
|
||||
];
|
||||
|
||||
export const JOB_EMPLOY_TYPE_OPTIONS = [
|
||||
|
||||
@ -13,6 +13,21 @@
|
||||
.taroify-cell__value {
|
||||
color: @blColor;
|
||||
}
|
||||
|
||||
&-icon {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 50%;
|
||||
background: rgba(255, 80, 81, 0.16);
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-right: 16px;
|
||||
> image {
|
||||
width: 18px;
|
||||
height: 24px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&__go-publish-cell {
|
||||
@ -24,4 +39,6 @@
|
||||
color: @blHighlightColor;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import { Image } from '@tarojs/components';
|
||||
|
||||
import { Cell } from '@taroify/core';
|
||||
import classNames from 'classnames';
|
||||
import { useCallback } from 'react';
|
||||
@ -27,7 +29,14 @@ export default function CompanyFragment() {
|
||||
<Cell
|
||||
isLink
|
||||
align="center"
|
||||
title="发通告,让主播主动报单"
|
||||
title={
|
||||
<div>
|
||||
<div className={`${PREFIX}__cell-icon`}>
|
||||
<Image src="https://publiccdn.neighbourhood.com.cn/img/lightning.svg" />
|
||||
</div>
|
||||
发布急招通告,优先展示
|
||||
</div>
|
||||
}
|
||||
className={classNames(`${PREFIX}__cell`, `${PREFIX}__go-publish-cell`)}
|
||||
onClick={handlePublishJob}
|
||||
>
|
||||
|
||||
10
src/hooks/use-city-operators.tsx
Normal file
10
src/hooks/use-city-operators.tsx
Normal file
@ -0,0 +1,10 @@
|
||||
import { useSelector } from 'react-redux';
|
||||
|
||||
import { selectCityOperators } from '@/store/selector';
|
||||
|
||||
function useCityOperators() {
|
||||
const data = useSelector(selectCityOperators);
|
||||
return data || [];
|
||||
}
|
||||
|
||||
export default useCityOperators;
|
||||
@ -99,6 +99,8 @@ export const APP_CONFIG: AppConfigType = {
|
||||
PageUrl.WithdrawRecord,
|
||||
PageUrl.GroupDelegatePublish,
|
||||
PageUrl.GiveVip,
|
||||
PageUrl.GroupOwnerCertificate,
|
||||
PageUrl.PartnerShareVip,
|
||||
// PageUrl.DevDebug,
|
||||
],
|
||||
window: {
|
||||
|
||||
@ -88,4 +88,12 @@ export enum API {
|
||||
GENERATE_MEMBERSHIP_COUPON = '/coupon/membership/generate',
|
||||
CLAIM_MEMBERSHIP_COUPON = '/coupon/membership/claim',
|
||||
GET_VIP_QRCODE = '/user/getVipQrCode',
|
||||
// 群认证
|
||||
GENERATE_GROUP_AUTH_CODE = '/partner/generateGroupAuthCode',
|
||||
DECRYPT_OPEN_GID = '/partner/decryptOpenGid',
|
||||
GET_USER_PROFIT_LIST = '/partner/getLatestUserProfitList',
|
||||
GET_AUTHED_GROUP_LIST = '/partner/getAuthedGroupList',
|
||||
GET_STAFF_CODE = '/partner/staff/{cityCode}',
|
||||
// 所有城市运营
|
||||
GET_ALL_CITY_OPERATOR = '/group/getAllGroup',
|
||||
}
|
||||
|
||||
@ -107,7 +107,7 @@ 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);
|
||||
};
|
||||
|
||||
@ -233,6 +233,10 @@ export default function AnchorPage() {
|
||||
}
|
||||
});
|
||||
|
||||
Taro.showShareMenu({
|
||||
withShareTicket: true,
|
||||
});
|
||||
|
||||
useShareAppMessage(() => {
|
||||
return getCommonShareMessage({ inviteCode, title: '数万名优质主播等你来挑', path: PageUrl.Anchor });
|
||||
});
|
||||
@ -287,7 +291,7 @@ export default function AnchorPage() {
|
||||
</div>
|
||||
</div>
|
||||
<div className={`${PREFIX}__banner`}>
|
||||
<PartnerBanner />
|
||||
<PartnerBanner isBoss />
|
||||
</div>
|
||||
<ListWrapper
|
||||
filters={filters}
|
||||
|
||||
4
src/pages/group-owner-certification/index.config.ts
Normal file
4
src/pages/group-owner-certification/index.config.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '群主认证',
|
||||
enableShareAppMessage: true,
|
||||
});
|
||||
129
src/pages/group-owner-certification/index.less
Normal file
129
src/pages/group-owner-certification/index.less
Normal file
@ -0,0 +1,129 @@
|
||||
@import '@/styles/common.less';
|
||||
@import '@/styles/variables.less';
|
||||
|
||||
.group-owner-certification {
|
||||
&__tabs {
|
||||
--tabs-active-color: @blHighlightColor;
|
||||
--tabs-nav-background-color: #fff;
|
||||
--tabs-wrap-height: 98px;
|
||||
|
||||
> .taroify-tabs__wrap {
|
||||
position: fixed;
|
||||
width: 100vw;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
> .taroify-tabs__content {
|
||||
padding-top: var(--tabs-wrap-height);
|
||||
}
|
||||
}
|
||||
|
||||
&__main {
|
||||
padding-left: 24px;
|
||||
padding-right: 24px;
|
||||
padding-top: 48px;
|
||||
padding-bottom: calc(48px + constant(safe-area-inset-bottom));
|
||||
padding-bottom: calc(48px + env(safe-area-inset-bottom));
|
||||
}
|
||||
|
||||
&__block {
|
||||
margin-bottom: 40px;
|
||||
}
|
||||
|
||||
&__card {
|
||||
background: #fff;
|
||||
border-radius: 24px;
|
||||
padding: 24px 32px;
|
||||
margin-bottom: 48px;
|
||||
}
|
||||
|
||||
&__bold {
|
||||
font-weight: 500;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
&__body {
|
||||
font-weight: 400;
|
||||
font-size: 28px;
|
||||
line-height: 40px;
|
||||
color: @blColor;
|
||||
|
||||
.highlight {
|
||||
color: @blHighlightColor;
|
||||
}
|
||||
|
||||
&.center {
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
&__title {
|
||||
margin-bottom: 24px;
|
||||
font-weight: 500;
|
||||
font-size: 32px;
|
||||
line-height: 32px;
|
||||
|
||||
color: #1d2129;
|
||||
}
|
||||
|
||||
&__share {
|
||||
.button(@height: 72px; @width: 384px; @fontSize: 28px; @fontWeight: 400; @borderRadius: 44px; @highlight: 0);
|
||||
margin-top: 32px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
&__lined-wrapper {
|
||||
text-align: center;
|
||||
margin-top: 48px;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
&__lined-title {
|
||||
text-align: center;
|
||||
font-weight: 400;
|
||||
font-size: 28px;
|
||||
line-height: 40px;
|
||||
color: #333333;
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
|
||||
&:before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: -68px;
|
||||
width: 56px;
|
||||
height: 1px;
|
||||
background: #ccc;
|
||||
top: 50%;
|
||||
}
|
||||
|
||||
&:after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
right: -68px;
|
||||
width: 56px;
|
||||
height: 1px;
|
||||
background: #ccc;
|
||||
top: 50%;
|
||||
}
|
||||
}
|
||||
&__city-select {
|
||||
background: #F7F7F7;
|
||||
border-radius: 16px;
|
||||
padding: 34px 32px;
|
||||
font-weight: 400;
|
||||
font-size: 32px;
|
||||
line-height: 32px;
|
||||
color: #333333;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
&__qrcode {
|
||||
width: 280px;
|
||||
height: 280px;
|
||||
background: #6F7686;
|
||||
display: block;
|
||||
margin: auto auto 24px;
|
||||
}
|
||||
}
|
||||
130
src/pages/group-owner-certification/index.tsx
Normal file
130
src/pages/group-owner-certification/index.tsx
Normal file
@ -0,0 +1,130 @@
|
||||
import { Button, Image } from '@tarojs/components';
|
||||
import Taro, { useShareAppMessage } from '@tarojs/taro';
|
||||
|
||||
import { Tabs } from '@taroify/core';
|
||||
import { Arrow } from '@taroify/icons';
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
|
||||
import GroupCertificationList from '@/components/group-certification-list';
|
||||
import { EventName, OpenSource, PageUrl } from '@/constants/app';
|
||||
import { CITY_CODE_TO_NAME_MAP } from '@/constants/city';
|
||||
import useInviteCode from '@/hooks/use-invite-code';
|
||||
import useLocation from '@/hooks/use-location';
|
||||
import { StaffInfo } from '@/types/partner';
|
||||
import { generateGroupAuthCode, getStaffInfo } from '@/utils/partner';
|
||||
import { navigateTo } from '@/utils/route';
|
||||
import { getCommonShareMessage } from '@/utils/share';
|
||||
import './index.less';
|
||||
|
||||
const PREFIX = 'group-owner-certification';
|
||||
|
||||
export default function GroupOwnerCertification() {
|
||||
const location = useLocation();
|
||||
const inviteCode = useInviteCode();
|
||||
const [cityCode, setCityCode] = useState<string>(location.cityCode);
|
||||
const cityValuesChangedRef = useRef(false);
|
||||
Taro.showShareMenu({
|
||||
withShareTicket: true,
|
||||
});
|
||||
useShareAppMessage(async () => {
|
||||
const { authCode } = await generateGroupAuthCode();
|
||||
return getCommonShareMessage({
|
||||
useCapture: false,
|
||||
title: `我在认证群主,宝子帮我点击下 ${authCode}`,
|
||||
inviteCode,
|
||||
params: { authCode },
|
||||
path: PageUrl.Job,
|
||||
imageUrl: 'https://publiccdn.neighbourhood.com.cn/img/share-group-owner-certificate.png',
|
||||
});
|
||||
});
|
||||
|
||||
const handleClickCityMenu = useCallback(() => {
|
||||
navigateTo(PageUrl.CitySearch, { city: cityCode, source: OpenSource.GroupOwnerCertificate });
|
||||
}, [cityCode]);
|
||||
|
||||
const handleCityChange = useCallback(data => {
|
||||
console.log('handleCityChange', data);
|
||||
const { openSource, cityCode: cCode } = data;
|
||||
if (openSource !== OpenSource.GroupOwnerCertificate) {
|
||||
return;
|
||||
}
|
||||
cityValuesChangedRef.current = true;
|
||||
setCityCode(cCode);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (cityValuesChangedRef.current) {
|
||||
return;
|
||||
}
|
||||
setCityCode(location.cityCode);
|
||||
}, [location]);
|
||||
useEffect(() => {
|
||||
Taro.eventCenter.on(EventName.SELECT_CITY, handleCityChange);
|
||||
return () => {
|
||||
Taro.eventCenter.off(EventName.SELECT_CITY, handleCityChange);
|
||||
};
|
||||
}, [handleCityChange]);
|
||||
|
||||
const [staffInfo, setStaffInfo] = useState<StaffInfo | null>(null);
|
||||
useEffect(() => {
|
||||
getStaffInfo(cityCode)
|
||||
.then(data => {
|
||||
setStaffInfo(data);
|
||||
})
|
||||
.catch(() => {
|
||||
setStaffInfo(null);
|
||||
});
|
||||
}, [cityCode]);
|
||||
|
||||
return (
|
||||
<div className={PREFIX}>
|
||||
<Tabs className={`${PREFIX}__tabs`}>
|
||||
<Tabs.TabPane value={0} title="认证方法">
|
||||
<div className={`${PREFIX}__main`}>
|
||||
<div className={`${PREFIX}__block`}>
|
||||
<div className={`${PREFIX}__title`}>第一步:拉运营入群</div>
|
||||
<div className={`${PREFIX}__card`}>
|
||||
<div className={`${PREFIX}__body`}>
|
||||
<div>拉播络城市运营进入你的带货主播群,</div>
|
||||
<div>请确认你是群主且是带货主播群,不然不要拉</div>
|
||||
</div>
|
||||
<div className={`${PREFIX}__lined-wrapper`}>
|
||||
<div className={`${PREFIX}__lined-title`}>选择城市,添加运营</div>
|
||||
</div>
|
||||
<div className={`${PREFIX}__city-select`} onClick={handleClickCityMenu}>
|
||||
{CITY_CODE_TO_NAME_MAP.get(cityCode)}
|
||||
<Arrow size={16} />
|
||||
</div>
|
||||
<div className={`${PREFIX}__lined-wrapper`}>
|
||||
<div className={`${PREFIX}__lined-title`}>长按并识别二维码添加运营</div>
|
||||
</div>
|
||||
{staffInfo && (
|
||||
<Image
|
||||
className={`${PREFIX}__qrcode`}
|
||||
src={staffInfo.staffQrCode}
|
||||
showMenuByLongpress
|
||||
mode="aspectFill"
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<div className={`${PREFIX}__title`}>第二步</div>
|
||||
<div className={`${PREFIX}__card`}>
|
||||
<div className={`${PREFIX}__h1 ${PREFIX}__bold`}>点击以下按钮分享小程序到群,并在群里打开小程序</div>
|
||||
<div className={`${PREFIX}__body`}>
|
||||
<div className="highlight">1次分享只能认证一个群,有多个群请分享多次,不可在微信聊天里直接转发;</div>
|
||||
<div>一般1天内完成,超时未完成认证请重新分享或者咨询运营</div>
|
||||
</div>
|
||||
<Button className={`${PREFIX}__share`} openType="share">
|
||||
分享小程序
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Tabs.TabPane>
|
||||
<Tabs.TabPane value={1} title="已认证的群">
|
||||
<GroupCertificationList />
|
||||
</Tabs.TabPane>
|
||||
</Tabs>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@ -5,7 +5,7 @@ import { useCallback } from 'react';
|
||||
import HomePage from '@/components/home-page';
|
||||
import SearchCity from '@/components/search-city';
|
||||
import { PageType, PageUrl, RoleType } from '@/constants/app';
|
||||
import { GROUPS } from '@/constants/group';
|
||||
import useCityOperators from '@/hooks/use-city-operators';
|
||||
import useInviteCode from '@/hooks/use-invite-code';
|
||||
import { switchRoleType } from '@/utils/app';
|
||||
import { openCustomerServiceChat } from '@/utils/common';
|
||||
@ -20,6 +20,7 @@ const PREFIX = 'group-v2-page';
|
||||
|
||||
export default function GroupV2() {
|
||||
const inviteCode = useInviteCode();
|
||||
const cityOperators = useCityOperators();
|
||||
|
||||
useLoad(() => {
|
||||
switchRoleType(RoleType.Anchor);
|
||||
@ -32,15 +33,18 @@ export default function GroupV2() {
|
||||
getCommonShareMessage({ inviteCode, title: '邀请你加入本地主播求职招聘群', path: PageUrl.GroupV2 })
|
||||
);
|
||||
|
||||
const handleSelectCity = useCallback(cityCode => {
|
||||
if (!checkCityCode(cityCode)) {
|
||||
return;
|
||||
}
|
||||
const group = GROUPS.find(g => String(g.cityCode) === cityCode);
|
||||
if (group) {
|
||||
openCustomerServiceChat(group.serviceUrl);
|
||||
}
|
||||
}, []);
|
||||
const handleSelectCity = useCallback(
|
||||
cityCode => {
|
||||
if (!checkCityCode(cityCode)) {
|
||||
return;
|
||||
}
|
||||
const group = cityOperators.find(g => String(g.cityCode) === cityCode);
|
||||
if (group) {
|
||||
openCustomerServiceChat(group.groupLink);
|
||||
}
|
||||
},
|
||||
[cityOperators]
|
||||
);
|
||||
|
||||
return (
|
||||
<HomePage type={PageType.GroupV2}>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { useShareAppMessage } from '@tarojs/taro';
|
||||
import Taro, { useShareAppMessage } from '@tarojs/taro';
|
||||
|
||||
import { Tabs } from '@taroify/core';
|
||||
import { useCallback, useState } from 'react';
|
||||
@ -20,6 +20,10 @@ export default function Group() {
|
||||
|
||||
const handleTypeChange = useCallback(value => setTabType(value), []);
|
||||
|
||||
Taro.showShareMenu({
|
||||
withShareTicket: true,
|
||||
});
|
||||
|
||||
useShareAppMessage(() => getCommonShareMessage());
|
||||
|
||||
return (
|
||||
|
||||
@ -297,7 +297,9 @@ export default function JobDetail() {
|
||||
Toast.error('出错了,请重试');
|
||||
}
|
||||
});
|
||||
|
||||
Taro.showShareMenu({
|
||||
withShareTicket: true,
|
||||
});
|
||||
useShareAppMessage(() => {
|
||||
if (!data) {
|
||||
return getCommonShareMessage({ inviteCode });
|
||||
|
||||
@ -23,5 +23,24 @@
|
||||
background-color: @blTabLineColor;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.taroify-dialog.taroify-popup {
|
||||
position: absolute;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&__tab-icon {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 50%;
|
||||
background: rgba(255, 80, 81, 0.16);
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-right: 8px;
|
||||
> image {
|
||||
width: 14.4px;
|
||||
height: 19.2px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import { Image } from '@tarojs/components';
|
||||
import Taro, { useDidShow, useLoad, useShareAppMessage } from '@tarojs/taro';
|
||||
|
||||
import { Tabs } from '@taroify/core';
|
||||
@ -132,6 +133,10 @@ export default function Job() {
|
||||
|
||||
useDidShow(() => requestUnreadMessageCount());
|
||||
|
||||
Taro.showShareMenu({
|
||||
withShareTicket: true,
|
||||
});
|
||||
|
||||
useShareAppMessage(() => {
|
||||
if (sortType === SortType.CREATE_TIME) {
|
||||
return {
|
||||
@ -152,7 +157,20 @@ export default function Job() {
|
||||
style={{ height: barHeight.current, paddingTop: statusBarHeight.current }}
|
||||
>
|
||||
{JOB_PAGE_TABS.map(tab => (
|
||||
<Tabs.TabPane value={tab.type} title={tab.title} key={tab.type}>
|
||||
<Tabs.TabPane
|
||||
value={tab.type}
|
||||
title={
|
||||
<>
|
||||
{tab.type === JobSourceType.BL ? (
|
||||
<div className={`${PREFIX}__tab-icon`}>
|
||||
<Image src="https://publiccdn.neighbourhood.com.cn/img/lightning.svg" />
|
||||
</div>
|
||||
) : null}
|
||||
{tab.title}
|
||||
</>
|
||||
}
|
||||
key={tab.type}
|
||||
>
|
||||
<JobFragment
|
||||
cityCode={cityCode}
|
||||
sortType={sortType}
|
||||
|
||||
@ -6,7 +6,7 @@ import { useCallback, useEffect, useState } from 'react';
|
||||
import MaterialManagePopup from '@/components/material-manage-popup';
|
||||
import PageLoading from '@/components/page-loading';
|
||||
import SafeBottomPadding from '@/components/safe-bottom-padding';
|
||||
import { EventName, RoleType } from '@/constants/app';
|
||||
import { EventName } from '@/constants/app';
|
||||
import { CollectEventName } from '@/constants/event';
|
||||
import { MaterialStatus } from '@/constants/material';
|
||||
import ProfileViewFragment from '@/fragments/profile/view';
|
||||
@ -15,9 +15,7 @@ import { collectEvent } from '@/utils/event';
|
||||
import { getMaterialShareMessage, requestProfileDetail, updateProfileStatus } from '@/utils/material';
|
||||
import { getCommonShareMessage } from '@/utils/share';
|
||||
import Toast from '@/utils/toast';
|
||||
|
||||
import './index.less';
|
||||
import { switchRoleType } from '@/utils/app';
|
||||
|
||||
const PREFIX = 'page-material-profile';
|
||||
|
||||
|
||||
@ -199,6 +199,10 @@ export default function MaterialViewPage() {
|
||||
}
|
||||
});
|
||||
|
||||
Taro.showShareMenu({
|
||||
withShareTicket: true,
|
||||
});
|
||||
|
||||
useShareAppMessage(async () => {
|
||||
const shareMessage = await getMaterialShareMessage(profile, true, inviteCode, jobId);
|
||||
return shareMessage as BL.Anything;
|
||||
|
||||
3
src/pages/partner-share-vip/index.config.ts
Normal file
3
src/pages/partner-share-vip/index.config.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export default definePageConfig({
|
||||
navigationBarTitleText: '赠送会员',
|
||||
});
|
||||
182
src/pages/partner-share-vip/index.less
Normal file
182
src/pages/partner-share-vip/index.less
Normal file
@ -0,0 +1,182 @@
|
||||
@import '@/styles/variables.less';
|
||||
@import '@/styles/common.less';
|
||||
|
||||
.share-vip {
|
||||
background: #eae5fb;
|
||||
padding-top: 200px;
|
||||
position: relative;
|
||||
padding-bottom: calc(142px + constant(safe-area-inset-bottom));
|
||||
padding-bottom: calc(142px + env(safe-area-inset-bottom));
|
||||
|
||||
&__bg {
|
||||
width: 100%;
|
||||
height: 705px;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
&__slogan {
|
||||
top: 66px;
|
||||
left: 44px;
|
||||
position: absolute;
|
||||
font-family: 'Alimama ShuHeiTi';
|
||||
font-style: normal;
|
||||
font-weight: 700;
|
||||
font-size: 44px;
|
||||
line-height: 62px;
|
||||
color: #333333;
|
||||
|
||||
> div {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
&-highlight {
|
||||
display: inline-block;
|
||||
padding-left: 12px;
|
||||
padding-right: 9px;
|
||||
font-size: 64px;
|
||||
line-height: 62px;
|
||||
background: linear-gradient(87.53deg, #683DE3 0.4%, #39227D 84.55%);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-clip: text;
|
||||
text-fill-color: transparent;
|
||||
}
|
||||
}
|
||||
|
||||
&__main {
|
||||
padding-left: 24px;
|
||||
padding-right: 24px;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
&__highlight {
|
||||
color: @blHighlightColor;
|
||||
font-family: 'DIN Alternate';
|
||||
padding: 0 8px;
|
||||
font-weight: 700;
|
||||
display: inline-block;
|
||||
font-size: 40px;
|
||||
}
|
||||
|
||||
&__block {
|
||||
margin-bottom: 12px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
&__card {
|
||||
background: #fff;
|
||||
border-radius: 24px;
|
||||
padding: 68px 32px 44px;
|
||||
}
|
||||
|
||||
&__h1 {
|
||||
font-weight: 500;
|
||||
font-size: 32px;
|
||||
line-height: 40px;
|
||||
color: #1d2129;
|
||||
margin-bottom: 16px;
|
||||
margin-top: 32px;
|
||||
position: relative;
|
||||
z-index: 0;
|
||||
|
||||
&:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
&:after {
|
||||
content: '';
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
background: #ffd236;
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
left: -6px;
|
||||
top: -3px;
|
||||
z-index: -1;
|
||||
}
|
||||
}
|
||||
|
||||
&__body {
|
||||
font-weight: 400;
|
||||
font-size: 28px;
|
||||
line-height: 40px;
|
||||
color: @blColor;
|
||||
|
||||
&.grey {
|
||||
color: @blColorG2;
|
||||
}
|
||||
|
||||
&.center {
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
&__title {
|
||||
margin-left: 48px;
|
||||
margin-right: 48px;
|
||||
font-weight: 500;
|
||||
font-size: 32px;
|
||||
line-height: 80px;
|
||||
height: 80px;
|
||||
transform: translateY(50%);
|
||||
background: #ffd236;
|
||||
box-shadow: 0px 12px 0px #ffa35d;
|
||||
border-radius: 60px;
|
||||
color: #1d2129;
|
||||
text-align: center;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
&__service {
|
||||
.button(@height: 72px; @width: 384px; @fontSize: 28px; @fontWeight: 400; @borderRadius: 44px; @highlight: 0);
|
||||
margin-top: 32px;
|
||||
}
|
||||
|
||||
&__tip {
|
||||
margin-top: 24px;
|
||||
font-size: 24px;
|
||||
line-height: 40px;
|
||||
color: #999999;
|
||||
}
|
||||
|
||||
&__footer {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
z-index: 2;
|
||||
width: 100vw;
|
||||
background: #ffffff;
|
||||
padding: 12px 32px;
|
||||
padding-bottom: calc(constant(safe-area-inset-bottom) + 12px);
|
||||
/* 兼容 iOS < 11.2 */
|
||||
padding-bottom: calc(env(safe-area-inset-bottom) + 12px);
|
||||
/* 兼容 iOS >= 11.2 */
|
||||
box-shadow: 0px -4px 20px 0px #00000014;
|
||||
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
box-sizing: border-box;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
&__download-button {
|
||||
flex: 1 1;
|
||||
.button(@height: 88px; @fontSize: 32px; @fontWeight: 500; @borderRadius: 44px; @highlight: 0);
|
||||
}
|
||||
|
||||
&__share-button {
|
||||
flex: 2 2;
|
||||
width: 406px;
|
||||
.button(@height: 88px; @fontSize: 32px; @fontWeight: 500; @borderRadius: 44px;);
|
||||
margin-left: 32px;
|
||||
}
|
||||
}
|
||||
|
||||
#posterCanvas {
|
||||
position: fixed;
|
||||
bottom: -99999px;
|
||||
left: -99999px;
|
||||
visibility: hidden;
|
||||
}
|
||||
191
src/pages/partner-share-vip/index.tsx
Normal file
191
src/pages/partner-share-vip/index.tsx
Normal file
@ -0,0 +1,191 @@
|
||||
import { Button, Canvas, Image } from '@tarojs/components';
|
||||
import Taro, { useShareAppMessage } from '@tarojs/taro';
|
||||
|
||||
import { PageUrl } from '@/constants/app';
|
||||
import useInviteCode from '@/hooks/use-invite-code';
|
||||
import { generateMembershipCoupon, getCouponQrCode } from '@/utils/coupon';
|
||||
import { getCommonShareMessage } from '@/utils/share';
|
||||
|
||||
import './index.less';
|
||||
|
||||
const PREFIX = 'share-vip';
|
||||
|
||||
export default function PartnerShareVip() {
|
||||
const inviteCode = useInviteCode();
|
||||
|
||||
Taro.showShareMenu({
|
||||
withShareTicket: true,
|
||||
});
|
||||
|
||||
useShareAppMessage(async () => {
|
||||
console.log('Partner inviteCode', inviteCode);
|
||||
const { code } = await generateMembershipCoupon();
|
||||
return getCommonShareMessage({
|
||||
useCapture: false,
|
||||
inviteCode,
|
||||
title: '宝子,送你个播络会员,免费找主播工作',
|
||||
path: PageUrl.GiveVip,
|
||||
params: { d: code },
|
||||
imageUrl: 'https://publiccdn.neighbourhood.com.cn/img/share-coupon1.png',
|
||||
});
|
||||
});
|
||||
|
||||
const getQrcode = async () => {
|
||||
try {
|
||||
const { code } = await generateMembershipCoupon();
|
||||
const data = await getCouponQrCode(code);
|
||||
const base64 = Taro.arrayBufferToBase64(data);
|
||||
return `data:image/png;base64,${base64}`;
|
||||
} catch (error) {
|
||||
console.error('获取二维码失败', error);
|
||||
Taro.showToast({ title: '获取二维码失败', icon: 'none' });
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
const saveCanvasToTempFile = (): Promise<string> => {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
const query = Taro.createSelectorQuery().select('#posterCanvas');
|
||||
query.fields({ node: true }).exec(async res => {
|
||||
const canvas = res[0].node;
|
||||
const tempFilePath = await Taro.canvasToTempFilePath({
|
||||
canvas,
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 1500, // 实际绘制宽度
|
||||
height: 2668, // 实际绘制高度
|
||||
destWidth: 750, // 目标显示宽度
|
||||
destHeight: 1334, // 目标显示高度
|
||||
fileType: 'png',
|
||||
});
|
||||
|
||||
resolve(tempFilePath.tempFilePath);
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('保存 Canvas 到临时文件失败', error);
|
||||
Taro.showToast({ title: '保存 Canvas 失败', icon: 'none' });
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
};
|
||||
const drawCanvas = (qrCode: string): Promise<string> => {
|
||||
const query = Taro.createSelectorQuery().select('#posterCanvas');
|
||||
return new Promise(resolve => {
|
||||
query.fields({ node: true, size: true }).exec(async res => {
|
||||
const canvas = res[0].node;
|
||||
const ctx = canvas.getContext('2d');
|
||||
|
||||
canvas.width = 550 * 2;
|
||||
canvas.height = 918 * 2;
|
||||
ctx.scale(2, 2);
|
||||
|
||||
// 绘制背景图片
|
||||
const bgImage = canvas.createImage();
|
||||
const poster = 'https://publiccdn.neighbourhood.com.cn/img/share-coupon-poster2.png';
|
||||
bgImage.src = poster;
|
||||
bgImage.onload = () => {
|
||||
ctx.drawImage(bgImage, 0, 0, 550, 918);
|
||||
|
||||
const qrCodeImage = canvas.createImage();
|
||||
qrCodeImage.src = qrCode; // 假设 getQrcode() 返回的是二维码图片的路径
|
||||
qrCodeImage.onload = () => {
|
||||
ctx.drawImage(qrCodeImage, 196, 600, 180, 160); // 绘制二维码,位置和大小
|
||||
saveCanvasToTempFile().then(tempPath => {
|
||||
resolve(tempPath);
|
||||
});
|
||||
};
|
||||
};
|
||||
bgImage.onerror = err => {
|
||||
console.error(err);
|
||||
};
|
||||
});
|
||||
});
|
||||
};
|
||||
const savePoster = async () => {
|
||||
Taro.showLoading({ title: '正在生成海报' });
|
||||
const qrCode = await getQrcode();
|
||||
const filePath = await drawCanvas(qrCode);
|
||||
Taro.hideLoading();
|
||||
|
||||
const res = await Taro.getSetting();
|
||||
const hasPermission = res.authSetting['scope.writePhotosAlbum'];
|
||||
if (hasPermission === false) {
|
||||
Taro.showModal({
|
||||
title: '提示',
|
||||
content: '需要访问相册权限才能保存图片,请前往设置开启权限',
|
||||
showCancel: false,
|
||||
success() {
|
||||
Taro.openSetting();
|
||||
},
|
||||
});
|
||||
} else {
|
||||
try {
|
||||
await Taro.authorize({ scope: 'scope.writePhotosAlbum' });
|
||||
await Taro.saveImageToPhotosAlbum({ filePath });
|
||||
Taro.showToast({ title: '保存成功', icon: 'success' });
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
Taro.showToast({ title: '保存失败', icon: 'none' });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={PREFIX}>
|
||||
<Image
|
||||
src="https://publiccdn.neighbourhood.com.cn/img/partner-share-vip-bg.png"
|
||||
className={`${PREFIX}__bg`}
|
||||
mode="aspectFill"
|
||||
/>
|
||||
<div className={`${PREFIX}__slogan`}>
|
||||
<div>
|
||||
会员可每日<div className={`${PREFIX}__slogan-highlight`}>免费查看</div>
|
||||
</div>
|
||||
<div>通告联系方式</div>
|
||||
</div>
|
||||
<div className={`${PREFIX}__main`}>
|
||||
<div className={`${PREFIX}__block`}>
|
||||
<div className={`${PREFIX}__title`}>赠送会员</div>
|
||||
<div className={`${PREFIX}__card`}>
|
||||
<div className={`${PREFIX}__h1`}>方法一:</div>
|
||||
<div className={`${PREFIX}__body`}>点击下方"立即赠送"即可分享赠送卡片,对方点击卡片即可领取</div>
|
||||
<div className={`${PREFIX}__h1`}>方法二:</div>
|
||||
<div className={`${PREFIX}__body`}>点击"朋友圈海报"获得图片,分享到朋友圈,对方扫码即可领取</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className={`${PREFIX}__block`}>
|
||||
<div className={`${PREFIX}__title`}>赠送规则</div>
|
||||
<div className={`${PREFIX}__card`}>
|
||||
<div className={`${PREFIX}__body`}>
|
||||
<div className={`${PREFIX}__h1`}>规则一:</div>
|
||||
<div>每次分享的赠送链接或者图片在7天内有效</div>
|
||||
<div className={`${PREFIX}__h1`}>规则二:</div>
|
||||
<div>每个用户一周最多只能领取一次会员</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className={`${PREFIX}__block`}>
|
||||
<div className={`${PREFIX}__title`}>分享建议</div>
|
||||
<div className={`${PREFIX}__card`}>
|
||||
<div className={`${PREFIX}__body`}>
|
||||
<div className={`${PREFIX}__h1`}>建议一:</div>
|
||||
<div>每周在朋友圈或者群中分享一次,效果最佳 可以写明:新会员来啦</div>
|
||||
<div className={`${PREFIX}__h1`}>建议二:</div>
|
||||
<div>分享得越多,邀请的人会越多,也会更活跃,更容易获得分成</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<Canvas id="posterCanvas" canvas-id="posterCanvas" type="2d" style="width: 750px; height: 1334px;" />
|
||||
|
||||
<div className={`${PREFIX}__footer`}>
|
||||
<Button className={`${PREFIX}__download-button`} onClick={savePoster}>
|
||||
朋友圈海报
|
||||
</Button>
|
||||
<Button className={`${PREFIX}__share-button`} openType="share">
|
||||
立即赠送
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
import { useShareAppMessage } from '@tarojs/taro';
|
||||
import Taro, { useShareAppMessage } from '@tarojs/taro';
|
||||
|
||||
import { Tabs } from '@taroify/core';
|
||||
import { useState } from 'react';
|
||||
@ -8,7 +8,6 @@ import PartnerInviteList from '@/components/partner-invite-list';
|
||||
import PartnerProfit from '@/components/partner-profit';
|
||||
import { PageUrl } from '@/constants/app';
|
||||
import useInviteCode from '@/hooks/use-invite-code';
|
||||
import { generateMembershipCoupon } from '@/utils/coupon';
|
||||
import { getCommonShareMessage } from '@/utils/share';
|
||||
import './index.less';
|
||||
|
||||
@ -20,16 +19,28 @@ export default function Partner() {
|
||||
const handleChange = v => {
|
||||
setTab(v);
|
||||
};
|
||||
|
||||
Taro.showShareMenu({
|
||||
withShareTicket: true,
|
||||
});
|
||||
|
||||
useShareAppMessage(async () => {
|
||||
console.log('Partner inviteCode', inviteCode);
|
||||
const { code } = await generateMembershipCoupon();
|
||||
// const { code } = await generateMembershipCoupon();
|
||||
// return getCommonShareMessage({
|
||||
// useCapture: false,
|
||||
// inviteCode,
|
||||
// title: '宝子,送你个播络会员,免费找主播工作',
|
||||
// path: PageUrl.GiveVip,
|
||||
// params: { d: code },
|
||||
// imageUrl: 'https://publiccdn.neighbourhood.com.cn/img/share-coupon1.png',
|
||||
// });
|
||||
return getCommonShareMessage({
|
||||
useCapture: false,
|
||||
inviteCode,
|
||||
title: '宝子,送你个播络会员,免费找主播工作',
|
||||
path: PageUrl.GiveVip,
|
||||
params: { d: code },
|
||||
imageUrl: 'https://publiccdn.neighbourhood.com.cn/img/share-coupon1.png',
|
||||
title: '播络专业主播招聘平台招募合伙人',
|
||||
path: PageUrl.Partner,
|
||||
imageUrl: 'https://publiccdn.neighbourhood.com.cn/img/share-partner.png',
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ import { useCallback, useState } from 'react';
|
||||
import HomePage from '@/components/home-page';
|
||||
import SearchCity from '@/components/search-city';
|
||||
import { PageType, PageUrl, RoleType } from '@/constants/app';
|
||||
import { GROUPS } from '@/constants/group';
|
||||
import useCityOperators from '@/hooks/use-city-operators';
|
||||
import useInviteCode from '@/hooks/use-invite-code';
|
||||
import { switchRoleType } from '@/utils/app';
|
||||
import { openCustomerServiceChat } from '@/utils/common';
|
||||
@ -23,6 +23,7 @@ const EXAMPLE_IMAGE = 'https://publiccdn.neighbourhood.com.cn/img/delegate-examp
|
||||
const COMMENT_IMAGE = 'https://publiccdn.neighbourhood.com.cn/img/delegate-comments.png';
|
||||
export default function BizService() {
|
||||
const inviteCode = useInviteCode();
|
||||
const cityOperators = useCityOperators();
|
||||
const [value, setValue] = useState('0');
|
||||
|
||||
const handleClickDelegate = useCallback(() => {
|
||||
@ -37,15 +38,18 @@ export default function BizService() {
|
||||
const handleOpenService = useCallback(() => {
|
||||
openCustomerServiceChat('https://work.weixin.qq.com/kfid/kfcd60708731367168d');
|
||||
}, []);
|
||||
const handleSelectCity = useCallback(cityCode => {
|
||||
if (!checkCityCode(cityCode)) {
|
||||
return;
|
||||
}
|
||||
const group = GROUPS.find(g => String(g.cityCode) === cityCode);
|
||||
if (group) {
|
||||
openCustomerServiceChat(group.serviceUrl);
|
||||
}
|
||||
}, []);
|
||||
const handleSelectCity = useCallback(
|
||||
cityCode => {
|
||||
if (!checkCityCode(cityCode)) {
|
||||
return;
|
||||
}
|
||||
const group = cityOperators.find(g => String(g.cityCode) === cityCode);
|
||||
if (group) {
|
||||
openCustomerServiceChat(group.groupLink);
|
||||
}
|
||||
},
|
||||
[cityOperators]
|
||||
);
|
||||
const handleChange = useCallback(v => {
|
||||
setValue(v);
|
||||
}, []);
|
||||
@ -59,6 +63,10 @@ export default function BizService() {
|
||||
}
|
||||
});
|
||||
|
||||
Taro.showShareMenu({
|
||||
withShareTicket: true,
|
||||
});
|
||||
|
||||
useShareAppMessage(() =>
|
||||
getCommonShareMessage({
|
||||
inviteCode,
|
||||
|
||||
@ -69,19 +69,23 @@
|
||||
}
|
||||
|
||||
&__header__contact {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
border-radius: 50%;
|
||||
background: #0000004D;
|
||||
width: 76px;
|
||||
height: 81px;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: transparent;
|
||||
border: none;
|
||||
|
||||
&:after {
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
|
||||
&__header__contact-icon {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
width: 76px;
|
||||
height: 81px;
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ export default function User() {
|
||||
<Image
|
||||
mode="aspectFit"
|
||||
className={`${PREFIX}__header__contact-icon`}
|
||||
src={require('@/statics/svg/contact.svg')}
|
||||
src="https://publiccdn.neighbourhood.com.cn/img/kefu.svg"
|
||||
/>
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { useShareAppMessage } from '@tarojs/taro';
|
||||
import Taro, { useShareAppMessage } from '@tarojs/taro';
|
||||
|
||||
import { List, PullRefresh } from '@taroify/core';
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
@ -90,6 +90,11 @@ export default function WithdrawRecords() {
|
||||
};
|
||||
refresh();
|
||||
}, []);
|
||||
|
||||
Taro.showShareMenu({
|
||||
withShareTicket: true,
|
||||
});
|
||||
|
||||
useShareAppMessage(() => {
|
||||
return getCommonShareMessage({ useCapture: false, inviteCode });
|
||||
});
|
||||
|
||||
@ -1,10 +1,13 @@
|
||||
import { RoleType, PageType } from '@/constants/app';
|
||||
import { LocationInfo } from '@/types/location';
|
||||
import { AppState } from '@/types/store';
|
||||
|
||||
import { CHANGE_ROLE_TYPE, CHANGE_HOME_PAGE, SET_LOCATION_INFO } from '../constants';
|
||||
import { CHANGE_ROLE_TYPE, CHANGE_HOME_PAGE, SET_LOCATION_INFO, SET_SERVICE_URLS } from '../constants';
|
||||
|
||||
export const changeRoleType = (value: RoleType) => ({ type: CHANGE_ROLE_TYPE, value });
|
||||
|
||||
export const changeHomePage = (value: PageType) => ({ type: CHANGE_HOME_PAGE, value });
|
||||
|
||||
export const setLocationInfo = (value: LocationInfo) => ({ type: SET_LOCATION_INFO, value });
|
||||
|
||||
export const setCityOperators = (value: AppState['cityOperators']) => ({ type: SET_SERVICE_URLS, value });
|
||||
|
||||
@ -6,3 +6,4 @@ export const SET_BIND_PHONE = 'SET_BIND_PHONE';
|
||||
export const SET_USER_MESSAGE = 'SET_USER_MESSAGE';
|
||||
export const SET_INVITE_CODE = 'SET_INVITE_CODE';
|
||||
export const SET_JOB_ID = 'SET_JOB_ID';
|
||||
export const SET_SERVICE_URLS = 'SET_SERVICE_URLS';
|
||||
|
||||
@ -7,7 +7,7 @@ import { CacheKey } from '@/constants/cache-key';
|
||||
import { LocationInfo } from '@/types/location';
|
||||
import { AppState } from '@/types/store';
|
||||
|
||||
import { CHANGE_ROLE_TYPE, CHANGE_HOME_PAGE, SET_LOCATION_INFO } from '../constants';
|
||||
import { CHANGE_ROLE_TYPE, CHANGE_HOME_PAGE, SET_LOCATION_INFO, SET_SERVICE_URLS } from '../constants';
|
||||
|
||||
const DEFAULT_LOCATION: LocationInfo = {
|
||||
provinceCode: '440000',
|
||||
@ -23,6 +23,7 @@ const INIT_STATE: AppState = {
|
||||
roleType: defaultAppMode,
|
||||
homePageType: defaultAppMode === RoleType.Company ? PageType.Anchor : PageType.JOB,
|
||||
location: Taro.getStorageSync<LocationInfo>(CacheKey.CACHE_LOCATION_INFO) || DEFAULT_LOCATION,
|
||||
cityOperators: [],
|
||||
};
|
||||
|
||||
const appState = (state: AppState = INIT_STATE, action: Action): AppState => {
|
||||
@ -33,6 +34,8 @@ const appState = (state: AppState = INIT_STATE, action: Action): AppState => {
|
||||
return { ...state, roleType: value };
|
||||
case CHANGE_HOME_PAGE:
|
||||
return { ...state, homePageType: value };
|
||||
case SET_SERVICE_URLS:
|
||||
return { ...state, cityOperators: value };
|
||||
case SET_LOCATION_INFO:
|
||||
Taro.setStorageSync(CacheKey.CACHE_LOCATION_INFO, value);
|
||||
return { ...state, location: value };
|
||||
|
||||
@ -5,3 +5,5 @@ export const selectRoleType = (state: IState) => state.appState.roleType;
|
||||
export const selectHomePageType = (state: IState) => state.appState.homePageType;
|
||||
|
||||
export const selectLocation = (state: IState) => state.appState.location;
|
||||
|
||||
export const selectCityOperators = (state: IState) => state.appState.cityOperators || {};
|
||||
|
||||
@ -20,3 +20,14 @@ export interface GetCityCodeRequest {
|
||||
latitude: number; // 纬度,浮点数,范围为-90~90,负数表示南纬
|
||||
longitude: number; // 经度,范围为-180~180,负数表示西经
|
||||
}
|
||||
|
||||
export interface CityOperatorListItem {
|
||||
id: number;
|
||||
staffId: number;
|
||||
staffName: string;
|
||||
cityName: string;
|
||||
cityCode: string;
|
||||
groupLink: string;
|
||||
created: string;
|
||||
updated: string;
|
||||
}
|
||||
|
||||
@ -87,3 +87,41 @@ export interface PartnerPagination<T> {
|
||||
content: T[];
|
||||
totalPages: number;
|
||||
}
|
||||
export enum EarnType {
|
||||
ORDER_PAYMENT_SHARE_L1 = 'ORDER_PAYMENT_SHARE_L1',
|
||||
ORDER_PAYMENT_SHARE_L2 = 'ORDER_PAYMENT_SHARE_L2',
|
||||
CHAT_ACTIVITY_SHARE_L1 = 'CHAT_ACTIVITY_SHARE_L1',
|
||||
CHAT_ACTIVITY_SHARE_L2 = 'CHAT_ACTIVITY_SHARE_L2',
|
||||
OTHER = 'OTHER',
|
||||
}
|
||||
export interface UserProfitListItem {
|
||||
userId: string;
|
||||
total: number;
|
||||
earnType: EarnType;
|
||||
amount: number;
|
||||
updatedAt: string;
|
||||
}
|
||||
export interface GroupAuthCode {
|
||||
shareUserId: string;
|
||||
authCode: string;
|
||||
}
|
||||
export interface AuthedGroupInfo {
|
||||
userId: string;
|
||||
openGid: string;
|
||||
groupId: string;
|
||||
groupName: string;
|
||||
groupAvatar: string;
|
||||
authDate: string;
|
||||
}
|
||||
export interface DecryptOpenGidBody {
|
||||
authCode?: string;
|
||||
inviteCode?: string;
|
||||
encryptedData: string;
|
||||
iv: string;
|
||||
}
|
||||
export interface StaffInfo {
|
||||
id: number;
|
||||
staffName: string;
|
||||
staffQrCode: string;
|
||||
isDefault: 0 | 1;
|
||||
}
|
||||
|
||||
@ -17,4 +17,8 @@ export interface AppState {
|
||||
roleType: RoleType;
|
||||
homePageType: PageType;
|
||||
location: LocationInfo;
|
||||
cityOperators: Array<{
|
||||
cityCode: string;
|
||||
groupLink: string;
|
||||
}>;
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
import Taro from '@tarojs/taro';
|
||||
|
||||
import { API } from '@/http/api';
|
||||
|
||||
export const isDev = () => process.env.NODE_ENV === 'development';
|
||||
// export const isDev = () => true;
|
||||
|
||||
@ -13,7 +15,6 @@ export const isDesktop = (() => {
|
||||
return info.platform === 'windows' || info.platform === 'mac';
|
||||
})();
|
||||
|
||||
|
||||
export const logWithPrefix = isDev()
|
||||
? (prefix: string) =>
|
||||
(...args: BL.Anything[]) =>
|
||||
@ -87,3 +88,9 @@ export const isValidIdCard = (idCard: string) =>
|
||||
export const isValidPhone = (phone: string) => /^1[3-9]\d{9}$/.test(phone);
|
||||
|
||||
export const getScrollItemId = (id?: string) => (id ? `sid-${id}` : id);
|
||||
|
||||
export function buildUrl(url: API, params: Record<string, string | number>): API {
|
||||
return Object.entries(params).reduce((result, [key, value]) => {
|
||||
return result.replace(new RegExp(`\\{${key}\\}`, 'g'), String(value));
|
||||
}, url) as API;
|
||||
}
|
||||
|
||||
@ -6,9 +6,9 @@ import { CITY_CODE_TO_NAME_MAP, COUNTY_CODE_TO_NAME_MAP, PROVINCE_CODE_TO_NAME_M
|
||||
import http from '@/http';
|
||||
import { API } from '@/http/api';
|
||||
import store from '@/store';
|
||||
import { setLocationInfo } from '@/store/actions';
|
||||
import { setLocationInfo, setCityOperators } from '@/store/actions';
|
||||
import { selectLocation } from '@/store/selector';
|
||||
import { GetCityCodeRequest, LocationInfo } from '@/types/location';
|
||||
import { CityOperatorListItem, GetCityCodeRequest, LocationInfo } from '@/types/location';
|
||||
|
||||
import { authorize, getWxSetting } from './wx';
|
||||
|
||||
@ -134,3 +134,15 @@ export async function requestLocation(force: boolean = false) {
|
||||
store.dispatch(setLocationInfo(location));
|
||||
return location;
|
||||
}
|
||||
|
||||
export async function requestCityOperators() {
|
||||
const list = await http.get<CityOperatorListItem[]>(API.GET_ALL_CITY_OPERATOR);
|
||||
store.dispatch(
|
||||
setCityOperators(
|
||||
(list || []).map(it => ({
|
||||
cityCode: it.cityCode,
|
||||
groupLink: it.groupLink,
|
||||
}))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -7,15 +7,21 @@ import store from '@/store';
|
||||
import { setInviteCode } from '@/store/actions/partner';
|
||||
import { IPaginationRequest } from '@/types/common';
|
||||
import {
|
||||
AuthedGroupInfo,
|
||||
DecryptOpenGidBody,
|
||||
GetProfitRequest,
|
||||
GroupAuthCode,
|
||||
InviteUserInfo,
|
||||
PartnerInviteCode,
|
||||
PartnerPagination,
|
||||
PartnerProfitItem,
|
||||
PartnerProfitsState,
|
||||
StaffInfo,
|
||||
UserProfitListItem,
|
||||
WithdrawRecord,
|
||||
WithdrawResponse,
|
||||
} from '@/types/partner';
|
||||
import { buildUrl } from '@/utils/common';
|
||||
import { requestUserInfo } from '@/utils/user';
|
||||
|
||||
export const getInviteCodeFromQuery = (query: Record<string, string>): string | undefined => {
|
||||
@ -75,14 +81,14 @@ export const getProfitList = async (data: GetProfitRequest) => {
|
||||
return Array.isArray(result) ? result : [];
|
||||
return [];
|
||||
};
|
||||
export const formatMoney = (cents: number) => {
|
||||
export const formatMoney = (cents: number, fraction = 2) => {
|
||||
if (!cents) {
|
||||
return '0';
|
||||
}
|
||||
const yuan = cents / 100;
|
||||
return yuan.toFixed(2);
|
||||
return yuan.toFixed(fraction);
|
||||
};
|
||||
export function formatTimestamp(timestamp: string): string {
|
||||
export function formatTimestamp(timestamp: string, dateOnly?: boolean): string {
|
||||
// 创建 Date 对象
|
||||
const date = new Date(/^\d+$/.test(timestamp) ? Number(timestamp) : timestamp);
|
||||
|
||||
@ -94,7 +100,7 @@ export function formatTimestamp(timestamp: string): string {
|
||||
const mm = String(date.getMinutes()).padStart(2, '0');
|
||||
|
||||
// 拼接成所需的格式
|
||||
return `${YYYY}.${MM}.${DD} ${HH}:${mm}`;
|
||||
return dateOnly ? `${YYYY}.${MM}.${DD}` : `${YYYY}.${MM}.${DD} ${HH}:${mm}`;
|
||||
}
|
||||
|
||||
export function formatUserId(input: string): string {
|
||||
@ -127,3 +133,26 @@ export async function getWithdrawList(data: IPaginationRequest) {
|
||||
contentType: 'application/x-www-form-urlencoded',
|
||||
});
|
||||
}
|
||||
export async function getLastProfitList() {
|
||||
const result = await http.get<UserProfitListItem[]>(API.GET_USER_PROFIT_LIST, {
|
||||
contentType: 'application/x-www-form-urlencoded',
|
||||
});
|
||||
return Array.isArray(result) ? result : [];
|
||||
}
|
||||
|
||||
export async function generateGroupAuthCode() {
|
||||
return await http.get<GroupAuthCode>(API.GENERATE_GROUP_AUTH_CODE);
|
||||
}
|
||||
|
||||
export async function getAuthedGroupList() {
|
||||
return await http.get<AuthedGroupInfo[]>(API.GET_AUTHED_GROUP_LIST);
|
||||
}
|
||||
export async function decryptOpenGid(data: DecryptOpenGidBody) {
|
||||
return await http.post(API.DECRYPT_OPEN_GID, {
|
||||
data,
|
||||
});
|
||||
}
|
||||
export async function getStaffInfo(cityCode: string) {
|
||||
const result = await http.get<StaffInfo[]>(buildUrl(API.GET_STAFF_CODE, { cityCode }));
|
||||
return Array.isArray(result) && result.length ? result[0] : null;
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@ export const getUserId = () => getUserInfo().userId;
|
||||
export const isValidUserInfo = (info: UserInfo) => !!info.userId;
|
||||
|
||||
export const isNeedLogin = (info: UserInfo) => !info.isBindPhone;
|
||||
// export const isNeedLogin = (info: UserInfo) => !info.isBindPhone || info.userId === '534740874077898752';
|
||||
// export const isNeedLogin = (info: UserInfo) => !info.isBindPhone || info.userId === '218396277145075712';
|
||||
|
||||
export const isNeedPhone = (info: UserInfo) => isNeedLogin(info) || !info.phone;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user