页面登录后自动跳转代码

<script>
function OnClose()
{
if(document.all.chkShow.checked == true)
{
document.cookie = "eccpopup=no";
}
else
{
document.cookie = "eccpopup=yes";
}

window.close();
}


function run()
{
var hiddenValue = document.getElementById("btn_HiddenValue");
var submitValue = document.getElementById("showNum");
var currentValue = parseInt(submitValue.innerHTML);
if(hiddenValue.value == 0)
{
window.location.href= ecclogin ;
return true;
}
currentValue = hiddenValue.value * 1 - 1;
document.getElementById("btn_HiddenValue").value=currentValue;
document.getElementById("showNum").innerHTML=currentValue;
if(hiddenValue.value==0)
{
window.location.href= ecclogin;
return true;
}
}

function redirectJump()
{
window.location.href=ecclogin;
}
window.setInterval("run();", 1000);



</script>
</head>

<body>
<form name='form1'>
<div class="tips_div" id="info" style="cursor:default;vertical-align:middle;margin:120px 380px">
<div class="tips_title">
<div class="left_title"><label resid="ecc_index_tips">系统提示:</label></div>
</div>
<div class="tips_content">
<ul>

<li><label resid="ecc_index.0001">可能由于以下的原因,系统需重新进行登录</label></li>
<li><label resid="ecc_index.0002">1、会话超时;</label></li>
<li><label resid="ecc_index.0003">2、无效的系统链接;</label></li>
<li><label resid="ecc_index.0004">3、未启动UDS单点登录或单点登录失效。</label></li>
<li><label resid="ecc_index.0005">由于MICI 信息中心子系统已整合到ECC系统中,故请登录ECC系统</label> <A href="http://ecc.app.com.cn" ><strong>http://ecc.app.com.cn</strong></A> <label resid="ecc_index.0006">进行访问。</label></li>
</ul>
</div>
<div class="tips_nowarn" >
<div class="f_left" >
<label resid="ecc_index.0007">系统将在</label><label id="showNum" style="color:red;">10</label><label resid="ecc_index.0008">秒后自动进入ECC登录页面</label>
</div>
<div class="f_right" >
<input type="hidden" id="btn_HiddenValue" value="10"/>
<input type="button" id="yes" resid="ecc_index.0009" value="立即登录" class="button" onClick="javascript:redirectJump();"/>
<input type="button" id="yes" resid="ecc_index.0010" value="关闭" class="button" οnclick="javascript:window.close();"/>
</div>
</div>
</div>
</form>
</body>
</html>

<SCRIPT LANGUAGE="javascript1.2">
<!--//
if (navigator.appName == 'Netscape')
var language = navigator.language;
else
var language = navigator.browserLanguage;
if (language.indexOf('en') > -1)
{
document.location.href = 'http://mim.zte.com.cn/MIMS/uiloader/login.html?lan=en';
}
else if (language.indexOf('zh') > -1)
{
document.location.href = 'http://mim.zte.com.cn/MIMS/uiloader/login.html?lan=zh';
}
else
{
document.location.href = 'http://mim.zte.com.cn/MIMS/uiloader/login.html?lan=zh';
}
// End -->
</script>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在Vue中实现登录后的页面有多种方式,以下是其中一种常见的方法: 1. 首先,你需要在Vue项目中安装`vue-router`,可以通过以下命令进行安装: ```bash npm install vue-router ``` 2. 在你的Vue项目中创建一个路由文件(通常命名为`router.js`或者`index.js`),并配置路由信息。在路由配置中,你可以使用`beforeEach`导航守卫来检查用户是否已登录。如果用户已登录,则允许页面,否则将用户重定向到登录页面。 ```javascript import Vue from 'vue'; import Router from 'vue-router'; import Home from './views/Home.vue'; import Login from './views/Login.vue'; Vue.use(Router); const router = new Router({ routes: [ { path: '/', name: 'home', component: Home, meta: { requiresAuth: true // 设置需要登录才能访问的页面 }, }, { path: '/login', name: 'login', component: Login, }, ], }); router.beforeEach((to, from, next) => { const isLoggedIn = ... // 根据你的登录状态判断用户是否已登录 if (to.matched.some(record => record.meta.requiresAuth) && !isLoggedIn) { next('/login'); // 如果需要登录才能访问的页面登录,则重定向到登录页 } else { next(); // 允许页面 } }); export default router; ``` 3. 在主Vue实例中引入路由配置,并将路由挂载到Vue实例中: ```javascript import Vue from 'vue'; import App from './App.vue'; import router from './router'; new Vue({ router, render: h => h(App), }).$mount('#app'); ``` 在上述代码中,`Home`组件是需要登录才能访问的页面,`Login`组件是登录页面。通过设置路由的`meta`字段中的`requiresAuth`为`true`,我们标记了需要登录才能访问的页面。在导航守卫中,我们检查用户的登录状态,如果未登录且访问的页面需要登录权限,则将用户重定向到登录页面。 当用户成功登录后,你可以使用Vue Router提供的`router.push()`方法来实现页面,例如: ```javascript // 登录成功后到首页 this.$router.push('/'); ``` 这样,当用户登录后,页面自动到首页。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值