diff --git a/src/pages/login.vue b/src/pages/login.vue index 8673102..ef20bea 100644 --- a/src/pages/login.vue +++ b/src/pages/login.vue @@ -3,7 +3,7 @@ - + @@ -38,6 +38,20 @@ + + + + @@ -45,12 +59,16 @@ import modal from '@/plugins/modal' import { getCodeImg } from '@/api/login' import { computed, ref } from "vue"; +import { useI18n } from 'vue-i18n' import config from '@/config.js' import useUserStore from '@/store/modules/user' import NavBar from '@/components/common/NavBar.vue' import { getFirstTabBarPath } from '@/utils/permissionMenu' +import { SERVER_BASE_URL_STORAGE_KEY, getBaseUrl } from '@/utils/request' +import { removeToken } from '@/utils/auth' const userStore = useUserStore() +const { t } = useI18n() const codeUrl = ref(""); const captchaEnabled = ref(false); const statusBarHeight = ref(uni.getSystemInfoSync?.().statusBarHeight || 0) @@ -66,6 +84,43 @@ const loginForm = ref({ uuid: '' }); +const serverPopup = ref(null) +const serverAddress = ref(getBaseUrl()) + +function onLogoLongPress() { + setTimeout(() => { + uni.hideToast() + uni.vibrateShort() + serverPopup.value?.open() + }, 2000) +} + +function handleServerAddressSave(value) { + const nextAddress = value.trim() + if (!nextAddress) { + uni.showToast({ + title: t('setting.serverAddressRequired'), + icon: 'none', + duration: 1500 + }) + return false + } + uni.setStorageSync(SERVER_BASE_URL_STORAGE_KEY, nextAddress) + serverAddress.value = nextAddress + uni.showToast({ + title: t('setting.serverAddressSaved'), + icon: 'none', + duration: 1200 + }) + removeToken() + setTimeout(() => { + uni.reLaunch({ + url: '/pages/login' + }) + }, 1200) + return true +} + function getCode() { getCodeImg().then(res => { captchaEnabled.value = res.captchaEnabled === undefined ? true : res.captchaEnabled @@ -159,6 +214,8 @@ page { padding-top: 0; display: flex; justify-content: center; + position: relative; + z-index: 1; .logo-wrapper { width: 160rpx;