<template>
  <div class="reportContainer">
    <web-view :src="webUrl" @load="webLoading"></web-view>
  </div>
</template>
<script>
import store from '@/store/index';
import game_store from "@/store/game";

var $this;
export default {
  name: "reportContainer",
  data() {
    return {
      report_id: 0,
      webUrl: ""
    }
  },
  methods: {
    webLoading(params) {
      console.log("加载完成")
      wx.hideLoading();
    }
  },
  created() {
    $this = this;
  },
  onLoad(options) {
    wx.showLoading({
      title: "加载中",
      mask: true,
      duration: 5000
    })
    $this.report_id = options.id
      ? options.id
      : game_store.getters.getGameRecordId();
    let mode = options.mode ? options.mode : wx.getStorageSync('report_mode')
    console.log($this.report_id);
    let $userinfo = wx.getStorageSync("userinfo")

    $this.webUrl = `${process.env.REPORT_URI}?mode=${mode}&token=${store.getters.get_token()}&record_id=${options.id}&nickName=${$userinfo.user_name}&mp=1`
    console.log($this.webUrl);
  },
  onUnload(){
    wx.removeStorageSync("mode")
  }
}
</script>
