import * as React from 'react'; import { Props, State } from './type'; import styled from 'styled-components' import { callHandler } from 'nejsbridge/dist/bridge.lofter.es' import { rem } from '../style/function.style' import { openAppLofter } from 'nw-app-lofter' import { isLofter } from 'nw-detect' import { showMessage } from '../common/toast/toast' import { TemplateActivityContext } from '../common/template-context' import { get } from '../utils/request'; const Text = styled.div` box-sizing: border-box; padding: ${rem(20)} ${rem(24)}; background:#26279d; text-align:center; color:#FFF60E; font-size: ${rem(22)} ` export class ShareButton extends React.Component { public static defaultProps = new Props(); public state = new State(); static contextType = TemplateActivityContext context: React.ContextType = {} as any render() { const { style, isEdit } = this.props; const activityInfo = this.context?.activityInfo const shareClick = () => { const currentTime = new Date().getTime(); // 当前时间小于结束时间才可以分享 if (currentTime < new Date("2022-01-15").getTime()) { console.log('点击我要分享'); if (!isLofter()) { openAppLofter({ path: 'webview', query: { url: window.location.href } }) } else { const shareContent = { url: `https://www.lofter.com/front/blog/home-page/${activityInfo?.actUserInfo?.blogInfo.blogName}`, // 个人主页 content: { weiboImg:'https://imglf5.lf127.net/bkimg/20211108155242/b8823b16-f56f-46ee-af5d-86e2d0d93379.jpg', weiboDesc: `故事精不精彩,你说了算!点击领取“礼物”,为#${activityInfo?.actUserInfo?.blogInfo.blogNickName}#加油助力吧!`, fImg: 'https://imglf5.lf127.net/bkimg/20211108155242/b8823b16-f56f-46ee-af5d-86e2d0d93379.jpg', fTitle: `#${activityInfo?.actUserInfo?.blogInfo.blogNickName}#正在参加网易元气故事大赛`, fDesc: `故事精不精彩,你说了算!点击领取“礼物”,为#${activityInfo?.actUserInfo?.blogInfo.blogNickName}#加油助力吧!`, domain: [] as any[], lofterContent: { lTitle: `#${activityInfo?.actUserInfo?.blogInfo.blogNickName}#正在参加网易元气故事大赛`, lImg: 'https://imglf5.lf127.net/bkimg/20211108155242/b8823b16-f56f-46ee-af5d-86e2d0d93379.jpg', price: 15, ext: '', }, } } callHandler('njb_share', { shareCnt: shareContent }) } } // const ua = window.navigator.userAgent.toLowerCase() // 如果在站外,跳转到站内打开活动页 else { showMessage({ text: '活动已结束' }) } } console.log('activityInfo', activityInfo) return ( {activityInfo?.actUserInfo?.signup &&
已报名作者点击上方按钮分享个人主页,
支持者可通过专属分享链接获得更多粮票喔~
}

1.投票开启时间:2021年11月9日—2021年12月30日
2.仅统计投票周期内,作者报名后获得的免费礼物数,记得报名哟~
3.请按活动规则添加正确的活动标签与赛道标签,以免影响票数统计,点击查看更多 投票规则

) } }