feat: There is no way the, weblink 免登陆

This commit is contained in:
super_liu
2022-06-08 16:20:57 +08:00
parent 28dd02f406
commit 9b63fdc306
6 changed files with 24134 additions and 6887 deletions
+16642 -21
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -221,7 +221,7 @@ export default {
&& this.$route.name !== 'loginStandDetails' && this.$route.name !== 'error'
&& this.$route.name !== 'phoneHome'&& this.$route.name !== 'databaseSearch'
&& this.$route.name !== 'standDynamics' && this.$route.name !== 'domesticStand'
&& this.$route.name !== 'domesticDetails'
&& this.$route.name !== 'domesticDetails' && this.$route.name !== 'LoginVerifyPhone'
&& this.$route.name !== 'OtherStandardExternalDetails' && this.$route.name !== 'OtherStandardExternalDetails') {
this.isBoolean = true
} else {
+11 -2
View File
@@ -65,6 +65,7 @@ import VConsole from 'vuex'
import isMobile from "./store/isMobile";
// 路由拦截
router.beforeEach(function (to, from, next) {
debugger
let fromName = from.name
if(fromName === undefined || fromName === null){
@@ -72,7 +73,8 @@ router.beforeEach(function (to, from, next) {
}
let toName = to.name
if (toName === 'CheckPage' || toName === 'loginStandDetails' || toName === 'error') {
if (toName === 'CheckPage' || toName === 'loginStandDetails' || toName === 'error'
|| toName === 'LoginVerifyPhone') {
next()
return
}
@@ -145,7 +147,13 @@ router.beforeEach(function (to, from, next) {
// 单点登录
/** 判断是不是在手机端操作 */
if (isMobile()) {
if(toName === 'processCenter'){
if(toName === 'phoneHome'){
if((token === null || token === '' ) && toName !== 'Login'){
next('/loginVerifyPhone')
}else {
next()
}
}else if(toName === 'processCenter'){
// hwh5.close();
//关闭当前窗口
let userAgent = navigator.userAgent;
@@ -161,6 +169,7 @@ router.beforeEach(function (to, from, next) {
//如果是微信打开,关闭当前微信窗口
weixinClosePage()
}else {
if ((token === null || token === '' ) && toName !== 'Login') {
if(toName !== 'phoneIndex'){
localStorage.removeItem("param");
+157
View File
@@ -0,0 +1,157 @@
<!-- 长城项目 登录页 -->
<template>
</template>
<script>
import { mapMutations, mapActions } from 'vuex'
import axios from 'axios'
import util from 'util'
import { get_verify_by_instance,loginIdm,getMenu,checkPageNoEncryption } from 'api/process'
import { ssoLoginUrlDev,ssoLogoutUrlDev,ssoLoginUrl,webLoginType,devWebUrl } from '@/sysConfig'
import HWH5 from '../../api/hwh5-cloudonline.js';
export default {
name: 'loginVerifyPhone',
data () {
return {
username: this.$store.state.laws_urm || '', // 用户名
password: this.$store.state.laws_prm || '', // 密码
loading: false,
isRemember: false, // 记住密码
showIETips: false
}
},
methods: {
logout(){
this.$store.dispatch('logout')
this.$alert('您没有系统访问权限,请联系管理员进行授权', '提示', {
confirmButtonText: '确定',
type: 'warning',
showClose: false,
showCancelButton: false,
}).then(() => {
HWH5.close()
})
},
/**
* @description: 获取菜单logout
* @author: chenxiaoxi
* @date: 2018/11/11 13:42:14
*/
getMenu () {
return new Promise((resolve, reject) => {
this.$http.get('sarUser/user/menu', {
userId: this.$store.getters.userInfo.userId,
}, {
_this: this,
}, res => {
if (res.ok) {
resolve(res.data)
}
}, e => {
reject(e)
})
})
},
loginNew (res) {
let Base64 = require('js-base64').Base64
let userInfoStr = Base64.decode(res.data)
let userInfo2 = decodeURIComponent(userInfoStr)
let userInfoObj = JSON.parse(userInfo2)
userInfoObj.userId = userInfoObj.usid
window.sessionStorage.setItem('userInfoObj', userInfoObj); // del
this.setToken(userInfoObj.token) // vuex存储token
let userInfo = {}
for (let key in userInfoObj) {
if (key !== 'uname') {
userInfo[key] = userInfoObj[key]
} else {
userInfo.uName = userInfoObj[key]
}
}
this.setUserInfo(JSON.stringify((userInfo)))
// this.resetTime()
// 获取用户菜单
window.sessionStorage.setItem('userInfo', userInfo); // del
this.getMenu().then((menuList) => {
let hasHomeMenu = false
menuList.map((menuItem) => {
if (menuItem.id === 'asdfadf') {
hasHomeMenu = true
}
})
window.sessionStorage.setItem('hasHomeMenu', hasHomeMenu); // del
window.sessionStorage.setItem('menuList', menuList); // del
if (hasHomeMenu) {
this.setMenu(JSON.stringify(menuList)).then(res => {
this.$router.push('phoneHome')
}, e => {
this.logout()
})
} else {
this.logout()
}
})
},
...mapMutations(['setToken', 'setUserInfo', 'resetTime', 'rememberPwd', 'setJESSCookie']),
...mapActions(['setMenu'])
},
computed: {
},
mounted () {
debugger
HWH5.getAuthCode().then(data => {
console.log(data)
if(data){
let code = data.code
console.log(code)
let greeting_cards = "standards regulations"
axios.request({
url: 'https://iftappwelink.foton.com.cn/devserver/welink/getIftappCodeByWelinkCode?code='+code+"&name=" + encodeURIComponent(greeting_cards),
method: 'post',
headers: {
"Content-Type": "application/json",
},
}).then(res => {
if(res.code){
let userName = res.data.access_token;
if(userName !== undefined && userName !== ""){
checkPageNoEncryption({
username: userName
}, {
_this: this
}).then(res => {
if (res.ok) {
this.loginNew(res)
} else {
if(res.respCode && res.respCode === 'r0011'){
this.logout()
}
}
})
}else {
// window.location.href = ssoLogoutUrlDev
}
}
})
}
}).catch(error => {
console.log('获取异常', error);
});
if (this.$store.state.laws_urm !== '') {
this.isRemember = true
}
const UA = navigator.userAgent.toLocaleLowerCase()
if (UA.match(/msie/) != null || UA.match(/trident/) != null) {
this.showIETips = true
}
}
}
</script>
<style lang="less" scoped>
</style>
+6
View File
@@ -108,6 +108,12 @@ const routes = [
component: () =>
import('@/pages/loginVerifyNoEncryption')
},
{
path: '/loginVerifyPhone',
name: 'LoginVerifyPhone',
component: () =>
import('@/pages/loginVerifyPhone')
},
// 跳转刷新页面
{
path: '/redirect',
+7317 -6863
View File
File diff suppressed because it is too large Load Diff