- 根因:public/index.html head 内同步引用 pv.sohu.com/cityjson, 浏览器需阻塞等待该外部脚本加载完成(该服务已不稳定,经常长时间挂起), 是登录页打开慢的主因 - ip 参数整链路为死代码:login.vue 取 returnCitySN["cip"] → store handleLogin 透传 → api login() 中根本未使用; 后端也无一处消费 ip 参数(smart-campus 脚手架遗留) - 删除 index.html 脚本引用与 login.vue / store 中的 ip 取值透传
This commit is contained in:
@@ -5,8 +5,6 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||
<!--获取当前ip的js依赖-->
|
||||
<script src="http://pv.sohu.com/cityjson?ie=utf-8"></script>
|
||||
<title>freedom</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -34,10 +34,10 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import LoginForm from '_c/login-form'
|
||||
import {mapActions} from 'vuex'
|
||||
import LoginForm from '_c/login-form'
|
||||
import { mapActions } from 'vuex'
|
||||
|
||||
export default {
|
||||
export default {
|
||||
components: {
|
||||
LoginForm
|
||||
},
|
||||
@@ -46,11 +46,9 @@
|
||||
'handleLogin',
|
||||
'getUserInfo'
|
||||
]),
|
||||
handleSubmit({username, password}) {
|
||||
// returnCitySN 由 index.html 引用的第三方脚本定义,可能加载失败,需兜底
|
||||
var ip = (typeof returnCitySN !== 'undefined' && returnCitySN) ? returnCitySN["cip"] : ''
|
||||
handleSubmit ({ username, password }) {
|
||||
this.$refs.loginForm.loading = true
|
||||
this.handleLogin({username, password, ip}).then(res => {
|
||||
this.handleLogin({ username, password }).then(res => {
|
||||
setTimeout(() => {
|
||||
this.$refs.loginForm.loading = false
|
||||
this.$router.push({
|
||||
@@ -68,7 +66,7 @@
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
Reference in New Issue
Block a user