mirror of
https://github.com/YMFE/yapi.git
synced 2025-04-12 15:10:23 +08:00
fix: interfaceMenu defaultkeys bug
This commit is contained in:
parent
0fcece73e9
commit
049634f33a
@ -238,12 +238,12 @@ class InterfaceMenu extends Component {
|
||||
};
|
||||
|
||||
const defaultExpandedKeys = ()=>{
|
||||
const {router, inter, list} = this.props;
|
||||
if(list.length === 0) return null;
|
||||
const {router, inter, list} = this.props, rNull = {expands: [], selects: []};
|
||||
if(list.length === 0) return rNull;
|
||||
if(router){
|
||||
if(!isNaN(router.params.actionId)){
|
||||
let _actionId = parseInt(router.params.actionId, 10)
|
||||
if(!inter._id || inter._id !== _actionId)return null;
|
||||
if(!inter._id || inter._id !== _actionId)return rNull;
|
||||
return {
|
||||
expands: ['group-' + inter.catid],
|
||||
selects: [inter._id+""]
|
||||
|
@ -14,11 +14,7 @@
|
||||
<script src="http://127.0.0.1:4000/prd/lib@dev.js"></script>
|
||||
<script src="http://127.0.0.1:4000/prd/index@dev.js"></script>
|
||||
|
||||
<script src="/lib/ace-1.2.8.js"></script>
|
||||
<script src="/lib/snippets-json.js"></script>
|
||||
<script src="/lib/ext-language.tools.js"></script>
|
||||
<script src="/lib/mode-json-1.2.8.js"></script>
|
||||
<script src="https://qsso.corp.qunar.com/lib/qsso-auth.js"></script>
|
||||
<script src="/lib/qsso-auth.js"></script>
|
||||
|
||||
|
||||
|
||||
|
@ -34,9 +34,6 @@
|
||||
document.write('<script src="/prd/' + window.WEBPACK_ASSETS['index.js'].js + '"><\/script>');
|
||||
</script>
|
||||
|
||||
<script src="/lib/ace-1.2.8.js"></script>
|
||||
<script src="/lib/ext-language.tools.js"></script>
|
||||
<script src="/lib/mode-json-1.2.8.js"></script>
|
||||
<script src="https://qsso.corp.qunar.com/lib/qsso-auth.js"></script>
|
||||
<script src="/lib/qsso-auth.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
73
static/lib/qsso-auth.js
Normal file
73
static/lib/qsso-auth.js
Normal file
@ -0,0 +1,73 @@
|
||||
// file_id:2D7ABF69-3BC0-4175-98C9-5C3D5CB00158 -- nerver change this !!
|
||||
|
||||
/*
|
||||
* file: qsso-auth.js
|
||||
* URL: https://qsso.corp.qunar.com/lib/qsso-auth.js
|
||||
* written by zhibin.ning
|
||||
* version: 0.1
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
if (!window['QSSO']) {
|
||||
var QSSO = (function () {
|
||||
|
||||
var AUTH_SERVER = 'https://qsso.corp.qunar.com',
|
||||
LOGIN_PAGE = '/login.php',
|
||||
SORRY_PAGE = '/sorry.html';
|
||||
|
||||
if (location.hostname.match(/qunar\.ctripgroup\.com$/i)) {
|
||||
AUTH_SERVER = 'https://qunar.ctripgroup.com/sec/qsso/api';
|
||||
}
|
||||
|
||||
var qualifyURL = function (url, encode) {
|
||||
var url = url || '';
|
||||
var ret = location.protocol + '//' + location.host + (url.substr(0,1) === '/' ? '' : location.pathname.match(/.*\//)) + url;
|
||||
if (encode) {
|
||||
ret = encodeURIComponent(ret);
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
var URLStringify = function (o) {
|
||||
var ret = [];
|
||||
for (var i in o) {
|
||||
// ret.push( encodeURIComponent(i) + '=' + encodeURIComponent(o[i]) );
|
||||
ret.push(i + '=' + o[i]);
|
||||
}
|
||||
return ret.join('&');
|
||||
};
|
||||
|
||||
return {
|
||||
'auth': function (loginURI, opt_ext) {
|
||||
if (!location.hostname.match(/\.qunar(man|ops)?\.com$|\.qunarman\.com$|qunar\.it$|\.928383\.com$|^928383\.com$|qunar\.ctripgroup\.c(om|n)$|\.ctrip(corp)?\.com$|^opsdata\.me$|\.mofun\.com$/i)) {
|
||||
location = AUTH_SERVER + SORRY_PAGE + '?host=' + qualifyURL('', true);
|
||||
return;
|
||||
}
|
||||
var ret = qualifyURL(loginURI, true);
|
||||
|
||||
var redirectURL = AUTH_SERVER + LOGIN_PAGE + '?ret=' + ret + (opt_ext ? '&ext=' + encodeURIComponent(URLStringify(opt_ext)) : '');
|
||||
// console.log(redirectURL);
|
||||
location = redirectURL;
|
||||
},
|
||||
|
||||
'attach': function (eid, loginURI, opt_ext) {
|
||||
QSSO.login = function() {
|
||||
QSSO.auth(loginURI, opt_ext);
|
||||
|
||||
};
|
||||
document.getElementById(eid).onclick = QSSO.login;
|
||||
if (location.hash.match('qsso-auto-login')) {
|
||||
QSSO.login();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
})();
|
||||
|
||||
|
||||
/* todo add QSSO login UI, frame login, etc */
|
||||
|
||||
|
||||
}
|
@ -1 +0,0 @@
|
||||
define("ace/snippets/json",["require","exports","module"],function(e,t,n){"use strict";t.snippetText=undefined,t.scope="json"})
|
Loading…
x
Reference in New Issue
Block a user