朱思禹提交:1.添加统一认证逻辑;2.修改主题部分颜色

init
Administrator 4 years ago
parent 764e6e2831
commit 1021171f22

@ -0,0 +1,58 @@
var Q=require('q');
export default function asyncLoadJs (url) {
return Q.Promise((resolve, reject) => {
let srcArr = document.getElementsByTagName("script");
let hasLoaded = false;
for (let i=0;i<srcArr.length;i++){//判断当前js是否加载上
hasLoaded = srcArr[i].src === url;
}
if (hasLoaded) {
resolve();
return;
}
let script = document.createElement('script')
script.type = 'text/javascript';
script.src = url;
document.body.appendChild(script);
script.onload = () => {
resolve();
}
script.onerror = () => {
reject();
}
})
}
export function loadCss(url){
let css = document.createElement('link');
css.href = url;
css.rel = 'stylesheet';
css.type = 'text/css';
document.head.appendChild(css);
}
export function loadMineMapJs () {
//加载js
return Q.Promise((resolve, reject) => {
asyncLoadJs("../../../js/jquery.js")
.then(() => {
return asyncLoadJs("../../../js/jsencrypt.min.js")
})
.then(() => {
return asyncLoadJs("../../../js/jquery.cookie.js")
})
.then(() => {
return asyncLoadJs("../../../js/base-config.js")
})
.then(() => {
return asyncLoadJs("../../../js/sso.js")
})
.then(() => {
resolve()
})
.catch(err => {
reject(err)
})
})
}

@ -32,7 +32,6 @@
import {Button,Icon,Input} from 'ant-design-vue'
import StaticParams from '../../../global-llibs/staticParams'
import InterfaceConfig from '../../../commonInterface/interfaceConfig'
// import Base64 from '../../../global-llibs/base64'
import JSEncrypt from 'jsencrypt'
export default {
name: "Login",
@ -88,48 +87,68 @@
param.pwd = pass;
}
this.InterfaceConfig.callInterface([{
url:url,
params:param,
method:'POST',
isTestLogin:false,
if(this.sso_flag === "2"){
let _this = this;
let sso = new SSO();
sso.submitForm(name, pass, function(data) {
//data
console.log(data);
if (data.success === true) {
//
_this.gotoMain(data);
} else {
_this.tips = data.info;
}
});
}else{
this.InterfaceConfig.callInterface([{
url:url,
params:param,
method:'POST',
isTestLogin:false,
}],(result)=>{
if (result[0].status === 200){
let data = result[0].data;
if (data.success === true){
this.Cookie.set("person_id",data.person_id);
this.Cookie.set("identity_id",data.identity_id);
this.BaseConfig.userInfo.identity_id_cookie = data.identity_id;
this.BaseConfig.userInfo.person_id_cookie = data.person_id;
this.BaseConfig.userInfo.identity_id = data.identity_id;
this.BaseConfig.userInfo.person_id = data.person_id;
this.InterfaceConfig.callInterface([{
url:InterfaceConfig.getValueByKey.url,
params:{key:'common.server.location'},
method:InterfaceConfig.getValueByKey.method,
isTestLogin:InterfaceConfig.getValueByKey.isTestLogin
}],(res)=>{
if (res[0].status === 200){
let env = res[0].data;
this.BaseConfig.pt_type = env["common.server.location"];
window.pt_type = env["common.server.location"]
this.BaseConfig.ConfigFn.setParamsValue();
this.BaseConfig.ConfigFn.getPersonInfo_I();
let interval = setInterval(()=>{
if (window.person_info_my){
clearInterval(interval);
this.$router.replace('mainPlatform')
}
},500)
}
})
}else{
this.tips = data.info;
}],(result)=>{
if (result[0].status === 200){
let data = result[0].data;
if (data.success === true){
this.gotoMain(data);
}else{
this.tips = data.info;
}
}
}
})
})
}
}
},
gotoMain:function(data){
console.log("登录成功")
this.Cookie.set("person_id",data.person_id);
this.Cookie.set("identity_id",data.identity_id);
this.BaseConfig.userInfo.identity_id_cookie = data.identity_id;
this.BaseConfig.userInfo.person_id_cookie = data.person_id;
this.BaseConfig.userInfo.identity_id = data.identity_id;
this.BaseConfig.userInfo.person_id = data.person_id;
this.InterfaceConfig.callInterface([{
url:InterfaceConfig.getValueByKey.url,
params:{key:'common.server.location'},
method:InterfaceConfig.getValueByKey.method,
isTestLogin:InterfaceConfig.getValueByKey.isTestLogin
}],(res)=>{
if (res[0].status === 200){
let env = res[0].data;
this.BaseConfig.pt_type = env["common.server.location"];
window.pt_type = env["common.server.location"]
this.BaseConfig.ConfigFn.setParamsValue();
this.BaseConfig.ConfigFn.getPersonInfo_I();
let interval = setInterval(()=>{
if (window.person_info_my){
clearInterval(interval);
this.$router.replace('mainPlatform')
}
},500)
}
})
}
}
}

@ -11,10 +11,10 @@ import './themeParams.scss';
import vuescroll from "vuescroll";//引入vuescroll
import "vuescroll/dist/vuescroll.css";//引入vuescroll样式
import router from '../../router/router';
import axiosConfig from '../../global-llibs/axios-config';
import BaseConfig from '../../global-llibs/base-config';
import InterfaceConfig from '../../commonInterface/interfaceConfig';
import Cookie from '../../global-llibs/cookie';
import BaseConfig from '../../global-llibs/base-config';
import axiosConfig from '../../global-llibs/axios-config';
const MyIcon = Icon.createFromIconfontCN({
scriptUrl: '//at.alicdn.com/t/font_2679650_fwz8i0ntate.js', // 在 iconfont.cn 上生成
});
@ -26,9 +26,37 @@ Vue.component('my-icon', MyIcon)
Vue.component('vueScroll', vuescroll)
Vue.config.productionTip = false
Vue.prototype.RSALogin = false;
Vue.prototype.isTestLogin = false;
Vue.prototype.PUBLIC_KEY = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCi0thPP5lZbBp1zWGhHLnEkAcXeBVkz4SW/7grZWdsCa4QVjT/YzbLE8Lj8v2XbrOIcrkCz4AZPrM9n9Vt7nizwTULVypBkhL4cOHbAWahtbEkgVGLkb3Jk/pvO+R24pllfkOeteo82FnR1fCrx+/+Va6il/0VggzhpDKEcBbmawIDAQAB'
// let sso ="";
function testSSO(to,from,next){
import {loadMineMapJs} from './loadResources';
let loadedMineMapJs = false;//是否加载完js
let sso ="";
function testSSO(to,from,next) {
if (sso === "2"){//接入统一认证
if (!loadedMineMapJs) {//未加载js
loadMineMapJs().then(() => {
loadedMineMapJs = true;
});
let interval = setInterval(()=>{
if(loadedMineMapJs){
clearInterval(interval);
testLogin(to,from,next)
}
},100);
}else {
if (Vue.prototype.isTestLogin === false){
testLogin(to,from,next)
}else{
testPersonInfo(to,from,next)
}
}
}else{//未接入统一认证
testPersonInfo(to,from,next)
}
}
function testPersonInfo(to,from,next) {
let person_id = Cookie.get('person_id');
if (!person_id || person_id ===''){//没有用户信息 进入登录
if (to.name === 'login'){
@ -37,67 +65,89 @@ function testSSO(to,from,next){
next({replace:true,name:'login'});
}
}else{
if (!window.person_info_my){//没有人员具体信息
BaseConfig.userInfo.identity_id_cookie = Cookie.get('identity_id');
BaseConfig.userInfo.person_id_cookie = person_id;
BaseConfig.userInfo.identity_id = Cookie.get('identity_id');
BaseConfig.userInfo.person_id = person_id;
axiosConfig.callInterface([{
url:InterfaceConfig.getValueByKey.url,
params:{key:'common.server.location'},
method:InterfaceConfig.getValueByKey.method,
isTestLogin:InterfaceConfig.getValueByKey.isTestLogin
}],(res)=>{
if (res[0].status === 200){
let env = res[0].data;
BaseConfig.pt_type = env["common.server.location"];
window.pt_type = env["common.server.location"];
BaseConfig.ConfigFn.setParamsValue();
BaseConfig.ConfigFn.getPersonInfo_I();
let interval = setInterval(()=>{
if (window.person_info_my){
clearInterval(interval);
if (to.name === 'login'){
next({replace:true,name:'mainPlatform'})
}else{
next()
}
}
},500)
}
})
}else{
gotoPage(to,from,next);
}
}
function testLogin(to,from,next) {
let s = new SSO();
s.exeFun(function (data) {
Vue.prototype.isTestLogin = true;
if (data.success === true){//已登录过
console.log("登录过")
gotoPage(to,from,next);
}else{//未登录过 进入登录页面
console.log("未登录过")
if (to.name === 'login'){
next({replace:true,name:'mainPlatform'})
next();
}else{
next()
next({replace:true,name:'login'});
}
}
})
}
function gotoPage(to,from,next) {
if (!window.person_info_my){//没有人员具体信息
BaseConfig.userInfo.identity_id_cookie = Cookie.get('identity_id');
BaseConfig.userInfo.person_id_cookie = Cookie.get('person_id');
BaseConfig.userInfo.identity_id = Cookie.get('identity_id');
BaseConfig.userInfo.person_id = Cookie.get('person_id');
InterfaceConfig.callInterface([{
url:InterfaceConfig.getValueByKey.url,
params:{key:'common.server.location'},
method:InterfaceConfig.getValueByKey.method,
isTestLogin:InterfaceConfig.getValueByKey.isTestLogin
}],(res)=>{
if (res[0].status === 200){
let env = res[0].data;
BaseConfig.pt_type = env["common.server.location"];
window.pt_type = env["common.server.location"];
BaseConfig.ConfigFn.setParamsValue();
BaseConfig.ConfigFn.getPersonInfo_I();
let interval = setInterval(()=>{
if (window.person_info_my){
clearInterval(interval);
if (to.name === 'login'){
next({replace:true,name:'mainPlatform'})
}else{
next()
}
}
},500)
}
})
}else{
if (to.name === 'login'){
next({replace:true,name:'mainPlatform'});
}else{
next();
}
}
}
router.beforeEach((to,from,next)=>{
// if (sso === ""){
// axiosConfig.callInterface([{
// url:InterfaceConfig.getValueByKey.url,
// params:{key:'common.sso'},
// method:InterfaceConfig.getValueByKey.method,
// isTestLogin:InterfaceConfig.getValueByKey.isTestLogin
// }],(res)=>{
// if (res[0].status === 200){
// let env = res[0].data;
// sso = env["common.sso"];
// testSSO(to,from,next);
// }
// })
// }else{
if (sso === ""){
axiosConfig.callInterface([{
url:InterfaceConfig.getValueByKey.url,
params:{key:'common.sso'},
method:InterfaceConfig.getValueByKey.method,
isTestLogin:InterfaceConfig.getValueByKey.isTestLogin
}],(res)=>{
if (res[0].status === 200){
let env = res[0].data;
sso = env["common.sso"];
Vue.prototype.sso_flag = sso;
testSSO(to,from,next);
}
})
}else{
testSSO(to,from,next)
// }
}
});
new Vue({
router,
render: h => h(App),
// beforeMount(){
// let sn = document.getElementsByTagName('body')[0]
// let sn = document.getElementsByTagName('head')[0]
// let jsAry = ["jquery.js","jsencrypt.min.js","jquery.cookie.js","base-config.js","sso.js"];
// jsAry.forEach((item)=>{
// let s = document.createElement('script');

@ -456,6 +456,11 @@
}
})
},
/*
* jurisdictionAry:[]//id
*
* */
jurisdictionIsExist(jurisdictionAry = [],testRange=true){
let isExist = true;
if (jurisdictionAry && this.TypesCheck.isArray(jurisdictionAry) && jurisdictionAry.length > 0){

@ -97,9 +97,9 @@
font-size: 16px;
color:white;
/*justify-items: space-around;*/
background:linear-gradient(to bottom right,var(--modTitleOne),var(--modTitleTwo));
background:-moz-linear-gradient(to bottom right,var(--modTitleOne),var(--modTitleTwo));
background:-webkit-linear-gradient(bottom right,var(--modTitleOne),var(--modTitleTwo));
background:linear-gradient(to bottom right,var(--modTitleTwo),var(--modTitleOne));
background:-moz-linear-gradient(to bottom right,var(--modTitleTwo),var(--modTitleOne));
background:-webkit-linear-gradient(bottom right,var(--modTitleTwo),var(--modTitleOne));
.icon-style{
font-size: 18px;
margin-right: 20px;

@ -74,7 +74,8 @@
JSON.stringify(newData)){
this.moduleDataList = _.cloneDeep(newData.showModule);
this.layout = newData.layout;
this.theme = newData.theme
this.theme = newData.theme;
this.$forceUpdate();
}
},
}

@ -88,22 +88,45 @@ export const layoutData=[
export const themeData=[
{'id':'default','name':'默认','--platTitle':'#0182ff','--btnBgc':'#1089fe','--btnBor':'#1a90ff','--btnHover':'#0174e3',
'--modTitleOne':'#3ea0ff','--modTitleTwo':'#038aff',img:'default.png',selectedImg:'default-selected.png'},
{'id':'lake-blue','name':'湖水蓝','--platTitle':'#00c5c3','--btnBgc':'#00d8d6','--btnBor':'#01e5e3','--btnHover':'#00aeac',
'--modTitleOne':'#63f3f2','--modTitleTwo':'#00c5c3',img:'lake-blue.png',selectedImg:'lake-blue-selected.png'},
{'id':'yelan-green','name':'叶兰绿','--platTitle':'#8fc31f','--btnBgc':'#9de502','--btnBor':'#a7f401','--btnHover':'#6c9e01',
'--modTitleOne':'#c1db81','--modTitleTwo':'#8fc31f',img:'yelan-green.png',selectedImg:'yelan-green-selected.png'},
{'id':'cherry-pink','name':'樱花粉','--platTitle':'#e7336e','--btnBgc':'#fc5a8f','--btnBor':'#fe8ab0','--btnHover':'#d10e4e',
'--modTitleOne':'#ee86a8','--modTitleTwo':'#e7336e',img:'cherry-pink.png',selectedImg:'cherry-pink-selected.png'},
{'id':'lemon-yellow','name':'柠檬黄','--platTitle':'#fdd000','--btnBgc':'#fddb3e','--btnBor':'#ffe880','--btnHover':'#dab300',
'--modTitleOne':'#ffe67a','--modTitleTwo':'#fdd000',img:'lemon-yellow.png',selectedImg:'lemon-yellow-selected.png'},
{'id':'classic-blue','name':'经典蓝','--platTitle':'#003477','--btnBgc':'#014fb3','--btnBor':'#015cd1','--btnHover':'#002657',
'--modTitleOne':'#005bac','--modTitleTwo':'#003477',img:'classic-blue.png',selectedImg:'classic-blue-selected.png'},
{'id':'almond-white','name':'杏仁白','--platTitle':'#d6d4b1','--btnBgc':'#e4e2c6','--btnBor':'#f3f1d7','--btnHover':'#bab786',
'--modTitleOne':'#eae9d7','--modTitleTwo':'#d6d4b1',img:'almond-white.png',selectedImg:'almond-white-selected.png'},
{'id':'lavender','name':'熏衣紫','--platTitle':'#920783','--btnBgc':'#b0009d','--btnBor':'#c900b3','--btnHover':'#79006c',
'--modTitleOne':'#c021af','--modTitleTwo':'#920783',img:'lavender.png',selectedImg:'lavender-selected.png'}
{'id':'default','name':'经典蓝','--platTitle':'#0182ff','--btnBgc':'#1089fe','--btnBor':'#1a90ff','--btnHover':'#0174e3',
'--modTitleOne':'#038aff','--modTitleTwo':'#3ea0ff','--noticeOne':'#81c485','--noticeTwo':'#aed9b1','--todoOne':'#fe7e73',
'--todoTwo':'#eb5440','--todoOneBtn':'#37c2fa','--todoTwoBtn':'#66bb6e','--appOne':'#ffad5d','--appTwo':'#ff962f',
img:'default.png',selectedImg:'default-selected.png'},
{'id':'lake-blue','name':'浅草绿','--platTitle':'#66bb6a','--btnBgc':'#6cB870','--btnBor':'#6dd072','--btnHover':'#54a358',
'--modTitleOne':'#66bb6a','--modTitleTwo':'#86d68a','--noticeOne':'#81c485','--noticeTwo':'#aed9b1','--todoOne':'#fe7e73',
'--todoTwo':'#eb5440','--todoOneBtn':'#37c2fa','--todoTwoBtn':'#66bb6e','--appOne':'#ffad5d','--appTwo':'#ff962f',
img:'lake-blue.png',selectedImg:'lake-blue-selected.png'},
{'id':'yelan-green','name':'乳脂咖','--platTitle':'#8fc31f','--btnBgc':'#9de502','--btnBor':'#a7f401','--btnHover':'#6c9e01',
'--modTitleOne':'#c1db81','--modTitleTwo':'#8fc31f','--noticeOne':'#81c485','--noticeTwo':'#aed9b1','--todoOne':'#fe7e73',
'--todoTwo':'#eb5440','--todoOneBtn':'#37c2fa','--todoTwoBtn':'#66bb6e','--appOne':'#ffad5d','--appTwo':'#ff962f',
img:'yelan-green.png',selectedImg:'yelan-green-selected.png'},
{'id':'cherry-pink','name':'海洋绿','--platTitle':'#17c4b5','--btnBgc':'#18ccbd','--btnBor':'#1ad6c6','--btnHover':'#12998e',
'--modTitleOne':'#11998e','--modTitleTwo':'#38d2c5','--noticeOne':'#6ab5ef','--noticeTwo':'#6cd2bc','--todoOne':'#f4729d',
'--todoTwo':'#f55b8e','--todoOneBtn':'#18c3b6','--todoTwoBtn':'#38a2ee','--appOne':'#f4a53d','--appTwo':'#f19113',
img:'cherry-pink.png',selectedImg:'cherry-pink-selected.png'},
{'id':'lemon-yellow','name':'午夜蓝','--platTitle':'#fdd000','--btnBgc':'#fddb3e','--btnBor':'#ffe880','--btnHover':'#dab300',
'--modTitleOne':'#ffe67a','--modTitleTwo':'#fdd000','--noticeOne':'#81c485','--noticeTwo':'#aed9b1','--todoOne':'#fe7e73',
'--todoTwo':'#eb5440','--todoOneBtn':'#37c2fa','--todoTwoBtn':'#66bb6e','--appOne':'#ffad5d','--appTwo':'#ff962f',
img:'lemon-yellow.png',selectedImg:'lemon-yellow-selected.png'},
{'id':'classic-blue','name':'矢车菊蓝','--platTitle':'#83baff','--btnBgc':'#6ba7f3','--btnBor':'#91c3ff','--btnHover':'#59cfff',
'--modTitleOne':'#5f9fff','--modTitleTwo':'#83baff','--noticeOne':'#9bc5fa','--noticeTwo':'#90d2ed','--todoOne':'#6ae5c5',
'--todoTwo':'#29c19b','--todoOneBtn':'#116fde','--todoTwoBtn':'#36e1f0','--appOne':'#6ee5e9','--appTwo':'#3fc0c4',
img:'classic-blue.png',selectedImg:'classic-blue-selected.png'},
{'id':'almond-white','name':'秘鲁棕','--platTitle':'#c18672','--btnBgc':'#d7947d','--btnBor':'#dc9d88','--btnHover':'#aa6d59',
'--modTitleOne':'#bd7d69','--modTitleTwo':'#db9881','--noticeOne':'#d1a89b','--noticeTwo':'#e6c4b9','--todoOne':'#f8ac60',
'--todoTwo':'#db8e40','--todoOneBtn':'#eb6380','--todoTwoBtn':'#eb6452','--appOne':'#fb9c96','--appTwo':'#ea6359',
img:'almond-white.png',selectedImg:'almond-white-selected.png'},
{'id':'lavender','name':'香芋紫','--platTitle':'#920783','--btnBgc':'#b0009d','--btnBor':'#c900b3','--btnHover':'#79006c',
'--modTitleOne':'#c021af','--modTitleTwo':'#920783','--noticeOne':'#81c485','--noticeTwo':'#aed9b1','--todoOne':'#fe7e73',
'--todoTwo':'#eb5440','--todoOneBtn':'#37c2fa','--todoTwoBtn':'#66bb6e','--appOne':'#ffad5d','--appTwo':'#ff962f',
img:'lavender.png',selectedImg:'lavender-selected.png'}
]
/*
* 默认显示mouduleId

@ -83,9 +83,9 @@
align-items: center;
border-bottom-left-radius: 10px;
border-top-right-radius: 10px;
background:linear-gradient(to bottom right,#fb6252,#eb4044);
background:-moz-linear-gradient(to bottom right,#fb6252,#eb4044);
background:-webkit-linear-gradient(to bottom right,#fb6252,#eb4044);
background:linear-gradient(to bottom right,var(--todoTwo),var(--todoOne));
background:-moz-linear-gradient(to bottom right,var(--todoTwo),var(--todoOne));
background:-webkit-linear-gradient(bottom right,var(--todoTwo),var(--todoOne));
.title-icon-style{
font-size: 30px;
color: white;
@ -123,9 +123,9 @@
.icon-container-style{
width: 100%;
height: 72px;
background:linear-gradient(to bottom right,#00bdfa,#0162eb);
background:-moz-linear-gradient(to bottom right,#00bdfa,#0162eb);
background:-webkit-linear-gradient(to bottom right,#00bdfa,#0162eb);
background:linear-gradient(to bottom right,var(--todoTwoBtn),var(--todoOneBtn));
background:-moz-linear-gradient(to bottom right,var(--todoTwoBtn),var(--todoOneBtn));
background:-webkit-linear-gradient(bottom right,var(--todoTwoBtn),var(--todoOneBtn));
border-radius: 10px;
display: flex;
align-content: center;

@ -143,7 +143,10 @@
<style scoped lang="scss">
.notice{
width: 100%;
border: 1px solid #92c8fe;
background:linear-gradient(to bottom right,var(--noticeTwo),var(--noticeOne));
background:-moz-linear-gradient(to bottom right,var(--noticeTwo),var(--noticeOne));
background:-webkit-linear-gradient(bottom right,var(--noticeTwo),var(--noticeOne));
/*border: 1px solid #92c8fe;*/
.notice-title{
padding: 0 12px;
display: flex;
@ -162,6 +165,7 @@
font-weight: 600;
}
.more-style{
border: 1px solid #fff;
width: 45px;
height: 18px;
display: flex;

@ -114,7 +114,13 @@
this.Cookie.delete("token");
window.person_info_my = null;
window.pt_type = null;
this.$router.replace('login');
if (this.sso_flag === "2"){
this.isTestLogin = false;
let sso = new SSO();
sso.doLogoutSso("",1)
}else{
this.$router.replace('login');
}
},
getPopoverClass:function(){
let className = "pop-style";

@ -12,7 +12,7 @@
<system-list :crmData="systemData"></system-list>
</FunctionBtn>
<FunctionBtn title="版面设置" icon="icon-huanfu" @btnClick="onBtnClick('setting')" :style="rightBtnStyle"/>
<FunctionBtn title="驾驶舱" icon="icon-jiashicang" @btnClick="onBtnClick('driver')" :style="{marginRight:'110px'}"/>
<!-- <FunctionBtn title="驾驶舱" icon="icon-jiashicang" @btnClick="onBtnClick('driver')" :style="{marginRight:'110px'}"/>-->
</div>
<div class="date-weather-style">
<div class="date-style">

@ -5,4 +5,12 @@
--btnHover:'';//hover
--modTitleOne:'';//1
--modTitleTwo:'';//2
--noticeOne:'';//1
--noticeTwo:'';//2
--todoOne:'';//1
--todoTwo:'';//2
--todoOneBtn:'';//1
--todoTwoBtn:'';//2
--appOne:'';//1
--appTwo:'';//2
}

Loading…
Cancel
Save