diff --git a/app/controller/Base.php b/app/controller/Base.php new file mode 100644 index 0000000..3dfdc69 --- /dev/null +++ b/app/controller/Base.php @@ -0,0 +1,16 @@ + +// +---------------------------------------------------------------------- +namespace app\controller; + +use app\BaseController; + +class Base extends BaseController{ + + public $data = ['code' => 1, 'data' => '', 'message' => '']; +} \ No newline at end of file diff --git a/app/controller/Index.php b/app/controller/Index.php deleted file mode 100644 index 81203ad..0000000 --- a/app/controller/Index.php +++ /dev/null @@ -1,17 +0,0 @@ -*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} a{color:#2E5CD5;cursor: pointer;text-decoration: none} a:hover{text-decoration:underline; } body{ background: #fff; font-family: "Century Gothic","Microsoft yahei"; color: #333;font-size:18px;} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.6em; font-size: 42px }

:)

ThinkPHP V' . \think\facade\App::version() . '
14载初心不改 - 你值得信赖的PHP框架

[ V6.0 版本由 亿速云 独家赞助发布 ]
'; - } - - public function hello($name = 'ThinkPHP6') - { - return 'hello,' . $name; - } -} diff --git a/app/controller/auth/Index.php b/app/controller/auth/Index.php new file mode 100644 index 0000000..449bdde --- /dev/null +++ b/app/controller/auth/Index.php @@ -0,0 +1,26 @@ + +// +---------------------------------------------------------------------- +namespace app\controller\auth; + +use app\controller\Base; +use app\services\auth\LoginService; + +class Index extends Base{ + + public function login(LoginService $service){ + try { + $data = $service->authLogin($this->request); + $this->data['data'] = $data; + } catch (\think\Exception $e) { + $this->data['code'] = 0; + $this->data['message'] = $e->getMessage(); + } + return $this->data; + } +} diff --git a/app/middleware.php b/app/middleware.php index d2989de..7f18944 100644 --- a/app/middleware.php +++ b/app/middleware.php @@ -1,6 +1,7 @@ +// +---------------------------------------------------------------------- +declare (strict_types = 1); + +namespace app\middleware; + +use think\Config; +use think\Request; +use think\Response; + +class AllowCrossDomain{ + + protected $header = [ + 'Access-Control-Allow-Credentials' => 'true', + 'Access-Control-Max-Age' => 1800, + 'Access-Control-Allow-Methods' => 'GET, POST, PATCH, PUT, DELETE, OPTIONS', + 'Access-Control-Allow-Headers' => 'Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-CSRF-TOKEN, X-Requested-With', + ]; + + public function __construct(Config $config){ + $this->header = array_merge($this->header, $config->get('cross', '')); + } + + /** + * 允许跨域请求 + * @access public + * @param Request $request + * @param Closure $next + * @param array $header + * @return Response + */ + public function handle($request, \Closure $next, ? array $header = []){ + $header = !empty($header) ? array_merge($this->header, $header) : $this->header; + + if (!isset($header['Access-Control-Allow-Origin'])) { + $origin = $request->header('origin'); + $header['Access-Control-Allow-Origin'] = $origin ? $origin : "*"; + } + + return $next($request)->header($header); + } +} diff --git a/app/middleware/Api.php b/app/middleware/Api.php index 9a3cbc6..ff054f5 100644 --- a/app/middleware/Api.php +++ b/app/middleware/Api.php @@ -11,6 +11,9 @@ declare (strict_types = 1); namespace app\middleware; class Api{ + + public $data = ['code' => 1, 'data' => '', 'message' => '']; + /** * 处理请求 * diff --git a/app/model/BaseModel.php b/app/model/BaseModel.php new file mode 100644 index 0000000..f02ad81 --- /dev/null +++ b/app/model/BaseModel.php @@ -0,0 +1,15 @@ + +// +---------------------------------------------------------------------- +namespace app\model; + +use think\Model; + +class BaseModel extends Model{ + +} \ No newline at end of file diff --git a/app/model/user/Users.php b/app/model/user/Users.php new file mode 100644 index 0000000..9ea0ae5 --- /dev/null +++ b/app/model/user/Users.php @@ -0,0 +1,20 @@ + +// +---------------------------------------------------------------------- +namespace app\model\user; + +use app\model\BaseModel; +use xiaodi\JWTAuth\Facade\Jwt; + +class Users extends BaseModel{ + + public function getTokenAttr($value, $data){ + $token = Jwt::store('api')->token($data)->__toString(); + return $token; + } +} \ No newline at end of file diff --git a/app/services/auth/LoginService.php b/app/services/auth/LoginService.php new file mode 100644 index 0000000..1b7ccaf --- /dev/null +++ b/app/services/auth/LoginService.php @@ -0,0 +1,36 @@ + +// +---------------------------------------------------------------------- +namespace app\services\auth; + +use app\model\user\Users; + +class LoginService{ + + public function authLogin($request){ + $params = $request->post(); + $map = []; + foreach($params as $field => $value){ + if(in_array($field, ['username', 'email', 'mobile']) && $field != 'password'){ + $map[$field] = $value; + } + } + $user = Users::where($map)->field(['uid','username', 'password', 'email', 'avatar', 'department_id', 'status'])->findOrEmpty(); + if (!$user->isEmpty()) { + if(password_verify(base64_decode($params['password']), $user->password)){ + throw new \think\Exception('密码不正确!', 100002); + }elseif($user->status != 1){ + throw new \think\Exception('当前用户不可用', 100003); + }else{ + return $user->append(['token']); + } + }else{ + throw new \think\Exception('当前用户不存在', 100001); + } + } +} \ No newline at end of file diff --git a/composer.json b/composer.json index ff2a220..bc0cf27 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,8 @@ "require": { "php": ">=7.2.5", "topthink/framework": "^6.0.0", - "topthink/think-orm": "^2.0" + "topthink/think-orm": "^2.0", + "xiaodi/think-jwt": "^2.0" }, "require-dev": { "symfony/var-dumper": "^4.2", diff --git a/composer.lock b/composer.lock index f5c84df..5fea774 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,72 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "972d5f37c97d6a688bc084d56a25d074", + "content-hash": "aed98006f10d9fbc1ef4ac60e21a2a0e", "packages": [ + { + "name": "lcobucci/jwt", + "version": "3.3.3", + "source": { + "type": "git", + "url": "https://github.com/lcobucci/jwt.git", + "reference": "c1123697f6a2ec29162b82f170dd4a491f524773" + }, + "dist": { + "type": "zip", + "url": "https://repo.huaweicloud.com/repository/php/lcobucci/jwt/3.3.3/lcobucci-jwt-3.3.3.zip", + "reference": "c1123697f6a2ec29162b82f170dd4a491f524773", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "ext-openssl": "*", + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "mikey179/vfsstream": "~1.5", + "phpmd/phpmd": "~2.2", + "phpunit/php-invoker": "~1.1", + "phpunit/phpunit": "^5.7 || ^7.3", + "squizlabs/php_codesniffer": "~2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Lcobucci\\JWT\\": "src" + } + }, + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Luís Otávio Cobucci Oblonczyk", + "email": "lcobucci@gmail.com", + "role": "Developer" + } + ], + "description": "A simple library to work with JSON Web Token and JSON Web Signature", + "keywords": [ + "JWS", + "jwt" + ], + "funding": [ + { + "url": "https://github.com/lcobucci", + "type": "github" + }, + { + "url": "https://www.patreon.com/lcobucci", + "type": "patreon" + } + ], + "time": "2020-08-20T13:22:28+00:00" + }, { "name": "league/flysystem", "version": "1.1.9", @@ -192,6 +256,149 @@ ], "time": "2022-04-17T13:12:02+00:00" }, + { + "name": "nette/php-generator", + "version": "v3.6.7", + "source": { + "type": "git", + "url": "https://github.com/nette/php-generator.git", + "reference": "b9ba414c9895fd9420887f20eeb4eabde123677f" + }, + "dist": { + "type": "zip", + "url": "https://repo.huaweicloud.com/repository/php/nette/php-generator/v3.6.7/nette-php-generator-v3.6.7.zip", + "reference": "b9ba414c9895fd9420887f20eeb4eabde123677f", + "shasum": "" + }, + "require": { + "nette/utils": "^3.1.2", + "php": ">=7.2 <8.2" + }, + "require-dev": { + "nette/tester": "^2.4", + "nikic/php-parser": "^4.13", + "phpstan/phpstan": "^0.12", + "tracy/tracy": "^2.8" + }, + "suggest": { + "nikic/php-parser": "to use ClassType::withBodiesFrom() & GlobalFunction::withBodyFrom()" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.6-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "license": [ + "BSD-3-Clause", + "GPL-2.0-only", + "GPL-3.0-only" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "🐘 Nette PHP Generator: generates neat PHP code for you. Supports new PHP 8.1 features.", + "homepage": "https://nette.org", + "keywords": [ + "code", + "nette", + "php", + "scaffolding" + ], + "time": "2022-03-10T01:51:00+00:00" + }, + { + "name": "nette/utils", + "version": "v3.2.7", + "source": { + "type": "git", + "url": "https://github.com/nette/utils.git", + "reference": "0af4e3de4df9f1543534beab255ccf459e7a2c99" + }, + "dist": { + "type": "zip", + "url": "https://repo.huaweicloud.com/repository/php/nette/utils/v3.2.7/nette-utils-v3.2.7.zip", + "reference": "0af4e3de4df9f1543534beab255ccf459e7a2c99", + "shasum": "" + }, + "require": { + "php": ">=7.2 <8.2" + }, + "conflict": { + "nette/di": "<3.0.6" + }, + "require-dev": { + "nette/tester": "~2.0", + "phpstan/phpstan": "^1.0", + "tracy/tracy": "^2.3" + }, + "suggest": { + "ext-gd": "to use Image", + "ext-iconv": "to use Strings::webalize(), toAscii(), chr() and reverse()", + "ext-intl": "to use Strings::webalize(), toAscii(), normalize() and compare()", + "ext-json": "to use Nette\\Utils\\Json", + "ext-mbstring": "to use Strings::lower() etc...", + "ext-tokenizer": "to use Nette\\Utils\\Reflection::getUseStatements()", + "ext-xml": "to use Strings::length() etc. when mbstring is not available" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "license": [ + "BSD-3-Clause", + "GPL-2.0-only", + "GPL-3.0-only" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "🛠 Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.", + "homepage": "https://nette.org", + "keywords": [ + "array", + "core", + "datetime", + "images", + "json", + "nette", + "paginator", + "password", + "slugify", + "string", + "unicode", + "utf-8", + "utility", + "validation" + ], + "time": "2022-01-24T11:29:14+00:00" + }, { "name": "psr/cache", "version": "1.0.1", @@ -574,6 +781,69 @@ "orm" ], "time": "2022-02-28T14:54:22+00:00" + }, + { + "name": "xiaodi/think-jwt", + "version": "v2.0.3", + "source": { + "type": "git", + "url": "https://github.com/friendsofthinkphp/think-jwt.git", + "reference": "e24e6084a25d3463f125b3844061b0b0fa1ab843" + }, + "dist": { + "type": "zip", + "url": "https://repo.huaweicloud.com/repository/php/xiaodi/think-jwt/v2.0.3/xiaodi-think-jwt-v2.0.3.zip", + "reference": "e24e6084a25d3463f125b3844061b0b0fa1ab843", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-mbstring": "*", + "lcobucci/jwt": "3.3.3", + "nette/php-generator": "^3.2", + "php": ">=7.1.0", + "topthink/framework": "^6.0.2" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.15", + "mockery/mockery": "^1.2", + "phpstan/phpstan": "^0.12.0", + "phpunit/phpunit": "^6.2" + }, + "type": "think-extend", + "extra": { + "think": { + "services": [ + "xiaodi\\JWTAuth\\JwtService" + ], + "config": { + "jwt": "config/config.php" + } + }, + "think-config": { + "jwt": "config/config.php" + } + }, + "autoload": { + "psr-4": { + "xiaodi\\JWTAuth\\": "src/" + } + }, + "license": [ + "MIT" + ], + "authors": [ + { + "name": "xiaodi", + "email": "liangjinbiao@live.com" + } + ], + "description": "ThinkPHP Jwt Component", + "keywords": [ + "php", + "thinkphp" + ], + "time": "2021-02-22T02:09:36+00:00" } ], "packages-dev": [ diff --git a/config/cross.php b/config/cross.php new file mode 100644 index 0000000..f5e3db6 --- /dev/null +++ b/config/cross.php @@ -0,0 +1,15 @@ + +// +---------------------------------------------------------------------- + +return [ + 'Access-Control-Allow-Credentials' => 'true', + 'Access-Control-Max-Age' => 1800, + 'Access-Control-Allow-Methods' => 'GET, POST, PATCH, PUT, DELETE, OPTIONS', + 'Access-Control-Allow-Headers' => 'Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-CSRF-TOKEN, X-Requested-With', +]; \ No newline at end of file diff --git a/config/jwt.php b/config/jwt.php new file mode 100644 index 0000000..7c28498 --- /dev/null +++ b/config/jwt.php @@ -0,0 +1,45 @@ + +// +---------------------------------------------------------------------- +use app\model\user\Users; + +return [ + 'stores' => [ + 'api' => [ + 'sso' => [ + 'enable' => false, + ], + 'token' => [ + 'unique_id_key' => 'uid', + 'signer_key' => 'tensent', + 'not_before' => 0, + 'expires_at' => 3600, + 'refresh_ttL' => 7200, + 'signer' => 'Lcobucci\JWT\Signer\Hmac\Sha256', + 'type' => 'Header', + 'relogin_code' => 50001, + 'refresh_code' => 50002, + 'iss' => 'client.tensent', + 'aud' => 'server.tensent', + 'automatic_renewal' => false, + ], + 'user' => [ + 'bind' => true, + 'class' => null, + ] + ] + ], + 'manager' => [ + // 缓存前缀 + 'prefix' => 'jwt', + // 黑名单缓存名 + 'blacklist' => 'blacklist', + // 白名单缓存名 + 'whitelist' => 'whitelist' + ] +]; diff --git a/route/auth.php b/route/auth.php new file mode 100644 index 0000000..932be58 --- /dev/null +++ b/route/auth.php @@ -0,0 +1,14 @@ + +// +---------------------------------------------------------------------- +use think\facade\Route; +use app\controller\auth; + +Route::group('auth', function(){ + Route::post('login', 'auth.Index/login'); +}); \ No newline at end of file diff --git a/ui/README.md b/ui/README.md index 2d87a44..6740d80 100644 --- a/ui/README.md +++ b/ui/README.md @@ -1,65 +1,19 @@ +# thinkvue-admin -
+## Project setup +``` +npm install +``` -![logo](https://lolicode.gitee.io/scui-doc/logo.png) - -

- - vue - - - element plus - -

- -

SCUI Admin

- -
- -## 介绍 -SCUI 是一个中后台前端解决方案,基于VUE3和elementPlus实现。 -使用最新的前端技术栈,提供各类实用的组件方便在业务开发时的调用,并且持续性的提供丰富的业务模板帮助你快速搭建企业级中后台前端任务。 - -SCUI的宗旨是 让一切复杂的东西傻瓜化。 - -![logo](https://lolicode.gitee.io/scui-doc/g_1.jpg) - -## 特点 -- **组件** 多个独家组件、业务模板和代码生成器 -- **权限** 完整的鉴权体系和高精度权限控制 -- **布局** 提供多套布局模式,满足各种视觉需求 -- **API** 完善的API管理,使用真实网络MOCK -- **配置** 统一的全局配置和组件配置,支持build后配置热更新 -- **性能** 在减少带宽请求和前端算力上多次优化,并且持续着 -- **其他** 多功能视图标签、动态权限菜单、控制台组态化、统一异常处理等等 - -## 演示和文档 - -- 演示 -- 文档 - -## 部分截图 - -![logo](https://lolicode.gitee.io/scui-doc/g_2.jpg) - -## 安装教程 -``` sh -# 克隆项目 -git clone https://gitee.com/lolicode/scui.git - -# 进入项目目录 -cd scui - -# 安装依赖 -npm i - -# 启动项目(开发模式) +### Compiles and hot-reloads for development +``` npm run serve ``` -启动完成后浏览器访问 http://localhost:2800 -## 感谢 -![fastmock](https://www.fastmock.site/resource/images/logo.png) +### Compiles and minifies for production +``` +npm run build +``` -## 支持 -如果觉得本项目还不错或在工作中有所启发,请在Gitee(码云)帮开发者点亮星星,这是对开发者最大的支持和鼓励! +### Customize configuration +See [Configuration Reference](https://cli.vuejs.org/config/). diff --git a/ui/package.json b/ui/package.json index 3cfad77..b6226d9 100644 --- a/ui/package.json +++ b/ui/package.json @@ -1,5 +1,5 @@ { - "name": "scui", + "name": "thinkvue-admin", "version": "1.5.0", "private": true, "scripts": { diff --git a/ui/public/config.js b/ui/public/config.js index 6ab642a..10e148d 100644 --- a/ui/public/config.js +++ b/ui/public/config.js @@ -4,8 +4,8 @@ const APP_CONFIG = { //标题 - APP_NAME: "SCUI", + // APP_NAME: "SCUI", //接口地址,如遇跨域需使用nginx代理 - API_URL: "https://www.fastmock.site/mock/5039c4361c39a7e3252c5b55971f1bd3/api" + // API_URL: "https://www.fastmock.site/mock/5039c4361c39a7e3252c5b55971f1bd3/api" } diff --git a/ui/public/img/logo-r.png b/ui/public/img/logo-r.png index 9f8fba9..54300a1 100644 Binary files a/ui/public/img/logo-r.png and b/ui/public/img/logo-r.png differ diff --git a/ui/public/img/logo.png b/ui/public/img/logo.png index 7a2fb28..54300a1 100644 Binary files a/ui/public/img/logo.png and b/ui/public/img/logo.png differ diff --git a/ui/src/App.vue b/ui/src/App.vue index 03880f1..1b12446 100644 --- a/ui/src/App.vue +++ b/ui/src/App.vue @@ -1,29 +1,29 @@ diff --git a/ui/src/api/model/auth.js b/ui/src/api/model/auth.js index 5639e63..9dcd4f2 100644 --- a/ui/src/api/model/auth.js +++ b/ui/src/api/model/auth.js @@ -2,11 +2,18 @@ import config from "@/config" import http from "@/utils/request" export default { - token: { - url: `${config.API_URL}/token`, + login: { + url: `${config.API_URL}auth/login`, name: "登录获取TOKEN", post: async function(data={}){ return await http.post(this.url, data); } + }, + logout:{ + url: `${config.API_URL}auth/logout`, + name: "登出", + get: async function(data={}){ + return await http.get(this.url, data); + } } } diff --git a/ui/src/api/model/demo.js b/ui/src/api/model/demo.js deleted file mode 100644 index 210a071..0000000 --- a/ui/src/api/model/demo.js +++ /dev/null @@ -1,37 +0,0 @@ -import config from "@/config" -import http from "@/utils/request" - -export default { - ver: { - url: `${config.API_URL}/demo/ver`, - name: "获取最新版本号", - get: async function(){ - return await http.get(this.url); - } - }, - post: { - url: `${config.API_URL}/demo/post`, - name: "分页列表", - post: async function(data){ - return await http.post(this.url, data, { - headers: { - //'response-status': 401 - } - }); - } - }, - page: { - url: `${config.API_URL}/demo/page`, - name: "分页列表", - get: async function(params){ - return await http.get(this.url, params); - } - }, - menu: { - url: `${config.API_URL}/demo/menu`, - name: "普通用户菜单", - get: async function(){ - return await http.get(this.url); - } - } -} diff --git a/ui/src/api/model/system.js b/ui/src/api/model/system.js index 85ce415..a4827ad 100644 --- a/ui/src/api/model/system.js +++ b/ui/src/api/model/system.js @@ -2,62 +2,130 @@ import config from "@/config" import http from "@/utils/request" export default { + version:{ + url: `${config.API_URL}system/index/version`, + name: "获取最新版本号", + get: async function(){ + return await http.get(this.url); + } + }, + setting:{ + list: { + url: `${config.API_URL}system/index/setting`, + name: "获取最新版本号", + get: function(){ + return http.get(this.url); + } + } + }, menu: { myMenus: { - url: `${config.API_URL}/system/menu/my/1.5.0`, + url: `${config.API_URL}system/menu/my/1.5.0`, name: "获取我的菜单", get: async function(){ return await http.get(this.url); } }, list: { - url: `${config.API_URL}/system/menu/list`, + url: `${config.API_URL}system/menu/index`, name: "获取菜单", get: async function(){ return await http.get(this.url); } + }, + add: { + url: `${config.API_URL}/system/menu/add`, + name: "添加菜单", + post: async function(data){ + return await http.post(this.url, data); + } + }, + edit: { + url: `${config.API_URL}/system/menu/edit`, + name: "编辑菜单", + post: async function(data){ + return await http.post(this.url, data); + } + }, + delete: { + url: `${config.API_URL}/system/menu/delete`, + name: "删除菜单", + post: async function(data){ + return await http.post(this.url, data); + } } }, - dic: { - tree: { - url: `${config.API_URL}/system/dic/tree`, + dictionary: { + category: { + url: `${config.API_URL}/system/dictionary/category`, name: "获取字典树", get: async function(){ return await http.get(this.url); } }, + editcate:{ + url: `${config.API_URL}/system/dictionary/editcate`, + name: "编辑字典树", + post: async function(data = {}){ + return await http.post(this.url, data); + } + }, + addcate:{ + url: `${config.API_URL}/system/dictionary/addcate`, + name: "添加字典树", + post: async function(data = {}){ + return await http.post(this.url, data); + } + }, + delCate:{ + url: `${config.API_URL}/system/dictionary/delcate`, + name: "删除字典树", + post: async function(data = {}){ + return await http.post(this.url, data); + } + }, list: { - url: `${config.API_URL}/system/dic/list`, + url: `${config.API_URL}/system/dictionary/lists`, name: "字典明细", get: async function(params){ return await http.get(this.url, params); } }, get: { - url: `${config.API_URL}/system/dic/get`, + url: `${config.API_URL}/system/dictionary/detail`, name: "获取字典数据", get: async function(params){ return await http.get(this.url, params); } - } - }, - role: { - list: { - url: `${config.API_URL}/system/role/list`, - name: "获取角色列表", + }, + edit:{ + url: `${config.API_URL}/system/dictionary/edit`, + name: "编辑字典明细", + post: async function(data = {}){ + return await http.post(this.url, data); + } + }, + add:{ + url: `${config.API_URL}/system/dictionary/add`, + name: "添加字典明细", + post: async function(data = {}){ + return await http.post(this.url, data); + } + }, + delete:{ + url: `${config.API_URL}/system/dictionary/delete`, + name: "删除字典明细", + post: async function(data = {}){ + return await http.post(this.url, data); + } + }, + detail: { + url: `${config.API_URL}/system/dictionary/detail`, + name: "字典明细", get: async function(params){ return await http.get(this.url, params); } - } - }, - user: { - list: { - url: `${config.API_URL}/system/user/list`, - name: "获取用户列表", - get: async function(params){ - return await http.get(this.url, params); - } - } + }, }, app: { list: { @@ -70,7 +138,7 @@ export default { }, log: { list: { - url: `${config.API_URL}/system/log/list`, + url: `${config.API_URL}/system/log/index`, name: "日志列表", get: async function(params){ return await http.get(this.url, params); diff --git a/ui/src/api/model/user.js b/ui/src/api/model/user.js new file mode 100644 index 0000000..dff984a --- /dev/null +++ b/ui/src/api/model/user.js @@ -0,0 +1,65 @@ +import config from "@/config" +import http from "@/utils/request" + +export default { + list: { + url: `${config.API_URL}/user/user/index`, + name: "获得用户列表", + get: async function(params){ + return await http.get(this.url, params); + } + }, + add: { + url: `${config.API_URL}/user/user/add`, + name: "添加用户", + post: async function(params){ + return await http.post(this.url, params); + } + }, + edit: { + url: `${config.API_URL}/user/user/edit`, + name: "编辑用户", + post: async function(params){ + return await http.post(this.url, params); + } + }, + role: { + list: { + url: `${config.API_URL}/user/role/index`, + name: "获得角色列表", + get: async function(params){ + return await http.get(this.url, params); + } + }, + edit: { + url: `${config.API_URL}/user/role/edit`, + name: "编辑角色", + post: async function(params){ + return await http.post(this.url, params); + } + } + }, + department: { + list: { + url: `${config.API_URL}/user/department/index`, + name: "获得部门列表", + get: async function(params){ + return await http.get(this.url, params); + } + }, + edit: { + url: `${config.API_URL}/user/department/edit`, + name: "编辑部门", + post: async function(params){ + return await http.post(this.url, params); + } + } + }, + userinfo:{ + url: `${config.API_URL}/user/user/info`, + name: "获得部门列表", + get: async function(params){ + return await http.get(this.url, params); + } + } +} \ No newline at end of file diff --git a/ui/src/components/HelloWorld.vue b/ui/src/components/HelloWorld.vue deleted file mode 100644 index d167419..0000000 --- a/ui/src/components/HelloWorld.vue +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - diff --git a/ui/src/config/index.js b/ui/src/config/index.js index b41222c..bd5eea9 100644 --- a/ui/src/config/index.js +++ b/ui/src/config/index.js @@ -1,6 +1,6 @@ const DEFAULT_CONFIG = { //标题 - APP_NAME: "SCUI", + APP_NAME: "管理系统", //首页地址 DASHBOARD_URL: "/dashboard", @@ -12,7 +12,7 @@ const DEFAULT_CONFIG = { CORE_VER: "1.5.0", //接口地址 - API_URL: "/api", + API_URL: "http://localhost:8000/", //请求超时 TIMEOUT: 10000, @@ -51,12 +51,11 @@ const DEFAULT_CONFIG = { //控制台首页默认布局 DEFAULT_GRID: { //默认分栏数量和宽度 例如 [24] [18,6] [8,8,8] [6,12,6] - layout: [12, 6, 6], + layout: [12, 12], //小组件分布,com取值:views/home/components 文件名 copmsList: [ - ['welcome'], - ['about', 'ver'], - ['time', 'progress'] + ['time', 'version'], + ['welcome'] ] } } diff --git a/ui/src/config/select.js b/ui/src/config/select.js index ce71587..0375d52 100644 --- a/ui/src/config/select.js +++ b/ui/src/config/select.js @@ -3,7 +3,7 @@ import API from "@/api"; //字典选择器配置 export default { - dicApiObj: API.system.dic.get, //获取字典接口对象 + dicApiObj: API.system.dictionary.detail, //获取字典接口对象 parseData: function (res) { return { data: res.data, //分析行数据字段结构 @@ -15,7 +15,7 @@ export default { name: 'name' //规定搜索字段 }, props: { - label: 'label', //映射label显示字段 - value: 'value', //映射value值字段 + label: 'name', //映射label显示字段 + value: 'key', //映射value值字段 } } diff --git a/ui/src/config/table.js b/ui/src/config/table.js index 609af9b..778e62b 100644 --- a/ui/src/config/table.js +++ b/ui/src/config/table.js @@ -3,15 +3,15 @@ import tool from '@/utils/tool' export default { - successCode: 200, //请求完成代码 + successCode: 1, //请求完成代码 pageSize: 20, //表格每一页条数 parseData: function (res) { //数据分析 return { data: res.data, //分析无分页的数据字段结构 - rows: res.data.rows, //分析行数据字段结构 + rows: res.data.data, //分析行数据字段结构 total: res.data.total, //分析总数字段结构 summary: res.data.summary, //分析合计行字段结构 - msg: res.message, //分析描述字段结构 + msg: res.msg, //分析描述字段结构 code: res.code //分析状态字段结构 } }, diff --git a/ui/src/config/upload.js b/ui/src/config/upload.js index 0ac0c7c..3551b8a 100644 --- a/ui/src/config/upload.js +++ b/ui/src/config/upload.js @@ -4,7 +4,7 @@ import API from "@/api"; export default { apiObj: API.common.upload, //上传请求API对象 - successCode: 200, //请求完成代码 + successCode: 1, //请求完成代码 maxSize: 10, //最大文件大小 默认10MB parseData: function (res) { return { diff --git a/ui/src/config/workflow.js b/ui/src/config/workflow.js index ceb1305..ac37042 100644 --- a/ui/src/config/workflow.js +++ b/ui/src/config/workflow.js @@ -26,11 +26,11 @@ export default { }, //配置用户 user: { - apiObj: API.demo.page, + apiObj: API.system.page, pageSize: 20, parseData: function (res) { return { - rows: res.data.rows, + rows: res.data.data, total: res.data.total, msg: res.message, code: res.code diff --git a/ui/src/layout/components/userbar.vue b/ui/src/layout/components/userbar.vue index 3b2fe17..82475a1 100644 --- a/ui/src/layout/components/userbar.vue +++ b/ui/src/layout/components/userbar.vue @@ -63,40 +63,12 @@ userName: "", userNameF: "", msg: false, - msgList: [ - { - id: 1, - type: 'user', - avatar: "img/avatar.jpg", - title: "Skuya", - describe: "如果喜欢就点个星星支持一下哦", - link: "https://gitee.com/lolicode/scui", - time: "5分钟前" - }, - { - id: 2, - type: 'user', - avatar: "img/avatar2.gif", - title: "Lolowan", - describe: "点进去Gitee获取最新开源版本", - link: "https://gitee.com/lolicode/scui", - time: "14分钟前" - }, - { - id: 3, - type: 'system', - avatar: "img/logo.png", - title: "感谢登录SCUI Admin", - describe: "Vue 3.0 + Vue-Router 4.0 + ElementPlus + Axios 后台管理系统。", - link: "https://gitee.com/lolicode/scui", - time: "2020年7月24日" - } - ] + msgList: [] } }, created() { var userInfo = this.$TOOL.data.get("USER_INFO"); - this.userName = userInfo.userName; + this.userName = userInfo.username; this.userNameF = this.userName.substring(0,1); }, methods: { diff --git a/ui/src/main.js b/ui/src/main.js index 212abc7..c016ce0 100644 --- a/ui/src/main.js +++ b/ui/src/main.js @@ -1,7 +1,7 @@ import ElementPlus from 'element-plus' import 'element-plus/dist/index.css' import 'element-plus/theme-chalk/display.css' -import scui from './scui' +import sent from './sent' import i18n from './locales' import router from './router' import store from './store' @@ -14,7 +14,7 @@ app.use(store); app.use(router); app.use(ElementPlus, {size: 'default'}); app.use(i18n); -app.use(scui); +app.use(sent); //挂载app app.mount('#app'); diff --git a/ui/src/pages/home/index.vue b/ui/src/pages/home/index.vue new file mode 100644 index 0000000..a7ab9ce --- /dev/null +++ b/ui/src/pages/home/index.vue @@ -0,0 +1,48 @@ + + + + + diff --git a/ui/src/views/home/widgets/components/about.vue b/ui/src/pages/home/widgets/components/about.vue similarity index 100% rename from ui/src/views/home/widgets/components/about.vue rename to ui/src/pages/home/widgets/components/about.vue diff --git a/ui/src/views/home/widgets/components/echarts.vue b/ui/src/pages/home/widgets/components/echarts.vue similarity index 100% rename from ui/src/views/home/widgets/components/echarts.vue rename to ui/src/pages/home/widgets/components/echarts.vue diff --git a/ui/src/views/home/widgets/components/index.js b/ui/src/pages/home/widgets/components/index.js similarity index 100% rename from ui/src/views/home/widgets/components/index.js rename to ui/src/pages/home/widgets/components/index.js diff --git a/ui/src/views/home/widgets/components/progress.vue b/ui/src/pages/home/widgets/components/progress.vue similarity index 100% rename from ui/src/views/home/widgets/components/progress.vue rename to ui/src/pages/home/widgets/components/progress.vue diff --git a/ui/src/pages/home/widgets/components/time.vue b/ui/src/pages/home/widgets/components/time.vue new file mode 100644 index 0000000..7baf81c --- /dev/null +++ b/ui/src/pages/home/widgets/components/time.vue @@ -0,0 +1,41 @@ + + + + + diff --git a/ui/src/pages/home/widgets/components/version.vue b/ui/src/pages/home/widgets/components/version.vue new file mode 100644 index 0000000..d816d72 --- /dev/null +++ b/ui/src/pages/home/widgets/components/version.vue @@ -0,0 +1,37 @@ + + + diff --git a/ui/src/views/home/widgets/components/welcome.vue b/ui/src/pages/home/widgets/components/welcome.vue similarity index 92% rename from ui/src/views/home/widgets/components/welcome.vue rename to ui/src/pages/home/widgets/components/welcome.vue index b1bf536..bd4d280 100644 --- a/ui/src/views/home/widgets/components/welcome.vue +++ b/ui/src/pages/home/widgets/components/welcome.vue @@ -3,7 +3,7 @@
@@ -19,9 +19,6 @@
项目目的:让前端工作更快乐
-
- 文档 -
diff --git a/ui/src/views/home/widgets/index.vue b/ui/src/pages/home/widgets/index.vue similarity index 100% rename from ui/src/views/home/widgets/index.vue rename to ui/src/pages/home/widgets/index.vue diff --git a/ui/src/views/home/work/components/myapp.vue b/ui/src/pages/home/work/components/myapp.vue similarity index 100% rename from ui/src/views/home/work/components/myapp.vue rename to ui/src/pages/home/work/components/myapp.vue diff --git a/ui/src/pages/home/work/index.vue b/ui/src/pages/home/work/index.vue new file mode 100644 index 0000000..c442b83 --- /dev/null +++ b/ui/src/pages/home/work/index.vue @@ -0,0 +1,48 @@ + + + + + diff --git a/ui/src/views/setting/client/index.vue b/ui/src/pages/system/client/index.vue similarity index 100% rename from ui/src/views/setting/client/index.vue rename to ui/src/pages/system/client/index.vue diff --git a/ui/src/views/setting/client/save.vue b/ui/src/pages/system/client/save.vue similarity index 100% rename from ui/src/views/setting/client/save.vue rename to ui/src/pages/system/client/save.vue diff --git a/ui/src/pages/system/department/index.vue b/ui/src/pages/system/department/index.vue new file mode 100644 index 0000000..61b3a36 --- /dev/null +++ b/ui/src/pages/system/department/index.vue @@ -0,0 +1,146 @@ + + + \ No newline at end of file diff --git a/ui/src/pages/system/department/save.vue b/ui/src/pages/system/department/save.vue new file mode 100644 index 0000000..08b7846 --- /dev/null +++ b/ui/src/pages/system/department/save.vue @@ -0,0 +1,118 @@ + + + \ No newline at end of file diff --git a/ui/src/views/setting/dic/dic.vue b/ui/src/pages/system/dic/dic.vue similarity index 73% rename from ui/src/views/setting/dic/dic.vue rename to ui/src/pages/system/dic/dic.vue index fb1092d..bf732b4 100644 --- a/ui/src/views/setting/dic/dic.vue +++ b/ui/src/pages/system/dic/dic.vue @@ -7,8 +7,8 @@ - - + +