mirror of https://gitee.com/karson/fastadmin.git
parent
0e75d1d6cd
commit
96dd46d32d
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
FastAdmin Install SQL
|
FastAdmin Install SQL
|
||||||
Date: 2020-06-11 22:11:09
|
Date: 2023-06-07 15:17:57
|
||||||
*/
|
*/
|
||||||
|
|
||||||
SET FOREIGN_KEY_CHECKS = 0;
|
SET FOREIGN_KEY_CHECKS = 0;
|
||||||
|
|
@ -8,7 +8,6 @@ SET FOREIGN_KEY_CHECKS = 0;
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for fa_admin
|
-- Table structure for fa_admin
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
DROP TABLE IF EXISTS `fa_admin`;
|
|
||||||
CREATE TABLE `fa_admin` (
|
CREATE TABLE `fa_admin` (
|
||||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||||
`username` varchar(20) DEFAULT '' COMMENT '用户名',
|
`username` varchar(20) DEFAULT '' COMMENT '用户名',
|
||||||
|
|
@ -39,7 +38,6 @@ COMMIT;
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for fa_admin_log
|
-- Table structure for fa_admin_log
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
DROP TABLE IF EXISTS `fa_admin_log`;
|
|
||||||
CREATE TABLE `fa_admin_log` (
|
CREATE TABLE `fa_admin_log` (
|
||||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||||
`admin_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '管理员ID',
|
`admin_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '管理员ID',
|
||||||
|
|
@ -57,7 +55,6 @@ CREATE TABLE `fa_admin_log` (
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for fa_area
|
-- Table structure for fa_area
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
DROP TABLE IF EXISTS `fa_area`;
|
|
||||||
CREATE TABLE `fa_area` (
|
CREATE TABLE `fa_area` (
|
||||||
`id` int(10) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
`id` int(10) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||||
`pid` int(10) DEFAULT NULL COMMENT '父id',
|
`pid` int(10) DEFAULT NULL COMMENT '父id',
|
||||||
|
|
@ -78,7 +75,6 @@ CREATE TABLE `fa_area` (
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for fa_attachment
|
-- Table structure for fa_attachment
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
DROP TABLE IF EXISTS `fa_attachment`;
|
|
||||||
CREATE TABLE `fa_attachment` (
|
CREATE TABLE `fa_attachment` (
|
||||||
`id` int(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
`id` int(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||||
`category` varchar(50) DEFAULT '' COMMENT '类别',
|
`category` varchar(50) DEFAULT '' COMMENT '类别',
|
||||||
|
|
@ -111,7 +107,6 @@ COMMIT;
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for fa_auth_group
|
-- Table structure for fa_auth_group
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
DROP TABLE IF EXISTS `fa_auth_group`;
|
|
||||||
CREATE TABLE `fa_auth_group` (
|
CREATE TABLE `fa_auth_group` (
|
||||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`pid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '父组别',
|
`pid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '父组别',
|
||||||
|
|
@ -137,7 +132,6 @@ COMMIT;
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for fa_auth_group_access
|
-- Table structure for fa_auth_group_access
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
DROP TABLE IF EXISTS `fa_auth_group_access`;
|
|
||||||
CREATE TABLE `fa_auth_group_access` (
|
CREATE TABLE `fa_auth_group_access` (
|
||||||
`uid` int(10) unsigned NOT NULL COMMENT '会员ID',
|
`uid` int(10) unsigned NOT NULL COMMENT '会员ID',
|
||||||
`group_id` int(10) unsigned NOT NULL COMMENT '级别ID',
|
`group_id` int(10) unsigned NOT NULL COMMENT '级别ID',
|
||||||
|
|
@ -156,7 +150,6 @@ COMMIT;
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for fa_auth_rule
|
-- Table structure for fa_auth_rule
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
DROP TABLE IF EXISTS `fa_auth_rule`;
|
|
||||||
CREATE TABLE `fa_auth_rule` (
|
CREATE TABLE `fa_auth_rule` (
|
||||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`type` enum('menu','file') NOT NULL DEFAULT 'file' COMMENT 'menu为菜单,file为权限节点',
|
`type` enum('menu','file') NOT NULL DEFAULT 'file' COMMENT 'menu为菜单,file为权限节点',
|
||||||
|
|
@ -273,7 +266,6 @@ COMMIT;
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for fa_category
|
-- Table structure for fa_category
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
DROP TABLE IF EXISTS `fa_category`;
|
|
||||||
CREATE TABLE `fa_category` (
|
CREATE TABLE `fa_category` (
|
||||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`pid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '父ID',
|
`pid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '父ID',
|
||||||
|
|
@ -316,7 +308,6 @@ COMMIT;
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for fa_config
|
-- Table structure for fa_config
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
DROP TABLE IF EXISTS `fa_config`;
|
|
||||||
CREATE TABLE `fa_config` (
|
CREATE TABLE `fa_config` (
|
||||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`name` varchar(30) DEFAULT '' COMMENT '变量名',
|
`name` varchar(30) DEFAULT '' COMMENT '变量名',
|
||||||
|
|
@ -361,7 +352,6 @@ COMMIT;
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for fa_ems
|
-- Table structure for fa_ems
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
DROP TABLE IF EXISTS `fa_ems`;
|
|
||||||
CREATE TABLE `fa_ems` (
|
CREATE TABLE `fa_ems` (
|
||||||
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||||
`event` varchar(30) DEFAULT '' COMMENT '事件',
|
`event` varchar(30) DEFAULT '' COMMENT '事件',
|
||||||
|
|
@ -376,7 +366,6 @@ CREATE TABLE `fa_ems` (
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for fa_sms
|
-- Table structure for fa_sms
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
DROP TABLE IF EXISTS `fa_sms`;
|
|
||||||
CREATE TABLE `fa_sms` (
|
CREATE TABLE `fa_sms` (
|
||||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||||
`event` varchar(30) DEFAULT '' COMMENT '事件',
|
`event` varchar(30) DEFAULT '' COMMENT '事件',
|
||||||
|
|
@ -391,7 +380,6 @@ CREATE TABLE `fa_sms` (
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for fa_test
|
-- Table structure for fa_test
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
DROP TABLE IF EXISTS `fa_test`;
|
|
||||||
CREATE TABLE `fa_test` (
|
CREATE TABLE `fa_test` (
|
||||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||||
`user_id` int(10) DEFAULT '0' COMMENT '会员ID',
|
`user_id` int(10) DEFAULT '0' COMMENT '会员ID',
|
||||||
|
|
@ -441,7 +429,6 @@ COMMIT;
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for fa_user
|
-- Table structure for fa_user
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
DROP TABLE IF EXISTS `fa_user`;
|
|
||||||
CREATE TABLE `fa_user` (
|
CREATE TABLE `fa_user` (
|
||||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||||
`group_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '组别ID',
|
`group_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '组别ID',
|
||||||
|
|
@ -487,7 +474,6 @@ COMMIT;
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for fa_user_group
|
-- Table structure for fa_user_group
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
DROP TABLE IF EXISTS `fa_user_group`;
|
|
||||||
CREATE TABLE `fa_user_group` (
|
CREATE TABLE `fa_user_group` (
|
||||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`name` varchar(50) DEFAULT '' COMMENT '组名',
|
`name` varchar(50) DEFAULT '' COMMENT '组名',
|
||||||
|
|
@ -508,7 +494,6 @@ COMMIT;
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for fa_user_money_log
|
-- Table structure for fa_user_money_log
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
DROP TABLE IF EXISTS `fa_user_money_log`;
|
|
||||||
CREATE TABLE `fa_user_money_log` (
|
CREATE TABLE `fa_user_money_log` (
|
||||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`user_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '会员ID',
|
`user_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '会员ID',
|
||||||
|
|
@ -523,7 +508,6 @@ CREATE TABLE `fa_user_money_log` (
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for fa_user_rule
|
-- Table structure for fa_user_rule
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
DROP TABLE IF EXISTS `fa_user_rule`;
|
|
||||||
CREATE TABLE `fa_user_rule` (
|
CREATE TABLE `fa_user_rule` (
|
||||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`pid` int(10) DEFAULT NULL COMMENT '父ID',
|
`pid` int(10) DEFAULT NULL COMMENT '父ID',
|
||||||
|
|
@ -559,7 +543,6 @@ COMMIT;
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for fa_user_score_log
|
-- Table structure for fa_user_score_log
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
DROP TABLE IF EXISTS `fa_user_score_log`;
|
|
||||||
CREATE TABLE `fa_user_score_log` (
|
CREATE TABLE `fa_user_score_log` (
|
||||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`user_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '会员ID',
|
`user_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '会员ID',
|
||||||
|
|
@ -574,7 +557,6 @@ CREATE TABLE `fa_user_score_log` (
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for fa_user_token
|
-- Table structure for fa_user_token
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
DROP TABLE IF EXISTS `fa_user_token`;
|
|
||||||
CREATE TABLE `fa_user_token` (
|
CREATE TABLE `fa_user_token` (
|
||||||
`token` varchar(50) NOT NULL COMMENT 'Token',
|
`token` varchar(50) NOT NULL COMMENT 'Token',
|
||||||
`user_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '会员ID',
|
`user_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '会员ID',
|
||||||
|
|
@ -586,7 +568,6 @@ CREATE TABLE `fa_user_token` (
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- Table structure for fa_version
|
-- Table structure for fa_version
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
DROP TABLE IF EXISTS `fa_version`;
|
|
||||||
CREATE TABLE `fa_version` (
|
CREATE TABLE `fa_version` (
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||||
`oldversion` varchar(30) DEFAULT '' COMMENT '旧版本号',
|
`oldversion` varchar(30) DEFAULT '' COMMENT '旧版本号',
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,7 @@ class Min extends Command
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$config = preg_replace("/(urlArgs|baseUrl):(.*)\n/", '', $matches[1]);
|
$config = preg_replace("/(urlArgs|baseUrl):(.*)\n/", '', $matches[1]);
|
||||||
|
$config = preg_replace("/('tableexport'):(.*)\,\n/", "'tableexport': 'empty:',\n", $config);
|
||||||
$data['config'] = $config;
|
$data['config'] = $config;
|
||||||
}
|
}
|
||||||
// 生成压缩文件
|
// 生成压缩文件
|
||||||
|
|
|
||||||
|
|
@ -156,49 +156,6 @@
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</script>
|
</script>
|
||||||
<script id="logintpl" type="text/html">
|
|
||||||
<div>
|
|
||||||
<form class="form-horizontal">
|
|
||||||
<fieldset>
|
|
||||||
<div class="alert alert-dismissable alert-danger">
|
|
||||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
|
||||||
<strong>{:__('Warning')}</strong><br/>{:__('Login tips')}
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="col-lg-12">
|
|
||||||
<div class="input-group">
|
|
||||||
<span class="input-group-addon"><i class="fa fa-user"></i></span>
|
|
||||||
<input type="text" class="form-control" id="inputAccount" value=""
|
|
||||||
placeholder="{:__('Your username or email')}">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<div class="col-lg-12">
|
|
||||||
<div class="input-group">
|
|
||||||
<span class="input-group-addon"><i class="fa fa-lock"></i></span>
|
|
||||||
<input type="password" class="form-control" id="inputPassword" value=""
|
|
||||||
placeholder="{:__('Your password')}">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</script>
|
|
||||||
<script id="userinfotpl" type="text/html">
|
|
||||||
<div>
|
|
||||||
<form class="form-horizontal form-userinfo">
|
|
||||||
<fieldset>
|
|
||||||
<div class="alert alert-dismissable alert-info-light">
|
|
||||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
|
||||||
<strong>{:__('Warning')}</strong><br/>{:__('Logined tips', '<%=username%>')}
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
<div class="breadcrumb"><a href="https://www.fastadmin.net/user/myaddon.html" target="_blank"><i class="fa fa-cube"></i> {:__('My addons')}</a></div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</script>
|
|
||||||
<script id="uninstalltpl" type="text/html">
|
<script id="uninstalltpl" type="text/html">
|
||||||
<div class="">
|
<div class="">
|
||||||
<div class=""><%=#__("Are you sure you want to unstall %s?", addon['title'])%>
|
<div class=""><%=#__("Are you sure you want to unstall %s?", addon['title'])%>
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ use app\common\library\Upload;
|
||||||
use app\common\model\Area;
|
use app\common\model\Area;
|
||||||
use app\common\model\Version;
|
use app\common\model\Version;
|
||||||
use fast\Random;
|
use fast\Random;
|
||||||
|
use think\captcha\Captcha;
|
||||||
use think\Config;
|
use think\Config;
|
||||||
use think\Hook;
|
use think\Hook;
|
||||||
|
|
||||||
|
|
@ -16,15 +17,30 @@ use think\Hook;
|
||||||
*/
|
*/
|
||||||
class Common extends Api
|
class Common extends Api
|
||||||
{
|
{
|
||||||
protected $noNeedLogin = ['init'];
|
protected $noNeedLogin = ['init', 'captcha'];
|
||||||
protected $noNeedRight = '*';
|
protected $noNeedRight = '*';
|
||||||
|
|
||||||
|
public function _initialize()
|
||||||
|
{
|
||||||
|
|
||||||
|
if (isset($_SERVER['HTTP_ORIGIN'])) {
|
||||||
|
header('Access-Control-Expose-Headers: __token__');//跨域让客户端获取到
|
||||||
|
}
|
||||||
|
//跨域检测
|
||||||
|
check_cors_request();
|
||||||
|
|
||||||
|
if (!isset($_COOKIE['PHPSESSID'])) {
|
||||||
|
Config::set('session.id', $this->request->server("HTTP_SID"));
|
||||||
|
}
|
||||||
|
parent::_initialize();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加载初始化
|
* 加载初始化
|
||||||
*
|
*
|
||||||
* @param string $version 版本号
|
* @param string $version 版本号
|
||||||
* @param string $lng 经度
|
* @param string $lng 经度
|
||||||
* @param string $lat 纬度
|
* @param string $lat 纬度
|
||||||
*/
|
*/
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
|
|
@ -127,4 +143,29 @@ class Common extends Api
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证码
|
||||||
|
* @param $id
|
||||||
|
* @return \think\Response
|
||||||
|
*/
|
||||||
|
public function captcha($id = "")
|
||||||
|
{
|
||||||
|
if ($this->request->isPost()) {
|
||||||
|
$captcha = $this->request->post("captcha");
|
||||||
|
if (!\think\Validate::is($captcha, 'captcha')) {
|
||||||
|
$this->error("验证码不正确");
|
||||||
|
}
|
||||||
|
$this->success("");
|
||||||
|
}
|
||||||
|
\think\Config::set([
|
||||||
|
'captcha' => array_merge(config('captcha'), [
|
||||||
|
'fontSize' => 44,
|
||||||
|
'imageH' => 150,
|
||||||
|
'imageW' => 350,
|
||||||
|
])
|
||||||
|
]);
|
||||||
|
$captcha = new Captcha((array)Config::get('captcha'));
|
||||||
|
return $captcha->entry($id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -293,84 +293,95 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'cookie']
|
||||||
var area = [$(window).width() > 800 ? '500px' : '95%', $(window).height() > 600 ? '400px' : '95%'];
|
var area = [$(window).width() > 800 ? '500px' : '95%', $(window).height() > 600 ? '400px' : '95%'];
|
||||||
var userinfo = Controller.api.userinfo.get();
|
var userinfo = Controller.api.userinfo.get();
|
||||||
if (!userinfo) {
|
if (!userinfo) {
|
||||||
Layer.open({
|
|
||||||
content: Template("logintpl", {}),
|
|
||||||
zIndex: 99,
|
|
||||||
area: area,
|
|
||||||
title: __('Login FastAdmin'),
|
|
||||||
resize: false,
|
|
||||||
btn: [__('Login'), __('Register')],
|
|
||||||
yes: function (index, layero) {
|
|
||||||
Fast.api.ajax({
|
|
||||||
url: Config.api_url + '/user/login',
|
|
||||||
type: 'post',
|
|
||||||
data: {
|
|
||||||
account: $("#inputAccount", layero).val(),
|
|
||||||
password: $("#inputPassword", layero).val(),
|
|
||||||
version: Config.faversion,
|
|
||||||
}
|
|
||||||
}, function (data, ret) {
|
|
||||||
Controller.api.userinfo.set(data);
|
|
||||||
Layer.closeAll();
|
|
||||||
Layer.alert(ret.msg, {title: __('Warning'), icon: 1});
|
|
||||||
return false;
|
|
||||||
}, function (data, ret) {
|
|
||||||
});
|
|
||||||
},
|
|
||||||
btn2: function () {
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
success: function (layero, index) {
|
|
||||||
this.checkEnterKey = function (event) {
|
|
||||||
if (event.keyCode === 13) {
|
|
||||||
$(".layui-layer-btn0").trigger("click");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
$(document).on('keydown', this.checkEnterKey);
|
|
||||||
$(".layui-layer-btn1", layero).prop("href", "https://www.fastadmin.net/user/register.html").prop("target", "_blank");
|
|
||||||
},
|
|
||||||
end: function () {
|
|
||||||
$(document).off('keydown', this.checkEnterKey);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
Fast.api.ajax({
|
Fast.api.ajax({
|
||||||
url: Config.api_url + '/user/index',
|
url: Config.api_url + '/user/logintpl',
|
||||||
|
type: 'post',
|
||||||
data: {
|
data: {
|
||||||
uid: userinfo.id,
|
version: Config.faversion
|
||||||
token: userinfo.token,
|
|
||||||
version: Config.faversion,
|
|
||||||
}
|
}
|
||||||
}, function (data) {
|
}, function (tpldata, ret) {
|
||||||
Layer.open({
|
Layer.open({
|
||||||
content: Template("userinfotpl", userinfo),
|
content: Template.render(tpldata, {}),
|
||||||
|
zIndex: 99,
|
||||||
area: area,
|
area: area,
|
||||||
title: __('Userinfo'),
|
title: __('Login FastAdmin'),
|
||||||
resize: false,
|
resize: false,
|
||||||
btn: [__('Logout'), __('Close')],
|
btn: [__('Login')],
|
||||||
yes: function () {
|
yes: function (index, layero) {
|
||||||
|
var data = $("form", layero).serializeArray();
|
||||||
|
data.push({name: "faversion", value: Config.faversion});
|
||||||
Fast.api.ajax({
|
Fast.api.ajax({
|
||||||
url: Config.api_url + '/user/logout',
|
url: Config.api_url + '/user/login',
|
||||||
data: {uid: userinfo.id, token: userinfo.token, version: Config.faversion}
|
type: 'post',
|
||||||
|
data: data
|
||||||
}, function (data, ret) {
|
}, function (data, ret) {
|
||||||
Controller.api.userinfo.set(null);
|
Controller.api.userinfo.set(data);
|
||||||
Layer.closeAll();
|
Layer.closeAll();
|
||||||
Layer.alert(ret.msg, {title: __('Warning'), icon: 0});
|
Layer.alert(ret.msg, {title: __('Warning'), icon: 1});
|
||||||
|
return false;
|
||||||
}, function (data, ret) {
|
}, function (data, ret) {
|
||||||
Controller.api.userinfo.set(null);
|
|
||||||
Layer.closeAll();
|
|
||||||
Layer.alert(ret.msg, {title: __('Warning'), icon: 0});
|
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
success: function (layero, index) {
|
||||||
|
this.checkEnterKey = function (event) {
|
||||||
|
if (event.keyCode === 13) {
|
||||||
|
$(".layui-layer-btn0").trigger("click");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
$(document).on('keydown', this.checkEnterKey);
|
||||||
|
},
|
||||||
|
end: function () {
|
||||||
|
$(document).off('keydown', this.checkEnterKey);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
}, function (data) {
|
});
|
||||||
Controller.api.userinfo.set(null);
|
} else {
|
||||||
$(that).trigger('click');
|
Fast.api.ajax({
|
||||||
|
url: Config.api_url + '/user/userinfotpl',
|
||||||
|
type: 'post',
|
||||||
|
data: {
|
||||||
|
version: Config.faversion
|
||||||
|
}
|
||||||
|
}, function (tpldata, ret) {
|
||||||
|
Fast.api.ajax({
|
||||||
|
url: Config.api_url + '/user/index',
|
||||||
|
data: {
|
||||||
|
uid: userinfo.id,
|
||||||
|
token: userinfo.token,
|
||||||
|
version: Config.faversion,
|
||||||
|
}
|
||||||
|
}, 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;
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -618,7 +629,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'cookie']
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Template.helper("__", __);
|
Template.helper("__", __);
|
||||||
Layer.confirm(Template("uninstalltpl", {addon: Config['addons'][name]}), {focusBtn: false}, function (index, layero) {
|
Layer.confirm(Template("uninstalltpl", {addon: Config['addons'][name]}), {focusBtn: false, title: __("Warning")}, function (index, layero) {
|
||||||
uninstall(name, false, $("input[name='droptables']", layero).prop("checked"));
|
uninstall(name, false, $("input[name='droptables']", layero).prop("checked"));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -715,7 +726,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'cookie']
|
||||||
if (typeof row.homepage !== 'undefined') {
|
if (typeof row.homepage !== 'undefined') {
|
||||||
url = row.homepage;
|
url = row.homepage;
|
||||||
} else if (typeof row.qq !== 'undefined' && row.qq) {
|
} else if (typeof row.qq !== 'undefined' && row.qq) {
|
||||||
url = 'https://wpa.qq.com/msgrd?v=3&uin=' + row.qq + '&site=fastadmin.net&menu=yes';
|
url = 'https://wpa.qq.com/msgrd?v=3&uin=' + row.qq + '&site=&menu=yes';
|
||||||
}
|
}
|
||||||
return '<a href="' + url + '" target="_blank" data-toggle="tooltip" class="text-primary">' + value + '</a>';
|
return '<a href="' + url + '" target="_blank" data-toggle="tooltip" class="text-primary">' + value + '</a>';
|
||||||
},
|
},
|
||||||
|
|
@ -740,26 +751,32 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template', 'cookie']
|
||||||
},
|
},
|
||||||
userinfo: {
|
userinfo: {
|
||||||
get: function () {
|
get: function () {
|
||||||
var userinfo = localStorage.getItem("fastadmin_userinfo");
|
if (typeof $.cookie !== 'undefined') {
|
||||||
|
var userinfo = $.cookie('fastadmin_userinfo');
|
||||||
|
} else {
|
||||||
|
var userinfo = sessionStorage.getItem("fastadmin_userinfo");
|
||||||
|
}
|
||||||
return userinfo ? JSON.parse(userinfo) : null;
|
return userinfo ? JSON.parse(userinfo) : null;
|
||||||
},
|
},
|
||||||
set: function (data) {
|
set: function (data) {
|
||||||
if (data) {
|
if (typeof $.cookie !== 'undefined') {
|
||||||
localStorage.setItem("fastadmin_userinfo", JSON.stringify(data));
|
if (data) {
|
||||||
|
$.cookie("fastadmin_userinfo", JSON.stringify(data));
|
||||||
|
} else {
|
||||||
|
$.removeCookie("fastadmin_userinfo");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
localStorage.removeItem("fastadmin_userinfo");
|
if (data) {
|
||||||
|
sessionStorage.setItem("fastadmin_userinfo", JSON.stringify(data));
|
||||||
|
} else {
|
||||||
|
sessionStorage.removeItem("fastadmin_userinfo");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
refresh: function (table, name) {
|
refresh: function (table, name) {
|
||||||
//刷新左侧边栏
|
//刷新左侧边栏
|
||||||
Fast.api.refreshmenu();
|
Fast.api.refreshmenu();
|
||||||
//刷新插件JS缓存
|
|
||||||
Fast.api.ajax({url: require.toUrl('addons.js'), loading: false}, function () {
|
|
||||||
return false;
|
|
||||||
}, function () {
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
//刷新行数据
|
//刷新行数据
|
||||||
if ($(".operate[data-name='" + name + "']").length > 0) {
|
if ($(".operate[data-name='" + name + "']").length > 0) {
|
||||||
|
|
|
||||||
|
|
@ -320,6 +320,12 @@ define(['jquery', 'bootstrap', 'toastr', 'layer', 'lang'], function ($, undefine
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
init: function () {
|
init: function () {
|
||||||
|
// jQuery兼容处理
|
||||||
|
$.fn.extend({
|
||||||
|
size: function () {
|
||||||
|
return $(this).length;
|
||||||
|
}
|
||||||
|
});
|
||||||
// 对相对地址进行处理
|
// 对相对地址进行处理
|
||||||
$.ajaxSetup({
|
$.ajaxSetup({
|
||||||
beforeSend: function (xhr, setting) {
|
beforeSend: function (xhr, setting) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue