<template>
    <div id="ProfessionalEdition">
        <el-button type="primary" v-on:click="editionChange">专业版</el-button>
    </div>
</template>

<script>

    import cache from '@/utils/cache'

    export default {
        name: 'index',
        data() {
            return {
                loginName: ''
            }
        },
        created() {
            let conpany = JSON.parse(cache.getSession('company'))
            if (conpany.bwCloudInfo.account != null) {
                this.loginName = conpany.bwCloudInfo.account
            }
        },
        methods: {
            // 跳转专业版
            editionChange() {
                console.log(this.loginName)
                let Base64 = require('js-base64').Base64
                let key = 'Ynlp'
                let date = this.getDateNow()
                let user = {
                    key: date + key,
                    username: this.loginName + key
                }
                let info = JSON.stringify(user)
                let userInfo = Base64.encodeURI(info)
                window.open('https://www.chtax.cn/txbw/?info=' + userInfo)
            },
            // 获取当前时间
            getDateNow() {
                let nowDate = new Date()
                let date = {
                    year: nowDate.getFullYear(),
                    month: nowDate.getMonth() + 1,
                    date: nowDate.getDate()
                }
                return date.year + '-' + date.month + '-' + date.date
            }
        }
    }
</script>

<style scoped>

</style>
