分享添加

This commit is contained in:
saplf
2019-09-07 22:12:57 +08:00
parent 5611bdb69e
commit 1c0e5ddb66
7 changed files with 32 additions and 16 deletions

View File

@@ -68,7 +68,7 @@ const model: Model = {
if (confirm !== newPwd) return message.warn(formatMessage({ id: 'check.msgConfirm' }));
yield put({ type: 'onUpdateState', submitting: true });
try {
yield call(changeFundPwd, newPwd, originVisible ? undefined : origin);
yield call(changeFundPwd, newPwd, originVisible ? origin : undefined);
yield put(routerRedux.goBack());
message.success(formatMessage({ id: 'fundpwd.success' }));
} catch (e) {

View File

@@ -43,7 +43,7 @@ const CommunityPage: React.FC<HomeCommunityModelState & DispatchProp> = ({
<div className="bg" />
<span className="title">{formatMessage({ id: 'home.community.total' })}</span>
<span className="content">
<span className="large">+{info ? info.rewardAll : 0} USDT</span>
<span className="large">+{info ? info.reward : 0} USDT</span>
</span>
<div className={styles.card}>
<div className="left">
@@ -51,14 +51,14 @@ const CommunityPage: React.FC<HomeCommunityModelState & DispatchProp> = ({
{formatMessage({
id: 'home.community.totalInvited',
}, {
num: info ? info.followerNumber : 0,
num: info ? info.follower : 0,
})}
</span>
<span className="line">
{formatMessage({
id: 'home.community.totalAll',
}, {
num: info ? info.communeNumber : 0,
num: info ? info.groupScale : 0,
})}
</span>
</div>

View File

@@ -6,7 +6,7 @@ export async function getCommunityBasic(): Promise<CommunityBasic> {
ok,
data,
msg,
} = await http.get<CommunityBasic>('/commune/basic');
} = await http.get<CommunityBasic>('/community/basic');
if (ok && data) {
return data;
}
@@ -18,7 +18,7 @@ export async function getCommunityList(pageIndex: number, pageSize: number): Pro
ok,
data,
msg,
} = await http.get<Inviters>('/commune/list', {
} = await http.get<Inviters>('/community/list', {
pageIndex,
pageSize,
});

View File

@@ -15,6 +15,7 @@ import Header from '@/components/Header';
import styles from './style.less';
import { UserModelState } from '@/models/user';
import { generateInviteHref } from './service';
import { isApp, share } from '@/utils/h5plus';
const InvitePage: React.FC<DispatchProp & InviteModelState & UserModelState> = ({
dispatch,
@@ -59,9 +60,14 @@ const InvitePage: React.FC<DispatchProp & InviteModelState & UserModelState> = (
<Icon type="copy" theme="filled" />
</Clipboard>
</div>
<Button type="primary">
{formatMessage({ id: 'invite.btn' })}
</Button>
{isApp() && (
<Button
type="primary"
onClick={() => share(href)}
>
{formatMessage({ id: 'invite.btn' })}
</Button>
)}
</div>
</div>
</div>

View File

@@ -232,17 +232,17 @@ export interface CommunityBasic {
/**
* 累计奖励总额的数字
*/
rewardAll: string;
reward: string;
/**
* 直接邀请人数
*/
followerNumber: string;
follower: string;
/**
* 社区总人数
*/
communeNumber: string;
groupScale: string;
}
export interface Inviter {

View File

@@ -362,7 +362,7 @@ interface ShareWrapper {
/**
* 使用系统组件发送分享
*/
sendWithSystem: (message: ShareMessage, successCB: () => any, errorCB: (err: DOMException) => any) => any;
sendWithSystem: (message: ShareMessage, successCB: () => any, errorCB?: (err: DOMException) => any) => any;
}
type AppKeyType =

View File

@@ -28,7 +28,7 @@ const scan = () => {
webview.currentWebview().append(bc);
bc.start();
});
}
};
const firstPaths = [
'/check',
@@ -53,17 +53,26 @@ const backButtonHandler = () => {
const init = () => {
if (!isApp()) return;
plus.key.addEventListener('backbutton', backButtonHandler);
}
};
const destory = () => {
if (!isApp()) return;
plus.key.removeEventListener('backbutton', backButtonHandler);
}
};
const share = (content: string) => {
if (!isApp()) return;
plus.share.sendWithSystem({
type: 'text',
content,
}, () => { });
};
export {
init,
isApp,
scan,
share,
destory,
};
@@ -71,5 +80,6 @@ export default {
init,
isApp,
scan,
share,
destory,
};