|
|
@@ -6,8 +6,7 @@ const room = ref(localStorage.getItem('ROOM') || '')
|
|
|
const url = ref(localStorage.getItem('URL') || '')
|
|
|
const props = defineProps<{ modelValue: string }>()
|
|
|
const err = computed(() => props.modelValue)
|
|
|
-const emit = defineEmits<{
|
|
|
- (evt: 'update:modelValue', value: string): void
|
|
|
+const emit = defineEmits<{(evt: 'update:modelValue', value: string): void
|
|
|
(evt: 'loginBack', value: { name: string, room: string, url: string }): void
|
|
|
}>()
|
|
|
|
|
|
@@ -19,7 +18,7 @@ function titleEvent(type: string) {
|
|
|
window.$electron?.send(type)
|
|
|
}
|
|
|
|
|
|
-watch([name, room, url], ([_, __, ___], [_o, __o, ___o]) => {
|
|
|
+watch([ name, room, url ], ([ _, __, ___ ], [ _o, __o, ___o ]) => {
|
|
|
if (_ && __ && ___) emit('update:modelValue', '')
|
|
|
if (___ !== ___o) localStorage.setItem('URL', ___)
|
|
|
if (_ !== _o) localStorage.setItem('NAME', _)
|
|
|
@@ -29,29 +28,69 @@ watch([name, room, url], ([_, __, ___], [_o, __o, ___o]) => {
|
|
|
<template>
|
|
|
<div class="login">
|
|
|
<div class="login-title">
|
|
|
- <Icon name="min" :size="20" color="#fff" @click="titleEvent('minWin')" />
|
|
|
- <Icon name="close" :size="20" color="#fff" @click="titleEvent('closeWin')" />
|
|
|
+ <Icon
|
|
|
+ name="min"
|
|
|
+ :size="20"
|
|
|
+ color="#fff"
|
|
|
+ @click="titleEvent('minWin')"
|
|
|
+ />
|
|
|
+ <Icon
|
|
|
+ name="close"
|
|
|
+ :size="20"
|
|
|
+ color="#fff"
|
|
|
+ @click="titleEvent('closeWin')"
|
|
|
+ />
|
|
|
</div>
|
|
|
<div class="login-content">
|
|
|
<div class="login-content-left" />
|
|
|
- <div class="login-content-right" @keydown.enter="login">
|
|
|
+ <div
|
|
|
+ class="login-content-right"
|
|
|
+ @keydown.enter="login"
|
|
|
+ >
|
|
|
<p>Hello, 欢迎登录</p>
|
|
|
<div>
|
|
|
- <Icon name="server" :size="25" />
|
|
|
- <input v-model="url" type="text" placeholder="mqtts://*******" maxlength="50">
|
|
|
+ <Icon
|
|
|
+ name="server"
|
|
|
+ :size="25"
|
|
|
+ />
|
|
|
+ <input
|
|
|
+ v-model="url"
|
|
|
+ type="text"
|
|
|
+ placeholder="mqtts://*******"
|
|
|
+ maxlength="50"
|
|
|
+ >
|
|
|
</div>
|
|
|
<div>
|
|
|
- <Icon name="username" :size="25" />
|
|
|
- <input v-model="room" type="text" placeholder="请输入房间" maxlength="20">
|
|
|
+ <Icon
|
|
|
+ name="username"
|
|
|
+ :size="25"
|
|
|
+ />
|
|
|
+ <input
|
|
|
+ v-model="room"
|
|
|
+ type="text"
|
|
|
+ placeholder="请输入房间"
|
|
|
+ maxlength="20"
|
|
|
+ >
|
|
|
</div>
|
|
|
<div>
|
|
|
- <Icon name="password" :size="25" />
|
|
|
- <input v-model="name" type="text" placeholder="请输入名称" maxlength="20">
|
|
|
+ <Icon
|
|
|
+ name="password"
|
|
|
+ :size="25"
|
|
|
+ />
|
|
|
+ <input
|
|
|
+ v-model="name"
|
|
|
+ type="text"
|
|
|
+ placeholder="请输入名称"
|
|
|
+ maxlength="20"
|
|
|
+ >
|
|
|
</div>
|
|
|
<span>{{ err }}</span>
|
|
|
<div>
|
|
|
- <button :disabled="!name && !room && !url && !url.includes('mqtts://')"
|
|
|
- :class="{ resetStyle: name && room && url && url.includes('mqtts://') }" @click="login">
|
|
|
+ <button
|
|
|
+ :disabled="!name && !room && !url && !url.includes('mqtts://')"
|
|
|
+ :class="{ resetStyle: name && room && url && url.includes('mqtts://') }"
|
|
|
+ @click="login"
|
|
|
+ >
|
|
|
加入
|
|
|
</button>
|
|
|
</div>
|