import Vue from 'vue'
import lib from 'lib'
import Clipboard from 'clipboard'

export default {
    data() {
        return {
            winHeight : 0,    
            cover : lib.formatHttpProtocol(lib.getParam("cover")),
            nick : lib.getParam("nick"),
            bonus : lib.getParam("bonus"),
            code : lib.getParam("code"),
            clipboard: null
        }
    },
    mounted() {
        this.winHeight = $(window).height()
        this.clipboard = new Clipboard(this.$refs.copy)
    },
    activated() {
        lib.setTitle("百万奥斯卡-微剧院")
        lib.setWxShare({
            title : `${this.nick}在【百万奥斯卡-微剧院】平分10万奖金啦！`,
            desc : "影视知识大问答，百万奖金等你拿。",
            link : location.href,
            imgUrl: `//h5-glance.duowan.com/build/logo-oscar.png`
        })
    },
    methods: {
        copy(){ 
            this.clipboard.on('success', function () {
                location.href = lib.downloadUrl
            });
        }
    }
}