|
@@ -5,12 +5,13 @@
|
|
|
|
|
|
<div class="content">
|
|
|
<div class="dialog_title">请输入房间密码</div>
|
|
|
- <div class="user_name">
|
|
|
+ <div class="pass_container">
|
|
|
<v-otp-input
|
|
|
class="otp-input-container"
|
|
|
ref="otpInput"
|
|
|
input-classes="otp-input"
|
|
|
separator="-"
|
|
|
+ input-type="password"
|
|
|
:num-inputs="4"
|
|
|
:should-auto-focus="true"
|
|
|
:is-input-num="true"
|
|
@@ -32,17 +33,23 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
- import { ref, watchEffect } from 'vue';
|
|
|
-
|
|
|
- // import Dialog from '/@/components/basic/dialog';
|
|
|
+ import { ref, watchEffect, computed, unref } from 'vue';
|
|
|
+ import md5 from 'crypto-js/md5';
|
|
|
+ import Dialog from '/@/components/basic/dialog';
|
|
|
import { useI18n } from '/@/hooks/useI18n';
|
|
|
+
|
|
|
// import { useSocket } from '/@/hooks/userSocket';
|
|
|
import VOtpInput from 'vue3-otp-input';
|
|
|
+ import { useRoom } from '/@/hooks/useRoom';
|
|
|
+ import { useRtcStore } from '/@/store/modules/rtc';
|
|
|
+
|
|
|
+ const rtcStore = useRtcStore();
|
|
|
const emit = defineEmits(['closeDialog', 'confirmDialog']);
|
|
|
const { t } = useI18n();
|
|
|
// const regex = new RegExp('^([\u4E00-\uFA29]|[\uE7C7-\uE7F3]|[a-zA-Z0-9_]){1,15}$');
|
|
|
|
|
|
const password = ref('');
|
|
|
+ const roomId = computed(() => rtcStore.roomId);
|
|
|
// const rtcStore = useRtcStore();
|
|
|
const ifShow = ref(false);
|
|
|
const props = defineProps({
|
|
@@ -52,20 +59,24 @@
|
|
|
},
|
|
|
});
|
|
|
watchEffect(() => {
|
|
|
- if (props.show) {
|
|
|
- ifShow.value = props.show;
|
|
|
- }
|
|
|
+ ifShow.value = props.show;
|
|
|
});
|
|
|
|
|
|
const closeCreated = () => {
|
|
|
ifShow.value = false;
|
|
|
- // const { closeSocket } = useSocket();
|
|
|
- // emit('closeDialog');
|
|
|
- // closeSocket();
|
|
|
emit('closeDialog');
|
|
|
};
|
|
|
- const createdConfirm = () => {
|
|
|
- emit('confirmDialog');
|
|
|
+ const createdConfirm = async () => {
|
|
|
+ const { validPassRoom } = useRoom();
|
|
|
+ if (unref(password).length > 0 && unref(password).length === 4) {
|
|
|
+ const encyrptPassword = md5(unref(password)).toString();
|
|
|
+ const res = await validPassRoom(unref(roomId), encyrptPassword);
|
|
|
+ if (res) {
|
|
|
+ emit('confirmDialog');
|
|
|
+ } else {
|
|
|
+ Dialog.toast({ content: '请正确输入房间密码', type: 'error' });
|
|
|
+ }
|
|
|
+ }
|
|
|
};
|
|
|
const handleOnChange = () => {};
|
|
|
|
|
@@ -171,7 +182,7 @@
|
|
|
border-bottom-width: 1px;
|
|
|
border-bottom-color: rgba(255, 255, 255, 0.1);
|
|
|
}
|
|
|
- .user_name {
|
|
|
+ .pass_container {
|
|
|
width: 100%;
|
|
|
height: 1.11rem;
|
|
|
padding: 0 0.56rem;
|
|
@@ -180,6 +191,8 @@
|
|
|
line-height: 1.11rem;
|
|
|
margin: 0.56rem 0;
|
|
|
position: relative;
|
|
|
+ overflow: hidden;
|
|
|
+ display: flex;
|
|
|
.limitNum {
|
|
|
position: absolute;
|
|
|
right: 0.64rem;
|
|
@@ -269,8 +282,9 @@
|
|
|
}
|
|
|
}
|
|
|
.otp-input {
|
|
|
- width: 80px;
|
|
|
- height: 60px;
|
|
|
+ width: 100%;
|
|
|
+ min-height: 60px;
|
|
|
+ line-height: 60px;
|
|
|
padding: 5px;
|
|
|
margin: 0 10px;
|
|
|
font-size: 22px;
|
|
@@ -278,6 +292,9 @@
|
|
|
background: rgba(46, 46, 46, 0.9);
|
|
|
text-align: center;
|
|
|
caret-color: #ed5d18;
|
|
|
+ &::placeholder{
|
|
|
+ font-size: 22px;
|
|
|
+ }
|
|
|
}
|
|
|
/* Background colour of an input field with value */
|
|
|
.otp-input.is-complete {
|