JLBA202505130001_关于吉林银行新建AI智能培训系统的需求_应华为商店要求,登录页增加双击返回桌面

This commit is contained in:
田岩
2026-01-22 13:48:12 +08:00
parent f56f70e91f
commit 1167dda609
+26 -5
View File
@@ -162,7 +162,6 @@
}
})
.catch((res) => {
common.hideLoading();
if (res.rtnCode === '1001') {
common.msg('账号或密码错误,如忘记密码,请去统一身份认证平台修改。');
@@ -196,14 +195,36 @@
}
});
});
// 跳进了登录页,禁止返回操作
onBackPress(() => back_state.value);
const lastBackTime = ref(0);
// 跳进了登录页,返回操作细化
onBackPress(({ from }) => {
// #ifdef APP-PLUS
if (from === 'backbutton') {
//点击按钮返回
const now = new Date().getTime();
// 判断是否在2秒内双击了返回键
if (now - lastBackTime.value < 2000) {
// 双击返回:退出App(uniapp 官方推荐的退出方式)
plus.runtime.quit(); // 仅App端有效,H5端无此API
return true; // 阻止默认返回行为
} else {
// 单次点击:提示用户再按一次退出,不返回首页
plus.nativeUI.toast('再按一次退出应用', {
duration: 'short' // 系统短时长(约2秒),和系统提示一致
});
// 更新第一次点击的时间戳
lastBackTime.value = now;
return true;
}
}
// #endif
return back_state.value;
});
</script>
<style lang="scss" scoped>
.fl2 {
flex: 2;
}
.fl8 {
flex: 4;
@@ -211,7 +232,7 @@
.ime-div {
height: v-bind(imeHeight);
width: 100%;
transition: height .2s ease;
transition: height 0.2s ease;
}
.bottom_login_div {
padding: 0 58rpx;