index.js 1 KB
Newer Older
zhanghaozhe committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
import React, { Component } from 'react'
import CallApp from 'callapp-lib'

const options = {
    scheme: {
        protocol: 'julyedu',
        host: '',
        port: ''
    },
    intent: {
        package: "com.julyapp.julyonline",
        scheme: "julyedu",
        action: 'julyapp.julyedu',
        category: 'category_julyedu'
    },
    universal: {
        host: "api.julyedu.com/action",
        pathKey: 'page'
    },
    appstore: "https://itunes.apple.com/cn/app/id1102275343?mt=8",
    yingyongbao: "http://android.myapp.com/myapp/detail.htm?apkName=com.julyapp.julyonline",
    fallback: "http://www-test.julyedu.com/weekend/redir1"
}

class OpenApp extends Component {

    callApp = new CallApp(options)

29 30 31 32
    static defaultProps = {
        text: '在APP打开'
    }

zhanghaozhe committed
33 34 35 36 37 38
    handleClick = () => {
        this.callApp.open({})
    }

    render() {
        return (
39
            <div className={this.props.className} onClick={this.handleClick}>{this.props.text}</div>
zhanghaozhe committed
40 41 42 43 44
        );
    }
}

export default OpenApp;