diff --git a/src/api/user.js b/src/api/user.js index f242758..0287f82 100644 --- a/src/api/user.js +++ b/src/api/user.js @@ -8,6 +8,15 @@ export function login(data) { }) } + +export function sgccLogin(data) { + return request({ + url: '/auth/sgccLogin', + method: 'post', + data + }) +} + export function getInfo(token) { return request({ url: '/vue-element-admin/user/info', @@ -79,4 +88,4 @@ export function logWarn(params) { method: 'post', data: params }) -} \ No newline at end of file +} diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index 672dbe1..ad8f110 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -68,7 +68,8 @@ export default { }, async logout() { await this.$store.dispatch('user/logout') - this.$router.push(`/login?redirect=${this.$route.fullPath}`) + window.location.href = 'http://sgwpdm.ah.sgcc.com.cn/'; + // this.$router.push(`/login?redirect=${this.$route.fullPath}`) } } } diff --git a/src/router/index.js b/src/router/index.js index 0857401..5f0f8a8 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -54,11 +54,11 @@ export const constantRoutes = [ component: () => import('@/views/login/ywgllogin'), hidden: true }, - { - path: '/isclogin', - component: () => import('@/views/isclogin/index'), - hidden: true - }, + // { + // path: '/isclogin', + // component: () => import('@/views/isclogin/index'), + // hidden: true + // }, { path: '/sso', name: 'sso', diff --git a/src/store/modules/user.js b/src/store/modules/user.js index f5d32c2..e0613d1 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -1,4 +1,4 @@ -import { login, logout, getInfo } from '@/api/user' +import { login, logout, getInfo ,sgccLogin} from '@/api/user' import {getToken, setToken, removeToken, setUs, setIscId, getIscId} from '@/utils/auth' import router, { resetRouter } from '@/router' import {encryptData,decryptData} from '@/utils/test'; @@ -57,7 +57,33 @@ const actions = { }) }) }, + sgccLogin({ commit }, userInfo) { + const { username, password ,token} = userInfo + console.log(userInfo) + console.log(token) + return new Promise((resolve, reject) => { + sgccLogin({ username: username, password: password,token: token }).then(response => { + const data = response.data + commit('SET_TOKEN', data.access_token) + setToken(data.access_token) + setUs(data.us)// 存储用户信息到缓存 + setIscId(data.iscUserId)// 存储用户信息到缓存 + commit('SET_ROLES', data.us.role) + commit('SET_NAME', data.us.userName) + if(JSON.parse(data.us).nickName){ + sessionStorage.setItem('nickName',encryptData(JSON.parse(data.us).nickName)) + } + if(JSON.parse(data.us).roleName){ + sessionStorage.setItem('roleName',encryptData(JSON.parse(data.us).roleName)) + } + resolve() + }).catch(error => { + window.location.href = 'http://sgwpdm.ah.sgcc.com.cn/'; + reject(error) + }) + }) + }, ssoLogin({ commit }, userInfo) { const { access_token, us } = userInfo const { sysUser } = us @@ -126,11 +152,9 @@ const actions = { commit('SET_TOKEN', '') commit('SET_ROLES', []) removeToken() - resetRouter() + //resetRouter() let iscId=getIscId(); - //window.location.href = 'http://iscssotest.ah.sgcc.com.cn/isc_sso/logout?iscUserId='+iscId+'&service=http://27.50.49.56:8000/zhgd-ht/#/login'; - // reset visited views and cached views - // to fixed https://github.com/PanJiaChen/vue-element-admin/issues/2485 + dispatch('tagsView/delAllViews', null, { root: true }) resolve() }).catch(error => { diff --git a/src/utils/request.js b/src/utils/request.js index 4bde794..be52577 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -156,8 +156,8 @@ service.interceptors.response.use( type: 'warning' }).then(() => { let iscId=getIscId(); - // window.location.href = 'http://iscssotest.ah.sgcc.com.cn/isc_sso/logout?iscUserId='+iscId+'&service=http://27.50.49.56:8000/zhgd-ht/#/login'; - router.push({ path: '/login' }) + window.location.href = 'http://sgwpdm.ah.sgcc.com.cn/'; + // router.push({ path: '/login' }) }) return } diff --git a/src/views/basic/quality/index.vue b/src/views/basic/quality/index.vue index b7c395d..1123009 100644 --- a/src/views/basic/quality/index.vue +++ b/src/views/basic/quality/index.vue @@ -221,8 +221,8 @@ export default { }, phoneFormatter(row, column, cellValue, index){ if(row.teamLeaderPhone){ - // let teamLeaderPhone = decryptData(row.teamLeaderPhone).replace(/\/g, ''); - const formatPhone = desensitize(row.teamLeaderPhone,'phone').replace(/\/g, ''); + let teamLeaderPhone = decryptData(row.teamLeaderPhone).replace(/\/g, ''); + const formatPhone = desensitize(teamLeaderPhone,'phone').replace(/\/g, ''); return formatPhone; }else{ return ''; @@ -261,7 +261,9 @@ export default { const currentTeam = this.teamList.find(item => item.id === val) this.temp.teamName = currentTeam.name this.temp.teamLeader = currentTeam.teamLeader - this.temp.teamLeaderPhone = currentTeam.teamLeaderPhone + let teamLeaderPhone = decryptData(currentTeam.teamLeaderPhone).replace(/\/g, ''); + const formatPhone = desensitize(teamLeaderPhone,'phone').replace(/\/g, ''); + this.temp.teamLeaderPhone = formatPhone }, getList() { this.listLoading = true diff --git a/src/views/login/index.vue b/src/views/login/index.vue index 8152e0d..5aaa7cd 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -1,337 +1,288 @@ + - - - diff --git a/src/views/login/index_back.vue_back b/src/views/login/index_back.vue_back new file mode 100644 index 0000000..8152e0d --- /dev/null +++ b/src/views/login/index_back.vue_back @@ -0,0 +1,337 @@ + + + + + + + diff --git a/src/views/login/ywgllogin.vue b/src/views/login/ywgllogin.vue index 9bf2aa9..769cfd9 100644 --- a/src/views/login/ywgllogin.vue +++ b/src/views/login/ywgllogin.vue @@ -238,32 +238,32 @@ export default { getLoginByNameAndTokenJ() { console.log(window.location.href); let url=window.location.href.split("?"); - let tickets=''; + let tokens=''; if(url.length>1){ let params=url[1].split("#"); if(params.length>0){ params=params[0].split("="); if(params.length>1){ - tickets=params[1] + tokens=params[1] } } } - if(!tickets){ - tickets = this.$route.query.ticket; + if(!tokens){ + tokens = this.$route.query.token; } - console.log(tickets) + console.log(tokens) //调用登录的接口 - if (tickets) { + if (tokens) { //转圈圈,不要看到登陆页面,无感体验 this.loading = true; let loginForm = { - ticket:tickets, + token:tokens, loginType: 333 }; console.log(loginForm); console.log("开始登录..") //执行另一套登录操作 - this.$store.dispatch('user/login', loginForm).then(() => { + this.$store.dispatch('user/sgccLogin', loginForm).then(() => { console.log("登录成功了..") this.$router.replace({ path:"/#/home" || "/" }).catch(()=>{}); this.loading = false @@ -275,6 +275,7 @@ export default { // this.$message.error("用户token为空"); } else { + window.location.href = 'http://sgwpdm.ah.sgcc.com.cn/'; // console.log("tick为空..") } }, diff --git a/vue.config.js b/vue.config.js index d536b56..bbbf8cf 100644 --- a/vue.config.js +++ b/vue.config.js @@ -24,7 +24,7 @@ module.exports = { * In most cases please use '/' !!! * Detail: https://cli.vuejs.org/config/#publicpath */ - publicPath: process.env.ENV === 'production' ? '/zhgd-ht/' : '/', + publicPath: process.env.ENV === 'production' ? '/zhgd-ht/' : '/zhgd-ht/', outputDir: 'dist', assetsDir: 'static', lintOnSave: false, @@ -37,7 +37,7 @@ module.exports = { [process.env.VUE_APP_BASE_API]: { // target: `http://36.33.26.201:19090/zhgd`, // target: `http://27.50.49.56:8000/zhgd`, - target: `http://192.168.0.14:13030/zhgd`, + target: `http://192.168.0.38:13030/zhgd`, // target: `http://11.158.16.194:21624/zhgd`, changeOrigin: true, pathRewrite: {