mirror of https://gitee.com/karson/fastadmin.git
优化插件管理JS
parent
faca2e0be0
commit
6ebde793bd
|
|
@ -92,7 +92,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'cookie']
|
||||||
uid: userinfo ? userinfo.id : '',
|
uid: userinfo ? userinfo.id : '',
|
||||||
token: userinfo ? userinfo.token : '',
|
token: userinfo ? userinfo.token : '',
|
||||||
domain: Config.domain,
|
domain: Config.domain,
|
||||||
version: Config.faversion
|
version: Config.faversion,
|
||||||
|
sid: Controller.api.sid()
|
||||||
});
|
});
|
||||||
return params;
|
return params;
|
||||||
},
|
},
|
||||||
|
|
@ -297,7 +298,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'cookie']
|
||||||
url: Config.api_url + '/user/logintpl',
|
url: Config.api_url + '/user/logintpl',
|
||||||
type: 'post',
|
type: 'post',
|
||||||
data: {
|
data: {
|
||||||
version: Config.faversion
|
version: Config.faversion,
|
||||||
|
sid: Controller.api.sid()
|
||||||
}
|
}
|
||||||
}, function (tpldata, ret) {
|
}, function (tpldata, ret) {
|
||||||
Layer.open({
|
Layer.open({
|
||||||
|
|
@ -310,6 +312,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'cookie']
|
||||||
yes: function (index, layero) {
|
yes: function (index, layero) {
|
||||||
var data = $("form", layero).serializeArray();
|
var data = $("form", layero).serializeArray();
|
||||||
data.push({name: "faversion", value: Config.faversion});
|
data.push({name: "faversion", value: Config.faversion});
|
||||||
|
data.push({name: "sid", value: Controller.api.sid()});
|
||||||
Fast.api.ajax({
|
Fast.api.ajax({
|
||||||
url: Config.api_url + '/user/login',
|
url: Config.api_url + '/user/login',
|
||||||
type: 'post',
|
type: 'post',
|
||||||
|
|
@ -342,45 +345,43 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'cookie']
|
||||||
url: Config.api_url + '/user/userinfotpl',
|
url: Config.api_url + '/user/userinfotpl',
|
||||||
type: 'post',
|
type: 'post',
|
||||||
data: {
|
data: {
|
||||||
version: Config.faversion
|
uid: userinfo.id,
|
||||||
|
token: userinfo.token,
|
||||||
|
version: Config.faversion,
|
||||||
|
sid: Controller.api.sid()
|
||||||
}
|
}
|
||||||
}, function (tpldata, ret) {
|
}, function (tpldata, ret) {
|
||||||
Fast.api.ajax({
|
Layer.open({
|
||||||
url: Config.api_url + '/user/index',
|
content: Template.render(tpldata, userinfo),
|
||||||
data: {
|
area: area,
|
||||||
uid: userinfo.id,
|
title: __('Userinfo'),
|
||||||
token: userinfo.token,
|
resize: false,
|
||||||
version: Config.faversion,
|
btn: [__('Logout'), __('Close')],
|
||||||
|
yes: function () {
|
||||||
|
Fast.api.ajax({
|
||||||
|
url: Config.api_url + '/user/logout',
|
||||||
|
data: {
|
||||||
|
uid: userinfo.id,
|
||||||
|
token: userinfo.token,
|
||||||
|
version: Config.faversion,
|
||||||
|
sid: Controller.api.sid()
|
||||||
|
}
|
||||||
|
}, function (data, ret) {
|
||||||
|
Controller.api.userinfo.set(null);
|
||||||
|
Layer.closeAll();
|
||||||
|
Layer.alert(ret.msg, {title: __('Warning'), icon: 0});
|
||||||
|
}, function (data, ret) {
|
||||||
|
Controller.api.userinfo.set(null);
|
||||||
|
Layer.closeAll();
|
||||||
|
Layer.alert(ret.msg, {title: __('Warning'), icon: 0});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}, function (data) {
|
|
||||||
Layer.open({
|
|
||||||
content: Template.render(tpldata, userinfo),
|
|
||||||
area: area,
|
|
||||||
title: __('Userinfo'),
|
|
||||||
resize: false,
|
|
||||||
btn: [__('Logout'), __('Close')],
|
|
||||||
yes: function () {
|
|
||||||
Fast.api.ajax({
|
|
||||||
url: Config.api_url + '/user/logout',
|
|
||||||
data: {uid: userinfo.id, token: userinfo.token, version: Config.faversion}
|
|
||||||
}, function (data, ret) {
|
|
||||||
Controller.api.userinfo.set(null);
|
|
||||||
Layer.closeAll();
|
|
||||||
Layer.alert(ret.msg, {title: __('Warning'), icon: 0});
|
|
||||||
}, function (data, ret) {
|
|
||||||
Controller.api.userinfo.set(null);
|
|
||||||
Layer.closeAll();
|
|
||||||
Layer.alert(ret.msg, {title: __('Warning'), icon: 0});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
}, function (data) {
|
|
||||||
Controller.api.userinfo.set(null);
|
|
||||||
$(that).trigger('click');
|
|
||||||
return false;
|
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
|
}, function (data) {
|
||||||
|
Controller.api.userinfo.set(null);
|
||||||
|
$(that).trigger('click');
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -774,6 +775,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'cookie']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
sid: function () {
|
||||||
|
var sid = $.cookie('fastadmin_sid');
|
||||||
|
if (!sid) {
|
||||||
|
sid = Math.random().toString(20).substr(2, 12);
|
||||||
|
$.cookie('fastadmin_sid', sid);
|
||||||
|
}
|
||||||
|
return sid;
|
||||||
|
},
|
||||||
refresh: function (table, name) {
|
refresh: function (table, name) {
|
||||||
//刷新左侧边栏
|
//刷新左侧边栏
|
||||||
Fast.api.refreshmenu();
|
Fast.api.refreshmenu();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue