Skip to content

Commit

Permalink
添加更换地址后自动更新快速机器人列表
Browse files Browse the repository at this point in the history
  • Loading branch information
HalcyonAlcedo committed Jul 7, 2024
1 parent 4aa3f2b commit 3c969b6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
15 changes: 12 additions & 3 deletions src/views/authentication/auth/LoginPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,19 @@ const server = ref(apiStore.baseUrl)
const dialog = ref(false)
const verifyMsg = ref('')
const rules = ref(value => /^((https|http|ftp|rtsp|mms)?:\/\/)[^\s]+/.test(value) || '错误的URL')
const childRef = ref(null)
const request = axios.create({
timeout: 1000
timeout: 10000
});
const updateChild = () => {
if (childRef.value) {
childRef.value.getUserList();
}
};
const verifyServer = (url:string) => {
if (!url) {
if (/^((https|http|ftp|rtsp|mms)?:\/\/)[^\s]+/.test(server.value)) {
Expand All @@ -36,6 +44,7 @@ const verifyServer = (url:string) => {
}
verifyMsg.value = '验证通过'
dialog.value = false
updateChild()
} else {
verifyMsg.value = `验证失败: ${response.data.error || '未知错误'}`
dialog.value = true
Expand Down Expand Up @@ -78,7 +87,7 @@ verifyServer(apiStore.baseUrl)
<!---Left Part Logo -->

<!---Left Part Form-->
<AuthLogin />
<AuthLogin ref="childRef" />
<!---Left Part Form-->
</v-card-text>
</v-card>
Expand Down
5 changes: 4 additions & 1 deletion src/views/authentication/authForms/AuthLogin.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { ref, onMounted, defineExpose } from 'vue';
import Social from '@/assets/images/auth/social.svg';
import { useAuthStore } from '@/stores/auth';
import { Form } from 'vee-validate';
Expand Down Expand Up @@ -97,6 +97,9 @@ const getBot = () => {
onMounted(() => {
getUserList()
})
defineExpose({
getUserList,
})
</script>

<template>
Expand Down

0 comments on commit 3c969b6

Please sign in to comment.