feige
2024-10-18 ed96edec7c6dfd4944d0ee1c6d924c7cb808428c
ruoyi-ui/src/views/meeting/Home.vue
@@ -65,6 +65,8 @@
import { getIndividualList } from "@/api/self";
import { Loading } from 'element-ui'
  //导入接口函数  --接好了
  import { getWebcastInfo } from "@/api/meeting/index";
export default {
  name: '6666',
  components: {
@@ -78,32 +80,91 @@
    return {
      user:{},
      showComponent: false,
      time:undefined,
      loading: true,
      // 会议基本信息
      sdkAppId: 1600032250,
      secretKey: 'abedcf588654e18888eff65dfdfde240a882c611710c6ed10e1044fb44818a89',
      userId: '',
      roomId: 123,
      roomId: '',
      cameraId: '',
      microphoneId: '',
    };
  },
  created() {
    this.getRoomId();
    this.getUser();
  },
computed: {
    isStartExercise() {
      let roomId = this.roomId;
      let userId = this.userId;
      let time = this.time
      return { roomId, userId, time };
    }
},
watch: {
    isStartExercise: {
      immediate: true,
      handler(n) {
        if (n.roomId && n.userId) {
          // 判断这两个值同时存在
          this.loading = false;
          this.showComponent = true;
        }
        if(n.time == false){
          this.showComponent = false;
        }
      },
    }
  },
  methods: {
    // 获取房间号
    getRoomId(){
      const id = this.$route.params && this.$route.params.id;
      getWebcastInfo(id).then(response => {
        this.roomId = response.data.roomId
        console.log(response.data,'datadtaadadsd')
        let time = response.data.startTime.split(' ')[0]
        // let now = new Date();
        // let dateStr = now.toLocaleDateString().replaceAll('/','-'); // 本地格式的日期字符串
        const now = new Date();
        const year = now.getFullYear();
        const month = (now.getMonth() + 1).toString().padStart(2, '0');
        const day = now.getDate().toString().padStart(2, '0');
        let dateStr = `${year}-${month}-${day}`;
        if(time == dateStr){
          this.time = true
        }else{
          this.time = false
          this.$modal.msgSuccess("不在直播时间范围!");
        }
      })
    },
    // 获取用户名
    getUser(id) {
      getIndividualList().then(response => {
        this.user = response.data;
        this.userId = this.user.nickName
        // alert(this.userId)
        // alert(this.roomId)
      });
      setTimeout(() => {
        this.loading = false;
        this.showComponent = true;
      }, 3000);
      // setTimeout(() => {
      //   this.loading = false;
      //   this.showComponent = true;
      // }, 5000);
      // if(this.userId !== '' && this.roomId !== ''){
      //   alert(123)
      //   this.loading = false;
      //   this.showComponent = true;
      // }
    },
    handleValueChange(value, key) {