log
zhoudw
2022-01-10 6274306b701e1ffc6773b30b11b55e3acad7cb6b
src/views/iframe/iframe.vue
@@ -12,6 +12,7 @@
</template>
<script>
import { mapActions, mapState } from "vuex";
import VConsole from 'vconsole';
export default {
  data(){
    return{
@@ -35,6 +36,7 @@
    this.iframeWin = this.$refs.iframe.contentWindow;
  },
  created () {
     let vConsole = new VConsole() // 初始化
     let item = JSON.parse(localStorage.getItem("item"));
     this.scenes_id = item.scenes_id;
     this.scenes_name = item.scenes_name;
@@ -42,7 +44,7 @@
     let url = process.env.INTERFACE_SERVER_PATH+process.env.ETS_APP_NEWRECORD_URL;
     this.live_url = url + "?scenes_id="+this.scenes_id+"&scenes_name="+this.scenes_name+"&client_id="+this.client_id+"&sid="+this.token;
     console.log(this.live_url);
     this.getwsConfig();
     this.loadWxjs();
  },
  methods:{
    ...mapActions({
@@ -71,17 +73,19 @@
      });;
    },
     postMessageEvent(){
       let _this = this;
       window.addEventListener("message", function(e){
            var data = e.data;
            console.log(data,'收到消息');
            switch (data.action) {
                case 'init': // 初始化
                    wx.config({
                        beta: true,// 必须这么写,否则wx.invoke调用形式的jsapi会有问题
                        debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
                        appId: appId, // 必填,企业微信的corpID
                        timestamp: timeStamp, // 必填,生成签名的时间戳
                        nonceStr: nonceStr, // 必填,生成签名的随机串
                        signature: signature,// 必填,签名,见 附录-JS-SDK使用权限签名算法
                        appId: _this.corpId, // 必填,企业微信的corpID
                        timestamp: _this.timeStamp, // 必填,生成签名的时间戳
                        nonceStr: _this.nonceStr, // 必填,生成签名的随机串
                        signature: _this.signature,// 必填,签名,见 附录-JS-SDK使用权限签名算法
                        jsApiList: [
                                'startRecord',
                                'stopRecord',
@@ -165,14 +169,13 @@
            script.type = 'text/javascript';
            script.src = wx_js;
            document.body.appendChild(script);
            if(index == 0){
              script.onload=function(){
                _this.jsload = true;
              }
            script.onload=function(){
              _this.jsload = true;
            }
        }else{
          _this.jsload = true;
        }
        this.getwsConfig();
     }
  }
}