base.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <template>
  2. <div id="dialog_index" v-if="ifBaseDialog">
  3. <div class="created_dialog">
  4. <div class="blurBox"></div>
  5. <div class="content">
  6. <div class="dialog_title">{{ title }}</div>
  7. <p class="dialog_desc">{{ desc }}</p>
  8. <div class="created_btn">
  9. <div class="end_cancel" @click="endLiveCancel" v-if="!isSingle">{{ closeTxt }}</div>
  10. <div class="end_confirm" @click="endLiveConfirm">{{ okTxt }}</div>
  11. </div>
  12. </div>
  13. </div>
  14. </div>
  15. </template>
  16. <script setup>
  17. // import browser from '/@/utils/browser';
  18. import {
  19. onMounted,
  20. watch,
  21. defineProps,
  22. defineEmits,
  23. ref,
  24. computed,
  25. watchEffect,
  26. unref,
  27. } from 'vue';
  28. import { useRtcStore } from '/@/store/modules/rtc';
  29. const emit = defineEmits(['closeDialog', 'confirmDialog']);
  30. const rtcStore = useRtcStore();
  31. const baseDialog = computed(() => rtcStore.baseDialog);
  32. const ifBaseDialog = computed(() => rtcStore.ifBaseDialog);
  33. const title = ref('');
  34. const desc = ref('');
  35. const okTxt = ref('');
  36. const closeTxt = ref('');
  37. const isSingle = ref(false);
  38. const props = defineProps({
  39. title: {
  40. type: String,
  41. default: '温馨提示',
  42. },
  43. desc: {
  44. type: String,
  45. default: '',
  46. },
  47. okTxt: {
  48. type: String,
  49. default: '确定',
  50. },
  51. closeTxt: {
  52. type: String,
  53. default: '取消',
  54. },
  55. isSingle: {
  56. type: Boolean,
  57. default: false,
  58. },
  59. });
  60. watch(
  61. () => [baseDialog, ifBaseDialog],
  62. (val) => {
  63. // console.log('hey', val);
  64. title.value = unref(val[0]).title;
  65. desc.value = unref(val[0]).desc;
  66. okTxt.value = unref(val[0]).okTxt;
  67. closeTxt.value = unref(val[0]).closeTxt;
  68. isSingle.value = unref(val[0]).isSingle;
  69. },
  70. { deep: true },
  71. );
  72. watch(
  73. () => props,
  74. (val) => {
  75. // console.log('hey', val);
  76. title.value = props.title;
  77. desc.value = props.desc;
  78. okTxt.value = props.okTxt;
  79. closeTxt.value = props.closeTxt;
  80. isSingle.value = props.isSingle;
  81. },
  82. { deep: true },
  83. );
  84. const endLiveCancel = () => {
  85. emit('closeDialog');
  86. rtcStore.hideBaseDialog();
  87. };
  88. const endLiveConfirm = () => {
  89. // socket.value.emit("disconnect");
  90. rtcStore.baseDiaLogCallback();
  91. emit('confirmDialog');
  92. rtcStore.hideBaseDialog();
  93. };
  94. </script>
  95. <style scoped lang="scss">
  96. #dialog_index {
  97. width: 100vw;
  98. height: 100%;
  99. // background: rgba(0, 0, 0, 0.5);
  100. position: fixed;
  101. left: 0;
  102. top: 0;
  103. z-index: 100000;
  104. pointer-events: none;
  105. .created_dialog {
  106. pointer-events: auto;
  107. width: 8.64rem;
  108. // min-height: 5rem;
  109. // background: #ffffff;
  110. border-radius: 8px;
  111. position: absolute;
  112. left: 50%;
  113. top: 50%;
  114. transform: translate(-50%, -50%);
  115. border: 1px solid rgba(255, 255, 255, 0.1);
  116. border-radius: 4px;
  117. .blurBox {
  118. position: absolute;
  119. z-index: 1;
  120. top: 0;
  121. left: 0;
  122. width: 100%;
  123. height: 100%;
  124. background: rgba(0, 0, 0, 0.7);
  125. filter: blur(1px);
  126. }
  127. .content {
  128. position: relative;
  129. z-index: 2;
  130. top: 0;
  131. left: 0;
  132. width: 100%;
  133. height: 100%;
  134. }
  135. .dialog_title {
  136. width: 100%;
  137. height: 1.39rem;
  138. padding: 0 0.56rem;
  139. box-sizing: border-box;
  140. font-size: 0.39rem;
  141. color: #fff;
  142. line-height: 1.39rem;
  143. overflow: hidden;
  144. text-overflow: ellipsis;
  145. white-space: nowrap;
  146. border-bottom-style: solid;
  147. border-bottom-width: 1px;
  148. border-bottom-color: rgba(255, 255, 255, 0.1);
  149. }
  150. .dialog_desc {
  151. font-size: 0.42rem;
  152. color: #fff;
  153. padding: 0.56rem 0.4rem;
  154. text-align: center;
  155. }
  156. .created_btn {
  157. width: 100%;
  158. height: 1.36rem;
  159. border-top-style: solid;
  160. border-top-width: 1px;
  161. border-top-color: rgba(255, 255, 255, 0.1);
  162. box-sizing: border-box;
  163. display: flex;
  164. align-items: center;
  165. justify-content: center;
  166. font-size: 0.39rem;
  167. > div {
  168. width: 50%;
  169. height: 1.36rem;
  170. text-align: center;
  171. line-height: 1.36rem;
  172. font-size: 0.39rem;
  173. box-sizing: border-box;
  174. &.end_cancel {
  175. color: #fff;
  176. border-right-style: solid;
  177. border-right-width: 1px;
  178. border-right-color: rgba(255, 255, 255, 0.1);
  179. }
  180. &.end_confirm {
  181. color: #ed5d18;
  182. }
  183. }
  184. }
  185. }
  186. }
  187. </style>