Newer
Older
XinYang_SanWei+RongYun / src / views / cesiumCom / index.vue
@张强云笔记本 张强云笔记本 on 21 Dec 2021 3 KB 测试提交
<template>
  <div id="CesiumBOX">
    <div id="CesiumContainer"></div>
    <div id="SHIPINTONGHUA" @click="spthClick('15629078847')">
      点击进行视频通话
    </div>

    <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)"
      >
        <!-- <router-view ref="TongHua"></router-view> -->
        <div style="height: 200px; position: relative">
          <Callss ref="TongHua" :partentInfo="partentInfo"></Callss>
        </div>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import qs from "qs";
import Callss from "./../../components/call.vue";
var setting = window.RongCall.setting;

export default {
  data() {
    return {
      earth: "",
      dialogVisible: false,
      loading: false,
      unsrNo: "",
      RongLoginOkData: {},
      partentInfo: {},
    };
  },
  components: { Callss },
  computed: {},
  mounted() {
    this.init();
  },
  methods: {
    init() {
      let viewer = new Cesium.Viewer("CesiumContainer", {
        // imageryProvider: gisMap,
      });

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

      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: "/cesiumCom/call/call",
        //   query: {
        //     phone: peopleNo,
        //     userId: PCUser,
        //   },
        // });
        let query = {
          phone: peopleNo,
          userId: PCUser,
        };
        this.partentInfo = query;

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

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

<style scoped>
#CesiumBOX {
  width: 100%;
  height: 100%;
}
</style>