feat:地址配置

This commit is contained in:
houjunxiang
2026-01-06 15:11:31 +08:00
parent 6d1a0950f2
commit 8ec33a963c
8 changed files with 80 additions and 28 deletions

View File

@@ -11,6 +11,9 @@
<uni-forms-item v-if="showContent" label="app更新地址">
<uni-easyinput v-model="upgradeBaseUrl" placeholder="请输入"></uni-easyinput>
</uni-forms-item>
<uni-forms-item v-if="showContent" label="webSocket地址">
<uni-easyinput v-model="webSocketUrl" placeholder="请输入"></uni-easyinput>
</uni-forms-item>
</uni-forms>
<u-button type="primary" @click="submitForm">保存</u-button>
<u-button v-if="showContent" type="primary" @click="clearCache">清除缓存</u-button>
@@ -24,6 +27,7 @@ import { ref, computed, onMounted } from 'vue'
const baseUrl = ref('')
const tenantId = ref('')
const upgradeBaseUrl = ref('')
const webSocketUrl = ref('')
const clickCount = ref(0) // 初始化点击次数为0
const threshold = 5 // 设置点击次数的阈值
const thresholdTime = 2 // 设置连续点击的时间阈值(秒)
@@ -36,9 +40,10 @@ const showContent = computed(() => {
// 页面加载时从缓存中读取已保存的配置
onMounted(() => {
baseUrl.value = uni.getStorageSync('base_url')
tenantId.value = uni.getStorageSync('tenant_id')
baseUrl.value = uni.getStorageSync('baseUrl')
tenantId.value = uni.getStorageSync('tenantId')
upgradeBaseUrl.value = uni.getStorageSync('upgradeBaseUrl')
webSocketUrl.value = uni.getStorageSync('webSocketUrl')
})
// 清除缓存方法
@@ -66,9 +71,10 @@ function submitForm() {
})
return
}
uni.setStorageSync('base_url', baseUrl.value)
uni.setStorageSync('tenant_id', tenantId.value)
uni.setStorageSync('baseUrl', baseUrl.value)
uni.setStorageSync('tenantId', tenantId.value)
uni.setStorageSync('upgradeBaseUrl', upgradeBaseUrl.value)
uni.setStorageSync('webSocketUrl', webSocketUrl.value)
uni.showToast({
title: '保存成功',
icon: 'none'