This commit is contained in:
taoser 2021-02-01 16:02:15 +08:00
parent c44c421c18
commit a7402b82df
141 changed files with 14935 additions and 0 deletions

274
addons/README.md Normal file
View File

@ -0,0 +1,274 @@
# think-addons
The ThinkPHP 6 Addons Package
## 安装
> composer require zzstudio/think-addons
## 配置
### 生成配置
系统安装后会自动在 config 目录中生成 addons.php 的配置文件,
如果系统未生成可在命令行执行
```php
php think addons:config
```
快速生成配置文件
### 公共配置
```php
'addons' => [
// 是否自动读取取插件钩子配置信息(默认是开启)
'autoload' => true,
// 当关闭自动获取配置时需要手动配置hooks信息
'hooks' => [
// 可以定义多个钩子
'testhook'=>'test' // 键为钩子名称,用于在业务中自定义钩子处理,值为实现该钩子的插件,
// 多个插件可以用数组也可以用逗号分割
],
'route' => [],
'service' => [],
];
```
或者在\config目录中新建`addons.php`,内容为:
```php
<?php
return [
// 是否自动读取取插件钩子配置信息
'autoload' => false,
// 当关闭自动获取配置时需要手动配置hooks信息
'hooks' => [
// 可以定义多个钩子
'testhook'=>'test' // 键为钩子名称,用于在业务中自定义钩子处理,值为实现该钩子的插件,
// 多个插件可以用数组也可以用逗号分割
],
'route' => [],
'service' => [],
];
```
## 创建插件
> 创建的插件可以在view视图中使用也可以在php业务中使用
安装完成后访问系统时会在项目根目录生成名为`addons`的目录,在该目录中创建需要的插件。
下面写一个例子:
### 创建test插件
> 在addons目录中创建test目录
### 创建钩子实现类
> 在test目录中创建 Plugin.php 类文件。注意:类文件首字母需大写
```php
<?php
namespace addons\test; // 注意命名空间规范
use think\Addons;
/**
* 插件测试
* @author byron sampson
*/
class Plugin extends Addons // 需继承think\Addons类
{
// 该插件的基础信息
public $info = [
'name' => 'test', // 插件标识
'title' => '插件测试', // 插件名称
'description' => 'thinkph6插件测试', // 插件简介
'status' => 0, // 状态
'author' => 'byron sampson',
'version' => '0.1'
];
/**
* 插件安装方法
* @return bool
*/
public function install()
{
return true;
}
/**
* 插件卸载方法
* @return bool
*/
public function uninstall()
{
return true;
}
/**
* 实现的testhook钩子方法
* @return mixed
*/
public function testhook($param)
{
// 调用钩子时候的参数信息
print_r($param);
// 当前插件的配置信息配置信息存在当前目录的config.php文件中见下方
print_r($this->getConfig());
// 可以返回模板,模板文件默认读取的为插件目录中的文件。模板名不能为空!
return $this->fetch('info');
}
}
```
### 创建插件配置文件
> 在test目录中创建config.php类文件插件配置文件可以省略。
```php
<?php
return [
'display' => [
'title' => '是否显示:',
'type' => 'radio',
'options' => [
'1' => '显示',
'0' => '不显示'
],
'value' => '1'
]
];
```
### 创建钩子模板文件
> 在test->view目录中创建info.html模板文件钩子在使用fetch方法时对应的模板文件。
```html
<h1>hello tpl</h1>
如果插件中需要有链接或提交数据的业务可以在插件中创建controller业务文件
要访问插件中的controller时使用addon_url生成url链接。
如下:
<a href="{:addons_url('Action/link')}">link test</a>
<a href="{:addons_url('test://Action/link')}">link test</a>
格式为:
test为插件名Action为controller中的类名[多级控制器可以用.分割]link为controller中的方法
```
### 创建插件的controller文件
> 在test目录中创建controller目录在controller目录中创建Index.php文件
> controller类的用法与tp6中的controller一致
```php
<?php
namespace addons\test\controller;
class Index
{
public function link()
{
echo 'hello link';
}
}
```
## 使用钩子
> 创建好插件后就可以在正常业务中使用该插件中的钩子了
> 使用钩子的时候第二个参数可以省略
### 模板中使用钩子
```html
<div>{:hook('testhook', ['id'=>1])}</div>
```
### php业务中使用
> 只要是thinkphp6正常流程中的任意位置均可以使用
```php
hook('testhook', ['id'=>1])
```
### 插件公共方法
```php
/**
* 处理插件钩子
* @param string $event 钩子名称
* @param array|null $params 传入参数
* @param bool $once 是否只返回一个结果
* @return mixed
*/
function hook($event, $params = null, bool $once = false);
/**
* 读取插件的基础信息
* @param string $name 插件名
* @return array
*/
function get_addons_info($name);
/**
* 获取插件Plugin的单例
* @param string $name 插件名
* @return mixed|null
*/
function get_addons_instance($name);
/**
* 插件显示内容里生成访问插件的url
* @param $url 在插件控制器中可忽略插件名,在非插件中生成时需指定插件名。例:插件名://控制器/方法
* @param array $param
* @param bool|string $suffix 生成的URL后缀
* @param bool|string $domain 域名
* @return bool|string
*/
function addons_url($url = '', $param = [], $suffix = true, $domain = false);
```
## 插件目录结构
### 最终生成的目录结构为
```html
www WEB部署目录或者子目录
├─addons 插件目录
├─app 应用目录
│ ├─controller 控制器目录
│ ├─model 模型目录
│ ├─ ... 更多类库目录
│ │
│ ├─common.php 公共函数文件
│ └─event.php 事件定义文件
├─config 配置目录
│ ├─app.php 应用配置
│ ├─cache.php 缓存配置
│ ├─console.php 控制台配置
│ ├─cookie.php Cookie配置
│ ├─database.php 数据库配置
│ ├─filesystem.php 文件磁盘配置
│ ├─lang.php 多语言配置
│ ├─log.php 日志配置
│ ├─middleware.php 中间件配置
│ ├─route.php URL和路由配置
│ ├─session.php Session配置
│ ├─trace.php Trace配置
│ └─view.php 视图配置
├─view 视图目录
├─route 路由定义目录
│ ├─route.php 路由定义文件
│ └─ ...
├─public WEB目录对外访问目录
│ ├─index.php 入口文件
│ ├─router.php 快速测试文件
│ └─.htaccess 用于apache的重写
├─extend 扩展类库目录
├─runtime 应用的运行时目录(可写,可定制)
├─vendor Composer类库目录
├─.example.env 环境变量示例文件
├─composer.json composer 定义文件
├─LICENSE.txt 授权说明文件
├─README.md README 文件
├─think 命令行入口文件
```

104
app/common/lib/Msg.php Normal file
View File

@ -0,0 +1,104 @@
<?php
declare (strict_types = 1);
namespace app\common\lib;
use think\facade\Lang;
class Msg
{
static protected $res = [];
/**
* 设置状态吗
* @return array
*/
public static function setCodes()
{
return $res = [
'success' => 0,
'error' => 1,
'add_success' => Lang::get('add success'),
'add_error' => Lang::get('add error'),
'edit_success' => Lang::get('edit success'),
'edit_error' => Lang::get('edit error'),
'delete_success' => Lang::get('delete success'),
'delete_error' => Lang::get('delete error'),
'upload_success' => Lang::get('upload success'),
'upload_error' => Lang::get('upload error'),
'upgrade_success' => Lang::get('upgrade success'),
'upgrade_error' => Lang::get('upgrade error'),
'illegal_request' => Lang::get('illegal request'),
];
}
/**
* 获取返回码
* @param string $strCode
* @return mixed string
*/
public static function getCode(string $strCode){
foreach(self::setCodes() as $k => $v){
if($k == $strCode){
return $v;
}
}
}
/**
* 获取返回信息 如果不存在返回自身
* @param string $strMsg
* @return mixed string
*/
public static function getMsg(string $strMsg){
foreach(self::setCodes() as $k => $v){
if($k == $strMsg){
return $v;
}
}
}
/**
* 成功提示
* @param string $strMsg
* @param string|null $url
* @param string $data
* @return string|\think\response\Json
*/
public static function success(string $strMsg,string $url = null, $data = ''){
if(empty($strMsg)){
return '不能返回为空消息';
}
$result = [
'code' => self::getCode('success'),
'msg' => self::getMsg($strMsg),
'url' => $url,
'data' => $data
];
return json($result);
}
/**
* 失败提示
* @param string $strMsg 消息提示码
* @param string|null $url 跳转地址
* @param string $data 返回数据
* @return string|\think\response\Json
*/
public static function error(string $strMsg,string $url = null, $data = ''){
if(empty($strMsg)){
return '不能返回为空消息';
}
$result = [
'code' => self::getCode('error'),
'msg' => self::getMsg($strMsg),
'url' => $url,
'data' => $data
];
return json($result);
}
}

2
config/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
database.php
app.php

24
public/install.php Normal file
View File

@ -0,0 +1,24 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2019 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
// [ 应用入口文件 ]
namespace think;
require __DIR__ . '/../vendor/autoload.php';
// 执行HTTP应用并响应
$http = (new App())->http;
$response = $http->run();
$response->send();
$http->end($response);

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

2
public/static/res/mods/jquery.min.js vendored Normal file

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

220
vendor/opis/closure/CHANGELOG.md vendored Normal file
View File

@ -0,0 +1,220 @@
CHANGELOG
---------
### v3.5.1, 2019.11.30
- Bugfix. See #47
### v3.5.0, 2019.11.29
- Added support for short closures (arrow functions)
- Added `isShortClosure` method to `Opis\Closure\ReflectionClosure`
### v3.4.2, 2019.11.29
- Added `stream_set_option()`
### v3.4.1, 2019.10.19
- Fixed a [bug](https://github.com/opis/closure/issues/40) that prevented serialization to work correctly.
### v3.4.0, 2019.09.03
- Added `createClosure` static method in `Opis\Closure\SerializableClosure`.
This method creates a new closure from arbitrary code, emulating `create_function`,
but without using eval
### v3.3.1, 2019.07.10
- Use `sha1` instead of `md5` for hashing file names in `Opis\Closure\ReflectionClosure` class
### v3.3.0, 2019.05.31
- Fixed a bug that prevented signed closures to properly work when the serialized string
contains invalid UTF-8 chars. Starting with this version `json_encode` is no longer used
when signing a closure. Backward compatibility is maintained and all closures that were
previously signed using the old method will continue to work.
### v3.2.0, 2019.05.05
- Since an unsigned closure can be unserialized when no security provider is set,
there is no reason to treat differently a signed closure in the same situation.
Therefore, the `Opis\Closure\SecurityException` exception is no longer thrown when
unserializing a signed closure, if no security provider is set.
### v3.1.6, 2019.02.22
- Fixed a bug that occurred when trying to set properties of classes that were not defined in user-land.
Those properties are now ignored.
### v3.1.5, 2019.01.14
- Improved parser
### v3.1.4, 2019.01.14
- Added support for static methods that are named using PHP keywords or magic constants.
Ex: `A::new()`, `A::use()`, `A::if()`, `A::function()`, `A::__DIR__()`, etc.
- Used `@internal` to mark classes & methods that are for internal use only and
backward compatibility is not guaranteed.
### v3.1.3, 2019.01.07
- Fixed a bug that prevented traits to be correctly resolved when used by an
anonymous class
- Fixed a bug that occurred when `$this` keyword was used inside an anonymous class
### v3.1.2, 2018.12.16
* Fixed a bug regarding comma trail in group-use statements. See [issue 23](https://github.com/opis/closure/issues/23)
### v3.1.1, 2018.10.02
* Fixed a bug where `parent` keyword was treated like a class-name and scope was not added to the
serialized closure
* Fixed a bug where return type was not properly handled for nested closures
* Support for anonymous classes was improved
### v3.1.0, 2018.09.20
* Added `transformUseVariables` and `resolveUseVariables` to
`Opis\Closure\SerializableClosure` class.
* Added `removeSecurityProvider` static method to
`Opis\Closure\SerializableClosure` class.
* Fixed some security related issues where a user was able to unserialize an unsigned
closure, even when a security provider was in use.
### v3.0.12, 2018.02.23
* Bugfix. See [issue 20](https://github.com/opis/closure/issues/20)
### v3.0.11, 2018.01.22
* Bugfix. See [issue 18](https://github.com/opis/closure/issues/18)
### v3.0.10, 2018.01.04
* Improved support for PHP 7.1 & 7.2
### v3.0.9, 2018.01.04
* Fixed a bug where the return type was not properly resolved.
See [issue 17](https://github.com/opis/closure/issues/17)
* Added more tests
### v3.0.8, 2017.12.18
* Fixed a bug. See [issue 16](https://github.com/opis/closure/issues/16)
### v3.0.7, 2017.10.31
* Bugfix: static properties are ignored now, since they are not serializable
### v3.0.6, 2017.10.06
* Fixed a bug introduced by accident in 3.0.5
### v3.0.5, 2017.09.18
* Fixed a bug related to nested references
### v3.0.4, 2017.09.18
* \[*internal*\] Refactored `SerializableClosure::mapPointers` method
* \[*internal*\] Added a new optional argument to `SerializableClosure::unwrapClosures`
* \[*internal*\] Removed `SerializableClosure::getClosurePointer` method
* Fixed various bugs
### v3.0.3, 2017.09.06
* Fixed a bug related to nested object references
* \[*internal*\] `Opis\Closure\ClosureScope` now extends `SplObjectStorage`
* \[*internal*\] The `storage` property was removed from `Opis\Closure\ClosureScope`
* \[*internal*\] The `instances` and `objects` properties were removed from `Opis\Closure\ClosureContext`
### v3.0.2, 2017.08.28
* Fixed a bug where `$this` object was not handled properly inside the
`SerializableClosre::serialize` method.
### v3.0.1, 2017.04.13
* Fixed a bug in 'ignore_next' state
### v3.0.0, 2017.04.07
* Dropped PHP 5.3 support
* Moved source files from `lib` to `src` folder
* Removed second parameter from `Opis\Closure\SerializableClosure::from` method and from constructor
* Removed `Opis\Closure\{SecurityProviderInterface, DefaultSecurityProvider, SecureClosure}` classes
* Refactored how signed closures were handled
* Added `wrapClosures` and `unwrapClosures` static methods to `Opis\Closure\SerializableClosure` class
* Added `Opis\Colosure\serialize` and `Opis\Closure\unserialize` functions
* Improved serialization. You can now serialize arbitrary objects and the library will automatically wrap all closures
### v2.4.0, 2016.12.16
* The parser was refactored and improved
* Refactored `Opis\Closure\SerializableClosure::__invoke` method
* `Opis\Closure\{ISecurityProvider, SecurityProvider}` were added
* `Opis\Closure\{SecurityProviderInterface, DefaultSecurityProvider, SecureClosure}` were deprecated
and they will be removed in the next major version
* `setSecretKey` and `addSecurityProvider` static methods were added to `Opis\Closure\SerializableClosure`
### v2.3.2, 2016.12.15
* Fixed a bug that prevented namespace resolution to be done properly
### v2.3.1, 2016.12.13
* Hotfix. See [PR](https://github.com/opis/closure/pull/7)
### v2.3.0, 2016.11.17
* Added `isBindingRequired` and `isScopeRequired` to the `Opis\Closure\ReflectionClosure` class
* Automatically detects when the scope and/or the bound object of a closure needs to be serialized.
### v2.2.1, 2016.08.20
* Fixed a bug in `Opis\Closure\ReflectionClosure::fetchItems`
### v2.2.0, 2016.07.26
* Fixed CS
* `Opis\Closure\ClosureContext`, `Opis\Closure\ClosureScope`, `Opis\Closure\SelfReference`
and `Opis\Closure\SecurityException` classes were moved into separate files
* Added support for PHP7 syntax
* Fixed some bugs in `Opis\Closure\ReflectionClosure` class
* Improved closure parser
* Added an analyzer for SuperClosure library
### v2.1.0, 2015.09.30
* Added support for the missing `__METHOD__`, `__FUNCTION__` and `__TRAIT__` magic constants
* Added some security related classes and interfaces: `Opis\Closure\SecurityProviderInterface`,
`Opis\Closure\DefaultSecurityProvider`, `Opis\Closure\SecureClosure`, `Opis\Closure\SecurityException`.
* Fiexed a bug in `Opis\Closure\ReflectionClosure::getClasses` method
* Other minor bugfixes
* Added support for static closures
* Added public `isStatic` method to `Opis\Closure\ReflectionClosure` class
### v2.0.1, 2015.09.23
* Removed `branch-alias` property from `composer.json`
* Bugfix. See [issue #6](https://github.com/opis/closure/issues/6)
### v2.0.0, 2015.07.31
* The closure parser was improved
* Class names are now automatically resolved
* Added support for the `#trackme` directive which allows tracking closure's residing source
### v1.3.0, 2014.10.18
* Added autoload file
* Changed README file
### Opis Closure 1.2.2
* Started changelog

20
vendor/opis/closure/LICENSE vendored Normal file
View File

@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2018-2019 Zindex Software
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

9
vendor/opis/closure/NOTICE vendored Normal file
View File

@ -0,0 +1,9 @@
Opis Closure
Copyright 2018-2019 Zindex Software
This product includes software developed at
Zindex Software (http://zindex.software).
This software was originally developed by Marius Sarca and Sorin Sarca
(Copyright 2014-2018). The copyright info was changed with the permission
of the original authors.

98
vendor/opis/closure/README.md vendored Normal file
View File

@ -0,0 +1,98 @@
Opis Closure
====================
[![Build Status](https://travis-ci.org/opis/closure.png)](https://travis-ci.org/opis/closure)
[![Latest Stable Version](https://poser.pugx.org/opis/closure/v/stable.png)](https://packagist.org/packages/opis/closure)
[![Latest Unstable Version](https://poser.pugx.org/opis/closure/v/unstable.png)](https://packagist.org/packages/opis/closure)
[![License](https://poser.pugx.org/opis/closure/license.png)](https://packagist.org/packages/opis/closure)
Serializable closures
---------------------
**Opis Closure** is a library that aims to overcome PHP's limitations regarding closure
serialization by providing a wrapper that will make all closures serializable.
**The library's key features:**
- Serialize any closure
- Serialize arbitrary objects
- Doesn't use `eval` for closure serialization or unserialization
- Works with any PHP version that has support for closures
- Supports PHP 7 syntax
- Handles all variables referenced/imported in `use()` and automatically wraps all referenced/imported closures for
proper serialization
- Handles recursive closures
- Handles magic constants like `__FILE__`, `__DIR__`, `__LINE__`, `__NAMESPACE__`, `__CLASS__`,
`__TRAIT__`, `__METHOD__` and `__FUNCTION__`.
- Automatically resolves all class names, function names and constant names used inside the closure
- Track closure's residing source by using the `#trackme` directive
- Simple and very fast parser
- Any error or exception, that might occur when executing an unserialized closure, can be caught and treated properly
- You can serialize/unserialize any closure unlimited times, even those previously unserialized
(this is possible because `eval()` is not used for unserialization)
- Handles static closures
- Supports cryptographically signed closures
- Provides a reflector that can give you information about the serialized closure
- Provides an analyzer for *SuperClosure* library
- Automatically detects when the scope and/or the bound object of a closure needs to be serialized
in order for the closure to work after deserialization
### Documentation
The full documentation for this library can be found [here][documentation].
### License
**Opis Closure** is licensed under the [MIT License (MIT)][license].
### Requirements
* PHP ^5.4 || ^7.0
## Installation
**Opis Closure** is available on [Packagist] and it can be installed from a
command line interface by using [Composer].
```bash
composer require opis/closure
```
Or you could directly reference it into your `composer.json` file as a dependency
```json
{
"require": {
"opis/closure": "^3.5"
}
}
```
### Migrating from 2.x
If your project needs to support PHP 5.3 you can continue using the `2.x` version
of **Opis Closure**. Otherwise, assuming you are not using one of the removed/refactored classes or features(see
[CHANGELOG]), migrating to version `3.x` is simply a matter of updating your `composer.json` file.
### Semantic versioning
**Opis Closure** follows [semantic versioning][SemVer] specifications.
### Arbitrary object serialization
This feature was primarily introduced in order to support serializing an object bound
to a closure and available via `$this`. The implementation is far from being perfect
and it's really hard to make it work flawless. I will try to improve this, but I can
not guarantee anything. So my advice regarding the `Opis\Closure\serialize|unserialize`
functions is to use them with caution.
### SuperClosure support
**Opis Closure** is shipped with an analyzer(`Opis\Closure\Analyzer`) which
aims to provide *Opis Closure*'s parsing precision and speed to [SuperClosure].
[documentation]: https://www.opis.io/closure "Opis Closure"
[license]: http://opensource.org/licenses/MIT "MIT License"
[Packagist]: https://packagist.org/packages/opis/closure "Packagist"
[Composer]: https://getcomposer.org "Composer"
[SuperClosure]: https://github.com/jeremeamia/super_closure "SuperClosure"
[SemVer]: http://semver.org/ "Semantic versioning"
[CHANGELOG]: https://github.com/opis/closure/blob/master/CHANGELOG.md "Changelog"

39
vendor/opis/closure/autoload.php vendored Normal file
View File

@ -0,0 +1,39 @@
<?php
/* ===========================================================================
* Copyright (c) 2018-2019 Zindex Software
*
* Licensed under the MIT License
* =========================================================================== */
require_once 'functions.php';
spl_autoload_register(function($class){
$class = ltrim($class, '\\');
$dir = __DIR__ . '/src';
$namespace = 'Opis\Closure';
if(strpos($class, $namespace) === 0)
{
$class = substr($class, strlen($namespace));
$path = '';
if(($pos = strripos($class, '\\')) !== FALSE)
{
$path = str_replace('\\', '/', substr($class, 0, $pos)) . '/';
$class = substr($class, $pos + 1);
}
$path .= str_replace('_', '/', $class) . '.php';
$dir .= '/' . $path;
if(file_exists($dir))
{
include $dir;
return true;
}
return false;
}
return false;
});

40
vendor/opis/closure/composer.json vendored Normal file
View File

@ -0,0 +1,40 @@
{
"name": "opis/closure",
"description": "A library that can be used to serialize closures (anonymous functions) and arbitrary objects.",
"keywords": ["closure", "serialization", "function", "serializable", "serialize", "anonymous functions"],
"homepage": "https://opis.io/closure",
"license": "MIT",
"authors": [
{
"name": "Marius Sarca",
"email": "marius.sarca@gmail.com"
},
{
"name": "Sorin Sarca",
"email": "sarca_sorin@hotmail.com"
}
],
"require": {
"php": "^5.4 || ^7.0"
},
"require-dev": {
"jeremeamia/superclosure": "^2.0",
"phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
},
"autoload": {
"psr-4": {
"Opis\\Closure\\": "src/"
},
"files": ["functions.php"]
},
"autoload-dev": {
"psr-4": {
"Opis\\Closure\\Test\\": "tests/"
}
},
"extra": {
"branch-alias": {
"dev-master": "3.5.x-dev"
}
}
}

38
vendor/opis/closure/functions.php vendored Normal file
View File

@ -0,0 +1,38 @@
<?php
/* ===========================================================================
* Copyright (c) 2018-2019 Zindex Software
*
* Licensed under the MIT License
* =========================================================================== */
namespace Opis\Closure;
/**
* Serialize
*
* @param $data
* @return string
*/
function serialize($data)
{
SerializableClosure::enterContext();
SerializableClosure::wrapClosures($data);
$data = \serialize($data);
SerializableClosure::exitContext();
return $data;
}
/**
* Unserialize
*
* @param $data
* @return mixed
*/
function unserialize($data)
{
SerializableClosure::enterContext();
$data = \unserialize($data);
SerializableClosure::unwrapClosures($data);
SerializableClosure::exitContext();
return $data;
}

59
vendor/opis/closure/src/Analyzer.php vendored Normal file
View File

@ -0,0 +1,59 @@
<?php
/* ===========================================================================
* Copyright (c) 2018-2019 Zindex Software
*
* Licensed under the MIT License
* =========================================================================== */
namespace Opis\Closure;
use Closure;
use SuperClosure\Analyzer\ClosureAnalyzer;
class Analyzer extends ClosureAnalyzer
{
/**
* Analyzer a given closure.
*
* @param Closure $closure
*
* @return array
*/
public function analyze(Closure $closure)
{
$reflection = new ReflectionClosure($closure);
$scope = $reflection->getClosureScopeClass();
$data = [
'reflection' => $reflection,
'code' => $reflection->getCode(),
'hasThis' => $reflection->isBindingRequired(),
'context' => $reflection->getUseVariables(),
'hasRefs' => false,
'binding' => $reflection->getClosureThis(),
'scope' => $scope ? $scope->getName() : null,
'isStatic' => $reflection->isStatic(),
];
return $data;
}
/**
* @param array $data
* @return mixed
*/
protected function determineCode(array &$data)
{
return null;
}
/**
* @param array $data
* @return mixed
*/
protected function determineContext(array &$data)
{
return null;
}
}

View File

@ -0,0 +1,34 @@
<?php
/* ===========================================================================
* Copyright (c) 2018-2019 Zindex Software
*
* Licensed under the MIT License
* =========================================================================== */
namespace Opis\Closure;
/**
* Closure context class
* @internal
*/
class ClosureContext
{
/**
* @var ClosureScope Closures scope
*/
public $scope;
/**
* @var integer
*/
public $locks;
/**
* Constructor
*/
public function __construct()
{
$this->scope = new ClosureScope();
$this->locks = 0;
}
}

View File

@ -0,0 +1,25 @@
<?php
/* ===========================================================================
* Copyright (c) 2018-2019 Zindex Software
*
* Licensed under the MIT License
* =========================================================================== */
namespace Opis\Closure;
/**
* Closure scope class
* @internal
*/
class ClosureScope extends \SplObjectStorage
{
/**
* @var integer Number of serializations in current scope
*/
public $serializations = 0;
/**
* @var integer Number of closures that have to be serialized
*/
public $toserialize = 0;
}

View File

@ -0,0 +1,99 @@
<?php
/* ===========================================================================
* Copyright (c) 2018-2019 Zindex Software
*
* Licensed under the MIT License
* =========================================================================== */
namespace Opis\Closure;
/**
* @internal
*/
class ClosureStream
{
const STREAM_PROTO = 'closure';
protected static $isRegistered = false;
protected $content;
protected $length;
protected $pointer = 0;
function stream_open($path, $mode, $options, &$opened_path)
{
$this->content = "<?php\nreturn " . substr($path, strlen(static::STREAM_PROTO . '://')) . ";";
$this->length = strlen($this->content);
return true;
}
public function stream_read($count)
{
$value = substr($this->content, $this->pointer, $count);
$this->pointer += $count;
return $value;
}
public function stream_eof()
{
return $this->pointer >= $this->length;
}
public function stream_set_option($option, $arg1, $arg2)
{
return false;
}
public function stream_stat()
{
$stat = stat(__FILE__);
$stat[7] = $stat['size'] = $this->length;
return $stat;
}
public function url_stat($path, $flags)
{
$stat = stat(__FILE__);
$stat[7] = $stat['size'] = $this->length;
return $stat;
}
public function stream_seek($offset, $whence = SEEK_SET)
{
$crt = $this->pointer;
switch ($whence) {
case SEEK_SET:
$this->pointer = $offset;
break;
case SEEK_CUR:
$this->pointer += $offset;
break;
case SEEK_END:
$this->pointer = $this->length + $offset;
break;
}
if ($this->pointer < 0 || $this->pointer >= $this->length) {
$this->pointer = $crt;
return false;
}
return true;
}
public function stream_tell()
{
return $this->pointer;
}
public static function register()
{
if (!static::$isRegistered) {
static::$isRegistered = stream_wrapper_register(static::STREAM_PROTO, __CLASS__);
}
}
}

View File

@ -0,0 +1,25 @@
<?php
/* ===========================================================================
* Copyright (c) 2018-2019 Zindex Software
*
* Licensed under the MIT License
* =========================================================================== */
namespace Opis\Closure;
interface ISecurityProvider
{
/**
* Sign serialized closure
* @param string $closure
* @return array
*/
public function sign($closure);
/**
* Verify signature
* @param array $data
* @return bool
*/
public function verify(array $data);
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,18 @@
<?php
/* ===========================================================================
* Copyright (c) 2018-2019 Zindex Software
*
* Licensed under the MIT License
* =========================================================================== */
namespace Opis\Closure;
use Exception;
/**
* Security exception class
*/
class SecurityException extends Exception
{
}

View File

@ -0,0 +1,42 @@
<?php
/* ===========================================================================
* Copyright (c) 2018-2019 Zindex Software
*
* Licensed under the MIT License
* =========================================================================== */
namespace Opis\Closure;
class SecurityProvider implements ISecurityProvider
{
/** @var string */
protected $secret;
/**
* SecurityProvider constructor.
* @param string $secret
*/
public function __construct($secret)
{
$this->secret = $secret;
}
/**
* @inheritdoc
*/
public function sign($closure)
{
return array(
'closure' => $closure,
'hash' => base64_encode(hash_hmac('sha256', $closure, $this->secret, true)),
);
}
/**
* @inheritdoc
*/
public function verify(array $data)
{
return base64_encode(hash_hmac('sha256', $data['closure'], $this->secret, true)) === $data['hash'];
}
}

View File

@ -0,0 +1,31 @@
<?php
/* ===========================================================================
* Copyright (c) 2018-2019 Zindex Software
*
* Licensed under the MIT License
* =========================================================================== */
namespace Opis\Closure;
/**
* Helper class used to indicate a reference to an object
* @internal
*/
class SelfReference
{
/**
* @var string An unique hash representing the object
*/
public $hash;
/**
* Constructor
*
* @param string $hash
*/
public function __construct($hash)
{
$this->hash = $hash;
}
}

View File

@ -0,0 +1,668 @@
<?php
/* ===========================================================================
* Copyright (c) 2018-2019 Zindex Software
*
* Licensed under the MIT License
* =========================================================================== */
namespace Opis\Closure;
use Closure;
use Serializable;
use SplObjectStorage;
use ReflectionObject;
/**
* Provides a wrapper for serialization of closures
*/
class SerializableClosure implements Serializable
{
/**
* @var Closure Wrapped closure
*
* @see \Opis\Closure\SerializableClosure::getClosure()
*/
protected $closure;
/**
* @var ReflectionClosure A reflection instance for closure
*
* @see \Opis\Closure\SerializableClosure::getReflector()
*/
protected $reflector;
/**
* @var mixed Used at deserialization to hold variables
*
* @see \Opis\Closure\SerializableClosure::unserialize()
* @see \Opis\Closure\SerializableClosure::getReflector()
*/
protected $code;
/**
* @var string Closure's ID
*/
protected $reference;
/**
* @var string Closure scope
*/
protected $scope;
/**
* @var ClosureContext Context of closure, used in serialization
*/
protected static $context;
/**
* @var ISecurityProvider|null
*/
protected static $securityProvider;
/** Array recursive constant*/
const ARRAY_RECURSIVE_KEY = '¯\_(ツ)_/¯';
/**
* Constructor
*
* @param Closure $closure Closure you want to serialize
*/
public function __construct(Closure $closure)
{
$this->closure = $closure;
if (static::$context !== null) {
$this->scope = static::$context->scope;
$this->scope->toserialize++;
}
}
/**
* Get the Closure object
*
* @return Closure The wrapped closure
*/
public function getClosure()
{
return $this->closure;
}
/**
* Get the reflector for closure
*
* @return ReflectionClosure
*/
public function getReflector()
{
if ($this->reflector === null) {
$this->reflector = new ReflectionClosure($this->closure, $this->code);
$this->code = null;
}
return $this->reflector;
}
/**
* Implementation of magic method __invoke()
*/
public function __invoke()
{
return call_user_func_array($this->closure, func_get_args());
}
/**
* Implementation of Serializable::serialize()
*
* @return string The serialized closure
*/
public function serialize()
{
if ($this->scope === null) {
$this->scope = new ClosureScope();
$this->scope->toserialize++;
}
$this->scope->serializations++;
$scope = $object = null;
$reflector = $this->getReflector();
if($reflector->isBindingRequired()){
$object = $reflector->getClosureThis();
static::wrapClosures($object, $this->scope);
if($scope = $reflector->getClosureScopeClass()){
$scope = $scope->name;
}
} elseif($reflector->isScopeRequired()) {
if($scope = $reflector->getClosureScopeClass()){
$scope = $scope->name;
}
}
$this->reference = spl_object_hash($this->closure);
$this->scope[$this->closure] = $this;
$use = $this->transformUseVariables($reflector->getUseVariables());
$code = $reflector->getCode();
$this->mapByReference($use);
$ret = \serialize(array(
'use' => $use,
'function' => $code,
'scope' => $scope,
'this' => $object,
'self' => $this->reference,
));
if (static::$securityProvider !== null) {
$data = static::$securityProvider->sign($ret);
$ret = '@' . $data['hash'] . '.' . $data['closure'];
}
if (!--$this->scope->serializations && !--$this->scope->toserialize) {
$this->scope = null;
}
return $ret;
}
/**
* Transform the use variables before serialization.
*
* @param array $data The Closure's use variables
* @return array
*/
protected function transformUseVariables($data)
{
return $data;
}
/**
* Implementation of Serializable::unserialize()
*
* @param string $data Serialized data
* @throws SecurityException
*/
public function unserialize($data)
{
ClosureStream::register();
if (static::$securityProvider !== null) {
if ($data[0] !== '@') {
throw new SecurityException("The serialized closure is not signed. ".
"Make sure you use a security provider for both serialization and unserialization.");
}
if ($data[1] !== '{') {
$separator = strpos($data, '.');
if ($separator === false) {
throw new SecurityException('Invalid signed closure');
}
$hash = substr($data, 1, $separator - 1);
$closure = substr($data, $separator + 1);
$data = ['hash' => $hash, 'closure' => $closure];
unset($hash, $closure);
} else {
$data = json_decode(substr($data, 1), true);
}
if (!is_array($data) || !static::$securityProvider->verify($data)) {
throw new SecurityException("Your serialized closure might have been modified and it's unsafe to be unserialized. " .
"Make sure you use the same security provider, with the same settings, " .
"both for serialization and unserialization.");
}
$data = $data['closure'];
} elseif ($data[0] === '@') {
if ($data[1] !== '{') {
$separator = strpos($data, '.');
if ($separator === false) {
throw new SecurityException('Invalid signed closure');
}
$hash = substr($data, 1, $separator - 1);
$closure = substr($data, $separator + 1);
$data = ['hash' => $hash, 'closure' => $closure];
unset($hash, $closure);
} else {
$data = json_decode(substr($data, 1), true);
}
if (!is_array($data) || !isset($data['closure']) || !isset($data['hash'])) {
throw new SecurityException('Invalid signed closure');
}
$data = $data['closure'];
}
$this->code = \unserialize($data);
// unset data
unset($data);
$this->code['objects'] = array();
if ($this->code['use']) {
$this->scope = new ClosureScope();
$this->code['use'] = $this->resolveUseVariables($this->code['use']);
$this->mapPointers($this->code['use']);
extract($this->code['use'], EXTR_OVERWRITE | EXTR_REFS);
$this->scope = null;
}
$this->closure = include(ClosureStream::STREAM_PROTO . '://' . $this->code['function']);
if($this->code['this'] === $this){
$this->code['this'] = null;
}
if ($this->code['scope'] !== null || $this->code['this'] !== null) {
$this->closure = $this->closure->bindTo($this->code['this'], $this->code['scope']);
}
if(!empty($this->code['objects'])){
foreach ($this->code['objects'] as $item){
$item['property']->setValue($item['instance'], $item['object']->getClosure());
}
}
$this->code = $this->code['function'];
}
/**
* Resolve the use variables after unserialization.
*
* @param array $data The Closure's transformed use variables
* @return array
*/
protected function resolveUseVariables($data)
{
return $data;
}
/**
* Wraps a closure and sets the serialization context (if any)
*
* @param Closure $closure Closure to be wrapped
*
* @return self The wrapped closure
*/
public static function from(Closure $closure)
{
if (static::$context === null) {
$instance = new static($closure);
} elseif (isset(static::$context->scope[$closure])) {
$instance = static::$context->scope[$closure];
} else {
$instance = new static($closure);
static::$context->scope[$closure] = $instance;
}
return $instance;
}
/**
* Increments the context lock counter or creates a new context if none exist
*/
public static function enterContext()
{
if (static::$context === null) {
static::$context = new ClosureContext();
}
static::$context->locks++;
}
/**
* Decrements the context lock counter and destroy the context when it reaches to 0
*/
public static function exitContext()
{
if (static::$context !== null && !--static::$context->locks) {
static::$context = null;
}
}
/**
* @param string $secret
*/
public static function setSecretKey($secret)
{
if(static::$securityProvider === null){
static::$securityProvider = new SecurityProvider($secret);
}
}
/**
* @param ISecurityProvider $securityProvider
*/
public static function addSecurityProvider(ISecurityProvider $securityProvider)
{
static::$securityProvider = $securityProvider;
}
/**
* Remove security provider
*/
public static function removeSecurityProvider()
{
static::$securityProvider = null;
}
/**
* @return null|ISecurityProvider
*/
public static function getSecurityProvider()
{
return static::$securityProvider;
}
/**
* Wrap closures
*
* @internal
* @param $data
* @param ClosureScope|SplObjectStorage|null $storage
*/
public static function wrapClosures(&$data, SplObjectStorage $storage = null)
{
if($storage === null){
$storage = static::$context->scope;
}
if($data instanceof Closure){
$data = static::from($data);
} elseif (is_array($data)){
if(isset($data[self::ARRAY_RECURSIVE_KEY])){
return;
}
$data[self::ARRAY_RECURSIVE_KEY] = true;
foreach ($data as $key => &$value){
if($key === self::ARRAY_RECURSIVE_KEY){
continue;
}
static::wrapClosures($value, $storage);
}
unset($value);
unset($data[self::ARRAY_RECURSIVE_KEY]);
} elseif($data instanceof \stdClass){
if(isset($storage[$data])){
$data = $storage[$data];
return;
}
$data = $storage[$data] = clone($data);
foreach ($data as &$value){
static::wrapClosures($value, $storage);
}
unset($value);
} elseif (is_object($data) && ! $data instanceof static){
if(isset($storage[$data])){
$data = $storage[$data];
return;
}
$instance = $data;
$reflection = new ReflectionObject($instance);
if(!$reflection->isUserDefined()){
$storage[$instance] = $data;
return;
}
$storage[$instance] = $data = $reflection->newInstanceWithoutConstructor();
do{
if(!$reflection->isUserDefined()){
break;
}
foreach ($reflection->getProperties() as $property){
if($property->isStatic() || !$property->getDeclaringClass()->isUserDefined()){
continue;
}
$property->setAccessible(true);
$value = $property->getValue($instance);
if(is_array($value) || is_object($value)){
static::wrapClosures($value, $storage);
}
$property->setValue($data, $value);
};
} while($reflection = $reflection->getParentClass());
}
}
/**
* Unwrap closures
*
* @internal
* @param $data
* @param SplObjectStorage|null $storage
*/
public static function unwrapClosures(&$data, SplObjectStorage $storage = null)
{
if($storage === null){
$storage = static::$context->scope;
}
if($data instanceof static){
$data = $data->getClosure();
} elseif (is_array($data)){
if(isset($data[self::ARRAY_RECURSIVE_KEY])){
return;
}
$data[self::ARRAY_RECURSIVE_KEY] = true;
foreach ($data as $key => &$value){
if($key === self::ARRAY_RECURSIVE_KEY){
continue;
}
static::unwrapClosures($value, $storage);
}
unset($data[self::ARRAY_RECURSIVE_KEY]);
}elseif ($data instanceof \stdClass){
if(isset($storage[$data])){
return;
}
$storage[$data] = true;
foreach ($data as &$property){
static::unwrapClosures($property, $storage);
}
} elseif (is_object($data) && !($data instanceof Closure)){
if(isset($storage[$data])){
return;
}
$storage[$data] = true;
$reflection = new ReflectionObject($data);
do{
if(!$reflection->isUserDefined()){
break;
}
foreach ($reflection->getProperties() as $property){
if($property->isStatic() || !$property->getDeclaringClass()->isUserDefined()){
continue;
}
$property->setAccessible(true);
$value = $property->getValue($data);
if(is_array($value) || is_object($value)){
static::unwrapClosures($value, $storage);
$property->setValue($data, $value);
}
};
} while($reflection = $reflection->getParentClass());
}
}
/**
* Creates a new closure from arbitrary code,
* emulating create_function, but without using eval
*
* @param string$args
* @param string $code
* @return Closure
*/
public static function createClosure($args, $code)
{
ClosureStream::register();
return include(ClosureStream::STREAM_PROTO . '://function(' . $args. '){' . $code . '};');
}
/**
* Internal method used to map closure pointers
* @internal
* @param $data
*/
protected function mapPointers(&$data)
{
$scope = $this->scope;
if ($data instanceof static) {
$data = &$data->closure;
} elseif (is_array($data)) {
if(isset($data[self::ARRAY_RECURSIVE_KEY])){
return;
}
$data[self::ARRAY_RECURSIVE_KEY] = true;
foreach ($data as $key => &$value){
if($key === self::ARRAY_RECURSIVE_KEY){
continue;
} elseif ($value instanceof static) {
$data[$key] = &$value->closure;
} elseif ($value instanceof SelfReference && $value->hash === $this->code['self']){
$data[$key] = &$this->closure;
} else {
$this->mapPointers($value);
}
}
unset($value);
unset($data[self::ARRAY_RECURSIVE_KEY]);
} elseif ($data instanceof \stdClass) {
if(isset($scope[$data])){
return;
}
$scope[$data] = true;
foreach ($data as $key => &$value){
if ($value instanceof SelfReference && $value->hash === $this->code['self']){
$data->{$key} = &$this->closure;
} elseif(is_array($value) || is_object($value)) {
$this->mapPointers($value);
}
}
unset($value);
} elseif (is_object($data) && !($data instanceof Closure)){
if(isset($scope[$data])){
return;
}
$scope[$data] = true;
$reflection = new ReflectionObject($data);
do{
if(!$reflection->isUserDefined()){
break;
}
foreach ($reflection->getProperties() as $property){
if($property->isStatic() || !$property->getDeclaringClass()->isUserDefined()){
continue;
}
$property->setAccessible(true);
$item = $property->getValue($data);
if ($item instanceof SerializableClosure || ($item instanceof SelfReference && $item->hash === $this->code['self'])) {
$this->code['objects'][] = array(
'instance' => $data,
'property' => $property,
'object' => $item instanceof SelfReference ? $this : $item,
);
} elseif (is_array($item) || is_object($item)) {
$this->mapPointers($item);
$property->setValue($data, $item);
}
}
} while($reflection = $reflection->getParentClass());
}
}
/**
* Internal method used to map closures by reference
*
* @internal
* @param mixed &$data
*/
protected function mapByReference(&$data)
{
if ($data instanceof Closure) {
if($data === $this->closure){
$data = new SelfReference($this->reference);
return;
}
if (isset($this->scope[$data])) {
$data = $this->scope[$data];
return;
}
$instance = new static($data);
if (static::$context !== null) {
static::$context->scope->toserialize--;
} else {
$instance->scope = $this->scope;
}
$data = $this->scope[$data] = $instance;
} elseif (is_array($data)) {
if(isset($data[self::ARRAY_RECURSIVE_KEY])){
return;
}
$data[self::ARRAY_RECURSIVE_KEY] = true;
foreach ($data as $key => &$value){
if($key === self::ARRAY_RECURSIVE_KEY){
continue;
}
$this->mapByReference($value);
}
unset($value);
unset($data[self::ARRAY_RECURSIVE_KEY]);
} elseif ($data instanceof \stdClass) {
if(isset($this->scope[$data])){
$data = $this->scope[$data];
return;
}
$instance = $data;
$this->scope[$instance] = $data = clone($data);
foreach ($data as &$value){
$this->mapByReference($value);
}
unset($value);
} elseif (is_object($data) && !$data instanceof SerializableClosure){
if(isset($this->scope[$data])){
$data = $this->scope[$data];
return;
}
$instance = $data;
$reflection = new ReflectionObject($data);
if(!$reflection->isUserDefined()){
$this->scope[$instance] = $data;
return;
}
$this->scope[$instance] = $data = $reflection->newInstanceWithoutConstructor();
do{
if(!$reflection->isUserDefined()){
break;
}
foreach ($reflection->getProperties() as $property){
if($property->isStatic() || !$property->getDeclaringClass()->isUserDefined()){
continue;
}
$property->setAccessible(true);
$value = $property->getValue($instance);
if(is_array($value) || is_object($value)){
$this->mapByReference($value);
}
$property->setValue($data, $value);
}
} while($reflection = $reflection->getParentClass());
}
}
}

View File

@ -0,0 +1,26 @@
<?php
/**
* Armenian PHPMailer language file: refer to English translation for definitive list
* @package PHPMailer
* @author Hrayr Grigoryan <hrayr@bits.am>
*/
$PHPMAILER_LANG['authenticate'] = 'SMTP -ի սխալ: չհաջողվեց ստուգել իսկությունը.';
$PHPMAILER_LANG['connect_host'] = 'SMTP -ի սխալ: չհաջողվեց կապ հաստատել SMTP սերվերի հետ.';
$PHPMAILER_LANG['data_not_accepted'] = 'SMTP -ի սխալ: տվյալները ընդունված չեն.';
$PHPMAILER_LANG['empty_message'] = 'Հաղորդագրությունը դատարկ է';
$PHPMAILER_LANG['encoding'] = 'Կոդավորման անհայտ տեսակ: ';
$PHPMAILER_LANG['execute'] = 'Չհաջողվեց իրականացնել հրամանը: ';
$PHPMAILER_LANG['file_access'] = 'Ֆայլը հասանելի չէ: ';
$PHPMAILER_LANG['file_open'] = 'Ֆայլի սխալ: ֆայլը չհաջողվեց բացել: ';
$PHPMAILER_LANG['from_failed'] = 'Ուղարկողի հետևյալ հասցեն սխալ է: ';
$PHPMAILER_LANG['instantiate'] = 'Հնարավոր չէ կանչել mail ֆունկցիան.';
$PHPMAILER_LANG['invalid_address'] = 'Հասցեն սխալ է: ';
$PHPMAILER_LANG['mailer_not_supported'] = ' փոստային սերվերի հետ չի աշխատում.';
$PHPMAILER_LANG['provide_address'] = 'Անհրաժեշտ է տրամադրել գոնե մեկ ստացողի e-mail հասցե.';
$PHPMAILER_LANG['recipients_failed'] = 'SMTP -ի սխալ: չի հաջողվել ուղարկել հետևյալ ստացողների հասցեներին: ';
$PHPMAILER_LANG['signing'] = 'Ստորագրման սխալ: ';
$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP -ի connect() ֆունկցիան չի հաջողվել';
$PHPMAILER_LANG['smtp_error'] = 'SMTP սերվերի սխալ: ';
$PHPMAILER_LANG['variable_set'] = 'Չի հաջողվում ստեղծել կամ վերափոխել փոփոխականը: ';
$PHPMAILER_LANG['extension_missing'] = 'Հավելվածը բացակայում է: ';

1
vendor/psr/log/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
vendor

View File

@ -0,0 +1,3 @@
/Tests export-ignore
/phpunit.xml.dist export-ignore
/.gitignore export-ignore

View File

@ -0,0 +1,27 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace think\route\dispatch;
use think\Response;
use think\route\Dispatch;
/**
* Redirect Dispatcher
*/
class Redirect extends Dispatch
{
public function exec()
{
return Response::create($this->dispatch, 'redirect')->code($this->code);
}
}

View File

@ -0,0 +1,27 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace think\route\dispatch;
use think\route\Dispatch;
/**
* Response Dispatcher
*/
class Response extends Dispatch
{
public function exec()
{
return $this->dispatch;
}
}

View File

@ -0,0 +1,28 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
declare (strict_types = 1);
namespace think\route\dispatch;
use think\Response;
use think\route\Dispatch;
/**
* View Dispatcher
*/
class View extends Dispatch
{
public function exec()
{
// 渲染模板输出
return Response::create($this->dispatch, 'view')->assign($this->param);
}
}

1
view/README.md Normal file
View File

@ -0,0 +1 @@
如果不使用模板,可以删除该目录

3
view/admin/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
/keyauth
/time_line
/version

48
view/admin/admin/add.html Normal file
View File

@ -0,0 +1,48 @@
{extend name="public:base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-admin" id="layuiadmin-form-admin" style="padding: 20px 30px 0 0;">
<div class="layui-form-item">
<label class="layui-form-label">登录名</label>
<div class="layui-input-inline">
<input type="text" name="username" lay-verify="required" placeholder="请输入用户名" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">手机</label>
<div class="layui-input-inline">
<input type="text" name="mobile" lay-verify="phone" placeholder="请输入号码" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">邮箱</label>
<div class="layui-input-inline">
<input type="text" name="email" lay-verify="email" placeholder="请输入邮箱" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">审核状态</label>
<div class="layui-input-inline">
<input type="checkbox" lay-filter="switch" name="status" lay-skin="switch" lay-text="通过|待审核">
</div>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="LAY-user-back-submit" id="LAY-user-back-submit" value="确认">
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form'], function(){
var $ = layui.$
,form = layui.form ;
})
</script>
{/block}

View File

@ -0,0 +1,61 @@
{extend name="public:base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-admin" id="layuiadmin-form-admin" style="padding: 20px 30px 0 0;">
<div class="layui-form-item layui-hide">
<input type="text" name="id" class="layui-input" value="{$admin.id}">
</div>
<div class="layui-form-item">
<label class="layui-form-label">登录名</label>
<div class="layui-input-inline">
<input type="text" name="username" disabled lay-verify="required" placeholder="请输入用户名" autocomplete="off" class="layui-input layui-disabled" value="{$admin.username}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">密码</label>
<div class="layui-input-inline">
<input type="text" name="password" lay-verify="password" placeholder="请输入密码" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">手机</label>
<div class="layui-input-inline">
<input type="text" name="mobile" lay-verify="phone" placeholder="请输入号码" autocomplete="off" class="layui-input" value="{$admin.mobile}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">邮箱</label>
<div class="layui-input-inline">
<input type="text" name="email" lay-verify="email" placeholder="请输入邮箱" autocomplete="off" class="layui-input" value="{$admin.email}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">角色</label>
<div class="layui-input-block">
<select name="auth_group_id" lay-verify="required">
{volist name="auth_group" id="vo"}
<option {if condition="$admin.auth_group_id eq $vo.id"} selected {/if} value="{$vo.id}">{$vo.title}</option>
{/volist}
</select>
</div>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="LAY-user-back-submit" id="LAY-user-back-submit" value="确认">
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form'], function(){
var $ = layui.$
,form = layui.form ;
})
</script>
{/block}

View File

@ -0,0 +1,57 @@
{extend name="public:base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-admin" id="layuiadmin-form-admin" style="padding: 20px 30px 0 0;">
<div class="layui-form-item">
<label class="layui-form-label">登录名</label>
<div class="layui-input-inline">
<input type="text" name="username" lay-verify="required" placeholder="请输入用户名" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">手机</label>
<div class="layui-input-inline">
<input type="text" name="mobile" lay-verify="phone" placeholder="请输入号码" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">邮箱</label>
<div class="layui-input-inline">
<input type="text" name="email" lay-verify="email" placeholder="请输入邮箱" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">角色</label>
<div class="layui-input-block">
<select name="auth_group_id" lay-verify="required">
{volist name="auth_group" id="vo"}
<option value="{$vo.id}">{$vo.title}</option>
{/volist}
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">审核状态</label>
<div class="layui-input-inline">
<input type="checkbox" lay-filter="switch" name="status" lay-skin="switch" lay-text="通过|待审核">
</div>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="LAY-user-back-submit" id="LAY-user-back-submit" value="确认">
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form'], function(){
var $ = layui.$
,form = layui.form ;
})
</script>
{/block}

View File

@ -0,0 +1,51 @@
{extend name="public:base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-admin" id="layuiadmin-form-admin" style="padding: 20px 30px 0 0;">
<div class="layui-form-item layui-hide">
<input type="text" name="id" class="layui-input" value="{$admin.id}">
</div>
<div class="layui-form-item">
<label class="layui-form-label">登录名</label>
<div class="layui-input-inline">
<input type="text" name="username" disabled lay-verify="required" placeholder="请输入用户名" autocomplete="off" class="layui-input layui-disabled" value="{$admin.username}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">密码</label>
<div class="layui-input-inline">
<input type="text" name="password" lay-verify="password" placeholder="请输入密码" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">手机</label>
<div class="layui-input-inline">
<input type="text" name="mobile" lay-verify="phone" placeholder="请输入号码" autocomplete="off" class="layui-input" value="{$admin.mobile}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">邮箱</label>
<div class="layui-input-inline">
<input type="text" name="email" lay-verify="email" placeholder="请输入邮箱" autocomplete="off" class="layui-input" value="{$admin.email}">
</div>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="LAY-user-back-submit" id="LAY-user-back-submit" value="确认">
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form'], function(){
var $ = layui.$
,form = layui.form ;
})
</script>
{/block}

247
view/admin/admin/index.html Normal file
View File

@ -0,0 +1,247 @@
{extend name="public:base" /}
{block name="body"}
<div class="layui-fluid">
<div class="layui-card">
<div class="layui-form layui-card-header layuiadmin-card-header-auto">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">登录名</label>
<div class="layui-input-block">
<input type="text" name="username" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">手机</label>
<div class="layui-input-block">
<input type="text" name="mobile" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">邮箱</label>
<div class="layui-input-block">
<input type="text" name="email" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="LAY-user-back-search">
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
</button>
</div>
</div>
</div>
<div class="layui-card-body">
<div style="padding-bottom: 10px;">
<button class="layui-btn layuiadmin-btn-admin" data-type="batchdel">删除</button>
<button class="layui-btn layuiadmin-btn-admin" data-type="add">添加</button>
</div>
<table id="LAY-user-back-manage" lay-filter="LAY-user-back-manage"></table>
<!-- <script type="text/html" id="buttonTpl">
{{# if(d.check == 1){ }}
<button class="layui-btn layui-btn-xs">已审核</button>
{{# } else { }}
<button class="layui-btn layui-btn-primary layui-btn-xs">未审核</button>
{{# } }}
</script>
-->
<script type="text/html" id="buttonTpl">
{{# if(d.id == '1'){ }}
<input type="checkbox" name="check" lay-skin="switch" disabled lay-text="通过|禁用" value="1" checked id="{{d.id}}">
{{# } else { }}
{if condition="checkRuleButton('admin/admin/check')"}<input type="checkbox" name="check" lay-skin="switch" lay-filter="admincheck" lay-text="通过|禁用" {{# if(d.check == 1){ }} checked {{# } }} id="{{d.id}}" >{else}<button class="layui-btn layui-btn-xs layui-btn-radius layui-btn-disabled">无权限</button>{/if}
{{# } }}
</script>
<script type="text/html" id="table-useradmin-admin">
{if condition="checkRuleButton('admin/admin/edit')"}
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>
{else /}<a class="layui-btn layui-btn-normal layui-btn-xs layui-btn-disabled"><i class="layui-icon layui-icon-edit"></i>编辑</a>{/if}
{{# if(d.id == '1'){ }}
<a class="layui-btn layui-btn-disabled layui-btn-xs"><i class="layui-icon layui-icon-delete"></i>删除</a>
{{# } else { }}
{if condition="checkRuleButton('admin/admin/delete')"}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
{else /}<a class="layui-btn layui-btn-danger layui-btn-xs layui-btn-disabled"><i class="layui-icon layui-icon-delete"></i>删除</a>{/if}
{{# } }}
</script>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
var userList = "{:url('User/list')}";
var userDelete = "{:url('User/delete')}";
var userEdit = "{:url('User/userEdit')}";
var adminIndex = "{:url('Admin/index')}";
var adminDelete = "{:url('Admin/delete')}";
var adminEdit = "{:url('Admin/edit')}";
var authGroupList = "{:url('AuthGroup/list')}";
var authGroupRoledel = "{:url('AuthGroup/roleDel')}";
var authGroupRoleEdit = "{:url('AuthGroup/roleEdit')}";
var authAccessIndex = "{:url('AuthAccess/index')}";
var authAccessDelete = "{:url('AuthAccess/delete')}";
var authAccessEdit = "{:url('AuthAccess/edit')}";
var authRuleIndex = "{:url('AuthRule/index')}";
var authRuleDelete = "{:url('AuthRule/delete')}";
var authRuleEdit = "{:url('AuthRule/edit')}";
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'useradmin', 'table'], function(){
var $ = layui.$
,form = layui.form
,table = layui.table;
//监听搜索
form.on('submit(LAY-user-back-search)', function(data){
var field = data.field;
$.ajax({
type:"post",
url:"{:url('admin/admin/index')}",
data:{"id":field.id,"username":field.username,"mobile":field.mobile,"email":field.email},
daType:"json",
success:function (data){
if (data.code == 0) {
} else {
layer.open({
content:data.msg,
icon:5,
anim:6
});
}
}
});
//执行重载
table.reload('LAY-user-back-manage', {
where: field
});
});
//监听管理员审核
form.on('switch(admincheck)', function(data){
var data= data.elem;
//console.log(data);
if(data.checked == true){
data.value = 1;
}else{
data.value = 0;
}
//执行管理员审核
$.ajax({
type:'post',
url:"{:url('admin/admin/check')}",
data:{"id":data.id,"status":data.value,},
dataType:'json',
success:function(res){
if(res.code == 0){
layer.msg(res.msg,{
icon:res.icon,
time:2000
}
//,function(){location.reload();}
);
} else {
layer.open({
title:'审核失败',
content:res.msg,
icon:5,
adim:6
})
}
}
});
return false;
});
//事件
var active = {
batchdel: function(){
var checkStatus = table.checkStatus('LAY-user-back-manage')
,checkData = checkStatus.data; //得到选中的数据
if(checkData.length === 0){
return layer.msg('请选择数据');
}
layer.prompt({
formType: 1
,title: '敏感操作,请验证口令'
}, function(value, index){
layer.close(index);
layer.confirm('确定删除吗?', function(index) {
//执行 Ajax 后重载
/*
admin.req({
url: 'xxx'
//,……
});
*/
table.reload('LAY-user-back-manage');
layer.msg('已删除');
});
});
}
,add: function(){
layer.open({
type: 2
,title: '添加管理员'
,content: 'add.html'
,area: ['420px', '420px']
,btn: ['确定', '取消']
,yes: function(index, layero){
var iframeWindow = window['layui-layer-iframe'+ index]
,submitID = 'LAY-user-back-submit'
,submit = layero.find('iframe').contents().find('#'+ submitID);
//监听提交
iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
var field = data.field; //获取提交的字段
//提交 Ajax 成功后,静态更新表格中的数据
$.ajax({
type:"post",
url:"{:url('admin/admin/add')}",
data:{"username":field.username,"password":field.username,"mobile":field.mobile,"email":field.email,"auth_group_id":field.auth_group_id,"status":field.status},
daType:"json",
success:function (data){
if (data.code == 0) {
layer.msg(data.msg,{
icon:6,
time:2000
});
} else {
layer.open({
tiele:'添加失败',
content:data.msg,
icon:5,
anim:6
});
}
}
});
table.reload('LAY-user-back-manage'); //数据刷新
layer.close(index); //关闭弹层
});
submit.trigger('click');
}
});
}
}
$('.layui-btn.layuiadmin-btn-admin').on('click', function(){
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
});
</script>
{/block}

226
view/admin/admin/list.html Normal file
View File

@ -0,0 +1,226 @@
{extend name="public:base" /}
{block name="body"}
<div class="layui-fluid">
<div class="layui-card">
<div class="layui-form layui-card-header layuiadmin-card-header-auto">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">登录名</label>
<div class="layui-input-block">
<input type="text" name="loginname" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">手机</label>
<div class="layui-input-block">
<input type="text" name="telphone" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">邮箱</label>
<div class="layui-input-block">
<input type="text" name="email" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">角色</label>
<div class="layui-input-block">
<select name="role">
<option value="0">管理员</option>
<option value="1">超级管理员</option>
<option value="2">纠错员</option>
<option value="3">采购员</option>
<option value="4">推销员</option>
<option value="5">运营人员</option>
<option value="6">编辑</option>
</select>
</div>
</div>
<div class="layui-inline">
<button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="LAY-user-back-search">
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
</button>
</div>
</div>
</div>
<div class="layui-card-body">
<div style="padding-bottom: 10px;">
<button class="layui-btn layuiadmin-btn-admin" data-type="batchdel">删除</button>
<button class="layui-btn layuiadmin-btn-admin" data-type="add">添加</button>
</div>
<table id="LAY-user-back-manage" lay-filter="LAY-user-back-manage"></table>
<!-- <script type="text/html" id="buttonTpl">
{{# if(d.check == 1){ }}
<button class="layui-btn layui-btn-xs">已审核</button>
{{# } else { }}
<button class="layui-btn layui-btn-primary layui-btn-xs">未审核</button>
{{# } }}
</script>
-->
<script type="text/html" id="buttonTpl">
{{# if(d.role == '1'){ }}
<input type="checkbox" name="admincheck" lay-skin="switch" disabled lay-text="已审核|未审核" value="1" checked id="{{d.id}}">
{{# } else { }}
{if condition="checkRuleButton('admin/admin/adminCheck')"}<input type="checkbox" name="admincheck" lay-skin="switch" lay-filter="admincheck" lay-text="已审核|未审核" {{# if(d.check == 1){ }} checked {{# } }} id="{{d.id}}" >{else}<button class="layui-btn layui-btn-xs layui-btn-radius layui-btn-disabled">无审核权</button>{/if}
{{# } }}
</script>
<script type="text/html" id="table-useradmin-admin">
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>
{{# if(d.role == '1'){ }}
<a class="layui-btn layui-btn-disabled layui-btn-xs"><i class="layui-icon layui-icon-delete"></i>删除</a>
{{# } else { }}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
{{# } }}
</script>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'useradmin', 'table'], function(){
var $ = layui.$
,form = layui.form
,table = layui.table;
//监听搜索
form.on('submit(LAY-user-back-search)', function(data){
var field = data.field;
//执行重载
table.reload('LAY-user-back-manage', {
where: field
});
});
//监听管理员审核
form.on('switch(admincheck)', function(data){
var data= data.elem;
//console.log(data);
if(data.checked == true){
data.value = 1;
}else{
data.value = 0;
}
//执行管理员审核
$.ajax({
type:'post',
url:"{:url('admin/admin/adminCheck')}",
data:{id:data.id,status:data.value,},
dataType:'json',
success:function(res){
if(res.code == 0){
layer.msg(res.msg,{
icon:res.icon,
time:2000
}
//,function(){location.reload();}
);
} else {
layer.open({
title:'审核失败',
content:res.msg,
icon:5,
adim:6
})
}
}
});
return false;
});
//事件
var active = {
batchdel: function(){
var checkStatus = table.checkStatus('LAY-user-back-manage')
,checkData = checkStatus.data; //得到选中的数据
if(checkData.length === 0){
return layer.msg('请选择数据');
}
layer.prompt({
formType: 1
,title: '敏感操作,请验证口令'
}, function(value, index){
layer.close(index);
layer.confirm('确定删除吗?', function(index) {
//执行 Ajax 后重载
/*
admin.req({
url: 'xxx'
//,……
});
*/
table.reload('LAY-user-back-manage');
layer.msg('已删除');
});
});
}
,add: function(){
layer.open({
type: 2
,title: '添加管理员'
,content: 'adminform.html'
,area: ['420px', '420px']
,btn: ['确定', '取消']
,yes: function(index, layero){
var iframeWindow = window['layui-layer-iframe'+ index]
,submitID = 'LAY-user-back-submit'
,submit = layero.find('iframe').contents().find('#'+ submitID);
//监听提交
iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
var field = data.field; //获取提交的字段
//提交 Ajax 成功后,静态更新表格中的数据
$.ajax({
type:"post",
url:"{:url('admin/admin/adminform')}",
data:{"username":field.username,"password":field.username,"mobile":field.mobile,"email":field.email,"auth_group_id":field.auth_group_id,"status":field.status},
daType:"json",
success:function (data){
if (data.code == 1) {
layer.msg(data.msg,{
icon:6,
time:2000
});
} else {
layer.open({
tiele:'添加失败',
content:data.msg,
icon:5,
anim:6
});
}
}
});
table.reload('LAY-user-back-manage'); //数据刷新
layer.close(index); //关闭弹层
});
submit.trigger('click');
}
});
}
}
$('.layui-btn.layuiadmin-btn-admin').on('click', function(){
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
});
</script>
{/block}

View File

@ -0,0 +1,113 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>layuiAdmin 内容系统 - 评论管理</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
</head>
<body>
<div class="layui-fluid">
<div class="layui-card">
<div class="layui-form layui-card-header layuiadmin-card-header-auto">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">ID</label>
<div class="layui-input-inline">
<input type="text" name="cid" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">评论者</label>
<div class="layui-input-inline">
<input type="text" name="username" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">评论内容</label>
<div class="layui-input-inline">
<input type="text" name="content" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<button class="layui-btn layuiadmin-btn-comm" data-type="reload" lay-submit lay-filter="LAY-app-contcomm-search">
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
</button>
</div>
</div>
</div>
<div class="layui-card-body">
<div style="padding-bottom: 10px;">
<button class="layui-btn layuiadmin-btn-comm" data-type="batchdel">删除</button>
</div>
<table id="LAY-app-content-comm" lay-filter="LAY-app-content-comm"></table>
<script type="text/html" id="table-content-com">
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
</script>
</div>
</div>
</div>
<script src="../../../layuiadmin/layui/layui.js"></script>
<script>
layui.config({
base: '../../../layuiadmin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'contlist', 'table'], function(){
var $ = layui.$
,form = layui.form
,table = layui.table;
//监听搜索
form.on('submit(LAY-app-contcomm-search)', function(data){
var field = data.field;
//执行重载
table.reload('LAY-app-content-comm', {
where: field
});
});
//点击事件
var active = {
batchdel: function(){
var checkStatus = table.checkStatus('LAY-app-content-comm')
,checkData = checkStatus.data; //得到选中的数据
if(checkData.length === 0){
return layer.msg('请选择数据');
}
layer.confirm('确定删除吗?', function(index) {
//执行 Ajax 后重载
/*
admin.req({
url: 'xxx'
//,……
});
*/
table.reload('LAY-app-content-comm');
layer.msg('已删除');
});
}
}
$('.layui-btn.layuiadmin-btn-comm').on('click', function(){
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,44 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>layuiAdmin 评论管理 iframe 框</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
</head>
<body>
<div class="layui-form" lay-filter="layuiadmin-form-comment" id="layuiadmin-form-comment" style="padding: 20px 30px 0 0;">
<div class="layui-form-item">
<label class="layui-form-label">评论内容</label>
<div class="layui-input-block">
<textarea name="content" lay-verify="required" placeholder="请输入" class="layui-textarea"></textarea>
</div>
</div>
<div class="layui-form-item layui-hide">
<label class="layui-form-label"></label>
<div class="layui-input-inline">
<input type="button" lay-submit lay-filter="layuiadmin-app-comm-submit" id="layuiadmin-app-comm-submit" value="确认" class="layui-btn">
</div>
</div>
</div>
<script src="../../../layuiadmin/layui/layui.js"></script>
<script>
layui.config({
base: '../../../layuiadmin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form'], function(){
var $ = layui.$
,form = layui.form;
});
</script>
</body>
</html>

View File

@ -0,0 +1,147 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>layuiAdmin 内容系统 - 文章列表</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
</head>
<body>
<div class="layui-fluid">
<div class="layui-card">
<div class="layui-form layui-card-header layuiadmin-card-header-auto">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">文章ID</label>
<div class="layui-input-inline">
<input type="text" name="id" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">作者</label>
<div class="layui-input-inline">
<input type="text" name="author" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">标题</label>
<div class="layui-input-inline">
<input type="text" name="title" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">文章标签</label>
<div class="layui-input-inline">
<select name="label">
<option value="">请选择标签</option>
<option value="0">美食</option>
<option value="1">新闻</option>
<option value="2">八卦</option>
<option value="3">体育</option>
<option value="4">音乐</option>
</select>
</div>
</div>
<div class="layui-inline">
<button class="layui-btn layuiadmin-btn-list" lay-submit lay-filter="LAY-app-contlist-search">
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
</button>
</div>
</div>
</div>
<div class="layui-card-body">
<div style="padding-bottom: 10px;">
<button class="layui-btn layuiadmin-btn-list" data-type="batchdel">删除</button>
<button class="layui-btn layuiadmin-btn-list" data-type="add">添加</button>
</div>
<table id="LAY-app-content-list" lay-filter="LAY-app-content-list"></table>
<script type="text/html" id="buttonTpl">
{{# if(d.status){ }}
<button class="layui-btn layui-btn-xs">已发布</button>
{{# } else { }}
<button class="layui-btn layui-btn-primary layui-btn-xs">待修改</button>
{{# } }}
</script>
<script type="text/html" id="table-content-list">
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
</script>
</div>
</div>
</div>
<script src="../../../layuiadmin/layui/layui.js"></script>
<script>
layui.config({
base: '../../../layuiadmin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'contlist', 'table'], function(){
var table = layui.table
,form = layui.form;
//监听搜索
form.on('submit(LAY-app-contlist-search)', function(data){
var field = data.field;
//执行重载
table.reload('LAY-app-content-list', {
where: field
});
});
var $ = layui.$, active = {
batchdel: function(){
var checkStatus = table.checkStatus('LAY-app-content-list')
,checkData = checkStatus.data; //得到选中的数据
if(checkData.length === 0){
return layer.msg('请选择数据');
}
layer.confirm('确定删除吗?', function(index) {
//执行 Ajax 后重载
/*
admin.req({
url: 'xxx'
//,……
});
*/
table.reload('LAY-app-content-list');
layer.msg('已删除');
});
},
add: function(){
layer.open({
type: 2
,title: '添加文章'
,content: 'listform.html'
,maxmin: true
,area: ['550px', '550px']
,btn: ['确定', '取消']
,yes: function(index, layero){
//点击确认触发 iframe 内容中的按钮提交
var submit = layero.find('iframe').contents().find("#layuiadmin-app-form-submit");
submit.click();
}
});
}
};
$('.layui-btn.layuiadmin-btn-list').on('click', function(){
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,82 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>layuiAdmin 文章管理 iframe 框</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
</head>
<body>
<div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list" style="padding: 20px 30px 0 0;">
<div class="layui-form-item">
<label class="layui-form-label">文章标题</label>
<div class="layui-input-inline">
<input type="text" name="title" lay-verify="required" placeholder="请输入用户名" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">发布人</label>
<div class="layui-input-inline">
<input type="text" name="author" lay-verify="required" placeholder="请输入号码" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">文章内容</label>
<div class="layui-input-inline">
<textarea name="content" lay-verify="required" style="width: 400px; height: 150px;" autocomplete="off" class="layui-textarea"></textarea>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">标签</label>
<div class="layui-input-inline">
<select name="label" lay-verify="required">
<option value="">请选择标签</option>
<option value="美食">美食</option>
<option value="新闻">新闻</option>
<option value="八卦">八卦</option>
<option value="体育">体育</option>
<option value="音乐">音乐</option>
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">发布状态</label>
<div class="layui-input-inline">
<input type="checkbox" lay-verify="required" lay-filter="status" name="status" lay-skin="switch" lay-text="已发布|待修改">
</div>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="layuiadmin-app-form-submit" id="layuiadmin-app-form-submit" value="确认添加">
<input type="button" lay-submit lay-filter="layuiadmin-app-form-edit" id="layuiadmin-app-form-edit" value="确认编辑">
</div>
</div>
<script src="../../../layuiadmin/layui/layui.js"></script>
<script>
layui.config({
base: '../../../layuiadmin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form'], function(){
var $ = layui.$
,form = layui.form;
//监听提交
form.on('submit(layuiadmin-app-form-submit)', function(data){
var field = data.field; //获取提交的字段
var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
//提交 Ajax 成功后,关闭当前弹层并重载表格
//$.ajax({});
parent.layui.table.reload('LAY-app-content-list'); //重载表格
parent.layer.close(index); //再执行关闭
});
})
</script>
</body>
</html>

View File

@ -0,0 +1,66 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>layuiAdmin 内容系统-分类管理</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
</head>
<body>
<div class="layui-fluid">
<div class="layui-card">
<div class="layui-card-header layuiadmin-card-header-auto">
<button class="layui-btn layuiadmin-btn-tags" data-type="add">添加</button>
</div>
<div class="layui-card-body">
<table id="LAY-app-content-tags" lay-filter="LAY-app-content-tags"></table>
<script type="text/html" id="layuiadmin-app-cont-tagsbar">
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
</script>
</div>
</div>
</div>
<script src="../../../layuiadmin/layui/layui.js"></script>
<script>
layui.config({
base: '../../../layuiadmin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'contlist', 'table'], function(){
var table = layui.table;
var $ = layui.$, active = {
add: function(){
layer.open({
type: 2
,title: '添加分类'
,content: 'tagsform.html'
,area: ['450px', '200px']
,btn: ['确定', '取消']
,yes: function(index, layero){
var othis = layero.find('iframe').contents().find("#layuiadmin-app-form-tags")
,tags = othis.find('input[name="tags"]').val();
if(!tags.replace(/\s/g, '')) return;
table.reload('LAY-app-content-tags');
layer.close(index);
}
});
}
}
$('.layui-btn.layuiadmin-btn-tags').on('click', function(){
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
});
</script>
</body>
</html>

View File

@ -0,0 +1,38 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>layuiAdmin 分类管理 iframe 框</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
</head>
<body>
<div class="layui-form" lay-filter="layuiadmin-form-tags" id="layuiadmin-app-form-tags" style="padding-top: 30px; text-align: center;">
<div class="layui-form-item">
<label class="layui-form-label">分类名</label>
<div class="layui-input-inline">
<input type="text" name="tags" lay-verify="required" placeholder="请输入..." autocomplete="off" class="layui-input">
</div>
</div>
</div>
<script src="../../../layuiadmin/layui/layui.js"></script>
<script>
layui.config({
base: '../../../layuiadmin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form'], function(){
var $ = layui.$
,form = layui.form ;
})
</script>
</body>
</html>

View File

@ -0,0 +1,44 @@
{extend name="public:base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-admin" id="layuiadmin-form-admin" style="padding: 20px 30px 0 0;">
<div class="layui-form-item">
<label class="layui-form-label">管理员</label>
<div class="layui-input-block">
<select name="uid" lay-verify="required">
{volist name="admins" id="vo"}
<option value="{$vo.id}">{$vo.username}</option>
{/volist}
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">角色</label>
<div class="layui-input-block">
<select name="group_id" lay-verify="required">
{volist name="auth_groups" id="vo"}
<option value="{$vo.id}">{$vo.title}</option>
{/volist}
</select>
</div>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="LAY-admin-group-submit" id="LAY-admin-group-submit" value="确认">
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form'], function(){
var $ = layui.$
,form = layui.form ;
})
</script>
{/block}

View File

@ -0,0 +1,47 @@
{extend name="public:base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-admin" id="layuiadmin-form-admin" style="padding: 20px 30px 0 0;">
<div class="layui-form-item layui-hide">
<input type="text" name="id" class="layui-input" value="{$access.id}">
</div>
<div class="layui-form-item">
<label class="layui-form-label">管理员</label>
<div class="layui-input-block">
<select name="uid" lay-verify="required">
{volist name="admins" id="vo"}
<option {if condition="$access.uid eq $vo.id"} selected {/if} value="{$vo.id}">{$vo.username}</option>
{/volist}
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">角色</label>
<div class="layui-input-block">
<select name="group_id" lay-verify="required">
{volist name="auth_groups" id="vo"}
<option {if condition="$access.group_id eq $vo.id"} selected {/if} value="{$vo.id}">{$vo.title}</option>
{/volist}
</select>
</div>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="LAY-admin-group-submit" id="LAY-admin-group-submit" value="确认">
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form'], function(){
var $ = layui.$
,form = layui.form ;
})
</script>
{/block}

View File

@ -0,0 +1,207 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-fluid">
<div class="layui-card">
<div class="layui-form layui-card-header layuiadmin-card-header-auto">
<div class="layui-form-item">
<div class="layui-inline">
管理员筛选
</div>
<div class="layui-inline">
<select name="uid" lay-filter="LAY-admin-group-type">
<option value="">全部用户</option>
{volist name="admins" id="vo"}
<option value="{$vo.id}">{$vo.username}</option>
{/volist}
</select>
</div>
</div>
</div>
<div class="layui-card-body">
<div style="padding-bottom: 10px;">
<button class="layui-btn layuiadmin-btn-role" data-type="batchdel">删除</button>
<button class="layui-btn layuiadmin-btn-role" data-type="add">添加</button>
</div>
<table id="LAY-user-back-group" lay-filter="LAY-user-back-group"></table>
<script type="text/html" id="buttonCheck">
{if condition="checkRuleButton('admin/AuthAccess/check')"}<input type="checkbox" name="check" lay-skin="switch" lay-filter="groupcheck" lay-text="开启|禁用" {{# if(d.check == 1){ }} checked {{# } }} id="{{d.id}}" >{else /}<button class="layui-btn layui-btn-xs layui-btn-radius layui-btn-disabled">无权限</button>{/if}
</script>
<script type="text/html" id="table-useradmin-admin">
{if condition="checkRuleButton('admin/AuthAccess/edit')"}
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>
{else /}<a class="layui-btn layui-btn-normal layui-btn-xs layui-btn-disabled"><i class="layui-icon layui-icon-edit"></i>编辑</a>{/if}
{if condition="checkRuleButton('admin/AuthAccess/delete')"}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
{else /}<a class="layui-btn layui-btn-danger layui-btn-xs layui-btn-disabled"><i class="layui-icon layui-icon-delete"></i>删除</a>{/if}
</script>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
var userList = "{:url('User/list')}";
var userDelete = "{:url('User/delete')}";
var userEdit = "{:url('User/userEdit')}";
var adminIndex = "{:url('Admin/index')}";
var adminDelete = "{:url('Admin/delete')}";
var adminEdit = "{:url('Admin/edit')}";
var authGroupList = "{:url('AuthGroup/list')}";
var authGroupRoledel = "{:url('AuthGroup/roleDel')}";
var authGroupRoleEdit = "{:url('AuthGroup/roleEdit')}";
var authAccessIndex = "{:url('AuthAccess/index')}";
var authAccessDelete = "{:url('AuthAccess/delete')}";
var authAccessEdit = "{:url('AuthAccess/edit')}";
var authRuleIndex = "{:url('AuthRule/index')}";
var authRuleDelete = "{:url('AuthRule/delete')}";
var authRuleEdit = "{:url('AuthRule/edit')}";
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'useradmin', 'table'], function(){
var $ = layui.$
,form = layui.form
,table = layui.table;
//搜索角色
form.on('select(LAY-admin-group-type)', function(data){
$.ajax({
type:"post",
url:"{:url('admin/AuthAccess/index')}",
data:{"uid":data.value},
daType:"json",
success:function (data){
if (data.code == -1){
layer.open({
content:data.msg,
icon:5,
anim:6
});
}
}
});
//执行重载
table.reload('LAY-user-back-group', {
where: {
uid: data.value
}
});
});
//监听角色审核
form.on('switch(groupcheck)', function(data){
var data= data.elem;
//console.log(data);
if(data.checked == true){
data.value = 1;
}else{
data.value = 0;
}
//执行角色审核
$.ajax({
type:'post',
url:"{:url('admin/AuthAccess/check')}",
data:{id:data.id,status:data.value,},
dataType:'json',
success:function(res){
if(res.code == 0){
layer.msg(res.msg,{
icon:res.icon,
time:2000
});
} else {
layer.open({
title:'审核失败',
content:res.msg,
icon:5,
adim:6
})
}
}
});
return false;
});
//事件
var active = {
batchdel: function(){
var checkStatus = table.checkStatus('LAY-user-back-group')
,checkData = checkStatus.data; //得到选中的数据
if(checkData.length === 0){
return layer.msg('请选择数据');
}
layer.confirm('确定删除吗?', function(index) {
//执行 Ajax 后重载
/*
admin.req({
url: 'xxx'
//,……
});
*/
table.reload('LAY-user-back-group');
layer.msg('已删除');
});
},
add: function(){
layer.open({
type: 2
,title: '添加权限'
,content: 'add.html'
,area: ['400px', '300px']
,btn: ['确定', '取消']
,yes: function(index, layero){
var iframeWindow = window['layui-layer-iframe'+ index]
,submit = layero.find('iframe').contents().find("#LAY-admin-group-submit");
//监听提交
iframeWindow.layui.form.on('submit(LAY-admin-group-submit)', function(data){
var field = data.field;
//提交 Ajax 成功后,静态更新表格中的数据
$.ajax({
type:"post",
url:"{:url('admin/AuthAccess/add')}",
data:field,
daType:"json",
success:function (data){
if (data.code == 0) {
layer.msg(data.msg,{
icon:6,
time:2000
});
} else {
layer.open({
tiele:'添加失败',
content:data.msg,
icon:5,
anim:6
});
}
}
});
//刷新数据
table.reload('LAY-user-back-group');
layer.close(index); //关闭弹层
});
submit.trigger('click');
}
});
}
}
$('.layui-btn.layuiadmin-btn-role').on('click', function(){
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
});
</script>
{/block}

View File

@ -0,0 +1,119 @@
<link rel="stylesheet" href="G:/www/Taole/public/static/admin/layui/css/layui.css" media="all">
<body>
<script src="G:/www/Taole/public/static/admin/layui/layui.js"></script>
<script type="text/javascript">
//需要引入的模块
layui.use(['table','form','jquery'], function() {
var form = layui.form,
table = layui.table,
$=layui.jquery;
form.on('checkbox()', function(data){
var pc = data.elem.classList //获取选中的checkbox的class属性
/* checkbox处于选中状态 */
if(data.elem.checked==true){//并且当前checkbox为选中状态
/*如果是parent节点 */
if(pc=="parent"){ //如果当前选中的checkbox class里面有parent
//获取当前checkbox的兄弟节点的孩子们是 input[type='checkbox']的元素
var c =$(data.elem).siblings().children("input[type='checkbox']");
c.each(function(){//遍历他们的孩子们
var e = $(this); //添加layui的选中的样式 控制台看元素
e.next().addClass("layui-form-checked");
});
}else{/*如果不是parent*/
//选中子级选中父级
$(data.elem).parent().prev().addClass("layui-form-checked");
}
}else{ /*checkbox处于 false状态*/
//父级没有选中 取消所有的子级选中
if(pc=="parent"){/*判断当前取消的是父级*/
var c =$(data.elem).siblings().children("input[type='checkbox']");
c.each(function(){
var e = $(this);
e.next().removeClass("layui-form-checked")
});
}else{/*不是父级*/
var c = $(data.elem).siblings("div");
var count =0;
c.each(function(){//遍历他们的孩子们
//如果有一个==3那么久说明是处于选中状态
var is = $(this).get(0).classList;
if(is.length==3){
count++;
}
});
//如果大于0说明还有子级处于选中状态
if(count>0){
}else{/*如果不大于那么就说明没有子级处于选中状态那么就移除父级的选中状态*/
$(data.elem).parent().prev().removeClass("layui-form-checked");
}
}
}
});
});
</script>
<div class="layui-form" lay-filter="layuiadmin-form-role" id="layuiadmin-form-role" style="padding: 20px 30px 0 0;">
<div class="layui-form-item" id="test">
<label class="layui-form-label">权限范围</label>
<ul class="layui-input-block" style="margin-top: 10px ;">
<li>
<input type="checkbox" class="parent" lay-skin="primary" title="人事模块">
<ul>
<input type="checkbox" name="limits[]" lay-skin="primary" title="社区系统">
<input type="checkbox" name="limits[]" lay-skin="primary" title="用户" >
<input type="checkbox" name="limits[]" lay-skin="primary" title="角色">
<input type="checkbox" name="limits[]" lay-skin="primary" title="评论审核">
</ul>
</li>
</ul>
<ul class="layui-input-block" style="margin-top: 10px ;">
<li>
<input type="checkbox" class="parent" name="limits[]" lay-skin="primary" title="人事模块">
<ul>
<input type="checkbox" name="limits[]" lay-skin="primary" title="社区系统">
<input type="checkbox" name="limits[]" lay-skin="primary" title="用户" >
<input type="checkbox" name="limits[]" lay-skin="primary" title="角色">
<input type="checkbox" name="limits[]" lay-skin="primary" title="评论审核">
</ul>
</li>
</ul>
<ul class="layui-input-block" style="margin-top: 10px ;">
<li>
<input type="checkbox" class="parent" name="limits[]" lay-skin="primary" title="人事模块">
<ul>
<input type="checkbox" name="limits[]" lay-skin="primary" title="社区系统">
<input type="checkbox" name="limits[]" lay-skin="primary" title="用户" >
<input type="checkbox" name="limits[]" lay-skin="primary" title="角色">
<input type="checkbox" name="limits[]" lay-skin="primary" title="评论审核">
</ul>
</li>
</ul>
</div>
</div>
</body>
//获取选中的checkbox的值
var mId = "";
var e =iframeWindow.$(":checkbox");
e.each(function () {
if($(this).next().hasClass("layui-form-checked")){
mId+=$(this).val()+",";
};
})
mId = mId.substring(0,mId.length-1);

View File

@ -0,0 +1,231 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-fluid">
<div class="layui-card">
<div class="layui-form layui-card-header layuiadmin-card-header-auto">
<div class="layui-form-item">
<div class="layui-inline">
角色筛选
</div>
<div class="layui-inline">
<select name="id" lay-filter="LAY-user-adminrole-type">
<option value="">全部角色</option>
{volist name="roles" id="vo"}
<option value="{$vo.id}">{$vo.title}</option>
{/volist}
</select>
</div>
</div>
</div>
<div class="layui-card-body">
<div style="padding-bottom: 10px;">
<button class="layui-btn layuiadmin-btn-role" data-type="batchdel">删除</button>
<button class="layui-btn layuiadmin-btn-role" data-type="add">添加</button>
</div>
<table id="LAY-user-back-role" lay-filter="LAY-user-back-role"></table>
<script type="text/html" id="buttonCheck">
{if condition="checkRuleButton('admin/AuthGroup/check')"}<input type="checkbox" name="check" lay-skin="switch" lay-filter="rolecheck" lay-text="打开|关闭" {{# if(d.check == 1){ }} checked {{# } }} id="{{d.id}}" >
{else /}<button class="layui-btn layui-btn-xs layui-btn-radius layui-btn-disabled">无权限</button>{/if}
</script>
<script type="text/html" id="table-useradmin-admin">
{if condition="checkRuleButton('admin/AuthGroup/roleedit')"}
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>
{else /} <a class="layui-btn layui-btn-normal layui-btn-xs layui-btn-disabled"><i class="layui-icon layui-icon-edit"></i>编辑</a>{/if}
{if condition="checkRuleButton('admin/AuthGroup/roledel')"}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
{else /} <a class="layui-btn layui-btn-danger layui-btn-xs layui-btn-disabled"><i class="layui-icon layui-icon-delete"></i>删除</a>{/if}
</script>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
var userList = "{:url('User/list')}";
var userDelete = "{:url('User/delete')}";
var userEdit = "{:url('User/userEdit')}";
var adminIndex = "{:url('Admin/index')}";
var adminDelete = "{:url('Admin/delete')}";
var adminEdit = "{:url('Admin/edit')}";
var authGroupList = "{:url('AuthGroup/list')}";
var authGroupRoledel = "{:url('AuthGroup/roleDel')}";
var authGroupRoleEdit = "{:url('AuthGroup/roleEdit')}";
var authAccessIndex = "{:url('AuthAccess/index')}";
var authAccessDelete = "{:url('AuthAccess/delete')}";
var authAccessEdit = "{:url('AuthAccess/edit')}";
var authRuleIndex = "{:url('AuthRule/index')}";
var authRuleDelete = "{:url('AuthRule/delete')}";
var authRuleEdit = "{:url('AuthRule/edit')}";
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'useradmin', 'table'], function(){
var $ = layui.$
,form = layui.form
,table = layui.table;
//搜索角色
form.on('select(LAY-user-adminrole-type)', function(data){
console.log(data);
$.ajax({
type:"post",
url:"{:url('admin/AuthGroup/list')}",
data:{"id":data.value},
daType:"json",
success:function (data){
if (data.code == 0) {
} else {
layer.open({
content:data.msg,
icon:5,
anim:6
});
}
}
});
//执行重载
table.reload('LAY-user-back-role', {
where: {
id: data.value
}
});
});
//监听角色审核
form.on('switch(rolecheck)', function(data){
var data= data.elem;
//console.log(data);
if(data.checked == true){
data.value = 1;
}else{
data.value = 0;
}
//执行角色审核
$.ajax({
type:'post',
url:"{:url('admin/AuthGroup/check')}",
data:{id:data.id,status:data.value,},
dataType:'json',
success:function(res){
if(res.code == 0){
layer.msg(res.msg,{
icon:res.icon,
time:2000
}
//,function(){location.reload();}
);
} else {
layer.open({
title:'审核失败',
content:res.msg,
icon:5,
adim:6
})
}
}
});
return false;
});
//事件
var active = {
batchdel: function(){
var checkStatus = table.checkStatus('LAY-user-back-role')
,checkData = checkStatus.data; //得到选中的数据
if(checkData.length === 0){
return layer.msg('请选择数据');
}
layer.confirm('确定删除吗?', function(index) {
//执行 Ajax 后重载
/*
admin.req({
url: 'xxx'
//,……
});
*/
table.reload('LAY-user-back-role');
layer.msg('已删除');
});
},
add: function(){
layer.open({
type: 2
,title: '添加新角色'
,content: 'roleadd.html'
,area: ['500px', '480px']
,btn: ['确定', '取消']
,yes: function(index, layero){
var iframeWindow = window['layui-layer-iframe'+ index]
,submit = layero.find('iframe').contents().find("#LAY-user-role-submit");
//监听提交
iframeWindow.layui.form.on('submit(LAY-user-role-submit)', function(data){
var field = data.field;
//checkbox 父子级级联或取id
var mId = "";
var e =iframeWindow.$(":checkbox");
e.each(function () {
if($(this).next().hasClass("layui-form-checked")){
mId+=$(this).val()+",";
};
})
rules = mId.substring(0,mId.length-1);
/*
var arr = new Array(); //获取提交的字段
$(iframeWindow.document).find('input[name=rules]:checked').each(function(){
arr.push($(this).val());
});
var rules = arr.join(',');//将数组元素连接起来以构建一个字符串
*/
//提交 Ajax 成功后,静态更新表格中的数据
$.ajax({
type:"post",
url:"{:url('admin/AuthGroup/roleAdd')}",
data:{"rules":rules,"title":field.title,"descr":field.descr},
daType:"json",
success:function (data){
if (data.code == 0) {
layer.msg(data.msg,{
icon:6,
time:2000
});
} else {
layer.open({
tiele:'添加失败',
content:data.msg,
icon:5,
anim:6
});
}
}
});
table.reload('LAY-user-back-role');
layer.close(index); //关闭弹层
});
submit.trigger('click');
}
});
}
}
$('.layui-btn.layuiadmin-btn-role').on('click', function(){
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
});
</script>
{/block}

View File

@ -0,0 +1,101 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-role" id="layuiadmin-form-role" style="padding: 20px 30px 0 0;">
<div class="layui-form-item">
<label class="layui-form-label">角色</label>
<div class="layui-input-inline">
<input type="text" name="title" lay-verify="required" placeholder="请输入角色名" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item" id="test">
<label class="layui-form-label">权限范围</label>
{volist name="menus" id="vo1"}
<ul class="layui-input-block" style="margin-top: 10px ;">
<li>
<input type="checkbox" name="rules" class="parent" lay-skin="primary" value="{$vo1.id}" title="{$vo1.title}">
<ul>
{if condition="isset($vo1['children'])"}
{volist name="vo1['children']" id="vo2"}
{if condition="isset($vo2['children'])"}
<input type="checkbox" name="rules" lay-skin="primary" value="{$vo2.id}" title="{$vo2.title}">
{volist name="vo2['children']" id="vo3"}
<input type="checkbox" name="rules" lay-skin="primary" id="{$vo3.id}" value="{$vo3.id}" title="{$vo3.title}">
{/volist}
{else /}
<input type="checkbox" name="rules" lay-skin="primary" id="{$vo2.id}" value="{$vo2.id}" title="{$vo2.title}">
{/if}
{/volist}
{/if}
</ul>
</li>
</ul>
{/volist}
</div>
<div class="layui-form-item">
<label class="layui-form-label">具体描述</label>
<div class="layui-input-block">
<textarea type="text" name="descr" lay-verify="required" autocomplete="off" class="layui-textarea"></textarea>
</div>
</div>
<div class="layui-form-item layui-hide">
<button class="layui-btn" lay-submit lay-filter="LAY-user-role-submit" id="LAY-user-role-submit">提交</button>
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form'], function(){
var $ = layui.$
,form = layui.form ;
form.on('checkbox()', function(data){
var pc = data.elem.classList; //获取选中的checkbox的class属性
if(data.elem.checked==true){
if(pc=="parent"){
var c =$(data.elem).siblings().children("input[type='checkbox']");
c.each(function(){
var e = $(this);
e.next().addClass("layui-form-checked");
});
}else{
$(data.elem).parent().prev().addClass("layui-form-checked");
}
}else{
if(pc=="parent"){
var c =$(data.elem).siblings().children("input[type='checkbox']");
c.each(function(){
var e = $(this);
e.next().removeClass("layui-form-checked");
});
}else{
var c = $(data.elem).siblings("div");
var count =0;
c.each(function(){
var is = $(this).get(0).classList;
if(is.length==3){
count++;
}
});
if(count>0){
}else{
$(data.elem).parent().prev().removeClass("layui-form-checked");
}
}
}
});
})
</script>
{/block}

View File

@ -0,0 +1,129 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-role" id="layuiadmin-form-role" style="padding: 20px 30px 0 0;">
<div class="layui-form-item layui-hide">
<input type="text" name="id" class="layui-input" value="{$auth.id}">
</div>
<div class="layui-form-item">
<label class="layui-form-label">角色</label>
<div class="layui-input-block">
<select name="title">
{volist name="authGroup" id="vo"}
<option {if condition="$vo.id eq $Request.param.id"} selected {/if} id="{$vo.id}" value="{$vo.title}">{$vo.title}</option>
{/volist}
</select>
</div>
</div>
<div class="layui-form-item" id="test">
<label class="layui-form-label">权限范围</label>
{volist name="menus" id="vo1"}
<ul class="layui-input-block" style="margin-top: 10px ;">
<li>
<input type="checkbox" name="rules" class="parent" lay-skin="primary" value="{$vo1.id}" title="{$vo1.title}">
<ul>
{if condition="isset($vo1['children'])"}
{volist name="vo1['children']" id="vo2"}
{if condition="isset($vo2['children'])"}
<input type="checkbox" name="rules" class="parent" lay-skin="primary" value="{$vo2.id}" title="{$vo2.title}">
{volist name="vo2['children']" id="vo3"}
<input type="checkbox" name="rules" lay-skin="primary" id="{$vo3.id}" value="{$vo3.id}" title="{$vo3.title}">
{/volist}
{else /}
<input type="checkbox" name="rules" lay-skin="primary" id="{$vo2.id}" value="{$vo2.id}" title="{$vo2.title}">
{/if}
{/volist}
{/if}
</ul>
</li>
</ul>
{/volist}
</div>
<div class="layui-form-item">
<label class="layui-form-label">具体描述</label>
<div class="layui-input-block">
<textarea type="text" name="descr" lay-verify="required" autocomplete="off" class="layui-textarea" value="{$auth.descr}">{$auth.descr}</textarea>
</div>
</div>
<div class="layui-form-item layui-hide">
<button class="layui-btn" lay-submit lay-filter="LAY-user-role-submit" id="LAY-user-role-submit">提交</button>
</div>
</div>
{/block}
{block name="js"}
<script type="text/javascript">
$(document).ready(function(){
var name = "{$ru}";
var names = name.split(",");
var inputs = $('input[name=rules]');
for (var i =0;i<inputs.length;i++) {
for (var n =0;n<names.length;n++) {
if (names[n]===inputs[i].value) {
inputs[i].checked = true;
}
}
}
});
</script>
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'table','form'], function(){
var $ = layui.$
,form = layui.form
,table = layui.table;
form.on('checkbox()', function(data){
var pc = data.elem.classList; //获取选中的checkbox的class属性
if(data.elem.checked==true){
if(pc=="parent"){
var c =$(data.elem).siblings().children("input[type='checkbox']");
c.each(function(){
var e = $(this);
e.next().addClass("layui-form-checked");
});
}else{
$(data.elem).parent().prev().addClass("layui-form-checked");
}
}else{
if(pc=="parent"){
var c =$(data.elem).siblings().children("input[type='checkbox']");
c.each(function(){
var e = $(this);
e.next().removeClass("layui-form-checked");
});
}else{
var c = $(data.elem).siblings("div");
var count =0;
c.each(function(){
var is = $(this).get(0).classList;
if(is.length==3){
count++;
}
});
if(count>0){
}else{
$(data.elem).parent().prev().removeClass("layui-form-checked");
}
}
}
});
})
</script>
{/block}

View File

@ -0,0 +1,65 @@
{extend name="public:base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-admin" id="layuiadmin-rule-add" style="padding: 20px 30px 0 0;">
<div class="layui-form-item">
<label class="layui-form-label">上级菜单</label>
<div class="layui-input-block">
<select name="pid" lay-verify="required">
<option value="0">顶级菜单</option>
{volist name="AuthRule" id="vo"}
<option value="{$vo.id}"><?php echo str_repeat('--',$vo['level']*2) ?>{$vo.title}</option>
{/volist}
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">权限名</label>
<div class="layui-input-inline">
<input type="text" name="title" lay-verify="required" placeholder="请输入权限名" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">权限地址</label>
<div class="layui-input-inline">
<input type="text" name="name" lay-verify="required" placeholder="请输入邮箱" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">图标</label>
<div class="layui-input-inline">
<input type="text" name="icon" lay-verify="" placeholder="请输入角色类型" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">排序</label>
<div class="layui-input-inline">
<input type="text" name="sort" lay-verify="" placeholder="请输入角色类型" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">显示</label>
<div class="layui-input-block">
<input type="checkbox" name="ishidden" lay-skin="primary" title="隐藏" value="0">
</div>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="LAY-user-rule-submit" id="LAY-user-rule-submit" value="确认">
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form'], function(){
var $ = layui.$
,form = layui.form ;
})
</script>
{/block}

View File

@ -0,0 +1,68 @@
{extend name="public:base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-admin" id="layuiadmin-rule-edit" style="padding: 20px 30px 0 0;">
<div class="layui-form-item layui-hide">
<input type="text" name="id" class="layui-input" value="{$rules.id}">
</div>
<div class="layui-form-item">
<label class="layui-form-label">上级菜单</label>
<div class="layui-input-block">
<select name="pid" lay-verify="required">
<option value="0">顶级菜单</option>
{volist name="AuthRule" id="vo"}
<option {if condition="$rules['pid'] eq $vo.id"} selected {/if} value="{$vo.id}"><?php echo str_repeat('--',$vo['level']*2) ?>{$vo.title}</option>
{/volist}
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">权限名</label>
<div class="layui-input-inline">
<input type="text" name="title" lay-verify="required" placeholder="请输入权限名" autocomplete="off" class="layui-input" value="{$rules.title}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">权限地址</label>
<div class="layui-input-inline">
<input type="text" name="name" lay-verify="required" placeholder="请输入邮箱" autocomplete="off" class="layui-input" value="{$rules.name}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">图标</label>
<div class="layui-input-inline">
<input type="text" name="icon" lay-verify="" placeholder="请输入角色类型" autocomplete="off" class="layui-input" value="{$rules.icon}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">排序</label>
<div class="layui-input-inline">
<input type="text" name="sort" lay-verify="required" placeholder="请输入角色类型" autocomplete="off" class="layui-input" value="{$rules.sort}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">显示</label>
<div class="layui-input-block">
<input type="checkbox" name="ishidden" lay-skin="primary" title="隐藏" {if condition="$rules.ishidden == 0"}checked{/if}>
</div>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="LAY-user-rule-submit" id="LAY-user-rule-submit" value="确认">
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form'], function(){
var $ = layui.$
,form = layui.form ;
})
</script>
{/block}

View File

@ -0,0 +1,277 @@
{extend name="public:base" /}
{block name="body"}
<div class="layui-fluid">
<div class="layui-card">
<div class="layui-card-header">权限菜单</div>
<div class="layui-card-body">
<div style="padding-bottom: 10px;">
<button class="layui-btn layuiadmin-btn-admin" data-type="add">添加</button>
</div>
<table id="LAY-user-auth-rule" lay-filter="LAY-user-auth-rule"></table>
<script type="text/html" id="rules-sort">
<div class="layui-input-inline" style="width: 30px; high: 30">
{if condition="checkRuleButton('admin/AuthRule/sort')"}
<input type="text" name="sort" autocomplete="off" placeholder="排序" dataid="{{d.id}}" lay-filter="sort" class="layui-input" value="{{d.sort}}">
{else /}<input type="text" placeholder="排序" class="layui-input" value="{{d.sort}}">{/if}
</div>
</script>
<script type="text/html" id="rules-title">
<span >{{# if(d.level !==1){ }}|{{# } }} {{d.title}}</span>
</script>
<script type="text/html" id="buttonAuth">
{if condition="checkRuleButton('admin/authrule/check')"}<input type="checkbox" name="status" lay-skin="switch" lay-filter="authcheck" lay-text="开启|关闭" {{# if(d.status == 1){ }} checked {{# } }} id="{{d.id}}" >
{else /}<button class="layui-btn layui-btn-xs layui-btn-radius layui-btn-disabled">无权限</button>{/if}
</script>
<script type="text/html" id="menu">
{{# if(d.id == '1' | d.id == '2' | d.id == '9' | d.id == '10' ){ }}
<input type="checkbox" name="ishidden" lay-skin="primary" checked disabled >
{{# } else { }}
{if condition="checkRuleButton('admin/authrule/menushow')"}<input type="checkbox" name="ishidden" lay-skin="primary" lay-filter="menu-show" {{# if(d.ishidden ==1){ }}checked value="0"{{# } else { }}value="1"{{# } }} id="{{d.id}}" >
{else /}<input type="checkbox" title="禁用" disabled> {/if}
{{# } }}
</script>
<script type="text/html" id="table-authrule-edit">
{if condition="checkRuleButton('admin/authrule/edit')"}
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>
{else /}<a class="layui-btn layui-btn-normal layui-btn-xs layui-btn-disabled"><i class="layui-icon layui-icon-edit"></i>编辑</a>{/if}
{{# if(d.id == '1' | d.id == '2' | d.id == '9' | d.id == '10' ){ }}
<a class="layui-btn layui-btn-disabled layui-btn-xs"><i class="layui-icon layui-icon-delete"></i>删除</a>
{{# } else { }}
{if condition="checkRuleButton('admin/authrule/delete')"}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
{else /}<a class="layui-btn layui-btn-danger layui-btn-xs layui-btn-disabled"><i class="layui-icon layui-icon-delete"></i>删除</a>{/if}
{{# } }}
</script>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
var userList = "{:url('User/list')}";
var userDelete = "{:url('User/delete')}";
var userEdit = "{:url('User/userEdit')}";
var adminIndex = "{:url('Admin/index')}";
var adminDelete = "{:url('Admin/delete')}";
var adminEdit = "{:url('Admin/edit')}";
var authGroupList = "{:url('AuthGroup/list')}";
var authGroupRoledel = "{:url('AuthGroup/roleDel')}";
var authGroupRoleEdit = "{:url('AuthGroup/roleEdit')}";
var authAccessIndex = "{:url('AuthAccess/index')}";
var authAccessDelete = "{:url('AuthAccess/delete')}";
var authAccessEdit = "{:url('AuthAccess/edit')}";
var authRuleIndex = "{:url('AuthRule/index')}";
var authRuleDelete = "{:url('AuthRule/delete')}";
var authRuleEdit = "{:url('AuthRule/edit')}";
//排序change方法
$(function(){
$('body').on('change','.layui-input',function(){
var id = $(this).attr('dataid'),
sort = $(this).val();
$.ajax({
type:'post',
url:"{:url('admin/AuthRule/sort')}",
data:{id:id,sort:sort},
dataType:'json',
success:function(data){
if(data.code == 0){
layer.msg(data.msg,{
icon:6,
time:2000
}
,function(){location.reload();}
);
} else {
layer.open({
title:'排序失败',
content:data.msg,
icon:5,
adim:6
})
}
}
});
});
return false;
});
</script>
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'useradmin', 'table', 'form'], function(){
var $ = layui.$
,form = layui.form
,table = layui.table;
//监听搜索
form.on('submit(LAY-user-back-search)', function(data){
var field = data.field;
//执行重载
table.reload('LAY-user-auth-rule', {
where: field
});
});
//菜单控制
form.on('checkbox(menu-show)', function(data){
var data = data.elem;
if(data.checked == true){
data.value = 1;
}else{
data.value = 0;
}
$.ajax({
type:'post',
url:"{:url('admin/AuthRule/menushow')}",
data:{"id":data.id,"ishidden":data.value,},
dataType:'json',
success:function(data){
if(data.code == 0){
layer.msg(data.msg,{
icon:6,
time:2000
}
//,function(){location.reload();}
);
} else {
layer.open({
title:'修改失败',
content:data.msg,
icon:5,
adim:6
})
}
}
});
return false;
});
//权限开关
form.on('switch(authcheck)', function(data){
var data= data.elem;
if(data.checked == true){
data.value = 1;
}else{
data.value = 0;
}
$.ajax({
type:'post',
url:"{:url('admin/AuthRule/check')}",
data:{id:data.id,status:data.value,},
dataType:'json',
success:function(data){
if(data.code == 0){
layer.msg(data.msg,{
icon:6,
time:2000
}
//,function(){location.reload();}
);
} else {
layer.open({
title:'审核失败',
content:data.msg,
icon:5,
adim:6
})
}
}
});
return false;
});
//事件
var active = {
batchdel: function(){
var checkStatus = table.checkStatus('LAY-user-auth-rule')
,checkData = checkStatus.data; //得到选中的数据
if(checkData.length === 0){
return layer.msg('请选择数据');
}
layer.prompt({
formType: 1
,title: '敏感操作,请验证口令'
}, function(value, index){
layer.close(index);
layer.confirm('确定删除吗?', function(index) {
//执行 Ajax 后重载
/*
admin.req({
url: 'xxx'
//,……
});
*/
table.reload('LAY-user-auth-rule');
layer.msg('已删除');
});
});
}
,add: function(){
layer.open({
type: 2
,title: '添加权限'
,content: 'add.html'
,area: ['420px', '420px']
,btn: ['确定', '取消']
,yes: function(index, layero){
var iframeWindow = window['layui-layer-iframe'+ index]
,submitID = 'LAY-user-rule-submit'
,submit = layero.find('iframe').contents().find('#'+ submitID);
//监听提交
iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
var field = data.field; //获取提交的字段
//提交 Ajax 成功后,静态更新表格中的数据
$.ajax({
type:"post",
url:"{:url('admin/AuthRule/add')}",
data:{"pid":field.pid,"title":field.title,"name":field.name,"icon":field.icon,"sort":field.sort,"ishidden":field.ishidden},
daType:"json",
success:function (data){
if (data.code == 0) {
layer.msg(data.msg,{
icon:6,
time:2000
}, function(){
location.reload();
});
} else {
layer.open({
tiele:'添加失败',
content:data.msg,
icon:5,
anim:6
});
}
}
});
table.reload('LAY-user-front-submit'); //数据刷新
layer.close(index); //关闭弹层
});
submit.trigger('click');
}
});
}
}
$('.layui-btn.layuiadmin-btn-admin').on('click', function(){
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
});
</script>
{/block}

View File

@ -0,0 +1,119 @@
<link rel="stylesheet" href="G:/www/Taole/public/static/admin/layui/css/layui.css" media="all">
<body>
<script src="G:/www/Taole/public/static/admin/layui/layui.js"></script>
<script type="text/javascript">
//需要引入的模块
layui.use(['table','form','jquery'], function() {
var form = layui.form,
table = layui.table,
$=layui.jquery;
form.on('checkbox()', function(data){
var pc = data.elem.classList //获取选中的checkbox的class属性
/* checkbox处于选中状态 */
if(data.elem.checked==true){//并且当前checkbox为选中状态
/*如果是parent节点 */
if(pc=="parent"){ //如果当前选中的checkbox class里面有parent
//获取当前checkbox的兄弟节点的孩子们是 input[type='checkbox']的元素
var c =$(data.elem).siblings().children("input[type='checkbox']");
c.each(function(){//遍历他们的孩子们
var e = $(this); //添加layui的选中的样式 控制台看元素
e.next().addClass("layui-form-checked");
});
}else{/*如果不是parent*/
//选中子级选中父级
$(data.elem).parent().prev().addClass("layui-form-checked");
}
}else{ /*checkbox处于 false状态*/
//父级没有选中 取消所有的子级选中
if(pc=="parent"){/*判断当前取消的是父级*/
var c =$(data.elem).siblings().children("input[type='checkbox']");
c.each(function(){
var e = $(this);
e.next().removeClass("layui-form-checked")
});
}else{/*不是父级*/
var c = $(data.elem).siblings("div");
var count =0;
c.each(function(){//遍历他们的孩子们
//如果有一个==3那么久说明是处于选中状态
var is = $(this).get(0).classList;
if(is.length==3){
count++;
}
});
//如果大于0说明还有子级处于选中状态
if(count>0){
}else{/*如果不大于那么就说明没有子级处于选中状态那么就移除父级的选中状态*/
$(data.elem).parent().prev().removeClass("layui-form-checked");
}
}
}
});
});
</script>
<div class="layui-form" lay-filter="layuiadmin-form-role" id="layuiadmin-form-role" style="padding: 20px 30px 0 0;">
<div class="layui-form-item" id="test">
<label class="layui-form-label">权限范围</label>
<ul class="layui-input-block" style="margin-top: 10px ;">
<li>
<input type="checkbox" class="parent" lay-skin="primary" title="人事模块">
<ul>
<input type="checkbox" name="limits[]" lay-skin="primary" title="社区系统">
<input type="checkbox" name="limits[]" lay-skin="primary" title="用户" >
<input type="checkbox" name="limits[]" lay-skin="primary" title="角色">
<input type="checkbox" name="limits[]" lay-skin="primary" title="评论审核">
</ul>
</li>
</ul>
<ul class="layui-input-block" style="margin-top: 10px ;">
<li>
<input type="checkbox" class="parent" name="limits[]" lay-skin="primary" title="人事模块">
<ul>
<input type="checkbox" name="limits[]" lay-skin="primary" title="社区系统">
<input type="checkbox" name="limits[]" lay-skin="primary" title="用户" >
<input type="checkbox" name="limits[]" lay-skin="primary" title="角色">
<input type="checkbox" name="limits[]" lay-skin="primary" title="评论审核">
</ul>
</li>
</ul>
<ul class="layui-input-block" style="margin-top: 10px ;">
<li>
<input type="checkbox" class="parent" name="limits[]" lay-skin="primary" title="人事模块">
<ul>
<input type="checkbox" name="limits[]" lay-skin="primary" title="社区系统">
<input type="checkbox" name="limits[]" lay-skin="primary" title="用户" >
<input type="checkbox" name="limits[]" lay-skin="primary" title="角色">
<input type="checkbox" name="limits[]" lay-skin="primary" title="评论审核">
</ul>
</li>
</ul>
</div>
</div>
</body>
//获取选中的checkbox的值
var mId = "";
var e =iframeWindow.$(":checkbox");
e.each(function () {
if($(this).next().hasClass("layui-form-checked")){
mId+=$(this).val()+",";
};
})
mId = mId.substring(0,mId.length-1);

View File

@ -0,0 +1,164 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-fluid">
<div class="layui-card">
<div class="layui-form layui-card-header layuiadmin-card-header-auto">
<div class="layui-form-item">
<div class="layui-inline">
角色筛选
</div>
<div class="layui-inline">
<select name="rolename" lay-filter="LAY-user-adminrole-type">
<option value="-1">全部角色</option>
<option value="0">管理员</option>
<option value="1">超级管理员</option>
<option value="2">纠错员</option>
<option value="3">采购员</option>
<option value="4">推销员</option>
<option value="5">运营人员</option>
<option value="6">编辑</option>
</select>
</div>
</div>
</div>
<div class="layui-card-body">
<div style="padding-bottom: 10px;">
<button class="layui-btn layuiadmin-btn-role" data-type="batchdel">删除</button>
<button class="layui-btn layuiadmin-btn-role" data-type="add">添加</button>
</div>
<table id="LAY-user-back-role" lay-filter="LAY-user-back-role"></table>
<script type="text/html" id="buttonTpl">
{{# if(d.check == true){ }}
<button class="layui-btn layui-btn-xs">已审核</button>
{{# } else { }}
<button class="layui-btn layui-btn-primary layui-btn-xs">未审核</button>
{{# } }}
</script>
<script type="text/html" id="table-useradmin-admin">
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
</script>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'useradmin', 'table'], function(){
var $ = layui.$
,form = layui.form
,table = layui.table;
//搜索角色
form.on('select(LAY-user-adminrole-type)', function(data){
//执行重载
table.reload('LAY-user-back-role', {
where: {
role: data.value
}
});
});
//事件
var active = {
batchdel: function(){
var checkStatus = table.checkStatus('LAY-user-back-role')
,checkData = checkStatus.data; //得到选中的数据
console.log(checkData);
if(checkData.length === 0){
return layer.msg('请选择数据');
}
layer.confirm('确定删除吗?', function(index) {
//执行 Ajax 后重载
/*
admin.req({
url: 'xxx'
//,……
});
*/
table.reload('LAY-user-back-role');
layer.msg('已删除');
});
},
add: function(){
layer.open({
type: 2
,title: '添加新角色'
,content: 'roleadd.html'
,area: ['500px', '480px']
,btn: ['确定', '取消']
,yes: function(index, layero){
var iframeWindow = window['layui-layer-iframe'+ index]
,submit = layero.find('iframe').contents().find("#LAY-user-role-submit");
//监听提交
iframeWindow.layui.form.on('submit(LAY-user-role-submit)', function(data){
var field = data.field;
//checkbox 父子级级联或取id
var mId = "";
var e =iframeWindow.$(":checkbox");
e.each(function () {
if($(this).next().hasClass("layui-form-checked")){
mId+=$(this).val()+",";
};
})
rules = mId.substring(0,mId.length-1);
/*
var arr = new Array(); //获取提交的字段
$(iframeWindow.document).find('input[name=rules]:checked').each(function(){
arr.push($(this).val());
});
var rules = arr.join(',');//将数组元素连接起来以构建一个字符串
//console.log(rules);
*/
//提交 Ajax 成功后,静态更新表格中的数据
$.ajax({
type:"post",
url:"{:url('admin/authgroup/roleAdd')}",
data:{"rules":rules,"title":field.title,"descr":field.descr},
daType:"json",
success:function (data){
if (data.code == 1) {
layer.msg(data.msg,{
icon:6,
time:2000
});
} else {
layer.open({
tiele:'添加失败',
content:data.msg,
icon:5,
anim:6
});
}
}
});
table.reload('LAY-user-back-role');
layer.close(index); //关闭弹层
});
submit.trigger('click');
}
});
}
}
$('.layui-btn.layuiadmin-btn-role').on('click', function(){
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
});
</script>
{/block}

View File

@ -0,0 +1,164 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-fluid">
<div class="layui-card">
<div class="layui-form layui-card-header layuiadmin-card-header-auto">
<div class="layui-form-item">
<div class="layui-inline">
角色筛选
</div>
<div class="layui-inline">
<select name="rolename" lay-filter="LAY-user-adminrole-type">
<option value="-1">全部角色</option>
<option value="0">管理员</option>
<option value="1">超级管理员</option>
<option value="2">纠错员</option>
<option value="3">采购员</option>
<option value="4">推销员</option>
<option value="5">运营人员</option>
<option value="6">编辑</option>
</select>
</div>
</div>
</div>
<div class="layui-card-body">
<div style="padding-bottom: 10px;">
<button class="layui-btn layuiadmin-btn-role" data-type="batchdel">删除</button>
<button class="layui-btn layuiadmin-btn-role" data-type="add">添加</button>
</div>
<table id="LAY-user-back-role" lay-filter="LAY-user-back-role"></table>
<script type="text/html" id="buttonTpl">
{{# if(d.check == true){ }}
<button class="layui-btn layui-btn-xs">已审核</button>
{{# } else { }}
<button class="layui-btn layui-btn-primary layui-btn-xs">未审核</button>
{{# } }}
</script>
<script type="text/html" id="table-useradmin-admin">
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
</script>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'useradmin', 'table'], function(){
var $ = layui.$
,form = layui.form
,table = layui.table;
//搜索角色
form.on('select(LAY-user-adminrole-type)', function(data){
//执行重载
table.reload('LAY-user-back-role', {
where: {
role: data.value
}
});
});
//事件
var active = {
batchdel: function(){
var checkStatus = table.checkStatus('LAY-user-back-role')
,checkData = checkStatus.data; //得到选中的数据
if(checkData.length === 0){
return layer.msg('请选择数据');
}
layer.confirm('确定删除吗?', function(index) {
//执行 Ajax 后重载
/*
admin.req({
url: 'xxx'
//,……
});
*/
table.reload('LAY-user-back-role');
layer.msg('已删除');
});
},
add: function(){
layer.open({
type: 2
,title: '添加新角色'
,content: 'roleadd.html'
,area: ['500px', '480px']
,btn: ['确定', '取消']
,yes: function(index, layero){
var iframeWindow = window['layui-layer-iframe'+ index]
,submit = layero.find('iframe').contents().find("#LAY-user-role-submit");
//监听提交
iframeWindow.layui.form.on('submit(LAY-user-role-submit)', function(data){
var field = data.field;
//checkbox 父子级级联或取id
var mId = "";
var e =iframeWindow.$(":checkbox");
e.each(function () {
if($(this).next().hasClass("layui-form-checked")){
mId+=$(this).val()+",";
};
})
rules = mId.substring(0,mId.length-1);
/*
var arr = new Array(); //获取提交的字段
$(iframeWindow.document).find('input[name=rules]:checked').each(function(){
arr.push($(this).val());
});
var rules = arr.join(',');//将数组元素连接起来以构建一个字符串
*/
//console.log(rules);
//提交 Ajax 成功后,静态更新表格中的数据
$.ajax({
type:"post",
url:"{:url('admin/authgroup/roleAdd')}",
data:{"rules":rules,"title":field.title,"descr":field.descr},
daType:"json",
success:function (data){
if (data.code == 1) {
layer.msg(data.msg,{
icon:6,
time:2000
});
} else {
layer.open({
tiele:'添加失败',
content:data.msg,
icon:5,
anim:6
});
}
}
});
table.reload('LAY-user-back-role');
layer.close(index); //关闭弹层
});
submit.trigger('click');
}
});
}
}
$('.layui-btn.layuiadmin-btn-role').on('click', function(){
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
});
</script>
{/block}

View File

@ -0,0 +1,101 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-role" id="layuiadmin-form-role" style="padding: 20px 30px 0 0;">
<div class="layui-form-item">
<label class="layui-form-label">角色</label>
<div class="layui-input-inline">
<input type="text" name="title" lay-verify="required" placeholder="请输入角色名" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item" id="test">
<label class="layui-form-label">权限范围</label>
{volist name="menus" id="vo1"}
<ul class="layui-input-block" style="margin-top: 10px ;">
<li>
<input type="checkbox" name="rules" class="parent" lay-skin="primary" value="{$vo1.id}" title="{$vo1.title}">
<ul>
{if condition="isset($vo1['children'])"}
{volist name="vo1['children']" id="vo2"}
{if condition="isset($vo2['children'])"}
<input type="checkbox" name="rules" lay-skin="primary" value="{$vo2.id}" title="{$vo2.title}">
{volist name="vo2['children']" id="vo3"}
<input type="checkbox" name="rules" lay-skin="primary" id="{$vo3.id}" value="{$vo3.id}" title="{$vo3.title}">
{/volist}
{else /}
<input type="checkbox" name="rules" lay-skin="primary" id="{$vo2.id}" value="{$vo2.id}" title="{$vo2.title}">
{/if}
{/volist}
{/if}
</ul>
</li>
</ul>
{/volist}
</div>
<div class="layui-form-item">
<label class="layui-form-label">具体描述</label>
<div class="layui-input-block">
<textarea type="text" name="descr" lay-verify="required" autocomplete="off" class="layui-textarea"></textarea>
</div>
</div>
<div class="layui-form-item layui-hide">
<button class="layui-btn" lay-submit lay-filter="LAY-user-role-submit" id="LAY-user-role-submit">提交</button>
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form'], function(){
var $ = layui.$
,form = layui.form ;
form.on('checkbox()', function(data){
var pc = data.elem.classList; //获取选中的checkbox的class属性
if(data.elem.checked==true){
if(pc=="parent"){
var c =$(data.elem).siblings().children("input[type='checkbox']");
c.each(function(){
var e = $(this);
e.next().addClass("layui-form-checked");
});
}else{
$(data.elem).parent().prev().addClass("layui-form-checked");
}
}else{
if(pc=="parent"){
var c =$(data.elem).siblings().children("input[type='checkbox']");
c.each(function(){
var e = $(this);
e.next().removeClass("layui-form-checked");
});
}else{
var c = $(data.elem).siblings("div");
var count =0;
c.each(function(){
var is = $(this).get(0).classList;
if(is.length==3){
count++;
}
});
if(count>0){
}else{
$(data.elem).parent().prev().removeClass("layui-form-checked");
}
}
}
});
})
</script>
{/block}

View File

@ -0,0 +1,154 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-role" id="layuiadmin-form-role" style="padding: 20px 30px 0 0;">
<div class="layui-form-item layui-hide">
<input type="text" name="id" class="layui-input" value="{$auth.id}">
</div>
<div class="layui-form-item">
<label class="layui-form-label">角色</label>
<div class="layui-input-block">
<select name="title">
{volist name="authGroup" id="vo"}
<option {if condition="$vo.id eq $Request.param.id"} selected {/if} id="{$vo.id}" value="{$vo.title}">{$vo.title}</option>
{/volist}
</select>
</div>
</div>
{volist name="menu" id="vo1"}
<div class="layui-form-item" id="{$vo1.id}">
<label class="layui-form-label">{$vo1.title}</label>
<div class="layui-input-block">
<input type="checkbox" name="rules" class="rule1" lay-skin="primary" id="{$vo1.id}" value="{$vo1.id}" title="{$vo1.title}">
<hr>
{if condition="isset($vo1['children'])"}
{volist name="vo1['children']" id="vo2"}
{if condition="isset($vo2['children'])"}
{volist name="vo2['children']" id="vo3"}
<input type="checkbox" name="rules" class="rule" lay-skin="primary" id="{$vo3.id}" value="{$vo3.id}" title="{$vo3.title}">
{/volist}
{else /}
<input type="checkbox" name="rules" class="rule" lay-skin="primary" id="{$vo2.id}" value="{$vo2.id}" title="{$vo2.title}">
{/if}
{/volist}
{/if}
</div>
</div>
{/volist}
<div class="layui-form-item">
<label class="layui-form-label">具体描述</label>
<div class="layui-input-block">
<textarea type="text" name="descr" lay-verify="required" autocomplete="off" class="layui-textarea" value="{$auth.descr}">{$auth.descr}</textarea>
</div>
</div>
<div class="layui-form-item layui-hide">
<button class="layui-btn" lay-submit lay-filter="LAY-user-role-submit" id="LAY-user-role-submit">提交</button>
</div>
</div>
{/block}
{block name="js"}
<script type="text/javascript">
$(document).ready(function(){
var name = "{$ru}";
var names = name.split(",");
var inputs = $('input[name=rules]');
for (var i =0;i<inputs.length;i++) {
for (var n =0;n<names.length;n++) {
if (names[n]===inputs[i].value) {
inputs[i].checked = true;
//var v = inputs[i].value;
//console.log($("input[id=v]").parent().parent().val());
}
}
}
});
function selectfather1(){
console.log(222);
var zi = $('input[class=rule]');
var fu = $('input[class=rule1]');
for(i=0;i<zi.length;i++){
              if(zi[i].checked){
                fu.checked = true;         
                }
              }
//input.checked
//console.log(input.checked);
//console.log(input.parent().prev().children('input').checked =true);
}
</script>
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'table','form'], function(){
var $ = layui.$
,form = layui.form
,table = layui.table;
form.on('checkbox()', function(data){
var pc = data.elem.classList; //获取选中的checkbox的class属性
/* checkbox处于选中状态 */
if(data.elem.checked==true){//并且当前checkbox为选中状态
/*如果是parent节点 */
if(pc=="parent"){ //如果当前选中的checkbox class里面有parent
//获取当前checkbox的兄弟节点的孩子们是 input[type='checkbox']的元素
var c =$(data.elem).siblings().children("input[type='checkbox']");
c.each(function(){//遍历他们的孩子们
var e = $(this); //添加layui的选中的样式 控制台看元素
e.next().addClass("layui-form-checked");
});
}else{/*如果不是parent*/
//选中子级选中父级
$(data.elem).parent().prev().addClass("layui-form-checked");
}
}else{ /*checkbox处于 false状态*/
//父级没有选中 取消所有的子级选中
if(pc=="parent"){/*判断当前取消的是父级*/
var c =$(data.elem).siblings().children("input[type='checkbox']");
c.each(function(){
var e = $(this);
e.next().removeClass("layui-form-checked")
});
}else{/*不是父级*/
var c = $(data.elem).siblings("div");
var count =0;
c.each(function(){//遍历他们的孩子们
//如果有一个==3那么久说明是处于选中状态
var is = $(this).get(0).classList;
if(is.length==3){
count++;
}
});
//如果大于0说明还有子级处于选中状态
if(count>0){
}else{/*如果不大于那么就说明没有子级处于选中状态那么就移除父级的选中状态*/
$(data.elem).parent().prev().removeClass("layui-form-checked");
}
}
}
});
});
})
</script>
{/block}

View File

@ -0,0 +1,129 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-role" id="layuiadmin-form-role" style="padding: 20px 30px 0 0;">
<div class="layui-form-item layui-hide">
<input type="text" name="id" class="layui-input" value="{$auth.id}">
</div>
<div class="layui-form-item">
<label class="layui-form-label">角色</label>
<div class="layui-input-block">
<select name="title">
{volist name="authGroup" id="vo"}
<option {if condition="$vo.id eq $Request.param.id"} selected {/if} id="{$vo.id}" value="{$vo.title}">{$vo.title}</option>
{/volist}
</select>
</div>
</div>
<div class="layui-form-item" id="test">
<label class="layui-form-label">权限范围</label>
{volist name="menus" id="vo1"}
<ul class="layui-input-block" style="margin-top: 10px ;">
<li>
<input type="checkbox" name="rules" class="parent" lay-skin="primary" value="{$vo1.id}" title="{$vo1.title}">
<ul>
{if condition="isset($vo1['children'])"}
{volist name="vo1['children']" id="vo2"}
{if condition="isset($vo2['children'])"}
<input type="checkbox" name="rules" class="parent" lay-skin="primary" value="{$vo2.id}" title="{$vo2.title}">
{volist name="vo2['children']" id="vo3"}
<input type="checkbox" name="rules" lay-skin="primary" id="{$vo3.id}" value="{$vo3.id}" title="{$vo3.title}">
{/volist}
{else /}
<input type="checkbox" name="rules" lay-skin="primary" id="{$vo2.id}" value="{$vo2.id}" title="{$vo2.title}">
{/if}
{/volist}
{/if}
</ul>
</li>
</ul>
{/volist}
</div>
<div class="layui-form-item">
<label class="layui-form-label">具体描述</label>
<div class="layui-input-block">
<textarea type="text" name="descr" lay-verify="required" autocomplete="off" class="layui-textarea" value="{$auth.descr}">{$auth.descr}</textarea>
</div>
</div>
<div class="layui-form-item layui-hide">
<button class="layui-btn" lay-submit lay-filter="LAY-user-role-submit" id="LAY-user-role-submit">提交</button>
</div>
</div>
{/block}
{block name="js"}
<script type="text/javascript">
$(document).ready(function(){
var name = "{$ru}";
var names = name.split(",");
var inputs = $('input[name=rules]');
for (var i =0;i<inputs.length;i++) {
for (var n =0;n<names.length;n++) {
if (names[n]===inputs[i].value) {
inputs[i].checked = true;
}
}
}
});
</script>
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'table','form'], function(){
var $ = layui.$
,form = layui.form
,table = layui.table;
form.on('checkbox()', function(data){
var pc = data.elem.classList; //获取选中的checkbox的class属性
if(data.elem.checked==true){
if(pc=="parent"){
var c =$(data.elem).siblings().children("input[type='checkbox']");
c.each(function(){
var e = $(this);
e.next().addClass("layui-form-checked");
});
}else{
$(data.elem).parent().prev().addClass("layui-form-checked");
}
}else{
if(pc=="parent"){
var c =$(data.elem).siblings().children("input[type='checkbox']");
c.each(function(){
var e = $(this);
e.next().removeClass("layui-form-checked");
});
}else{
var c = $(data.elem).siblings("div");
var count =0;
c.each(function(){
var is = $(this).get(0).classList;
if(is.length==3){
count++;
}
});
if(count>0){
}else{
$(data.elem).parent().prev().removeClass("layui-form-checked");
}
}
}
});
})
</script>
{/block}

View File

@ -0,0 +1,65 @@
{extend name="public:base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-admin" id="layuiadmin-rule-add" style="padding: 20px 30px 0 0;">
<div class="layui-form-item">
<label class="layui-form-label">上级菜单</label>
<div class="layui-input-block">
<select name="pid" lay-verify="required">
<option value="0">顶级菜单</option>
{volist name="AuthRule" id="vo"}
<option value="{$vo.id}"><?php echo str_repeat('--',$vo['level']*2) ?>{$vo.title}</option>
{/volist}
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">权限名</label>
<div class="layui-input-inline">
<input type="text" name="title" lay-verify="required" placeholder="请输入权限名" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">权限地址</label>
<div class="layui-input-inline">
<input type="text" name="name" lay-verify="required" placeholder="请输入邮箱" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">图标</label>
<div class="layui-input-inline">
<input type="text" name="icon" lay-verify="" placeholder="请输入角色类型" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">排序</label>
<div class="layui-input-inline">
<input type="text" name="sort" lay-verify="" placeholder="请输入角色类型" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">显示</label>
<div class="layui-input-block">
<input type="checkbox" name="ishidden" lay-skin="primary" title="隐藏" value="0">
</div>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="LAY-user-rule-submit" id="LAY-user-rule-submit" value="确认">
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form'], function(){
var $ = layui.$
,form = layui.form ;
})
</script>
{/block}

View File

@ -0,0 +1,68 @@
{extend name="public:base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-admin" id="layuiadmin-rule-edit" style="padding: 20px 30px 0 0;">
<div class="layui-form-item layui-hide">
<input type="text" name="id" class="layui-input" value="{$rules.id}">
</div>
<div class="layui-form-item">
<label class="layui-form-label">上级菜单</label>
<div class="layui-input-block">
<select name="pid" lay-verify="required">
<option value="0">顶级菜单</option>
{volist name="AuthRule" id="vo"}
<option {if condition="$rules['pid'] eq $vo.id"} selected {/if} value="{$vo.id}"><?php echo str_repeat('--',$vo['level']*2) ?>{$vo.title}</option>
{/volist}
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">权限名</label>
<div class="layui-input-inline">
<input type="text" name="title" lay-verify="required" placeholder="请输入权限名" autocomplete="off" class="layui-input" value="{$rules.title}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">权限地址</label>
<div class="layui-input-inline">
<input type="text" name="name" lay-verify="required" placeholder="请输入邮箱" autocomplete="off" class="layui-input" value="{$rules.name}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">图标</label>
<div class="layui-input-inline">
<input type="text" name="icon" lay-verify="" placeholder="请输入角色类型" autocomplete="off" class="layui-input" value="{$rules.icon}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">排序</label>
<div class="layui-input-inline">
<input type="text" name="sort" lay-verify="required" placeholder="请输入角色类型" autocomplete="off" class="layui-input" value="{$rules.sort}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">显示</label>
<div class="layui-input-block">
<input type="checkbox" name="ishidden" lay-skin="primary" title="隐藏" {if condition="$rules.ishidden == 0"}checked{/if}>
</div>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="LAY-user-rule-submit" id="LAY-user-rule-submit" value="确认">
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form'], function(){
var $ = layui.$
,form = layui.form ;
})
</script>
{/block}

View File

@ -0,0 +1,310 @@
{extend name="public:base" /}
{block name="body"}
<div class="layui-fluid">
<div class="layui-card">
<div class="layui-form layui-card-header layuiadmin-card-header-auto">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">登录名</label>
<div class="layui-input-block">
<input type="text" name="loginname" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">手机</label>
<div class="layui-input-block">
<input type="text" name="telphone" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">邮箱</label>
<div class="layui-input-block">
<input type="text" name="email" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">角色</label>
<div class="layui-input-block">
<select name="role">
<option value="0">管理员</option>
<option value="1">超级管理员</option>
<option value="2">纠错员</option>
<option value="3">采购员</option>
<option value="4">推销员</option>
<option value="5">运营人员</option>
<option value="6">编辑</option>
</select>
</div>
</div>
<div class="layui-inline">
<button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="LAY-user-back-search">
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
</button>
</div>
</div>
</div>
<div class="layui-card-body">
<div style="padding-bottom: 10px;">
<button class="layui-btn layuiadmin-btn-admin" data-type="batchdel">删除</button>
<button class="layui-btn layuiadmin-btn-admin" data-type="add">添加</button>
</div>
<table id="LAY-user-auth-rule" lay-filter="LAY-user-auth-rule"></table>
<script type="text/html" id="rules-sort">
<div class="layui-input-inline" style="width: 30px; high: 30">
<input type="text" name="sort" autocomplete="off" placeholder="排序" dataid="{{d.id}}" class="layui-input" value="{{d.sort}}">
</div>
</script>
<script type="text/html" id="rules-title">
<span >{{# if(d.level !==1){ }}|{{# } }} {{d.title}}</span>
</script>
<script type="text/html" id="buttonAuth">
{if condition="checkRuleButton('admin/authrule/check')"}<input type="checkbox" name="status" lay-skin="switch" lay-filter="authcheck" lay-text="开启|关闭" {{# if(d.status == 1){ }} checked {{# } }} id="{{d.id}}" >{else}<button class="layui-btn layui-btn-xs layui-btn-radius layui-btn-disabled">无权限</button>{/if}
</script>
<script type="text/html" id="menu">
{{# if(d.id == '1' | d.id == '2' | d.id == '9' | d.id == '10' ){ }}
<input type="checkbox" name="ishidden" lay-skin="primary" checked disabled >
{{# } else { }}
{if condition="checkRuleButton('admin/authrule/menushow')"}<input type="checkbox" name="ishidden" lay-skin="primary" lay-filter="menu-show" {{# if(d.ishidden ==1){ }}checked value="0"{{# } else { }}value="1"{{# } }} id="{{d.id}}" >{else}<button class="layui-btn layui-btn-xs layui-btn-disabled">没有权限</button>{/if}
{{# } }}
</script>
<script type="text/html" id="table-useradmin-admin">
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>
{{# if(d.role == '1'){ }}
<a class="layui-btn layui-btn-disabled layui-btn-xs"><i class="layui-icon layui-icon-delete"></i>删除</a>
{{# } else { }}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
{{# } }}
</script>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
//排序
$(function(){
$('input[name=sort]').change(function(){
var id = $(this).attr('dataid'),
sort = $(this).val();
console.log(id);
$.ajax({
type:'post',
url:"{:url('admin/authrule/sort')}",
data:{id:id,sort:sort},
dataType:'json',
success:function(data){
if(data.code == 1){
layer.msg(data.msg,{
icon:6,
time:2000
}
//,function(){location.reload();}
);
} else {
layer.open({
title:'排序失败',
content:data.msg,
icon:5,
adim:6
})
}
}
});
});
return false;
});
</script>
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'useradmin', 'table', 'form'], function(){
var $ = layui.$
,form = layui.form
,table = layui.table;
//监听搜索
form.on('submit(LAY-user-back-search)', function(data){
var field = data.field;
//执行重载
table.reload('LAY-user-auth-rule', {
where: field
});
});
//菜单控制
form.on('checkbox(menu-show)', function(data){
var data = data.elem;
//console.log(data);
if(data.checked == true){
data.value = 1;
}else{
data.value = 0;
}
$.ajax({
type:'post',
url:"/admin/authrule/menushow",
data:{id:data.id,ishidden:data.value,},
dataType:'json',
success:function(data){
if(data.code == 1){
layer.msg(data.msg,{
icon:6,
time:2000
}
//,function(){location.reload();}
);
} else {
layer.open({
title:'修改失败',
content:data.msg,
icon:5,
adim:6
})
}
}
});
return false;
});
//权限开关
form.on('switch(authcheck)', function(data){
var data= data.elem;
//console.log(data);
if(data.checked == true){
data.value = 1;
}else{
data.value = 0;
}
$.ajax({
type:'post',
url:"/admin/authrule/Check",
data:{id:data.id,status:data.value,},
dataType:'json',
success:function(data){
if(data.code == 0){
layer.msg(data.msg,{
icon:6,
time:2000
}
,function(){location.reload();}
);
} else {
layer.open({
title:'审核失败',
content:data.msg,
icon:5,
adim:6
})
}
}
});
return false;
//console.log(data.id);
//console.log(data.elem); //得到checkbox原始DOM对象
//console.log(data.elem.checked); //开关是否开启true或者false
//console.log(data.value); //开关value值也可以通过data.elem.value得到
//console.log(data.othis); //得到美化后的DOM对象
});
//事件
var active = {
batchdel: function(){
var checkStatus = table.checkStatus('LAY-user-auth-rule')
,checkData = checkStatus.data; //得到选中的数据
if(checkData.length === 0){
return layer.msg('请选择数据');
}
layer.prompt({
formType: 1
,title: '敏感操作,请验证口令'
}, function(value, index){
layer.close(index);
layer.confirm('确定删除吗?', function(index) {
//执行 Ajax 后重载
/*
admin.req({
url: 'xxx'
//,……
});
*/
table.reload('LAY-user-auth-rule');
layer.msg('已删除');
});
});
}
,add: function(){
layer.open({
type: 2
,title: '添加权限'
,content: '/admin/authrule/add'
,area: ['420px', '420px']
,btn: ['确定', '取消']
,yes: function(index, layero){
var iframeWindow = window['layui-layer-iframe'+ index]
,submitID = 'LAY-user-rule-submit'
,submit = layero.find('iframe').contents().find('#'+ submitID);
//监听提交
iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
var field = data.field; //获取提交的字段
//console.log(field);
//提交 Ajax 成功后,静态更新表格中的数据
$.ajax({
type:"post",
url:"{:url('admin/authrule/add')}",
data:{"pid":field.pid,"title":field.title,"name":field.name,"icon":field.icon,"sort":field.sort,"ishidden":field.ishidden},
daType:"json",
success:function (data){
if (data.code == 0) {
layer.msg(data.msg,{
icon:6,
time:2000
}, function(){
location.reload();
});
} else {
layer.open({
tiele:'添加失败',
content:data.msg,
icon:5,
anim:6
});
}
}
});
table.reload('LAY-user-front-submit'); //数据刷新
layer.close(index); //关闭弹层
});
submit.trigger('click');
}
});
}
}
$('.layui-btn.layuiadmin-btn-admin').on('click', function(){
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
});
</script>
{/block}

210
view/admin/forum/list.html Normal file
View File

@ -0,0 +1,210 @@
{extend name="public:base" /}
{block name="body"}
<div class="layui-fluid">
<div class="layui-card">
<div class="layui-form layui-card-header layuiadmin-card-header-auto">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">ID</label>
<div class="layui-input-block">
<input type="text" name="id" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">发帖人</label>
<div class="layui-input-block">
<input type="text" name="name" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">发帖名称</label>
<div class="layui-input-block">
<input type="text" name="title" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">帖子状态</label>
<div class="layui-input-block">
<select name="sec">
<option value="">选择状态</option>
<option value="1">正常</option>
<option value="2">置顶</option>
<option value="3">热门</option>
<option value="4">禁评</option>
<option value="5">封禁</option>
</select>
</div>
</div>
<div class="layui-inline">
<button class="layui-btn layuiadmin-btn-forum-list" lay-submit lay-filter="LAY-app-forumlist-search">
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
</button>
</div>
</div>
</div>
<div class="layui-card-body">
<div style="padding-bottom: 10px;">
<button class="layui-btn layuiadmin-btn-forum-list" data-type="batchdel">删除</button>
</div>
<table id="LAY-app-forum-list" lay-filter="LAY-app-forum-list"></table>
<script type="text/html" id="imgTpl">
<img style="display: inline-block; width: 50%; height: 100%;" src= "{{ d.avatar }}">
</script>
<script type="text/html" id="title">
<a href="/index/jie/{{d.id}}.html" target="_blank">{{d.content}}</a>
</script>
<script type="text/html" id="buttonTpl">
{{# if(d.top == 1){ }}
<button class="layui-btn layui-btn-xs">置顶</button>
{{# } else { }}
<button class="layui-btn layui-btn-primary layui-btn-xs">正常</button>
{{# } }}
</script>
<script type="text/html" id="buttonHot">
{{# if(d.hot == 1){ }}
<button class="layui-btn layui-btn-xs">精贴</button>
{{# } else { }}
<button class="layui-btn layui-btn-primary layui-btn-xs">正常</button>
{{# } }}
</script>
<script type="text/html" id="buttonReply">
{{# if(d.reply == 1){ }}
<button class="layui-btn layui-btn-primary layui-btn-xs">正常</button>
{{# } else { }}
<button class="layui-btn layui-btn-xs">禁评</button>
{{# } }}
</script>
<script type="text/html" id="buttonCheck">
{if condition="checkRuleButton('admin/forum/check')"}
<input type="checkbox" name="check" lay-skin="switch" lay-filter="forumcheck" lay-text="通过|禁止" {{# if(d.check == 1){ }} checked {{# } }} id="{{d.id}}" >
{else /}<button class="layui-btn layui-btn-xs layui-btn-radius layui-btn-disabled">无权限</button>{/if}
</script>
<script type="text/html" id="table-forum-list">
{if condition="checkRuleButton('admin/forum/listdel')"}
<!--a class="layui-btn layui-btn-disabled layui-btn-xs" lay-event="edit" ><i class="layui-icon layui-icon-edit"></i>编辑</a-->
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
{else /}<a class="layui-btn layui-btn-danger layui-btn-xs layui-btn-disabled"><i class="layui-icon layui-icon-delete"></i>删除</a>{/if}
</script>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
var forumList = "{:url('Forum/list')}",
forumListdel = "{:url('Forum/listdel')}",
forumListform = "{:url('Forum/listform')}",
forumReplys = "{:url('Forum/replys')}",
forumRedel = "{:url('Forum/redel')}",
forumReplysform = "{:url('Forum/replysform')}",
forumTags = "{:url('Forum/tags')}",
forumTagsDelete = "{:url('Forum/tagsdelete')}",
forumTagsForm = "{:url('Forum/tagsform')}";
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'forum', 'table'], function(){
var $ = layui.$
,form = layui.form
,table = layui.table;
//监听搜索
form.on('submit(LAY-app-forumlist-search)', function(data){
var field = data.field;
$.ajax({
type:"post",
url:"{:url('admin/Forum/list')}",
data:{field},
daType:"json",
success:function (data){
if (data.code == 0) {
} else {
layer.open({
content:data.msg,
icon:5,
anim:6
});
}
}
});
//执行重载
table.reload('LAY-app-forum-list', {
where: field
});
});
//事件
var active = {
batchdel: function(){
var checkStatus = table.checkStatus('LAY-app-forum-list')
,checkData = checkStatus.data; //得到选中的数据
if(checkData.length === 0){
return layer.msg('请选择数据');
}
layer.confirm('确定删除吗?', function(index) {
//执行 Ajax 后重载
/*
admin.req({
url: 'xxx'
//,……
});
*/
table.reload('LAY-app-forum-list');
layer.msg('已删除');
});
}
}
//监听帖子审核
form.on('switch(forumcheck)', function(data){
var data= data.elem;
if(data.checked == true){
data.value = 1;
}else{
data.value = 0;
}
//执行帖子审核
$.ajax({
type:'post',
url:"{:url('admin/Forum/check')}",
data:{id:data.id,status:data.value,},
dataType:'json',
success:function(res){
if(res.code == 0){
layer.msg(res.msg,{
icon:res.icon,
time:2000
}
//,function(){location.reload();}
);
} else {
layer.open({
title:'审核失败',
content:res.msg,
icon:5,
adim:6
})
}
}
});
return false;
});
$('.layui-btn.layuiadmin-btn-forum-list').on('click', function(){
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
});
</script>
{/block}

View File

@ -0,0 +1,61 @@
{extend name="public:base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-list" id="layuiadmin-form-list" style="padding: 20px 30px 0 0;">
<div class="layui-form-item">
<label class="layui-form-label">用户名</label>
<div class="layui-input-block">
<input type="text" name="poster" lay-verify="required" placeholder="请输入用户名" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">发帖内容</label>
<div class="layui-input-block">
<textarea name="content" lay-verify="required" autocomplete="off" class="layui-textarea"></textarea>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">置顶</label>
<div class="layui-input-block">
<input type="checkbox" lay-filter="switch" lay-verify="required" name="switch" lay-skin="switch" lay-text="ON|OFF">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">头像</label>
<div class="layui-input-inline">
<input type="text" name="avatar" placeholder="请上传图片" autocomplete="off" class="layui-input" >
</div>
<button style="float: left;" type="button" class="layui-btn" id="layuiadmin-upload-list">上传图片</button>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="LAY-app-forum-submit" id="LAY-app-forum-submit" value="确认">
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form', 'upload'], function(){
var $ = layui.$
,form = layui.form
,upload = layui.upload;
upload.render({
elem: '#layuiadmin-upload-list'
,url: layui.setter.base + 'json/upload/demo.js'
,accept: 'images'
,method: 'get'
,acceptMime: 'image/*'
,done: function(res){
$(this.item).prev("div").children("input").val(res.data.src)
}
});
})
</script>
{/block}

View File

@ -0,0 +1,168 @@
{extend name="public:base" /}
{block name="body"}
<div class="layui-fluid">
<div class="layui-card">
<div class="layui-form layui-card-header layuiadmin-card-header-auto">
<div class="layui-form-item">
<div class="layui-inline layuiadmin-input-useradmin">
<label class="layui-form-label">回帖人</label>
<div class="layui-input-block">
<input type="text" name="name" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">回帖内容</label>
<div class="layui-input-block">
<input type="text" name="content" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<button class="layui-btn layuiadmin-btn-replys" data-type="reload" lay-submit lay-filter="LAY-app-forumreply-search">
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
</button>
</div>
</div>
</div>
<div class="layui-card-body">
<div style="padding-bottom: 10px;">
<button class="layui-btn layuiadmin-btn-replys" data-type="batchdel">删除</button>
</div>
<table id="LAY-app-forumreply-list" lay-filter="LAY-app-forumreply-list"></table>
<script type="text/html" id="imgTpl">
<img style="display: inline-block; width: 50%; height: 100%;" src= {{ d.avatar }}>
</script>
<script type="text/html" id="title">
<a href="/index/jie/{{d.cid}}.html" target="_blank">{{d.cardid}}</a>
</script>
<script type="text/html" id="buttonCheck">
{if condition="checkRuleButton('admin/forum/recheck')"}<input type="checkbox" name="check" lay-skin="switch" lay-filter="recheck" lay-text="通过|禁止" {{# if(d.check == 1){ }} checked {{# } }} id="{{d.id}}" >
{else /}<button class="layui-btn layui-btn-xs layui-btn-radius layui-btn-disabled">无权限</button>{/if}
</script>
<script type="text/html" id="table-forum-replys">
{if condition="checkRuleButton('admin/forum/redel')"}
<!--a class="layui-btn layui-btn-disabled layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a-->
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
{else / }<a class="layui-btn layui-btn-danger layui-btn-xs layui-btn-disabled"><i class="layui-icon layui-icon-delete"></i>删除</a>{/if}
</script>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
var forumList = "{:url('Forum/list')}",
forumListdel = "{:url('Forum/listdel')}",
forumListform = "{:url('Forum/listform')}",
forumReplys = "{:url('Forum/replys')}",
forumRedel = "{:url('Forum/redel')}",
forumReplysform = "{:url('Forum/replysform')}",
forumTags = "{:url('Forum/tags')}",
forumTagsDelete = "{:url('Forum/tagsdelete')}",
forumTagsForm = "{:url('Forum/tagsform')}";
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'forum', 'table'], function(){
var $ = layui.$
,form = layui.form
,table = layui.table;
//监听搜索
form.on('submit(LAY-app-forumreply-search)', function(data){
var field = data.field;
$.ajax({
type:"post",
url:"{:url('admin/Forum/replys')}",
data:{field},
daType:"json",
success:function (data){
if (data.code == 0) {
} else {
layer.open({
content:data.msg,
icon:5,
anim:6
});
}
}
});
//执行重载
table.reload('LAY-app-forumreply-list', {
where: field
});
});
var active = {
batchdel: function(){
var checkStatus = table.checkStatus('LAY-app-forumreply-list')
,checkData = checkStatus.data; //得到选中的数据
if(checkData.length === 0){
return layer.msg('请选择数据');
}
layer.confirm('确定删除吗?', function(index) {
//执行 Ajax 后重载
/*
admin.req({
url: 'xxx'
//,……
});
*/
table.reload('LAY-app-forumreply-list');
layer.msg('已删除');
});
}
}
//监听回贴审核
form.on('switch(recheck)', function(data){
var data= data.elem;
if(data.checked == true){
data.value = 1;
}else{
data.value = 0;
}
//执行回帖审核
$.ajax({
type:'post',
url:"{:url('admin/Forum/recheck')}",
data:{id:data.id,status:data.value,},
dataType:'json',
success:function(res){
if(res.code == 0){
layer.msg(res.msg,{
icon:res.icon,
time:2000
}
//,function(){location.reload();}
);
} else {
layer.open({
title:'审核失败',
content:res.msg,
icon:5,
adim:6
})
}
}
});
return false;
});
$('.layui-btn.layuiadmin-btn-replys').on('click', function(){
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
});
</script>
{/block}

View File

@ -0,0 +1,39 @@
{extend name="public:base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-replys" id="layuiadmin-form-replys" style="padding: 20px 30px 0 0;">
<div class="layui-form-item">
<label class="layui-form-label">回帖内容</label>
<div class="layui-input-block">
<textarea name="content" lay-verify="required" autocomplete="off" class="layui-textarea" style="height: 200px;"></textarea>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form', 'upload'], function(){
var $ = layui.$
,form = layui.form
,upload = layui.upload;
upload.render({
elem: '#layuiadmin-upload-replys'
,url: layui.setter.base + 'json/upload/demo.js'
,accept: 'images'
,method: 'get'
,acceptMime: 'image/*'
,done: function(res){
$(this.item).prev("div").children("input").val(res.data.src)
}
});
})
</script>
{/block}

136
view/admin/forum/tags.html Normal file
View File

@ -0,0 +1,136 @@
{extend name="public:base" /}
{block name="body"}
<div class="layui-fluid">
<div class="layui-card">
<div class="layui-card-header layuiadmin-card-header-auto">
{if condition="checkRuleButton('admin/forum/addtags')"}
<button class="layui-btn layuiadmin-btn-tags" data-type="add">添加</button>
{/if}
</div>
<div class="layui-card-body">
<table id="LAY-app-content-tags" lay-filter="LAY-app-content-tags"></table>
<script type="text/html" id="buttonHot">
{if condition="checkRuleButton('admin/Forum/tagshot')"}<input type="checkbox" name="is_hot" lay-skin="primary" lay-filter="menu-show" {{# if(d.is_hot ==1){ }}checked value="0"{{# } else { }}value="1"{{# } }} id="{{d.id}}" >
{else /}<input type="checkbox" title="禁用" disabled> {/if}
</script>
<script type="text/html" id="layuiadmin-app-cont-tagsbar">
{if condition="checkRuleButton('admin/forum/tagsform')"}
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>
{else /}<a class="layui-btn layui-btn-disabled layui-btn-normal layui-btn-xs"><i class="layui-icon layui-icon-edit"></i>编辑</a>{/if}
{if condition="checkRuleButton('admin/forum/tagsdelete')"}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
{else /}<a class="layui-btn layui-btn-disabled layui-btn-danger layui-btn-xs"><i class="layui-icon layui-icon-delete"></i>删除</a>{/if}
</script>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
var forumList = "{:url('Forum/list')}",
forumListdel = "{:url('Forum/listdel')}",
forumListform = "{:url('Forum/listform')}",
forumReplys = "{:url('Forum/replys')}",
forumRedel = "{:url('Forum/redel')}",
forumReplysform = "{:url('Forum/replysform')}",
forumTags = "{:url('Forum/tags')}",
forumTagsDelete = "{:url('Forum/tagsdelete')}",
forumTagsForm = "{:url('Forum/tagsform')}";
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'forum', 'table','form'], function(){
var table = layui.table,
form = layui.form;
var $ = layui.$, active = {
add: function(){
layer.open({
type: 2
,title: '添加分类'
,content: '/admin/Forum/addtags'
,area: ['400px', '350px']
,btn: ['确定', '取消']
,yes: function(index, layero){
var othis = layero.find('iframe').contents().find("#layuiadmin-app-form-tags")
,sort = othis.find('input[name="sort"]').val()
,tags = othis.find('input[name="tags"]').val()
,ename = othis.find('input[name="ename"]').val()
,desc = othis.find('input[name="desc"]').val();
if(!tags.replace(/\s/g, '')) return;
$.ajax({
type:"post",
url:"{:url('admin/Forum/addtags')}",
data:{"sort":sort,"catename":tags,"ename":ename,"desc":desc},
daType:"json",
success:function (data){
if (data.code == 0) {
layer.msg(data.msg,{
icon:6,
time:2000
});
} else {
layer.open({
tiele:'添加失败',
content:data.msg,
icon:5,
anim:6
});
}
}
});
table.reload('LAY-app-content-tags');
layer.close(index);
}
});
}
}
//分类热点控制
form.on('checkbox(menu-show)', function(data){
var data = data.elem;
if(data.checked == true){
data.value = 1;
}else{
data.value = 0;
}
$.ajax({
type:'post',
url:"{:url('admin/Forum/tagshot')}",
data:{"id":data.id,"is_hot":data.value,},
dataType:'json',
success:function(data){
if(data.code == 0){
layer.msg(data.msg,{
icon:6,
time:2000
}
//,function(){location.reload();}
);
} else {
layer.open({
title:'修改失败',
content:data.msg,
icon:5,
adim:6
})
}
}
});
return false;
});
$('.layui-btn.layuiadmin-btn-tags').on('click', function(){
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
});
</script>
{/block}

View File

@ -0,0 +1,39 @@
{extend name="public:base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-tags" id="layuiadmin-app-form-tags" style="padding: 20px 30px 0 0 ; text-align: center;">
<div class="layui-form-item">
<label class="layui-form-label">分类名</label>
<div class="layui-input-inline">
<input type="text" name="tags" lay-verify="required" placeholder="分类名*" autocomplete="off" class="layui-input">
</div>
<label class="layui-form-label">EN别名</label>
<div class="layui-input-inline">
<input type="text" name="ename" lay-verify="required" placeholder="英文名*" autocomplete="off" class="layui-input">
</div>
<label class="layui-form-label">描述</label>
<div class="layui-input-inline">
<input type="text" name="desc" lay-verify="required" placeholder="描述*" autocomplete="off" class="layui-input">
</div>
<label class="layui-form-label">排序</label>
<div class="layui-input-inline">
<input type="text" name="sort" lay-verify="required" placeholder="请填数字" autocomplete="off" class="layui-input">
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form'], function(){
var $ = layui.$
,form = layui.form ;
})
</script>
{/block}

293
view/admin/index/home.html Normal file
View File

@ -0,0 +1,293 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-fluid">
<div class="layui-row layui-col-space15">
<div class="layui-col-md8">
<div class="layui-row layui-col-space15">
<div class="layui-col-md6">
<div class="layui-card">
<div class="layui-card-header">快捷方式</div>
<div class="layui-card-body">
<div class="layui-carousel layadmin-carousel layadmin-shortcut">
<div carousel-item>
<ul class="layui-row layui-col-space10">
<li class="layui-col-xs3">
<a lay-href="{:url('Forum/list')}">
<i class="layui-icon layui-icon-list"></i>
<cite>帖子</cite>
</a>
</li>
<li class="layui-col-xs3">
<a lay-href="{:url('Forum/replys')}">
<i class="layui-icon layui-icon-survey"></i>
<cite>评论</cite>
</a>
</li>
<li class="layui-col-xs3">
<a lay-href="{:url('Forum/tags')}">
<i class="layui-icon layui-icon-template-1"></i>
<cite>分类</cite>
</a>
</li>
<li class="layui-col-xs3">
<a lay-href="{:url('Admin/repass')}">
<i class="layui-icon layui-icon-password"></i>
<cite>密码</cite>
</a>
</li>
<li class="layui-col-xs3">
<a lay-href="{:url('Slider/index')}">
<i class="layui-icon layui-icon-dollar"></i>
<cite>广告</cite>
</a>
</li>
<li class="layui-col-xs3">
<a lay-href="{:url('Admin/info')}">
<i class="layui-icon layui-icon-form"></i>
<cite>资料</cite>
</a>
</li>
<li class="layui-col-xs3">
<a lay-href="{:url('User/list')}">
<i class="layui-icon layui-icon-user"></i>
<cite>用户</cite>
</a>
</li>
<li class="layui-col-xs3">
<a lay-href="{:url('Set/website')}">
<i class="layui-icon layui-icon-set"></i>
<cite>设置</cite>
</a>
</li>
</ul>
<ul class="layui-row layui-col-space10">
<li class="layui-col-xs3">
<a lay-href="">
<i class="layui-icon layui-icon-set"></i>
<cite>我的资料</cite>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="layui-col-md6">
<div class="layui-card">
<div class="layui-card-header">待办事项</div>
<div class="layui-card-body">
<div class="layui-carousel layadmin-carousel layadmin-backlog">
<div carousel-item>
<ul class="layui-row layui-col-space10">
<li class="layui-col-xs6">
<a lay-href="app/content/comment.html" class="layadmin-backlog-body">
<h3>待审评论</h3>
<p><cite>66</cite></p>
</a>
</li>
<li class="layui-col-xs6">
<a lay-href="app/forum/list.html" class="layadmin-backlog-body">
<h3>待审帖子</h3>
<p><cite>12</cite></p>
</a>
</li>
<li class="layui-col-xs6">
<a lay-href="template/goodslist.html" class="layadmin-backlog-body">
<h3>待审商品</h3>
<p><cite>99</cite></p>
</a>
</li>
<li class="layui-col-xs6">
<a href="javascript:;" onclick="layer.tips('不跳转', this, {tips: 3});" class="layadmin-backlog-body">
<h3>待发货</h3>
<p><cite>20</cite></p>
</a>
</li>
</ul>
<ul class="layui-row layui-col-space10">
<li class="layui-col-xs6">
<a href="javascript:;" class="layadmin-backlog-body">
<h3>待审友情链接</h3>
<p><cite style="color: #FF5722;">5</cite></p>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-header">数据概览</div>
<div class="layui-card-body">
<div class="layui-carousel layadmin-carousel layadmin-dataview" data-anim="fade" lay-filter="LAY-index-dataview">
<div carousel-item id="LAY-index-dataview">
<div><i class="layui-icon layui-icon-loading1 layadmin-loading"></i></div>
<div></div>
<div></div>
</div>
</div>
</div>
</div>
<div class="layui-card">
<div class="layui-tab layui-tab-brief layadmin-latestData">
<ul class="layui-tab-title">
<li class="layui-this">今周发帖</li>
<li>今周评论</li>
</ul>
<div class="layui-tab-content">
<div class="layui-tab-item layui-show">
<table id="LAY-index-topSearch"></table>
</div>
<div class="layui-tab-item">
<table id="LAY-index-topCard"></table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="layui-col-md4">
<div class="layui-card">
<div class="layui-card-header">版本信息</div>
<div class="layui-card-body layui-text">
<table class="layui-table">
<colgroup>
<col width="100">
<col>
</colgroup>
<tbody>
<tr>
<td>当前系统</td>
<td>
<script type="text/html" template>
<?php echo php_uname('s'); ?>
</script>
</td>
</tr>
<tr>
<td>当前版本</td>
<td>
<script type="text/html" template>
TaoLer_{$sys.sys_version_num}
<a href="/" target="_blank" style="padding-left: 15px;">更新日志</a>
</script>
</td>
</tr>
<tr>
<td>核心框架</td>
<td>
<script type="text/html" template>
Thinkphp_{:think\\App::VERSION}
</script>
</td>
</tr>
<tr>
<td>PHP版本</td>
<td>
<script type="text/html" template>
PHP_{$Think.PHP_VERSION}
</script>
</td>
</tr>
<tr>
<td>UI框架</td>
<td>
<script type="text/html" template>
Layui-v{{ layui.v }}
</script>
</td>
</tr>
<tr>
<td>运行时间</td>
<td>
<script type="text/html" template>
{$day}天{$hos}时{$mins}分
</script>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="layui-card">
<div class="layui-card-header">效果报告</div>
<div class="layui-card-body layadmin-takerates">
<div class="layui-progress" lay-showPercent="yes">
<h3>转化率(日同比 28% <span class="layui-edge layui-edge-top" lay-tips="增长" lay-offset="-15"></span></h3>
<div class="layui-progress-bar" lay-percent="65%"></div>
</div>
<div class="layui-progress" lay-showPercent="yes">
<h3>签到率(日同比 11% <span class="layui-edge layui-edge-bottom" lay-tips="下降" lay-offset="-15"></span></h3>
<div class="layui-progress-bar" lay-percent="32%"></div>
</div>
</div>
</div>
<div class="layui-card">
<div class="layui-card-header">实时监控</div>
<div class="layui-card-body layadmin-takerates">
<div class="layui-progress" lay-showPercent="yes">
<h3>CPU使用率</h3>
<div class="layui-progress-bar" lay-percent="58%"></div>
</div>
<div class="layui-progress" lay-showPercent="yes">
<h3>内存占用率</h3>
<div class="layui-progress-bar layui-bg-red" lay-percent="90%"></div>
</div>
</div>
</div>
<div class="layui-card">
<div class="layui-card-header">产品动态</div>
<div class="layui-card-body">
<div class="layui-carousel layadmin-carousel layadmin-news" data-autoplay="true" data-anim="fade" lay-filter="news">
<div carousel-item>
<div><a href="/" target="_blank" class="layui-bg-red"> 快速上手文档</a></div>
<div><a href="/" target="_blank" class="layui-bg-green">会员讨论专区</a></div>
<div><a href="/" target="_blank" class="layui-bg-blue">获得官方模板系统</a></div>
</div>
</div>
</div>
</div>
<div class="layui-card">
<div class="layui-card-header">
作者心语
<i class="layui-icon layui-icon-tips" lay-tips="要支持的噢" lay-offset="5"></i>
</div>
<div class="layui-card-body layui-text layadmin-text">
<p>TaoLer采用Thinkphp6.0最新版本为开发框架代码简洁运行高效更新及时。layui是国内比较流行的前端框架两者完美结合您会拥有一个非常让人舒适的网站。</p>
<p>专注专一,大简其道!--本系统的特点,力争做到简洁,不臃肿,功能专一。不管是学习还是商用,都可以良好的运行。</p>
<p>作者尽最大可能,长期进行项目的维护,做到长期可用。</p>
</div>
</div>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'console']);
var indexForums = "{:url('Index/forums')}",
indexReplys = "{:url('Index/replys')}";
</script>
{/block}

View File

@ -0,0 +1,32 @@
{extend name="public:base" /}
{block name="body"}
<div id="LAY_app">
<div class="layui-layout layui-layout-admin">
{include file="public/header,public/side_menu,public/page_tabs" /}
<!-- 主体内容 -->
<div class="layui-body" id="LAY_app_body">
<div class="layadmin-tabsbody-item layui-show">
<iframe src="home.html" frameborder="0" class="layadmin-iframe"></iframe>
</div>
</div>
<!-- 辅助元素,一般用于移动设备下遮罩 -->
<div class="layadmin-body-shade" layadmin-event="shade"></div>
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use('index');
</script>
{/block}

View File

@ -0,0 +1,67 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-keyauth" id="layuiadmin-form-keyauth" style="padding: 20px 30px 0 0;">
<div class="layui-form-item">
<label class="layui-form-label">授权等级</label>
<div class="layui-input-inline">
<select name="auth_level" lay-verify="required">
<option value="0">普通</option>
<option value="1">初级</option>
<option value="2">中级</option>
<option value="3">高级</option>
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">用户</label>
<div class="layui-input-inline">
<input type="text" name="user" lay-verify="required" placeholder="请输入用户" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">域名</label>
<div class="layui-input-inline">
<input type="text" name="domain" lay-verify="required" placeholder="请输入域名" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">到期时间</label>
<div class="layui-input-inline">
<input type="text" name="end_time" id="end-time" lay-verify="required" placeholder="请选择日期" autocomplete="off" class="layui-input" >
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">状态</label>
<div class="layui-input-inline">
<input type="text" name="status" lay-verify="required" placeholder="请设置状态" autocomplete="off" class="layui-input" >
</div>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="LAY-keyauth-submit" id="LAY-keyauth-submit" value="确认">
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form', 'laydate','table'], function(){
var $ = layui.$
,laydate = layui.laydate
,form = layui.form;
//结束时间
laydate.render({
elem: '#end-time'
,btns: ['clear', 'now']
,trigger: 'click'
});
})
</script>
{/block}

View File

@ -0,0 +1,73 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-keyauth" id="layuiadmin-form-keyauth" style="padding: 20px 30px 0 0;">
<div class="layui-form-item">
<label class="layui-form-label">授权等级</label>
<div class="layui-input-inline">
<select name="auth_level" lay-verify="required">
<option {if condition="$keys.auth_level eq 0"} selected {/if} value="0">普通</option>
<option {if condition="$keys.auth_level eq 1"} selected {/if} value="1">初级</option>
<option {if condition="$keys.auth_level eq 2"} selected {/if} value="2">中级</option>
<option {if condition="$keys.auth_level eq 3"} selected {/if} value="3">高级</option>
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">用户</label>
<div class="layui-input-inline">
<input type="text" name="user" lay-verify="required" placeholder="请输入用户" autocomplete="off" class="layui-input" value="{$keys.user}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">域名</label>
<div class="layui-input-inline">
<input type="text" name="domain" lay-verify="required" placeholder="请输入域名" autocomplete="off" class="layui-input" value="{$keys.domain}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">到期时间</label>
<div class="layui-input-inline">
<input type="text" name="end_time" id="end-time" lay-verify="required" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input" value="{$keys.end_time|date='Y-m-d'}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">状态</label>
<div class="layui-input-inline">
<input type="text" name="status" lay-verify="required" placeholder="请设置状态" autocomplete="off" class="layui-input" value="{$keys.status}">
</div>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="LAY-keyauth-submit" id="LAY-keyauth-submit" value="确认">
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index','form','table','laydate'], function(){
var $ = layui.$
,form = layui.form
,table = layui.table
,laydate = layui.laydate;
//结束时间
laydate.render({
elem: '#end-time'
,btns: ['clear', 'now']
,trigger: 'click'
});
})
</script>
{/block}

View File

@ -0,0 +1,212 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-fluid">
<div class="layui-row layui-col-space15">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-header">版本发布</div>
<div class="layui-card-body">
<div class="layui-form" wid100 lay-filter="">
<div class="layui-upload">
<button type="button" class="layui-btn layui-btn-normal" id="version-add">添加</button>
<div class="layui-upload-list">
<table class="layui-table">
<thead>
<tr>
<th>ID</th>
<th>用户</th>
<th>域名</th>
<th>Key</th>
<th>等级</th>
<th>状态</th>
<th>申请时间</th>
<th>到期时间</th>
<th>操作</th>
</tr></thead>
<tbody id="demoList">
{volist name="keys" id="vo"}
<tr>
<th>{$vo.id}</th>
<th>{$vo.user}</th>
<th>{$vo.domain}</th>
<th>{$vo.key}</th>
<th>{$vo.auth_level}</th>
<th>{$vo.status?'正常':'禁用'}</th>
<th>{$vo.create_time|date='Y-m-d'}</th>
<th>{$vo.end_time|date='Y-m-d'}</th>
<th>
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit" id-data="{$vo.id}"><i class="layui-icon layui-icon-edit"></i>编辑</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del" id-data="{$vo.id}"><i class="layui-icon layui-icon-delete"></i>删除</a>
</th>
</tr>
{/volist}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'set']);
</script>
<script>
layui.use(['layer','table','form','laydate'], function(){
var $ = layui.jquery
,layer = layui.layer
,table = layui.table
,form = layui.form
,laydate = layui.laydate;
//添加版本
$('#version-add').on('click', function(){
layer.open({
type: 2,
title: '添加授权',
content: 'add.html',
maxmin: true,
area : ['400px' , '450px'],
btn: ['确定', '取消'],
yes: function(index, layero){
var iframeWindow = window['layui-layer-iframe'+ index]
,submitID = 'LAY-keyauth-submit'
,submit = layero.find('iframe').contents().find('#'+ submitID);
//监听提交
iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
var field = data.field; //获取提交的字段
//提交 Ajax 成功后,静态更新表格中的数据
$.ajax({
type:"post",
url:"{:url('admin/KeyAuth/add')}",
data:{"user":field.user,"domain":field.domain,"auth_level":field.auth_level,"end_time":field.end_time,"status":field.status},
daType:"json",
success:function (data){
if (data.code == 1) {
layer.msg(data.msg,{
icon:6,
time:2000
}, function(){
location.reload();
});
} else {
layer.open({
tiele:'添加失败',
content:data.msg,
icon:5,
anim:6
});
}
}
});
layer.close(index);
});
submit.trigger('click');
}
});
});
//编辑版本
$('a[lay-event=edit]').on('click', function(){
var id = $(this).attr('id-data');
layer.open({
type: 2,
title: '编辑key',
content: 'edit.html?id='+ id,
maxmin: true,
area : ['400px' , '450px'],
btn: ['确定', '取消'],
yes: function(index, layero){
var iframeWindow = window['layui-layer-iframe'+ index]
,submitID = 'LAY-keyauth-submit'
,submit = layero.find('iframe').contents().find('#'+ submitID);
//监听提交
iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
var field = data.field; //获取提交的字段
//提交 Ajax 成功后,静态更新表格中的数据
$.ajax({
type:"post",
url:"{:url('admin/KeyAuth/edit')}",
data:{"id":id,"user":field.user,"domain":field.domain,"auth_level":field.auth_level,"end_time":field.end_time,"status":field.status},
daType:"json",
success:function (data){
if (data.code == 1) {
layer.msg(data.msg,{
icon:6,
time:2000
}, function(){
location.reload();
});
} else {
layer.open({
tiele:'添加失败',
content:data.msg,
icon:5,
anim:6
});
}
}
});
layer.close(index);
});
submit.trigger('click');
}
});
});
//删除授权
$('a[lay-event=del]').on('click', function(){
var id = $(this).attr('id-data');
layer.confirm('确定删除?', {icon: 3, title:'删除版本'}, function(index){
//提交 Ajax 成功后,静态更新表格中的数据
$.ajax({
type:"post",
url:"{:url('admin/KeyAuth/delete')}",
data:{"id":id},
daType:"json",
success:function (data){
if (data.code == 1) {
layer.msg(data.msg,{
icon:6,
time:2000
}, function(){
location.reload();
});
} else {
layer.open({
tiele:'删除失败',
content:data.msg,
icon:5,
anim:6
});
}
}
});
layer.close(index);
});
});
});
</script>
{/block}

View File

@ -0,0 +1,143 @@
{extend name="public/base" /}
{block name="title"}忘记密码 - TaoLer{/block}
{block name="css"}<link rel="stylesheet" href="/static/admin/style/login.css" media="all">{/block}
{block name="body"}
<div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">
<div class="layadmin-user-login-main">
<div class="layadmin-user-login-box layadmin-user-login-header">
<h2>layuiAdmin</h2>
<p>layui 官方出品的单页面后台管理模板系统</p>
</div>
<div class="layadmin-user-login-box layadmin-user-login-body layui-form">
<script type="text/html" template>
{{# if(layui.router().search.type === 'resetpass'){ }}
<div class="layui-form-item">
<label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"></label>
<input type="password" name="password" id="LAY-user-login-password" lay-verify="pass" placeholder="新密码" class="layui-input">
</div>
<div class="layui-form-item">
<label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-repass"></label>
<input type="password" name="repass" id="LAY-user-login-repass" lay-verify="required" placeholder="确认密码" class="layui-input">
</div>
<div class="layui-form-item">
<button class="layui-btn layui-btn-fluid" lay-submit lay-filter="LAY-user-forget-resetpass">重置新密码</button>
</div>
{{# } else { }}
<div class="layui-form-item">
<label class="layadmin-user-login-icon layui-icon layui-icon-cellphone" for="LAY-user-login-cellphone"></label>
<input type="text" name="cellphone" id="LAY-user-login-cellphone" lay-verify="phone" placeholder="请输入注册时的手机号" class="layui-input">
</div>
<div class="layui-form-item">
<div class="layui-row">
<div class="layui-col-xs7">
<label class="layadmin-user-login-icon layui-icon layui-icon-vercode" for="LAY-user-login-vercode"></label>
<input type="text" name="vercode" id="LAY-user-login-vercode" lay-verify="required" placeholder="图形验证码" class="layui-input">
</div>
<div class="layui-col-xs5">
<div style="margin-left: 10px;">
<img src="https://www.oschina.net/action/user/captcha" class="layadmin-user-login-codeimg" id="LAY-user-get-vercode">
</div>
</div>
</div>
</div>
<div class="layui-form-item">
<div class="layui-row">
<div class="layui-col-xs7">
<label class="layadmin-user-login-icon layui-icon layui-icon-vercode" for="LAY-user-login-smscode"></label>
<input type="text" name="vercode" id="LAY-user-login-smscode" lay-verify="required" placeholder="短信验证码" class="layui-input">
</div>
<div class="layui-col-xs5">
<div style="margin-left: 10px;">
<button type="button" class="layui-btn layui-btn-primary layui-btn-fluid" id="LAY-user-getsmscode">获取验证码</button>
</div>
</div>
</div>
</div>
<div class="layui-form-item">
<button class="layui-btn layui-btn-fluid" lay-submit lay-filter="LAY-user-forget-submit">找回密码</button>
</div>
{{# } }}
</script>
</div>
</div>
<div class="layui-trans layadmin-user-login-footer">
<p>© 2018 <a href="http://www.layui.com/" target="_blank">layui.com</a></p>
<p>
<span><a href="http://www.layui.com/admin/#get" target="_blank">获取授权</a></span>
<span><a href="http://www.layui.com/admin/pro/" target="_blank">在线演示</a></span>
<span><a href="http://www.layui.com/admin/" target="_blank">前往官网</a></span>
</p>
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '../../layuiadmin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'user'], function(){
var $ = layui.$
,setter = layui.setter
,admin = layui.admin
,form = layui.form
,router = layui.router();
form.render();
//找回密码下一步
form.on('submit(LAY-user-forget-submit)', function(obj){
var field = obj.field;
//请求接口
admin.req({
url: layui.setter.base + 'json/user/forget.js' //实际使用请改成服务端真实接口
,data: field
,done: function(res){
location.hash = '/type=resetpass';
location.reload();
}
});
return false;
});
//重置密码
form.on('submit(LAY-user-forget-resetpass)', function(obj){
var field = obj.field;
//确认密码
if(field.password !== field.repass){
return layer.msg('两次密码输入不一致');
}
//请求接口
admin.req({
url: layui.setter.base + 'json/user/resetpass.js' //实际使用请改成服务端真实接口
,data: field
,done: function(res){
layer.msg('密码已成功重置', {
offset: '15px'
,icon: 1
,time: 1000
}, function(){
location.href = 'login.html'; //跳转到登入页
});
}
});
return false;
});
});
</script>
{/block}

146
view/admin/login/login.html Normal file
View File

@ -0,0 +1,146 @@
{extend name="public/base" /}
{block name="title"}登入 - TaoLer{/block}
{block name="css"}<link rel="stylesheet" href="/static/admin/style/login.css" media="all">{/block}
{block name="body"}
<div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">
<div class="layadmin-user-login-main">
<div class="layadmin-user-login-box layadmin-user-login-header">
<h2>TaolerAdmin</h2>
<p>TaoLer后台管理系统</p>
</div>
<div class="layadmin-user-login-box layadmin-user-login-body layui-form">
<div class="layui-form-item">
<label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-username"></label>
<input type="text" name="username" id="LAY-user-login-username" lay-verify="required" placeholder="用户名" class="layui-input">
</div>
<div class="layui-form-item">
<label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"></label>
<input type="password" name="password" id="LAY-user-login-password" lay-verify="required" placeholder="密码" class="layui-input">
</div>
<div class="layui-form-item">
<div class="layui-row">
<div class="layui-col-xs7">
<label class="layadmin-user-login-icon layui-icon layui-icon-vercode" for="LAY-user-login-vercode"></label>
<input type="text" name="captcha" id="LAY-user-login-vercode" lay-verify="required" placeholder="图形验证码" class="layui-input">
</div>
<div class="layui-col-xs5">
<div style="margin-left: 10px;">
<img src="{:captcha_src()}" class="layadmin-user-login-codeimg" id="LAY-user-get-vercode" alt="captcha">
</div>
</div>
</div>
</div>
<div class="layui-form-item" style="margin-bottom: 20px;">
<input type="checkbox" name="remember" lay-skin="primary" title="记住密码">
<a href="{:url('admin/login/forget')}" class="layadmin-user-jump-change layadmin-link" style="margin-top: 7px;">忘记密码?</a>
</div>
<div class="layui-form-item">
<button class="layui-btn layui-btn-fluid" lay-submit lay-filter="LAY-user-login-submit" id="LAY-user-login-submit">登 入</button>
</div>
<div class="layui-trans layui-form-item layadmin-user-login-other">
<label>社交账号登入</label>
<a href="javascript:;"><i class="layui-icon layui-icon-login-qq"></i></a>
<a href="javascript:;"><i class="layui-icon layui-icon-login-wechat"></i></a>
<a href="javascript:;"><i class="layui-icon layui-icon-login-weibo"></i></a>
<a href="{:url('admin/login/reg')}" class="layadmin-user-jump-change layadmin-link">注册帐号</a>
</div>
</div>
</div>
<div class="layui-trans layadmin-user-login-footer">
<p>© 2020 <a href="http://www.aieok.com/" target="_blank">aieok.com</a></p>
<!--p>
<span><a href="http://www.layui.com/admin/#get" target="_blank">获取授权</a></span>
<span><a href="http://www.layui.com/admin/pro/" target="_blank">在线演示</a></span>
<span><a href="http://www.layui.com/admin/" target="_blank">前往官网</a></span>
</p-->
</div>
<!--<div class="ladmin-user-login-theme">
<script type="text/html" template>
<ul>
<li data-theme=""><img src="{{ layui.setter.base }}style/res/bg-none.jpg"></li>
<li data-theme="#03152A" style="background-color: #03152A;"></li>
<li data-theme="#2E241B" style="background-color: #2E241B;"></li>
<li data-theme="#50314F" style="background-color: #50314F;"></li>
<li data-theme="#344058" style="background-color: #344058;"></li>
<li data-theme="#20222A" style="background-color: #20222A;"></li>
</ul>
</script>
</div>-->
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'user'], function(){
var $ = layui.$
,setter = layui.setter
,admin = layui.admin
,form = layui.form
,router = layui.router()
,search = router.search;
form.render();
//回车登陆
//$('input').keydown(function(e){
// if(e.key.Code == 13){
//form.on();
// }
//});
//提交
form.on('submit(LAY-user-login-submit)', function(obj){
//请求登入接口
admin.req({
type: "post"
,url: '{:url('login/index')}' //实际使用请改成服务端真实接口
,data: obj.field
,success: function(res){
if(res.code == 0){
/*
//请求成功后,写入 access_token
layui.data(setter.tableName, {
key: setter.request.tokenName
,value: res.data.access_token
});
*/
//登入成功的提示与跳转
layer.msg('登入成功', {
offset: '15px'
,icon: 1
,time: 1000
}, function(){
location.href = "{:url('admin/index/index')}"; //后台主页
});
} else {
layer.open({
tiele:'登陆失败',
content:res.msg,
icon:5,
anim:6
});
layui.jquery('#LAY-user-get-vercode').attr('src', '{:captcha_src()}?'+Math.random());
}
}
});
return false;
});
});
</script>
{/block}

120
view/admin/login/reg.html Normal file
View File

@ -0,0 +1,120 @@
{extend name="public/base" /}
{block name="css"}<link rel="stylesheet" href="/static/admin/style/login.css" media="all">{/block}
{block name="body"}
<div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">
<div class="layadmin-user-login-main">
<div class="layadmin-user-login-box layadmin-user-login-header">
<h2>TaoLer_Admin</h2>
<p>官方出品的单页面后台管理模板系统</p>
</div>
<div class="layadmin-user-login-box layadmin-user-login-body layui-form">
<div class="layui-form-item">
<label class="layadmin-user-login-icon layui-icon layui-icon-cellphone" for="LAY-user-login-cellphone"></label>
<input type="text" name="cellphone" id="LAY-user-login-cellphone" lay-verify="phone" placeholder="手机" class="layui-input">
</div>
<div class="layui-form-item">
<div class="layui-row">
<div class="layui-col-xs7">
<label class="layadmin-user-login-icon layui-icon layui-icon-vercode" for="LAY-user-login-vercode"></label>
<input type="text" name="vercode" id="LAY-user-login-vercode" lay-verify="required" placeholder="验证码" class="layui-input">
</div>
<div class="layui-col-xs5">
<div style="margin-left: 10px;">
<button type="button" class="layui-btn layui-btn-primary layui-btn-fluid" id="LAY-user-getsmscode">获取验证码</button>
</div>
</div>
</div>
</div>
<div class="layui-form-item">
<label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"></label>
<input type="password" name="password" id="LAY-user-login-password" lay-verify="pass" placeholder="密码" class="layui-input">
</div>
<div class="layui-form-item">
<label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-repass"></label>
<input type="password" name="repass" id="LAY-user-login-repass" lay-verify="required" placeholder="确认密码" class="layui-input">
</div>
<div class="layui-form-item">
<label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-nickname"></label>
<input type="text" name="nickname" id="LAY-user-login-nickname" lay-verify="nickname" placeholder="昵称" class="layui-input">
</div>
<div class="layui-form-item">
<input type="checkbox" name="agreement" lay-skin="primary" title="同意用户协议" checked>
</div>
<div class="layui-form-item">
<button class="layui-btn layui-btn-fluid" lay-submit lay-filter="LAY-user-reg-submit">注 册</button>
</div>
<div class="layui-trans layui-form-item layadmin-user-login-other">
<label>社交账号注册</label>
<a href="javascript:;"><i class="layui-icon layui-icon-login-qq"></i></a>
<a href="javascript:;"><i class="layui-icon layui-icon-login-wechat"></i></a>
<a href="javascript:;"><i class="layui-icon layui-icon-login-weibo"></i></a>
<a href="{:url('admin/login/index')}" class="layadmin-user-jump-change layadmin-link layui-hide-xs">用已有帐号登入</a>
<a href="{:url('admin/login/index')}" class="layadmin-user-jump-change layadmin-link layui-hide-sm layui-show-xs-inline-block">登入</a>
</div>
</div>
</div>
<div class="layui-trans layadmin-user-login-footer">
<p>© 2018 <a href="http://www.layui.com/" target="_blank">layui.com</a></p>
<p>
<span><a href="http://www.layui.com/admin/#get" target="_blank">获取授权</a></span>
<span><a href="http://www.layui.com/admin/pro/" target="_blank">在线演示</a></span>
<span><a href="http://www.layui.com/admin/" target="_blank">前往官网</a></span>
</p>
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'user'], function(){
var $ = layui.$
,setter = layui.setter
,admin = layui.admin
,form = layui.form
,router = layui.router();
form.render();
//提交
form.on('submit(LAY-user-reg-submit)', function(obj){
var field = obj.field;
//确认密码
if(field.password !== field.repass){
return layer.msg('两次密码输入不一致');
}
//是否同意用户协议
if(!field.agreement){
return layer.msg('你必须同意用户协议才能注册');
}
//请求接口
admin.req({
url: layui.setter.base + 'json/user/reg.js' //实际使用请改成服务端真实接口
,data: field
,done: function(res){
layer.msg('注册成功', {
offset: '15px'
,icon: 1
,time: 1000
}, function(){
location.hash = '/admin/user/login'; //跳转到登入页
});
}
});
return false;
});
});
</script>
{/block}

View File

@ -0,0 +1,67 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-fluid">
<div class="layui-row layui-col-space15">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body">
<div class="layui-form layui-form-pane">
<div class="layui-tab layui-tab-brief" lay-filter="timeline">
<div class="layui-tab-content" id="LAY_ucm" style="padding: 20px 0;">
<div class="layui-tab-item layui-show">
<div class="layui-row layui-col-space15 layui-form-item">
<div class="layui-col-md3">
<label class="layui-form-label">发送类型</label>
<div class="layui-input-block">
<select lay-verify="required" name="type" lay-filter="type">
<option {if condition="$msg.type eq 0"} selected {/if} value="0">站内通知</option>
</select>
</div>
</div>
<div class="layui-col-md9">
<label for="L_title" class="layui-form-label">标题</label>
<div class="layui-input-block">
<input type="text" id="L_title" name="title" required lay-verify="required" autocomplete="off" class="layui-input" value="{$msg.title}">
</div>
</div>
<div class="layui-form-item layui-form-text">
<div class="layui-input-block">
<textarea id="L_content" name="content" required lay-verify="content" autocomplete="off" class="layui-textarea " >{$msg.content}</textarea>
</div>
</div>
<div class="layui-form-item layui-hide">
<input type="text" name="id" class="layui-input" value="{$msg.id}">
</div>
<div class="layui-form-item layui-hide">
<button type="submit" class="layui-btn" lay-filter="notice-edit" lay-submit id="notice-edit">立即发布</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
var noticeIndex = "{:url('Notice/index')}";
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index','notice'],function(){
var $ = layui.jquery;
});
</script>
{/block}

View File

@ -0,0 +1,130 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-fluid">
<div class="layui-row layui-col-space15">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body">
<div class="layui-form layui-form-pane">
<div class="layui-tab layui-tab-brief" lay-filter="timeline">
<div class="layui-tab-content" id="LAY_ucm" style="padding: 20px 0;">
<div class="layui-tab-item layui-show">
<div class="layui-row layui-col-space15 layui-form-item">
<div class="layui-col-md3">
<label class="layui-form-label">发送类型</label>
<div class="layui-input-block">
<select lay-verify="required" name="type" lay-filter="type">
<option value="0">站内通知</option>
<option value="1">用户通知</option>
</select>
</div>
</div>
<div class="layui-col-md9">
<label for="L_title" class="layui-form-label">标题</label>
<div class="layui-input-block">
<input type="text" id="L_title" name="title" required lay-verify="required" autocomplete="off" class="layui-input" >
</div>
</div>
<div class="layui-form-item layui-form-text">
<div class="layui-input-block">
<textarea id="L_content" name="content" required lay-verify="content" autocomplete="off" class="layui-textarea "></textarea>
</div>
</div>
<div class="layui-form-item">
{if condition="checkRuleButton('admin/notice/add')"}
<button type="submit" class="layui-btn " lay-filter="notice-add" lay-submit id="notice-add">立即发布</button>
{else /}<button type="submit" class="layui-btn layui-btn-disabled">立即发布</button>{/if}
</div>
</div>
</div>
</div>
</div>
</div>
<div class="layui-form-item">
<table id="notice-list" lay-filter="notice-list"></table>
<script type="text/html" id="notice-tool">
{if condition="checkRuleButton('admin/notice/edit')"}
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>
{else /}<a class="layui-btn layui-btn-normal layui-btn-xs layui-btn-disabled"><i class="layui-icon layui-icon-edit"></i>编辑</a>{/if}
{if condition="checkRuleButton('admin/notice/delete')"}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
{else /}<a class="layui-btn layui-btn-danger layui-btn-xs layui-btn-disabled"><i class="layui-icon layui-icon-delete"></i>删除</a>{/if}
</script>
</div>
</div>
</div>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
var noticeIndex = "{:url('Notice/index')}",
noticeAdd = "{:url('Notice/add')}",
noticeDelete = "{:url('Notice/delete')}",
noticeEdit = "{:url('Notice/edit')}";
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index','notice', 'layedit','form' ,'table'],function(){
var $ = layui.jquery
,layedit = layui.layedit
,table = layui.table
,form = layui.form;
/*
form.on('select(type)', function(data){
var tpl = '<div class="layui-col-md12">\
<label for="L_title" class="layui-form-label">收件人</label>\
<div class="layui-input-block">\
<input type="text" id="receve_id" name="receve_id" required lay-verify="required" autocomplete="off" class="layui-input" >\
</div>\
</div>';
//如果选择是用户追加收件人
if(data.value == 1){
$(this).parents('div .layui-col-md3').next('div').after(tpl);
}else{
$(this).parents('div .layui-col-md3').nextAll('div .layui-col-md12').remove();
}
});
//发布通知
form.on('submit(notice-add)', function(data){
var field = data.field;
console.log(field);
$.ajax({
type:"post",
url:"{:url('Notice/add')}",
data:field,
dataType:"json",
success:function (data){
if (data.code == 0) {
layer.msg(data.msg,{
icon:6,
time:2000
});
} else {
layer.open({
content:data.msg,
icon:5,
anim:6
});
}
}
});
table.reload('notice-list'); //数据刷新
return false;
});
*/
});
</script>
{/block}

View File

@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>{block name="title"}TaoLer后台管理模板系统{/block}</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="/static/layui/css/layui.css" media="all">
<link rel="stylesheet" href="/static/admin/style/admin.css" media="all">
{block name="css"}{/block}
</head>
<body {if($Request.url=='/admin/index/index')}class="layui-layout-body"{/if}>
{block name="body"}内容{/block}
<script src="/static/layui/jquery.min.js" charset="utf-8"></script>
<script src="/static/layui/layui.js"></script>
<script type="text/javascript" charset="utf-8">
var AdminLogin = "{:url('Login/index')}",
AdminLogout = "{:url('Admin/logout')}",
adminClearCache = "{:url('Admin/clearCache')}";
//var c = "{:config('app.domain_bind.www')}";
//console.log(c);
</script>
{block name="js"}js文件{/block}
</body>
</html>

View File

@ -0,0 +1,72 @@
<div class="layui-header">
<!-- 头部区域 -->
<ul class="layui-nav layui-layout-left">
<li class="layui-nav-item layadmin-flexible" lay-unselect>
<a href="javascript:;" layadmin-event="flexible" title="侧边伸缩">
<i class="layui-icon layui-icon-shrink-right" id="LAY_app_flexible"></i>
</a>
</li>
<li class="layui-nav-item layui-hide-xs" lay-unselect>
<a href="/" target="_blank" title="前台">
<i class="layui-icon layui-icon-website"></i>
</a>
</li>
<li class="layui-nav-item" lay-unselect>
<a href="javascript:;" layadmin-event="refresh" title="刷新">
<i class="layui-icon layui-icon-refresh-3"></i>
</a>
</li>
<li class="layui-nav-item layui-hide-xs" lay-unselect>
<input type="text" placeholder="搜索..." autocomplete="off" class="layui-input layui-input-search" layadmin-event="serach" lay-action="template/search.html?keywords=">
</li>
</ul>
<ul class="layui-nav layui-layout-right" lay-filter="layadmin-layout-right">
<li class="layui-nav-item" lay-unselect>
<a lay-href="app/message/index.html" layadmin-event="message" lay-text="消息中心">
<i class="layui-icon layui-icon-notice"></i>
<!-- 如果有新消息,则显示小圆点 -->
<span class="layui-badge-dot"></span>
</a>
</li>
<li class="layui-nav-item layui-hide-xs" lay-unselect>
<a href="javascript:;" layadmin-event="theme">
<i class="layui-icon layui-icon-theme"></i>
</a>
</li>
<li class="layui-nav-item layui-hide-xs" lay-unselect>
<a href="javascript:;" layadmin-event="note">
<i class="layui-icon layui-icon-note"></i>
</a>
</li>
<li class="layui-nav-item layui-hide-xs" lay-unselect>
<a href="javascript:;" layadmin-event="fullscreen">
<i class="layui-icon layui-icon-screen-full"></i>
</a>
</li>
<li class="layui-nav-item layui-hide-xs" lay-unselect>
<a href="javascript:;" layadmin-event="clearcache">
<i class="layui-icon layui-icon-refresh"></i>
</a>
</li>
<li class="layui-nav-item" lay-unselect>
<a href="javascript:;">
<cite>{:session('admin_name')}</cite>
</a>
<dl class="layui-nav-child">
<dd><a lay-href="{:url('Admin/info')}">基本资料</a></dd>
<dd><a lay-href="{:url('Admin/repass')}">修改密码</a></dd>
<hr>
<dd layadmin-event="logout" style="text-align: center;"><a>退出</a></dd>
</dl>
</li>
<li class="layui-nav-item layui-hide-xs" lay-unselect>
<a href="javascript:;" layadmin-event=""><i class="layui-icon layui-icon-more-vertical"></i></a>
</li>
<li class="layui-nav-item layui-show-xs-inline-block layui-hide-sm" lay-unselect>
<a href="javascript:;" layadmin-event=""><i class="layui-icon layui-icon-more-vertical"></i></a>
</li>
</ul>
</div>

View File

@ -0,0 +1,22 @@
<!-- 页面标签 -->
<div class="layadmin-pagetabs" id="LAY_app_tabs">
<div class="layui-icon layadmin-tabs-control layui-icon-prev" layadmin-event="leftPage"></div>
<div class="layui-icon layadmin-tabs-control layui-icon-next" layadmin-event="rightPage"></div>
<div class="layui-icon layadmin-tabs-control layui-icon-down">
<ul class="layui-nav layadmin-tabs-select" lay-filter="layadmin-pagetabs-nav">
<li class="layui-nav-item" lay-unselect>
<a href="javascript:;"></a>
<dl class="layui-nav-child layui-anim-fadein">
<dd layadmin-event="closeThisTabs"><a href="javascript:;">关闭当前标签页</a></dd>
<dd layadmin-event="closeOtherTabs"><a href="javascript:;">关闭其它标签页</a></dd>
<dd layadmin-event="closeAllTabs"><a href="javascript:;">关闭全部标签页</a></dd>
</dl>
</li>
</ul>
</div>
<div class="layui-tab" lay-unauto lay-allowClose="true" lay-filter="layadmin-layout-tabs">
<ul class="layui-tab-title" id="LAY_app_tabsheader">
<li lay-id="home/console.html" lay-attr="home/console.html" class="layui-this"><i class="layui-icon layui-icon-home"></i></li>
</ul>
</div>
</div>

View File

@ -0,0 +1,79 @@
<!-- 侧边菜单 -->
<div class="layui-side layui-side-menu">
<div class="layui-side-scroll">
<div class="layui-logo" lay-href="home/console.html">
<span>TaoLer_Admin</span>
</div>
<ul class="layui-nav layui-nav-tree" lay-shrink="all" id="LAY-system-side-menu" lay-filter="layadmin-system-side-menu">
<li data-name="home" class="layui-nav-item layui-nav-itemed">
<a href="javascript:;" lay-tips="主页" lay-direction="2">
<i class="layui-icon layui-icon-home"></i>
<cite>主页</cite>
</a>
<dl class="layui-nav-child">
<dd data-name="console" class="layui-this">
<a lay-href="{:url('index/home')}">控制台</a>
</dd>
</dl>
</li>
<!--li data-name="user" class="layui-nav-item">
<a href="javascript:;" lay-tips="用户" lay-direction="2">
<i class="layui-icon layui-icon-user"></i>
<cite>管理</cite>
</a>
<dl class="layui-nav-child">
<dd>
<a lay-href="{:url('User/list')}">网站用户1</a>
</dd>
<dd>
<a lay-href="{:url('admin/admin/adminList')}">后台管理员</a>
</dd>
<dd>
<a lay-href="{:url('admin/authgroup/role')}">角色管理</a>
</dd>
<dd>
<a lay-href="{:url('admin/authrule/index')}">权限管理</a>
</dd>
</dl>
</li-->
{volist name="menu" id="vo1"}
{if condition="isset($vo1['children'])"}
<li data-name="set" class="layui-nav-item">
<a href="javascript:;" lay-tips="{$vo1.title}" lay-direction="2">
<i class="layui-icon {$vo1.icon}"></i>
<cite>{$vo1.title}</cite>
</a>
<dl class="layui-nav-child">
{volist name="vo1['children']" id="vo2"}
{if condition="isset($vo2['children'])"}
<dd class="layui-nav-itemed">
<a href="javascript:;">{$vo2.title}</a>
<dl class="layui-nav-child">
{volist name="vo2['children']" id="vo3"}
<dd><a lay-href="{:url($vo3.name)}">{$vo3.title}</a></dd>
{/volist}
</dl>
</dd>
{else /}
<dd><a lay-href="{:url($vo2.name)}">{$vo2.title}</a></dd>
{/if}
{/volist}
</dl>
</li>
{else /}
<li data-name="get" class="layui-nav-item">
<a href="javascript:;" lay-href="{:url($vo1.name)}" lay-tips="{$vo1.title}" lay-direction="2">
<i class="layui-icon {$vo1.icon}"></i>
<cite>{$vo1.title}</cite>
</a>
</li>
{/if}
{/volist}
</ul>
</div>
</div>

View File

@ -0,0 +1,66 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-fluid">
<div class="layui-row layui-col-space15">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-header">邮件服务</div>
<div class="layui-card-body">
<div class="layui-form" wid100 lay-filter="">
<div class="layui-form-item">
<label class="layui-form-label">SMTP服务器</label>
<div class="layui-input-inline">
<input type="text" name="host" value="{$mailserver.host}" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">smtp.163.com</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">SMTP端口号</label>
<div class="layui-input-inline" style="width: 80px;">
<input type="text" name="port" lay-verify="number" value="{$mailserver.port}" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">一般为 25 或 465</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">发件人邮箱</label>
<div class="layui-input-inline">
<input type="text" name="mail" value="{$mailserver.mail}" lay-verify="email" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">发件人昵称</label>
<div class="layui-input-inline">
<input type="text" name="nickname" value="{$mailserver.nickname}" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">邮箱登入密码</label>
<div class="layui-input-inline">
<input type="password" name="password" value="{$mailserver.password}" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
<button class="layui-btn" lay-submit lay-filter="set_system_email">确认保存</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'set']);
</script>
{/block}

View File

@ -0,0 +1,190 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-fluid" id="component-tabs">
<div class="layui-row">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body">
<div class="layui-tab layui-tab-brief" lay-filter="server-tabs-brief">
<ul class="layui-tab-title">
<li class="layui-this" lay-id="score">积分设置</li>
<li lay-id="vip">用户等级</li>
</ul>
<div class="layui-tab-content">
<div class="layui-tab-item layui-show">
<div class="layui-tab-content" style="padding: 20px 0;">
<div class="layui-form layui-card-header layuiadmin-card-header-auto">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">连续签到</label>
<div class="layui-input-inline">
<select name="days">
<option value="1">1天</option>
<option value="2">2天</option>
<option value="3">3天</option>
<option value="5">5天</option>
<option value="7">7天</option>
<option value="10">10天</option>
<option value="20">20天</option>
<option value="100">100天</option>
<option value="365">365天</option>
</select>
</div>
<div class="layui-input-inline">
<input type="tel" name="score" lay-verify="required" placeholder="获得积分" autocomplete="off" class="layui-input">
</div>
<div class="layui-input-inline">
{if condition="checkRuleButton('admin/Sign/add')"}
<input type="submit" class="layui-btn" lay-submit lay-filter="sign-rule-submit" id="sign-rule-submit" value="立即提交">
{else /}<input type="submit" class="layui-btn layui-btn-disabled" value="立即提交">{/if}
</div>
</div>
</div>
<div class="layui-form-item">
<table id="sign-rule" lay-filter="sign-rule"></table>
<script type="text/html" id="sign-rule-button">
{if condition="checkRuleButton('admin/Sin/edit')"}
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>
{else /}<a class="layui-btn layui-btn-normal layui-btn-xs layui-btn-disabled"><i class="layui-icon layui-icon-edit"></i>编辑</a>{/if}
{if condition="checkRuleButton('admin/Sign/delete')"}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
{else /}<a class="layui-btn layui-btn-danger layui-btn-xs layui-btn-disabled"><i class="layui-icon layui-icon-delete"></i>删除</a>{/if}
</script>
</div>
</div>
</div>
</div>
<div class="layui-tab-item">
<div class="layui-tab-content" style="padding: 20px 0;">
<div class="layui-form layui-card-header layuiadmin-card-header-auto">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">用户积分</label>
<div class="layui-input-inline" style="width: 120px;">
<select name="vip">
<option value="0">普通</option>
<option value="1">VIP1</option>
<option value="2">VIP2</option>
<option value="3">VIP3</option>
<option value="4">VIP4</option>
<option value="5">VIP5</option>
</select>
</div>
<div class="layui-input-inline">
<input type="tel" name="score" lay-verify="required" placeholder="积分区间:0-99" autocomplete="off" class="layui-input">
</div>
<div class="layui-input-inline">
{if condition="checkRuleButton('admin/Vip/add')"}
<input type="submit" class="layui-btn" lay-submit lay-filter="vip-rule-submit" id="vip-rule-submit" value="立即提交">
{else /}<input type="submit" class="layui-btn layui-btn-disabled" value="立即提交">{/if}
</div>
</div>
</div>
<div class="layui-form-item">
<table id="vip-rule" lay-filter="vip-rule"></table>
<script type="text/html" id="vip-rule-button">
{if condition="checkRuleButton('admin/Vip/vipEdit')"}
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>
{else /}<a class="layui-btn layui-btn-normal layui-btn-xs layui-btn-disabled"><i class="layui-icon layui-icon-edit"></i>编辑</a>{/if}
{if condition="checkRuleButton('admin/Vip/delete')"}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"><i class="layui-icon layui-icon-delete"></i>删除</a>
{else /}<a class="layui-btn layui-btn-danger layui-btn-xs layui-btn-disabled"><i class="layui-icon layui-icon-delete"></i>删除</a>{/if}
</script>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
var signSignRule ="{:url('Sign/signRule')}";
var signDelete ="{:url('Sign/delete')}";
var signSignEdit ="{:url('Sign/signEdit')}";
var vipRule ="{:url('Vip/vipRule')}";
var vipDelete ="{:url('Vip/delete')}";
var vipEdit ="{:url('Vip/vipEdit')}";
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'element','table', 'webset', 'form'], function(){
var $ = layui.$
,element = layui.element
,table = layui.table
,form = layui.form;
//添加签到规则
form.on('submit(sign-rule-submit)',function(data){
var field = data.field;
$.ajax({
type:"post",
url:"{:url('admin/Sign/add')}",
data:field,
daType:"json",
success:function (data){
if (data.code == 0) {
layer.msg(data.msg,{
icon:6,
time:2000
}, function(){
table.reload('sign-rule'); //数据刷新
});
} else {
layer.open({
tiele:'添加失败',
content:data.msg,
icon:5,
anim:6
});
}
}
});
return false;
});
//添加VIP规则
form.on('submit(vip-rule-submit)',function(data){
var field = data.field;
$.ajax({
type:"post",
url:"{:url('admin/Vip/add')}",
data:field,
daType:"json",
success:function (data){
if (data.code == 0) {
layer.msg(data.msg,{
icon:6,
time:2000
}, function(){
table.reload('vip-rule'); //数据刷新
});
} else {
layer.open({
tiele:'添加失败',
content:data.msg,
icon:5,
anim:6
});
}
}
});
return false;
});
});
</script>
{/block}

View File

@ -0,0 +1,38 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin" style="padding: 20px 30px 0 0;">
<div class="layui-form-item layui-hide">
<input type="text" name="id" class="layui-input" value="{$sign.id}">
</div>
<div class="layui-form-item">
<label class="layui-form-label">签到天数</label>
<div class="layui-input-inline">
<input type="text" name="days" disabled lay-verify="required" placeholder="请输入天数" autocomplete="off" class="layui-input layui-disabled" value="{$sign.days}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">获得积分</label>
<div class="layui-input-inline">
<input type="text" name="score" lay-verify="required" placeholder="请输入号码" autocomplete="off" class="layui-input" value="{$sign.score}">
</div>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="LAY-user-sign-submit" id="LAY-user-sign-submit" value="确认">
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form'], function(){
var $ = layui.$
,form = layui.form;
})
</script>
{/block}

View File

@ -0,0 +1,54 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin" style="padding: 20px 30px 0 0;">
<div class="layui-form-item layui-hide">
<input type="text" name="id" class="layui-input" value="{$vip.id}">
</div>
<div class="layui-form-item">
<label class="layui-form-label">Vip级别</label>
<div class="layui-input-inline" >
<select name="vip">
{volist name="level" id="vo"}
<option {if condition="$vip.vip eq $vo"} selected {/if} value="{$vo}">{if condition="$vo eq 0"}普通{else /}VIP{$vo}{/if}</option>
{/volist}
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">积分区间</label>
<div class="layui-input-inline">
<input type="text" name="score" lay-verify="required" placeholder="积分区间:0-99" autocomplete="off" class="layui-input" value="{$vip.score}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">认证</label>
<div class="layui-input-inline">
<input type="text" name="nick" lay-verify="required" placeholder="等级昵称" autocomplete="off" class="layui-input" value="{$vip.nick}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">权限</label>
<div class="layui-input-inline">
<input type="text" name="rules" lay-verify="" placeholder="请选择" autocomplete="off" class="layui-input" value="{$vip.rules}">
</div>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="LAY-user-vip-submit" id="LAY-user-vip-submit" value="确认">
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form'], function(){
var $ = layui.$
,form = layui.form;
})
</script>
{/block}

View File

@ -0,0 +1,204 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-fluid" id="component-tabs">
<div class="layui-row">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body">
<div class="layui-tab layui-tab-brief" lay-filter="component-tabs-brief">
<ul class="layui-tab-title">
<li class="layui-this" lay-id="website">网站设置</li>
<li lay-id="email">邮箱服务</li>
</ul>
<div class="layui-tab-content">
<div class="layui-tab-item layui-show">
<div class="layui-form" wid100 lay-filter="">
<div class="layui-form-item">
<label class="layui-form-label">网站名称</label>
<div class="layui-input-block">
<input type="text" name="webname" value="{$sysInfo.webname}" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">网站域名</label>
<div class="layui-input-block">
<input type="text" name="domain" lay-verify="url" value="{$sysInfo.domain}" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">LOGO</label>
<div class="layui-input-block">
<span><img src="{$sysInfo.logo}" hight="40" width="50" ></span>
{if condition="checkRuleButton('admin/set/upload')"}
<button type="button" class="layui-btn layui-btn-normal" id="logo-img">选择文件</button>
<button type="button" class="layui-btn" id="logo-upload-button">开始上传</button>
{else /}<button type="button" class="layui-btn layui-btn-normal layui-btn-disabled">选择文件</button>{/if}
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">缓存时间</label>
<div class="layui-input-inline" style="width: 80px;">
<input type="text" name="cache" lay-verify="number" value="{$sysInfo.cache}" class="layui-input">
</div>
<div class="layui-input-inline layui-input-company">分钟</div>
<div class="layui-form-mid layui-word-aux">本地开发一般推荐设置为 0线上环境建议设置为 10。</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">最大文件上传</label>
<div class="layui-input-inline" style="width: 80px;">
<input type="text" name="upsize" lay-verify="number" value="{$sysInfo.upsize}" class="layui-input">
</div>
<div class="layui-input-inline layui-input-company">KB</div>
<div class="layui-form-mid layui-word-aux">提示1 M = 1024 KB</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">上传文件类型</label>
<div class="layui-input-block">
<input type="text" name="uptype" value="{$sysInfo.uptype}r" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">禁止注册名</label>
<div class="layui-input-block">
<input type="text" name="blackname" value="{$sysInfo.blackname}" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">首页标题</label>
<div class="layui-input-block">
<input type="text" name="webtitle" value="{$sysInfo.webtitle}" class="layui-input">
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">META关键词</label>
<div class="layui-input-block">
<textarea name="keywords" class="layui-textarea" placeholder="多个关键词在英文状态下用,分开">{$sysInfo.keywords}</textarea>
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">META描述</label>
<div class="layui-input-block">
<textarea name="descript" class="layui-textarea">{$sysInfo.descript}</textarea>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">版权信息</label>
<div class="layui-input-inline" style="width: 500px;">
<input type="text" name="copyright" {if condition="$syscy == '0'"}disabled{/if} value="{$sysInfo.copyright}" class="layui-input {if condition="$syscy == '0'"}layui-disabled{/if}">
</div>
<div class="layui-input-inline layui-input-company">提示:</div>
<div class="layui-form-mid layui-word-aux">未经授权用户,可不限制功能使用,但严禁私自改写版权脚本。一旦发现,永远禁止升级并追诉相关责任。</div>
<div class="layui-form-mid layui-word-aux"></div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
{if condition="checkRuleButton('admin/Set/website')"}
<button class="layui-btn" lay-submit lay-filter="set_website">确认保存</button>
{else /}<button class="layui-btn layui-btn-disabled">确认保存</button>{/if}
</div>
</div>
</div>
</div>
<div class="layui-tab-item">
<div class="layui-form" wid100 lay-filter="">
<div class="layui-form-item">
<label class="layui-form-label">SMTP服务器</label>
<div class="layui-input-inline">
<input type="text" name="host" value="{$mailserver.host}" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">smtp.163.com</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">SMTP端口号</label>
<div class="layui-input-inline" style="width: 80px;">
<input type="text" name="port" lay-verify="number" value="{$mailserver.port}" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">一般为 25 或 465</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">发件人邮箱</label>
<div class="layui-input-inline">
<input type="text" name="mail" value="{$mailserver.mail}" lay-verify="email" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">发件人昵称</label>
<div class="layui-input-inline">
<input type="text" name="nickname" value="{$mailserver.nickname}" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">邮箱登入密码</label>
<div class="layui-input-inline">
<input type="password" name="password" value="{$mailserver.password}" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
{if condition="checkRuleButton('admin/Set/email')"}
<button class="layui-btn" lay-submit lay-filter="set_system_email">确认保存</button>
{else /}<button class="layui-btn layui-btn-disabled">确认保存</button>{/if}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
var setWebSite ="{:url('Set/website')}";
var setEmail ="{:url('Set/email')}";
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'set', 'element', 'upload'], function(){
var $ = layui.$
,element = layui.element
,table = layui.table
,form = layui.form
,upload = layui.upload;
//选完文件后不自动上传
upload.render({
elem: '#logo-img'
,url: '{:url('admin/set/upload')}'
,auto: false
,exts: 'jpg|png|gif|bmp|jpeg'
,size: 1000
//,multiple: true
,bindAction: '#logo-upload-button'
,done: function(res){
if(res.code == 0){
layer.msg(res.msg,{
icon:6,
tiye:2000
},function(){
location.reload();
});
} else {
layer.open({
title:"上传失败",
content:res.msg,
icon:5,
anim:6
});
}
}
});
});
</script>
{/block}

View File

@ -0,0 +1,101 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-fluid">
<div class="layui-row layui-col-space15">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-header">设置我的资料</div>
<div class="layui-card-body" pad15>
<div class="layui-form" lay-filter="">
<div class="layui-form-item layui-hide">
<input type="text" name="id" class="layui-input" value="{$admin.id}">
</div>
<div class="layui-form-item">
<label class="layui-form-label">我的角色</label>
<div class="layui-input-inline">
<input type="text" name="auth_group_id" value="{$admin.authGroup.title}" readonly class="layui-input layui-disabled" disabled>
</div>
<div class="layui-form-mid layui-word-aux">当前角色不可更改为其它角色</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">用户名</label>
<div class="layui-input-inline">
<input type="text" name="username" value="{$admin.username}" readonly class="layui-input layui-disabled">
</div>
<div class="layui-form-mid layui-word-aux">不可修改。一般用于后台登入名</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">昵称</label>
<div class="layui-input-inline">
<input type="text" name="nickname" value="{$admin.nickname}" lay-verify="nickname" autocomplete="off" placeholder="请输入昵称" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">性别</label>
<div class="layui-input-block">
<input type="radio" name="sex" value="0" {if condition="$admin['sex'] eq 0"} checked {/if} title="男">
<input type="radio" name="sex" value="1" {if condition="$admin['sex'] eq 1"} checked {/if} title="女">
</div>
</div>
<!--div class="layui-form-item">
<label class="layui-form-label">头像</label>
<div class="layui-input-inline">
<input name="avatar" lay-verify="required" id="LAY_avatarSrc" placeholder="图片地址" value="http://cdn.layui.com/avatar/168.jpg" class="layui-input">
</div>
<div class="layui-input-inline layui-btn-container" style="width: auto;">
<button type="button" class="layui-btn layui-btn-primary" id="LAY_avatarUpload">
<i class="layui-icon">&#xe67c;</i>上传图片
</button>
<button class="layui-btn layui-btn-primary" layadmin-event="avartatPreview">查看图片</button >
</div>
</div-->
<div class="layui-form-item">
<label class="layui-form-label">手机</label>
<div class="layui-input-inline">
<input type="text" name="mobile" value="{$admin.mobile}" lay-verify="phone" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">邮箱</label>
<div class="layui-input-inline">
<input type="text" name="email" value="{$admin.email}" lay-verify="email" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">备注</label>
<div class="layui-input-block">
<textarea name="remarks" placeholder="请输入内容" class="layui-textarea">{$admin.remarks}</textarea>
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
{if condition="checkRuleButton('admin/Admin/infoSet')"}
<button class="layui-btn" lay-submit lay-filter="setmyinfo">确认修改</button>
{else /}
<button class="layui-btn layui-btn-disabled">确认修改</button>
{/if}
<!--button type="reset" class="layui-btn layui-btn-primary">重新填写</button-->
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
var adminInfoSet ="{:url('Admin/infoSet')}";
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'set']);
</script>
{/block}

View File

@ -0,0 +1,58 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-fluid">
<div class="layui-row layui-col-space15">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-header">修改密码</div>
<div class="layui-card-body" pad15>
<div class="layui-form" lay-filter="">
<div class="layui-form-item">
<label class="layui-form-label">当前密码</label>
<div class="layui-input-inline">
<input type="password" name="oldPassword" lay-verify="required" lay-verType="tips" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">新密码</label>
<div class="layui-input-inline">
<input type="password" name="password" lay-verify="pass" lay-verType="tips" autocomplete="off" id="LAY_password" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">6到16个字符</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">确认新密码</label>
<div class="layui-input-inline">
<input type="password" name="repassword" lay-verify="repass" lay-verType="tips" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<div class="layui-input-block">
{if condition="checkRuleButton('admin/Admin/repassSet')"}
<button class="layui-btn" lay-submit lay-filter="setmypass">确认修改</button>
{else /}
<button class="layui-btn layui-btn-disabled">确认修改</button>
{/if}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
var adminRepassSet ="{:url('Admin/repassSet')}";
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'set']);
</script>
{/block}

120
view/admin/slider/add.html Normal file
View File

@ -0,0 +1,120 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-slider" id="layuiadmin-form-slider" style="padding: 20px 30px 0 0;">
<div class="layui-form-item">
<label class="layui-form-label">位置</label>
<div class="layui-input-inline">
<select name="slid_type" lay-verify="required">
<option value="">请选择广告位置</option>
<option value="1">1首页幻灯 - 1126x410</option>
<option value="2">2通用右底</option>
<option value="3">3首页赞助</option>
<option value="4">4文章赞助</option>
<option value="5">5分类赞助</option>
<option value="6">6友情链接</option>
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">名称</label>
<div class="layui-input-inline">
<input type="text" name="slid_name" lay-verify="required" placeholder="请输入名称" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">广告块底色</label>
<div class="layui-input-inline">
<input type="text" name="slid_color" lay-verify="" placeholder="位置3,4,5可选底色" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">开始</label>
<div class="layui-input-inline">
<input type="text" name="slid_start" id="start-time" lay-verify="required" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">结束</label>
<div class="layui-input-inline">
<input type="text" name="slid_over" id="over-time" lay-verify="required" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">链接</label>
<div class="layui-input-inline">
<input type="text" name="slid_href" lay-verify="required" placeholder="输入完整连接" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">图片</label>
<div class="layui-input-inline">
<input type="text" name="slid_img" lay-verify="" placeholder="位置1,2需上传图片" autocomplete="off" class="layui-input" >
</div>
<button style="float: left;" type="button" class="layui-btn" id="layuiadmin-upload-slid-img">上传图片</button>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="LAY-slider-submit" id="LAY-slider-submit" value="确认">
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form', 'upload','laydate','table'], function(){
var $ = layui.$
,table = layui.table
,form = layui.form
,laydate = layui.laydate
,upload = layui.upload ;
//开始时间
laydate.render({
elem: '#start-time'
,btns: ['clear', 'now']
,trigger: 'click'
});
//结束时间
laydate.render({
elem: '#over-time'
,btns: ['clear', 'now']
,trigger: 'click'
});
upload.render({
elem: '#layuiadmin-upload-slid-img'
,url: 'uploadImg'
,accept: 'images'
,method: 'get'
,acceptMime: 'image/*'
,done: function(res){
//console.log(res)
$(this.item).prev("div").children("input").val(res.src)
if(res.code == 0){
layer.msg(res.msg,{
icon:6,
tiye:2000
});
} else {
layer.open({
title:"上传失败",
content:res.msg,
icon:5,
anim:6
});
}
}
});
})
</script>
{/block}

119
view/admin/slider/edit.html Normal file
View File

@ -0,0 +1,119 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-slider" id="layuiadmin-form-slider" style="padding: 20px 0 0 0;">
<div class="layui-form-item">
<label class="layui-form-label">位置</label>
<div class="layui-input-inline">
<select name="slid_type" lay-verify="required">
<option {if condition="$slider.slid_type eq 1"} selected {/if} value="1">1首页幻灯</option>
<option {if condition="$slider.slid_type eq 2"} selected {/if} value="2">2通用右底</option>
<option {if condition="$slider.slid_type eq 3"} selected {/if} value="3">3首页赞助</option>
<option {if condition="$slider.slid_type eq 4"} selected {/if} value="4">4文章赞助</option>
<option {if condition="$slider.slid_type eq 5"} selected {/if} value="5">5分类赞助</option>
<option {if condition="$slider.slid_type eq 6"} selected {/if} value="6">6友情链接</option>
</select>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">名称</label>
<div class="layui-input-inline">
<input type="text" name="slid_name" lay-verify="required" placeholder="请输入名称" autocomplete="off" class="layui-input" value="{$slider.slid_name}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">广告块底色</label>
<div class="layui-input-inline">
<input type="text" name="slid_color" lay-verify="" placeholder="位置3,4,5可选底色" autocomplete="off" class="layui-input" value="{$slider.slid_color}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">开始</label>
<div class="layui-input-inline">
<input type="text" name="slid_start" id="start-time" lay-verify="required" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input" value="{$slider.slid_start|date='Y-m-d'}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">结束</label>
<div class="layui-input-inline">
<input type="text" name="slid_over" id="over-time" lay-verify="required" placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input" value="{$slider.slid_over|date='Y-m-d'}" >
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">链接</label>
<div class="layui-input-inline">
<input type="text" name="slid_href" lay-verify="required" placeholder="输入连接" autocomplete="off" class="layui-input" value="{$slider.slid_href}" >
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">图片</label>
<div class="layui-input-inline">
<input type="text" name="slid_img" lay-verify="" placeholder="置1,2需上传图片上传图片" autocomplete="off" class="layui-input" value="{$slider.slid_img}">
</div>
<button style="float: left;" type="button" class="layui-btn" dataid="{$slider.id}" id="layuiadmin-upload-slid-img">上传图片</button>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="LAY-slider-submit" id="LAY-slider-submit" value="确认">
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form', 'upload','laydate','table'], function(){
var $ = layui.$
,table = layui.table
,form = layui.form
,laydate = layui.laydate
,upload = layui.upload ;
//开始时间
laydate.render({
elem: '#start-time'
,btns: ['clear', 'now']
,trigger: 'click'
});
//结束时间
laydate.render({
elem: '#over-time'
,btns: ['clear', 'now']
,trigger: 'click'
});
upload.render({
//var id = $('.layui-btn').(this).attr('dataid');
elem: '#layuiadmin-upload-slid-img'
,url: 'uploadImg'
,accept: 'images'
,method: 'get'
,acceptMime: 'image/*'
,done: function(res){
$(this.item).prev("div").children("input").val(res.src)
if(res.code == 0){
layer.msg(res.msg,{
icon:6,
tiye:2000
});
} else {
layer.open({
title:"上传失败",
content:res.msg,
icon:5,
anim:6
});
}
}
});
})
</script>
{/block}

View File

@ -0,0 +1,218 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-fluid">
<div class="layui-row layui-col-space15">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-header">首页幻灯</div>
<div class="layui-card-body">
<div class="layui-form" wid100 lay-filter="">
<div class="layui-upload">
<button type="button" class="layui-btn layui-btn-normal" id="slid-add">添加</button>
<div class="layui-upload-list">
<table class="layui-table">
<thead>
<tr>
<th>ID</th>
<th>名称</th>
<th>图片</th>
<th>位置</th>
<th>路径</th>
<th>颜色</th>
<th>开始</th>
<th>结束</th>
<th>状态</th>
<th>操作</th>
</tr></thead>
<tbody id="demoList">
{volist name="slider" id="vo"}
<tr>
<th>{$vo.id}</th>
<th>{$vo.slid_name}</th>
<th>{if condition="$vo.slid_img != ''"}<img src="{$vo.slid_img}" height="40" width="80" />{/if}</th>
<th>{$vo.slid_type}</th>
<th><a href="{$vo.slid_href}" target="_blank">{$vo.slid_href}</a></th>
<th>{$vo.slid_color}</th>
<th>{$vo.slid_start|date='Y-m-d'}</th>
<th>{$vo.slid_over|date='Y-m-d'}</th>
<th>{$vo.slid_status ?'显示':'禁止'}</th>
<th>
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit" id-data="{$vo.id}"><i class="layui-icon layui-icon-edit"></i>编辑</a>
{if condition="checkRuleButton('admin/Slider/delete')"}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del" id-data="{$vo.id}"><i class="layui-icon layui-icon-delete"></i>删除</a>
{else /}<a class="layui-btn layui-btn-disabled layui-btn-danger layui-btn-xs"><i class="layui-icon layui-icon-delete"></i>删除</a>{/if}
</th>
</tr>
{/volist}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'set']);
</script>
<script>
layui.use(['layer','table','form','upload','laydate'], function(){
var $ = layui.jquery
,layer = layui.layer
,table = layui.table
,form = layui.form
,laydate = layui.laydate
,upload = layui.upload;
//添加幻灯
$('#slid-add').on('click', function(){
layer.open({
type: 2,
title: '添加广告',
content: 'add.html',
maxmin: true,
area : ['500px' , '450px'],
btn: ['确定', '取消'],
yes: function(index, layero){
var iframeWindow = window['layui-layer-iframe'+ index]
,submitID = 'LAY-slider-submit'
,submit = layero.find('iframe').contents().find('#'+ submitID);
//监听提交
iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
var field = data.field; //获取提交的字段
//console.log(field);
//提交 Ajax 成功后,静态更新表格中的数据
$.ajax({
type:"post",
url:"{:url('admin/slider/add')}",
data:{"slid_type":field.slid_type,"slid_name":field.slid_name,"slid_color":field.slid_color,"slid_start":field.slid_start,"slid_over":field.slid_over,"slid_href":field.slid_href,"slid_img":field.slid_img},
daType:"json",
success:function (data){
if (data.code == 1) {
layer.msg(data.msg,{
icon:6,
time:2000
}, function(){
location.reload();
});
} else {
layer.open({
tiele:'添加失败',
content:data.msg,
icon:5,
anim:6
});
}
}
});
layer.close(index);
});
submit.trigger('click');
}
});
});
//编辑广告
$('a[lay-event=edit]').on('click', function(){
var id = $(this).attr('id-data');
layer.open({
type: 2,
title: '编辑幻灯',
content: 'edit.html?id='+ id,
maxmin: true,
area : ['500px' , '450px'],
btn: ['确定', '取消'],
yes: function(index, layero){
var iframeWindow = window['layui-layer-iframe'+ index]
,submitID = 'LAY-slider-submit'
,submit = layero.find('iframe').contents().find('#'+ submitID);
//监听提交
iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
var field = data.field; //获取提交的字段
//console.log(field);
//提交 Ajax 成功后,静态更新表格中的数据
$.ajax({
type:"post",
url:"{:url('admin/slider/edit')}",
data:{"id":id,"slid_type":field.slid_type,"slid_name":field.slid_name,"slid_color":field.slid_color,"slid_start":field.slid_start,"slid_over":field.slid_over,"slid_href":field.slid_href,"slid_img":field.slid_img},
daType:"json",
success:function (data){
if (data.code == 1) {
layer.msg(data.msg,{
icon:6,
time:2000
}, function(){
location.reload();
});
} else {
layer.open({
tiele:'添加失败',
content:data.msg,
icon:5,
anim:6
});
}
}
});
layer.close(index);
});
submit.trigger('click');
}
});
});
//删除幻灯
$('a[lay-event=del]').on('click', function(){
var id = $(this).attr('id-data');
layer.confirm('确定删除?', {icon: 3, title:'删除幻灯'}, function(index){
//提交 Ajax 成功后,静态更新表格中的数据
$.ajax({
type:"post",
url:"{:url('admin/slider/delete')}",
data:{"id":id},
daType:"json",
success:function (data){
if (data.code == 1) {
layer.msg(data.msg,{
icon:6,
time:2000
}, function(){
location.reload();
});
} else {
layer.open({
tiele:'删除失败',
content:data.msg,
icon:5,
anim:6
});
}
}
});
layer.close(index);
});
});
});
</script>
{/block}

View File

@ -0,0 +1,278 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-fluid">
<div class="layui-row layui-col-space15">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-header">升级服务</div>
<div class="layui-card-body">
<div class="layui-form" wid100 lay-filter="">
{if ($ver_num.key == '')}
<div class="layui-form-item">
<label class="layui-form-label">配置Key</label>
<div class="layui-input-inline">
<input type="text" name="key" value="{$ver_num.key}" required class="layui-input" placeholder="填写申请得到在Key">
</div>
<div class="layui-input-inline layui-input-company"><button style="float: left;" type="button" class="layui-btn layui-btn-sm" id="upgrade-key">保存</button></div>
<div class="layui-form-mid layui-word-aux" >无Key不能升级</div>
<div class="layui-form-mid layui-word-aux " ><a href="http://www.aieok.com" target="_blank">去官网申请Key</a></div>
</div>
{else /}
<div class="layui-form-item">
<label class="layui-form-label">升级Key</label>
<div class="layui-form-item layui-hide">
<input type="text" name="key" value="{$ver_num.key}" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux " ><span style="color:red">{$ver_num.key}</span></div>
<div class="layui-input-inline layui-input-company">
{if condition="checkRuleButton('admin/Upgrade/keyedit')"}
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit" id-data="{:url('upgrade/keyedit')}" ><i class="layui-icon layui-icon-edit"></i>修改?</a>
{else /}<a class="layui-btn layui-btn-normal layui-btn-xs layui-btn-disabled" ><i class="layui-icon layui-icon-edit"></i>修改?</a>{/if}
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">在线升级</label>
<div class="layui-input-inline layui-input-company" id="ver_nums" >当前版本Taole v_{$ver_num.sys_version_num}</div>
<div class="layui-upload">
{if condition="checkRuleButton('admin/Upgrade/check')"}
<button type="button" class="layui-btn layui-btn-sm" data-url="{$ver_num.upcheck_url}" id="upload-check">检查更新</button>
{else /}<button type="button" class="layui-btn layui-btn-sm layui-btn-disabled">检查更新</button>{/if}
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">手动更新</label>
<div class="layui-upload">
{if condition="checkRuleButton('admin/Upgrade/uploadzip')"}
<button type="button" class="layui-btn layui-btn-sm" id="select-file">选择文件</button>
<button type="button" class="layui-btn layui-btn-sm" id="upgrade-sys-button">开始升级</button>
{else /}<button type="button" class="layui-btn layui-btn-sm layui-btn-disabled">无权限</button>{/if}
</div>
</div>
{/if}
<div style="margin-top: 10px;">
<div class="layui-form-item">
<div class="layui-card-header">升级说明</div>
<div style="padding-left: 20px;">1.升级服务需要去官网申请key配置文件</div>
<div style="padding-left: 20px;">2.多个版本需要升级时,会自行判断依次序升级</div>
<div style="padding-left: 20px;">3.升级过程尽管会自动备份文件,但为了安全起见可以自行备份文件</div>
<div style="padding-left: 20px;">4.在某些特殊场合,可能需要手动升级</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'set']);
</script>
<script>
layui.use(['layer','form','upload'], function(){
var $ = layui.jquery
,layer = layui.layer
,form = layui.form
,upload = layui.upload;
//手动更新,选完文件后不自动上传
upload.render({
elem: '#select-file'
,url: '/admin/upgrade/uploadzip'
,accept: 'file'
,field: 'file'
,auto: false
,exts: 'zip|rar|7z'
,size: 10000
//,multiple: true
,bindAction: '#upgrade-sys-button'
,before: function(obj){ //obj参数包含的信息跟 choose回调完全一致可参见上文。
layer.load(); //上传loading
}
,done: function(res){
layer.closeAll('loading'); //关闭loading
if(res.code == 1){
layer.msg(res.msg,{
icon:6,
tiye:2000
},function(){
location.reload();
});
} else {
layer.open({
title:"上传失败",
content:res.msg,
icon:5,
anim:6
});
}
}
});
//检测更新
$('#upload-check').on('click',function(){
var url = $(this).attr('data-url'),
loading = layer.load(2, {
shade: [0.2, '#000'],
time: 2000,
});
$.ajax({
type:"post",
url:"{:url('admin/upgrade/check')}",
data:{"url":url},
daType:"json",
success:function (data){
if (data.code == 1) {
layer.close(loading);
$('div#ver_nums').after('<div class="layui-input-inline layui-input-company">发现<span style="color:red">'+data.upnum+'</span>个新版本:<span style="color:red">可更新至v'+data.version+'</span></div> <button class="layui-btn layui-btn-sm" lay-submit lay-filter="update_system" data-url="{$ver_num.upgrade_url}" id="update_system">确认升级</button>');
$('button#upload-check').hide();
layer.msg(data.msg,{
icon:6,
time:2000
});
} else {
layer.open({
tiele:'添加失败',
content:data.msg,
icon:5,
anim:6
});
}
}
});
return false;
});
//确定升级操作
$(document).on('click','#update_system',function(){
var url = $(this).attr('data-url'),
key = $('input[name=key]').attr("value"),
loading = layer.load(2, {
shade: [0.2, '#000'],
});
$.ajax({
type:"post",
url:"{:url('admin/upgrade/upload')}",
data:{"url":url,"key":key},
daType:"json",
success:function (data){
if (data.code == 1) {
layer.close(loading);
layer.msg(data.msg,{
icon:6,
time:2000
},function(){
location.reload();
});
} else {
layer.close(loading);
layer.open({
tiele:'升级失败',
content:data.msg,
icon:5,
anim:6
});
}
}
});
return false;
});
//设置key
$('#upgrade-key').on('click',function(){
var key = $('input[name=key]').val();
console.log(key);
$.ajax({
type:"post",
url:"{:url('admin/upgrade/key')}",
data:{"key":key},
daType:"json",
success:function (data){
if (data.code == 1) {
layer.msg(data.msg,{
icon:6,
time:2000
},function(){
location.reload();
});
} else {
layer.open({
tiele:'保存失败',
content:data.msg,
icon:5,
anim:6
});
}
}
});
return false;
});
//修改key
$('a[lay-event=edit]').on('click', function(){
layer.open({
type: 2,
title: '修改key',
content: 'keyedit.html',
maxmin: true,
area : ['420px' , '380px'],
btn: ['确定', '取消'],
yes: function(index, layero){
var iframeWindow = window['layui-layer-iframe'+ index]
,submitID = 'LAY-keyedit-submit'
,submit = layero.find('iframe').contents().find('#'+ submitID);
//监听提交
iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
var field = data.field; //获取提交的字段
//console.log(field);
//提交 Ajax 成功后,静态更新表格中的数据
$.ajax({
type:"post",
url:"{:url('admin/upgrade/keyedit')}",
data:{"key":field.key,"upcheck_url":field.upcheck_url,"upgrade_url":field.upgrade_url},
daType:"json",
success:function (data){
if (data.code == 1) {
layer.msg(data.msg,{
icon:6,
time:2000
}, function(){
location.reload();
});
} else {
layer.open({
tiele:'修改失败',
content:data.msg,
icon:5,
anim:6
});
}
}
});
layer.close(index);
});
submit.trigger('click');
}
});
return false;
});
});
</script>
{/block}

View File

@ -0,0 +1,52 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-keyedit" id="layuiadmin-form-keyedit" style="padding: 20px 30px 0 0;">
<div class="layui-form-item">
<label class="layui-form-label">配置Key</label>
<div class="layui-input-inline">
<input type="text" name="key" value="{$key.key}" required class="layui-input" autocomplete="off" placeholder="填写申请得到在Key">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">检测api</label>
<div class="layui-input-inline">
<input type="text" name="upcheck_url" value="{$key.upcheck_url}" required class="layui-input" autocomplete="off" placeholder="没换官网服务器情况下不要改">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">升级api</label>
<div class="layui-input-inline">
<input type="text" name="upgrade_url" value="{$key.upgrade_url}" required class="layui-input" autocomplete="off" placeholder="没换官网服务器情况下不要改">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">申请key?</label>
<div class="layui-input-inline">
<div class="layui-form-mid layui-word-aux " ><a href="http://www.aieok.com" target="_blank">更换网址,请去官网重新申请key</a></div>
<div class="layui-form-mid layui-word-aux " ><span>未通知api接口变更,请不要私自更改api否则无法升级</span></div>
</div>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="LAY-keyedit-submit" id="LAY-keyedit-submit" value="确认">
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form','table'], function(){
var $ = layui.$
,table = layui.table
,form = layui.form;
});
</script>
{/block}

300
view/admin/user/list.html Normal file
View File

@ -0,0 +1,300 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-fluid">
<div class="layui-card">
<div class="layui-form layui-card-header layuiadmin-card-header-auto">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label">ID</label>
<div class="layui-input-block">
<input type="text" name="id" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">用户名</label>
<div class="layui-input-block">
<input type="text" name="name" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">邮箱</label>
<div class="layui-input-block">
<input type="text" name="email" placeholder="请输入" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label">性别</label>
<div class="layui-input-block">
<select name="sex">
<option value="">不限</option>
<option value="0"></option>
<option value="1"></option>
</select>
</div>
</div>
<div class="layui-inline">
<button class="layui-btn layuiadmin-btn-useradmin" lay-submit lay-filter="LAY-user-front-search">
<i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
</button>
</div>
</div>
</div>
<div class="layui-card-body">
<div style="padding-bottom: 10px;">
<button class="layui-btn layuiadmin-btn-useradmin" data-type="batchdel">删除</button>
<button class="layui-btn layuiadmin-btn-useradmin" data-type="add">添加</button>
</div>
<table id="LAY-user-manage" lay-filter="LAY-user-manage"></table>
<script type="text/html" id="imgTpl">
<img style="display: inline-block; width: 50%; height: 100%;" src= {{ d.avatar }}>
</script>
<script type="text/html" id="sex">
{{# if(d.sex == 0){ }}
<button class="layui-btn layui-btn-normal layui-btn-xs" ></button>
{{# } else { }}
<button class="layui-btn layui-btn-danger layui-btn-xs"></button>
{{# } }}
</script>
<script type="text/html" id="buttonCheck">
{{# if(d.id == '1'){ }}
<input type="checkbox" name="check" lay-skin="switch" disabled lay-text="通过|禁用" value="1" checked id="{{d.id}}">
{{# } else { }}
{if condition="checkRuleButton('admin/user/check')"}<input type="checkbox" name="check" lay-skin="switch" lay-filter="usercheck" lay-text="通过|禁用" {{# if(d.check == 1){ }} checked {{# } }} id="{{d.id}}" >{else}<button class="layui-btn layui-btn-xs layui-btn-radius layui-btn-disabled">无权限</button>{/if}
{{# } }}
</script>
<script type="text/html" id="buttonAuth">
{{# if(d.id == '1'){ }}
<input type="checkbox" name="auth" lay-skin="primary" checked disabled >
{{# } else { }}
{if condition="checkRuleButton('admin/user/auth')"}<input type="checkbox" name="auth" lay-skin="primary" lay-filter="auth" {{# if(d.auth ==1){ }}checked value="0"{{# } else { }}value="1"{{# } }} id="{{d.id}}" >{else}<button class="layui-btn layui-btn-xs layui-btn-disabled">无权限</button>{/if}
{{# } }}
</script>
<script type="text/html" id="table-useradmin-webuser">
{if condition="checkRuleButton('admin/user/useredit')"}
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="edit" id={{ d.id }}><i class="layui-icon layui-icon-edit"></i>编辑</a>
{else /}<a class="layui-btn layui-btn-normal layui-btn-xs layui-btn-disabled"><i class="layui-icon layui-icon-edit"></i>编辑</a>{/if}
{if condition="checkRuleButton('admin/user/delete')"}
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del" id={{ d.id }}><i class="layui-icon layui-icon-delete"></i>删除</a>
{else /}<a class="layui-btn layui-btn-danger layui-btn-xs layui-btn-disabled"><i class="layui-icon layui-icon-delete"></i>删除</a>{/if}
</script>
</div>
</div>
</div>
{/block}
{block name="js"}
<script>
var userList = "{:url('User/list')}";
var userDelete = "{:url('User/delete')}";
var userEdit = "{:url('User/userEdit')}";
var adminIndex = "{:url('Admin/index')}";
var adminDelete = "{:url('Admin/delete')}";
var adminEdit = "{:url('Admin/edit')}";
var authGroupList = "{:url('AuthGroup/list')}";
var authGroupRoledel = "{:url('AuthGroup/roleDel')}";
var authGroupRoleEdit = "{:url('AuthGroup/roleEdit')}";
var authAccessIndex = "{:url('AuthAccess/index')}";
var authAccessDelete = "{:url('AuthAccess/delete')}";
var authAccessEdit = "{:url('AuthAccess/edit')}";
var authRuleIndex = "{:url('AuthRule/index')}";
var authRuleDelete = "{:url('AuthRule/delete')}";
var authRuleEdit = "{:url('AuthRule/edit')}";
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'useradmin', 'table'], function(){
var $ = layui.$
,form = layui.form
,table = layui.table;
//监听搜索
form.on('submit(LAY-user-front-search)', function(data){
var field = data.field;
//提交 Ajax 成功后,静态更新表格中的数据
$.ajax({
type:"post",
url:"{:url('admin/User/list')}",
data:{"id":field.id,"name":field.name,"email":field.email,"sex":field.sex},
daType:"json",
success:function (data){
if (data.code == 0) {
} else {
layer.open({
tiele:'搜索失败',
content:data.msg,
icon:5,
anim:6
});
}
}
});
//执行重载
table.reload('LAY-user-manage', {
where: field
});
});
//事件
var active = {
batchdel: function(){
var checkStatus = table.checkStatus('LAY-user-manage')
,checkData = checkStatus.data; //得到选中的数据
if(checkData.length === 0){
return layer.msg('请选择数据');
}
layer.prompt({
formType: 1
,title: '敏感操作,请验证口令'
}, function(value, index){
layer.close(index);
layer.confirm('确定删除吗?', function(index) {
//执行 Ajax 后重载
/*
admin.req({
url: 'xxx'
//,……
});
*/
table.reload('LAY-user-manage');
layer.msg('已删除');
});
});
}
,add: function(){
layer.open({
type: 2
,title: '添加用户'
,content: 'userform.html'
,maxmin: true
,area: ['480px', '450px']
,btn: ['确定', '取消']
,yes: function(index, layero){
var iframeWindow = window['layui-layer-iframe'+ index]
,submitID = 'LAY-user-front-submit'
,submit = layero.find('iframe').contents().find('#'+ submitID);
//监听提交
iframeWindow.layui.form.on('submit('+ submitID +')', function(data){
var field = data.field; //获取提交的字段
//提交 Ajax 成功后,静态更新表格中的数据
$.ajax({
type:"post",
url:"{:url('admin/User/userform')}",
data:{"name":field.username,"phone":field.phone,"email":field.email,"user_img":field.avatar,"sex":field.sex},
daType:"json",
success:function (data){
if (data.code == 0) {
layer.msg(data.msg,{
icon:6,
time:2000
});
} else {
layer.open({
tiele:'添加失败',
content:data.msg,
icon:5,
anim:6
});
}
}
});
table.reload('LAY-user-manage'); //数据刷新
layer.close(index); //关闭弹层
});
submit.trigger('click');
}
});
}
};
//监听用户审核
form.on('switch(usercheck)', function(data){
var data= data.elem;
if(data.checked == true){
data.value = 1;
}else{
data.value = 0;
}
//执行用户审核
$.ajax({
type:'post',
url:"{:url('admin/User/check')}",
data:{"id":data.id,"status":data.value,},
dataType:'json',
success:function(res){
if(res.code == 0){
layer.msg(res.msg,{
icon:res.icon,
time:2000
}
//,function(){location.reload();}
);
} else {
layer.open({
title:'审核失败',
content:res.msg,
icon:5,
adim:6
})
}
}
});
return false;
});
//超级管理auth控制
form.on('checkbox(auth)', function(data){
var data = data.elem;
if(data.checked == true){
data.value = 1;
}else{
data.value = 0;
}
$.ajax({
type:'post',
url:"{:url('admin/User/auth')}",
data:{"id":data.id,"auth":data.value,},
dataType:'json',
success:function(data){
if(data.code == 0){
layer.msg(data.msg,{
icon:6,
time:2000
}
//,function(){location.reload();}
);
} else {
layer.open({
title:'修改失败',
content:data.msg,
icon:5,
adim:6
})
}
}
});
return false;
});
$('.layui-btn.layuiadmin-btn-useradmin').on('click', function(){
var type = $(this).data('type');
active[type] ? active[type].call(this) : '';
});
});
</script>
{/block}

View File

@ -0,0 +1,83 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin" style="padding: 20px 0 0 0;">
<div class="layui-form-item layui-hide">
<input type="text" name="id" class="layui-input" value="{$user.id}">
</div>
<div class="layui-form-item">
<label class="layui-form-label">用户名</label>
<div class="layui-input-inline">
<input type="text" name="username" disabled lay-verify="required" placeholder="请输入用户名" autocomplete="off" class="layui-input layui-disabled" value="{$user.name}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">手机号码</label>
<div class="layui-input-inline">
<input type="text" name="phone" lay-verify="phone" placeholder="请输入号码" autocomplete="off" class="layui-input" value="{$user.phone}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">邮箱</label>
<div class="layui-input-inline">
<input type="text" name="email" lay-verify="email" placeholder="请输入邮箱" autocomplete="off" class="layui-input" value="{$user.email}">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">头像</label>
<div class="layui-input-inline">
<input type="text" name="avatar" lay-verify="required" placeholder="请上传图片" autocomplete="off" class="layui-input" value="{$user.user_img}">
</div>
<button style="float: left;" type="button" class="layui-btn" dataid="{$user.id}" id="layuiadmin-upload-useradmin">上传图片</button>
</div>
<div class="layui-form-item" lay-filter="sex">
<label class="layui-form-label">选择性别</label>
<div class="layui-input-block">
<input type="radio" name="sex" value="0" title="男" {if condition="$user['sex'] eq 0"} checked {/if}>
<input type="radio" name="sex" value="1" title="女" {if condition="$user['sex'] eq 1"} checked {/if}>
</div>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="LAY-user-front-submit" id="LAY-user-front-submit" value="确认">
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form', 'upload'], function(){
var $ = layui.$
,form = layui.form
,upload = layui.upload ;
//上传头像
upload.render({
elem: '#layuiadmin-upload-useradmin'
,url: 'uploadImg'
,accept: 'images'
,method: 'get'
,acceptMime: 'image/*'
,done: function(res){
$(this.item).prev("div").children("input").val(res.src);
if(res.code == 0){
layer.msg(res.msg,{
icon:6,
tiye:2000
});
} else {
layer.open({
title:"上传失败",
content:res.msg,
icon:5,
anim:6
});
}
}
});
})
</script>
{/block}

View File

@ -0,0 +1,80 @@
{extend name="public/base" /}
{block name="body"}
<div class="layui-form" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin" style="padding: 20px 30px 0 0;">
<div class="layui-form-item">
<label class="layui-form-label">用户名</label>
<div class="layui-input-inline">
<input type="text" name="username" lay-verify="required" placeholder="请输入用户名" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">手机号码</label>
<div class="layui-input-inline">
<input type="text" name="phone" lay-verify="phone" placeholder="请输入号码" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">邮箱</label>
<div class="layui-input-inline">
<input type="text" name="email" lay-verify="email" placeholder="请输入邮箱" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">头像</label>
<div class="layui-input-inline">
<input type="text" name="avatar" lay-verify="required" placeholder="请上传图片" autocomplete="off" class="layui-input" >
</div>
<button style="float: left;" type="button" class="layui-btn" id="layuiadmin-upload-useradmin">上传图片</button>
</div>
<div class="layui-form-item" lay-filter="sex">
<label class="layui-form-label">选择性别</label>
<div class="layui-input-block">
<input type="radio" name="sex" value="0" title="男" checked>
<input type="radio" name="sex" value="1" title="女">
</div>
</div>
<div class="layui-form-item layui-hide">
<input type="button" lay-submit lay-filter="LAY-user-front-submit" id="LAY-user-front-submit" value="确认">
</div>
</div>
{/block}
{block name="js"}
<script>
layui.config({
base: '/static/admin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form', 'upload'], function(){
var $ = layui.$
,form = layui.form
,upload = layui.upload ;
//上传头像
upload.render({
elem: '#layuiadmin-upload-useradmin'
,url: 'uploadImg'
,accept: 'images'
,method: 'get'
,acceptMime: 'image/*'
,done: function(res){
$(this.item).prev("div").children("input").val(res.src);
if(res.code == 0){
layer.msg(res.msg,{
icon:6,
tiye:2000
});
} else {
layer.open({
title:"上传失败",
content:res.msg,
icon:5,
anim:6
});
}
}
});
})
</script>
{/block}

1
view/index/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/api

Some files were not shown because too many files have changed in this diff Show More