<template>
  <div id="app">
    <router-view/>
    <!-- <audio
      class="audio"
      id="audio1"
      :src="`${$cdn}audio/bg.mp3`"
      preload
      loop
      ref="musicBg"
    ></audio> -->

  </div>
  
</template>

<script>
import '@/assets/css/reset.less'
import '@/assets/css/public.less'
import '@/assets/fonts/iconfont.css'
import wx from 'weixin-js-sdk'
import jsonp from 'jsonp'

export default {
  methods:{
    // handleAudio(val){
    //   val ? this.$refs.musicBg.play() : this.$refs.musicBg.pause();
    // },
    wxShare () {
      let url = location.href.split('#')[0]
      jsonp('https://www.4dage.com/wechat/jssdk/share/?uri=' +
  window.escape(url) + '&name=淇澳端午巡游', 'success_jsonp', function (err, data) {
        if (err) {
          console.err(err)
        } else {
          wx.config({
            debug: false, // 开启调试模式
            appId: data.appId,
            timestamp: data.timestamp,
            nonceStr: data.nonceStr,
            signature: data.signature,
            jsApiList: ['checkJsApi',
              'onMenuShareTimeline',
              'onMenuShareAppMessage',
              'onMenuShareQQ',
              'onMenuShareWeibo',
              'hideMenuItems',
              'showMenuItems',
              'hideAllNonBaseMenuItem',
              'showAllNonBaseMenuItem',
              'translateVoice',
              'startRecord',
              'stopRecord',
              'onRecordEnd',
              'playVoice',
              'pauseVoice',
              'stopVoice',
              'uploadVoice',
              'downloadVoice']
          })
        }
        wx.ready(function () {
          var shareData = {
            title: 'UIC全景校园 UIC Virtual Tour', //  标题
            desc: 'UIC全景校园 UIC Virtual Tour', //  描述
            link: window.location.href, //  分享的URL，必须和当前打开的网页的URL是一样的
            imgUrl: 'https://houseoss.4dkankan.com/uic/logo.png', //  缩略图地址
            success: function () {

            },
            cancel: function () {

            }
          }
          wx.onMenuShareAppMessage(shareData)
          wx.onMenuShareTimeline(shareData)
          wx.onMenuShareQQ(shareData)
          wx.onMenuShareQZone(shareData)
        })
      })
    }
  },
  mounted () {
      this.wxShare()
  }
}
</script>

<style lang="less">
#app{
  width: 100%;
  height: 100%;
  overflow: hidden;
}
  .audio {
    position: fixed;
    top: -100px;
    left: -100px;
    opacity: 0;
  }
</style>
