import React from 'react'; import './index.less'; import Page from '@src/containers/Page'; import Assets from '@src/components/Assets'; import { asyncSMessage } from '@src/services/AsyncTools'; import { H5Url } from '../../../../Constant'; import Button from '../../../components/Button'; import Input from '../../../components/Input'; import Tag from '../../../components/Tag'; import { My } from '../../../stores/my'; import { Common } from '../../../stores/common'; export default class extends Page { initState() { return { emails: [], select: -1, }; } init() { Common.readyWechat(window.location.href, ['onMenuShareAppMessage']) .then((wx) => { const { info } = this.props.user; wx.onMenuShareAppMessage({ title: '千行GMAT 好友邀请连接', // Share title desc: '点击邀请连接', // Share description link: `${H5Url}/id/${info.inviteCode}`, // Share Link,this link domain name and path must be the same as the current page which corresponding to JS secured domain name as Official account imgUrl: '', // Share Icon type: 'link', // Share type, music, video link, not filled default link dataUrl: '', // If type is music or video, provide data links, the default is empty success() { // The user confirms the callback function that was executed after sharing }, cancel() { // The user cancels the callback function that was executed after sharing }, }); }); } addEmail(value) { const { emails } = this.state; emails.push(value.replace(';', '').replace(';', '')); this.setState({ email: '', emails, }); } removeEmail(index) { const { emails } = this.state; emails.splice(index, 1); this.setState({ emails, }); } submit() { const { emails } = this.state; if (emails.length === 0) return; My.inviteEmail(emails).then(() => { asyncSMessage('发送成功'); this.setState({ email: '', emails: [] }); }).catch(() => { asyncSMessage('发送失败', 'warn'); }); } renderView() { return (