feat:登录页添加logo长按事件

master
黄伟杰 1 week ago
parent 818f7737e7
commit dbf5a402a6

@ -3,7 +3,7 @@
<view class="login-container" :style="containerStyle">
<!-- <NavBar title=" " /> -->
<!-- Logo区域 -->
<view class="logo-section">
<view class="logo-section" @longpress="onLogoLongPress">
<view class="logo-wrapper">
<image :src="globalConfig.appInfo.logo" mode="aspectFit" class="logo-img"></image>
</view>
@ -38,6 +38,20 @@
</view>
</view>
</view>
<uni-popup ref="serverPopup" type="dialog">
<uni-popup-dialog
mode="input"
type="info"
:title="t('setting.serverAddress')"
:content="t('setting.serverAddressHint')"
:placeholder="t('setting.serverAddressPlaceholder')"
:value="serverAddress"
:confirmText="t('functionCommon.save')"
:cancelText="t('common.close')"
@confirm="handleServerAddressSave"
>
</uni-popup-dialog>
</uni-popup>
</view>
</template>
@ -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;

Loading…
Cancel
Save