Commit 4a57188e by limin

修改获取TGT逻辑

1 parent b6aa5d56
......@@ -89,7 +89,8 @@ header {
main {
flex: 1;
min-height: calc(100% - 60px - 30px);
/* min-height: calc(100% - 60px - 30px); */
min-height: calc(100% - 60px);
overflow: auto;
background-color: #f8f8f8;
}
......
......@@ -4,7 +4,7 @@
* @Author: limin
* @Date: 2021-07-15 15:46:53
* @LastEditors: limin
* @LastEditTime: 2021-07-23 15:23:54
* @LastEditTime: 2021-08-09 11:16:28
* @FilePath: \account\js\load.js
*/
;(function load() {
......@@ -32,21 +32,41 @@ function loadLayConfig() {
})
}
function loadHeaderFooter() {
isAppend() && append()
layui.use(['store'], function () {
var isExternal = isAppend()
var store = layui.store
if(isExternal){ //运营平台外部系统
append()
}else{//嵌入运营平台
var token = store.get('token')
if(token || isLoginPage()){
return
}
var t = qs('t')
if(!t){
throw new Error('未获取到TGT,请检测')
}
store.set('token', sessionId)
}
})
}
function append() {
var $ = layui.$
var header = document.createElement('header')
var footer = document.createElement('footer')
$(header).load('/html/components/header.html')
$(footer).load('/html/components/footer.html')
// $(footer).load('/html/components/footer.html')
$('main').before(header).after(footer)
}
function isAppend() {
return !isLoginPage() && self == top
}
function isLoginPage(){
var _href = location.href.split('/')
var _path = _href.slice(_href.length - 1, _href.length).toString()
return _path.split('?')[0] !== 'login.html' && self == top
return _path.split('?')[0] === 'login.html'
}
function loadConfig() {
......@@ -57,7 +77,7 @@ function loadConfig() {
}
var ajax = layui.$.ajax
ajax({
url: 'http://192.168.3.171:7300/mock/5be17454f31545347559d499/config/glsx-oss-account-config',
url: 'https://oss-config.test.glsx.com.cn/mock/5be17454f31545347559d499/config/glsx-oss-account-config',
async: false,
success: function (res) {
store.setEx('external', res.external, 10 * 60 * 1000)
......
......@@ -4,7 +4,7 @@
* @Author: limin
* @Date: 2021-07-19 10:15:48
* @LastEditors: limin
* @LastEditTime: 2021-07-22 17:45:23
* @LastEditTime: 2021-08-09 10:52:59
* @FilePath: \account\js\request.js
*/
layui.define(['sha1', 'md5', 'helper'], function (exports) {
......@@ -34,7 +34,7 @@ layui.define(['sha1', 'md5', 'helper'], function (exports) {
shade: false
}) //0代表加载的风格,支持0-2
var token = store.get('token')
request.setRequestHeader('sessionId', token)
request.setRequestHeader('TGT', token)
},
complete: function () {
layer.close(loading)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!