<template>
    <GlobalFooter class="i-copyright" :links="links" :copyright="copyright" />
</template>
<script>
    import { copyright } from '@/api/account';
    export default {
        name: 'i-copyright',
        data () {
            return {
                links: [
                    {
                        title: '官网',
                        key: '官网',
                        href: 'https://www.crmeb.com',
                        blankTarget: true
                    },
                    {
                        title: '社区',
                        key: '社区',
                        href: 'http://q.crmeb.com',
                        blankTarget: true
                    },
                    {
                        title: '文档',
                        key: '文档',
                        href: 'http://doc.crmeb.com',
                        blankTarget: true
                    }
                ],
                copyright: ''
            }
        },
        mounted () {
            this.getCopyright();
        },
        methods: {
            getCopyright () {
                copyright().then(res=>{
                    // this.copyright += res.data.copyrightContext?res.data.copyrightContext:'Copyright © 2022 浙江六牛科技有限公司';
                    this.copyright += 'Copyright © 2022 浙江六牛科技有限公司';
                    this.getVersion();
                }).catch(err=>{
                    this.$Message.error(err.msg)
                })
            },
            getVersion () {
                this.$store.dispatch('store/db/get', {
                    dbName: 'sys',
                    path: 'user.info',
                    user: true
                }).then(res => {
                    this.copyright += res.version ? '  |  ' + res.version : '';
                })
            }
        }
    }
</script>
<style lang="less">
    .i-copyright{
        flex: 0 0 auto;
        z-index: 1;
    }
</style>
