Newer
Older
XinYang_SanWei+RongYun / src / views / FangXunZhiHui / index / emergencycommand.vue
@张强云笔记本 张强云笔记本 on 21 Dec 2021 3 KB 测试提交
<template>
  <div id="MapBOXmap">
    <!-- <Swqj3Dmap ref="swqj3Dmap" /> -->
    <div id="map" ref="rootmap">
      <div id="SHIPINTONGHUA" @click="spthClick('15629078847')">
        点击进行视频通话
      </div>
    </div>
    <!-- <CesiumCom></CesiumCom> -->
    <!-- 视频对话 -->
    <el-dialog
      title="视频对话"
      :visible.sync="dialogVisible"
      width="30%"
      :close-on-click-modal="false"
      @close="closeDialog()"
    >
      <div
        id="TongHuaBox"
        v-loading="loading"
        element-loading-text="拼命加载中"
        element-loading-spinner="el-icon-loading"
        element-loading-background="rgba(0, 0, 0, 0.8)"
      >
        <CesiumCom ref="TongHua"></CesiumCom>
        <!-- <router-view ref="TongHua"></router-view> -->
      </div>
    </el-dialog>
  </div>
</template>

<script>
import CesiumCom from "@/components/call.vue";
// import CesiumCom from "@/views/cesiumCom/index.vue";

var setting = window.RongCall.setting;

export default {
  components: {
    CesiumCom,
  },
  data() {
    return {
      map: null,
      dialogVisible: false,
      loading: false,
      unsrNo: "",
      RongLoginOkData: {},
    };
  },
  created() {
    window.closepopup = this.closepopup;
    window.spthClick = this.spthClick;
  },

  mounted() {},
  beforeDestroy() {},
  methods: {
    // 前端代码======================================================A
    // 关闭弹窗
    closeDialog() {
      this.$refs.TongHua.hungup();
    },
    //视频通话按钮-------------------------------------------------------------------
    spthClick(peopleNo) {
      console.log("人员编号是:" + peopleNo);

      this.dialogVisible = true;
      this.login("PCUser", peopleNo);
    },
    // 视频通话功能----------------------------------------------------------A
    async login(PCUser, peopleNo) {
      this.loading = true;
      var userId = PCUser;
      let _this = this;
      // var loginDetail;

      console.log("第二次登录");
      let result = await this.$axios.login({
        userId,
      });

      if (result.code !== 200) {
        this.loading = false;
        _this.$message("登录失败, 请检查 CallLib Demo Server 是否启动");
      } else {
        this.loading = false;
        setting.token = result.token;
        this.RongLoginOkData = result;
        let RongCall = window.RongCall;
        RongCall.initIM(setting);

        // this.$router.push({
        //   path: "/FangXunZhiHui/emergencycommand/call",
        //   query: {
        //     phone: peopleNo,
        //     userId: PCUser,
        //   },
        // });

        this.$refs.TongHua.inputCall(false);
      }
    },
    // 视频通话功能----------------------------------------------------------B

    // 前端代码======================================================E
  },
};
</script>

<style scoped>
#MapBOXmap {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

#map {
  height: 100%;
  width: 100%;
  position: absolute;
  right: 0;
}

#SHIPINTONGHUA {
  position: absolute;
  top: 100px;
  left: 100px;
  color: rgb(217, 255, 0);
  font-size: 20px;
  z-index: 200;
  cursor: pointer;
  background: rosybrown;
}

.ol-zoom {
  display: none;
}

#TongHuaBox {
  height: 500px;
  width: 100%;
  background: rgb(255, 255, 255);
  position: relative;
}
</style>