App.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <template>
  2. <div id="app">
  3. <router-view/>
  4. <!-- <audio
  5. class="audio"
  6. id="audio1"
  7. :src="`${$cdn}audio/bg.mp3`"
  8. preload
  9. loop
  10. ref="musicBg"
  11. ></audio> -->
  12. </div>
  13. </template>
  14. <script>
  15. import '@/assets/css/reset.less'
  16. import '@/assets/css/public.less'
  17. import '@/assets/fonts/iconfont.css'
  18. import wx from 'weixin-js-sdk'
  19. import jsonp from 'jsonp'
  20. export default {
  21. methods:{
  22. // handleAudio(val){
  23. // val ? this.$refs.musicBg.play() : this.$refs.musicBg.pause();
  24. // },
  25. wxShare () {
  26. let url = location.href.split('#')[0]
  27. jsonp('https://www.4dage.com/wechat/jssdk/share/?uri=' +
  28. window.escape(url) + '&name=淇澳端午巡游', 'success_jsonp', function (err, data) {
  29. if (err) {
  30. console.err(err)
  31. } else {
  32. wx.config({
  33. debug: false, // 开启调试模式
  34. appId: data.appId,
  35. timestamp: data.timestamp,
  36. nonceStr: data.nonceStr,
  37. signature: data.signature,
  38. jsApiList: ['checkJsApi',
  39. 'onMenuShareTimeline',
  40. 'onMenuShareAppMessage',
  41. 'onMenuShareQQ',
  42. 'onMenuShareWeibo',
  43. 'hideMenuItems',
  44. 'showMenuItems',
  45. 'hideAllNonBaseMenuItem',
  46. 'showAllNonBaseMenuItem',
  47. 'translateVoice',
  48. 'startRecord',
  49. 'stopRecord',
  50. 'onRecordEnd',
  51. 'playVoice',
  52. 'pauseVoice',
  53. 'stopVoice',
  54. 'uploadVoice',
  55. 'downloadVoice']
  56. })
  57. }
  58. wx.ready(function () {
  59. var shareData = {
  60. title: 'UIC全景校园 UIC Virtual Tour', // 标题
  61. desc: 'UIC全景校园 UIC Virtual Tour', // 描述
  62. link: window.location.href, // 分享的URL,必须和当前打开的网页的URL是一样的
  63. imgUrl: 'https://houseoss.4dkankan.com/uic/logo.png', // 缩略图地址
  64. success: function () {
  65. },
  66. cancel: function () {
  67. }
  68. }
  69. wx.onMenuShareAppMessage(shareData)
  70. wx.onMenuShareTimeline(shareData)
  71. wx.onMenuShareQQ(shareData)
  72. wx.onMenuShareQZone(shareData)
  73. })
  74. })
  75. }
  76. },
  77. mounted () {
  78. this.wxShare()
  79. }
  80. }
  81. </script>
  82. <style lang="less">
  83. #app{
  84. width: 100%;
  85. height: 100%;
  86. overflow: hidden;
  87. }
  88. .audio {
  89. position: fixed;
  90. top: -100px;
  91. left: -100px;
  92. opacity: 0;
  93. }
  94. </style>