refactor(前端): 优化首页刷新数据逻辑
部署开发环境 / deploy-dev (push) Successful in 2m2s

This commit is contained in:
2026-06-03 13:55:20 +08:00
parent 026ba10bb7
commit a5dbbc4163
+9 -5
View File
@@ -21,7 +21,7 @@ const updateTime = () => {
const fetchInfo = async () => {
if (!input.value) return
loading.value = true
try {
const res = await axios.get('/api/token/info', {
params: {token: input.value}
@@ -29,14 +29,18 @@ const fetchInfo = async () => {
result.value = res.data.result
token.value = input.value
updateTime()
// ElMessage({message: '刷新成功', type: 'success', duration: 1500})
} catch {
ElMessage({message: 'Token输入错误', type: 'error', duration: 2000})
} finally {
loading.value = false
}
}
const refresh = async () => {
loading.value = true
await fetchInfo()
loading.value = false
ElMessage({message: '查询成功', type: 'success', duration: 1500})
}
const inputChange = () => {
if (input.value) fetchInfo()
}
@@ -83,7 +87,7 @@ const statCards = [
</el-icon>
</template>
</el-input>
<el-button type="primary" size="large" @click="fetchInfo" :loading="loading">
<el-button type="primary" size="large" @click="refresh" :loading="loading">
查询
</el-button>
<el-button type="success" size="large" @click="showAddDataDialog = true">