index.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <template>
  2. <view class="page_container">
  3. <custom-nav-bar title="加入会议" />
  4. <view class="input_row">
  5. <view> 会议号 </view>
  6. <u--input placeholder="请输入会议号" border="none" v-model="meetingID"></u--input>
  7. </view>
  8. <view class="action_row">
  9. <u-button type="primary" text="进入会议" @click="tryJoinMeeting"></u-button>
  10. </view>
  11. </view>
  12. </template>
  13. <script>
  14. import { mapGetters } from "vuex";
  15. import CustomNavBar from "../../../components/CustomNavBar/index.vue";
  16. import { meetingModule, meetingErrorHandle } from "../../../util/imCommon";
  17. import config from "../../../common/config";
  18. import { joinMeeting } from '../../../api/meeting'
  19. export default {
  20. components: {
  21. CustomNavBar,
  22. },
  23. data() {
  24. return {
  25. meetingID: "",
  26. };
  27. },
  28. computed: {
  29. ...mapGetters(["storeSelfInfo"]),
  30. },
  31. methods: {
  32. tryJoinMeeting() {
  33. if (!this.meetingID) {
  34. return;
  35. }
  36. const params = {
  37. meetingID: this.meetingID,
  38. userID: this.storeSelfInfo.userID,
  39. password: "",
  40. };
  41. joinMeeting(params)
  42. .then(( data ) => {
  43. const meetingData = {
  44. liveURL: data.liveKit?.url,
  45. token: data.liveKit?.token,
  46. roomID: this.meetingID,
  47. imToken: uni.getStorageSync("IMToken"),
  48. baseURL: config.getApiUrl()
  49. };
  50. meetingModule.startMeeting(meetingData);
  51. })
  52. .catch(meetingErrorHandle);
  53. },
  54. },
  55. };
  56. </script>
  57. <style lang="scss">
  58. .page_container {
  59. background-color: #f6f6f6;
  60. .input_row {
  61. display: flex;
  62. padding: 32rpx;
  63. margin-top: 24rpx;
  64. background-color: #fff;
  65. .u-input {
  66. margin-left: 24rpx;
  67. }
  68. }
  69. .action_row {
  70. margin-top: 10vh;
  71. padding: 0 24%;
  72. }
  73. }
  74. </style>