Compare commits
31 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
4ffd3eed52 | ||
![]() |
d47ccb586f | ||
![]() |
b81b9b66c8 | ||
![]() |
c3eb2443b6 | ||
![]() |
4696461d72 | ||
![]() |
aabaf99c1b | ||
![]() |
6f28c25a30 | ||
![]() |
667f6353d5 | ||
![]() |
e69cc0e147 | ||
![]() |
e5be0ca2f8 | ||
![]() |
4606f9c792 | ||
![]() |
604c17584f | ||
![]() |
8e63216e63 | ||
![]() |
4bf1658c2e | ||
![]() |
8e0ec2a6a9 | ||
![]() |
90ad443178 | ||
![]() |
324c974505 | ||
![]() |
d93275fa2d | ||
![]() |
832c65275e | ||
![]() |
4b15b2f01c | ||
![]() |
4814521198 | ||
![]() |
6058d1e7e0 | ||
![]() |
5fc2ad54c6 | ||
![]() |
601574f812 | ||
![]() |
e711546d02 | ||
![]() |
96aef3ce94 | ||
![]() |
558ad1271b | ||
![]() |
1d40dd9fe2 | ||
![]() |
07621425dc | ||
![]() |
4008ebdf7e | ||
![]() |
fd82aa75e1 |
51
.workflow/branch-pipeline.yml
Normal file
51
.workflow/branch-pipeline.yml
Normal file
@@ -0,0 +1,51 @@
|
||||
version: '1.0'
|
||||
name: branch-pipeline
|
||||
displayName: BranchPipeline
|
||||
stages:
|
||||
- stage:
|
||||
name: compile
|
||||
displayName: 编译
|
||||
steps:
|
||||
- step: build@php
|
||||
name: build_php
|
||||
displayName: PHP 构建
|
||||
# 支持5.0、7.0、7.1、7.2、7.3、7.4、8.0、8.1八个版本
|
||||
phpVersion: 8.0
|
||||
# 构建命令
|
||||
commands:
|
||||
- php --version
|
||||
# 非必填字段,开启后表示将构建产物暂存,但不会上传到制品库中,7天后自动清除
|
||||
artifacts:
|
||||
# 构建产物名字,作为产物的唯一标识可向下传递,支持自定义,默认为BUILD_ARTIFACT。在下游可以通过${BUILD_ARTIFACT}方式引用来获取构建物地址
|
||||
- name: BUILD_ARTIFACT
|
||||
# 构建产物获取路径,是指代码编译完毕之后构建物的所在路径
|
||||
path:
|
||||
- ./
|
||||
- step: publish@general_artifacts
|
||||
name: publish_general_artifacts
|
||||
displayName: 上传制品
|
||||
# 上游构建任务定义的产物名,默认BUILD_ARTIFACT
|
||||
dependArtifact: BUILD_ARTIFACT
|
||||
# 上传到制品库时的制品命名,默认output
|
||||
artifactName: output
|
||||
dependsOn: build_php
|
||||
- stage:
|
||||
name: release
|
||||
displayName: 发布
|
||||
steps:
|
||||
- step: publish@release_artifacts
|
||||
name: publish_release_artifacts
|
||||
displayName: '发布'
|
||||
# 上游上传制品任务的产出
|
||||
dependArtifact: output
|
||||
# 发布制品版本号
|
||||
version: '1.0.0.0'
|
||||
# 是否开启版本号自增,默认开启
|
||||
autoIncrement: true
|
||||
triggers:
|
||||
push:
|
||||
branches:
|
||||
exclude:
|
||||
- master
|
||||
include:
|
||||
- .*
|
49
.workflow/master-pipeline.yml
Normal file
49
.workflow/master-pipeline.yml
Normal file
@@ -0,0 +1,49 @@
|
||||
version: '1.0'
|
||||
name: master-pipeline
|
||||
displayName: MasterPipeline
|
||||
stages:
|
||||
- stage:
|
||||
name: compile
|
||||
displayName: 编译
|
||||
steps:
|
||||
- step: build@php
|
||||
name: build_php
|
||||
displayName: PHP 构建
|
||||
# 支持5.0、7.0、7.1、7.2、7.3、7.4、8.0、8.1八个版本
|
||||
phpVersion: 8.0
|
||||
# 构建命令
|
||||
commands:
|
||||
- php --version
|
||||
# 非必填字段,开启后表示将构建产物暂存,但不会上传到制品库中,7天后自动清除
|
||||
artifacts:
|
||||
# 构建产物名字,作为产物的唯一标识可向下传递,支持自定义,默认为BUILD_ARTIFACT。在下游可以通过${BUILD_ARTIFACT}方式引用来获取构建物地址
|
||||
- name: BUILD_ARTIFACT
|
||||
# 构建产物获取路径,是指代码编译完毕之后构建物的所在路径
|
||||
path:
|
||||
- ./
|
||||
- step: publish@general_artifacts
|
||||
name: publish_general_artifacts
|
||||
displayName: 上传制品
|
||||
# 上游构建任务定义的产物名,默认BUILD_ARTIFACT
|
||||
dependArtifact: BUILD_ARTIFACT
|
||||
# 上传到制品库时的制品命名,默认output
|
||||
artifactName: output
|
||||
dependsOn: build_php
|
||||
- stage:
|
||||
name: release
|
||||
displayName: 发布
|
||||
steps:
|
||||
- step: publish@release_artifacts
|
||||
name: publish_release_artifacts
|
||||
displayName: '发布'
|
||||
# 上游上传制品任务的产出
|
||||
dependArtifact: output
|
||||
# 发布制品版本号
|
||||
version: '1.0.0.0'
|
||||
# 是否开启版本号自增,默认开启
|
||||
autoIncrement: true
|
||||
triggers:
|
||||
push:
|
||||
branches:
|
||||
include:
|
||||
- master
|
36
.workflow/pr-pipeline.yml
Normal file
36
.workflow/pr-pipeline.yml
Normal file
@@ -0,0 +1,36 @@
|
||||
version: '1.0'
|
||||
name: pr-pipeline
|
||||
displayName: PRPipeline
|
||||
stages:
|
||||
- stage:
|
||||
name: compile
|
||||
displayName: 编译
|
||||
steps:
|
||||
- step: build@php
|
||||
name: build_php
|
||||
displayName: PHP 构建
|
||||
# 支持5.0、7.0、7.1、7.2、7.3、7.4、8.0、8.1八个版本
|
||||
phpVersion: 8.0
|
||||
# 构建命令
|
||||
commands:
|
||||
- php --version
|
||||
# 非必填字段,开启后表示将构建产物暂存,但不会上传到制品库中,7天后自动清除
|
||||
artifacts:
|
||||
# 构建产物名字,作为产物的唯一标识可向下传递,支持自定义,默认为BUILD_ARTIFACT。在下游可以通过${BUILD_ARTIFACT}方式引用来获取构建物地址
|
||||
- name: BUILD_ARTIFACT
|
||||
# 构建产物获取路径,是指代码编译完毕之后构建物的所在路径
|
||||
path:
|
||||
- ./
|
||||
- step: publish@general_artifacts
|
||||
name: publish_general_artifacts
|
||||
displayName: 上传制品
|
||||
# 上游构建任务定义的产物名,默认BUILD_ARTIFACT
|
||||
dependArtifact: BUILD_ARTIFACT
|
||||
# 上传到制品库时的制品命名,默认output
|
||||
artifactName: output
|
||||
dependsOn: build_php
|
||||
triggers:
|
||||
pr:
|
||||
branches:
|
||||
include:
|
||||
- master
|
33
README.md
33
README.md
@@ -3,11 +3,19 @@
|
||||
|
||||
[中文](./README.md)|[英文](./README-en.md)
|
||||
|
||||
## 专业版
|
||||
[专业版本官方地址](https://license.catchadmin.com)
|
||||
|
||||
首先感谢一直以来对 `CatchAdmin` 开源项目的支持和使用。作为一名开源工作者,我一直致力于开发出功能强大且易于使用的后台管理系统,以帮助您简化业务流程和提升工作效率。然而,由于某些原因,我不得不做出一些调整。为了能够继续开发和维护这个项目,我将推出一款付费的后台管理系统,以确保我能够持续为您提供高质量的服务和支持。
|
||||
|
||||
专业版本不会在开源版本做一些破坏性变更,所以当您从开源版本切换到专业版本,不会有任何开发心智负担。但是使用专业版本会有新的组件来配合您的工作。
|
||||
|
||||
我深信,付费后台管理系统将为您带来更多的价值和便利,帮助您提升工作效率
|
||||
|
||||
|
||||
## ⚠️Thinkphp 用户注意
|
||||
由于新版本使用 `Laravel` 开发,所以请使用 `thinkphp` 分支或者 tag2.6.2,thinkphp 版本已经非常稳定了。
|
||||
|
||||
## 为什么是 Laravel
|
||||
`V2` 版本使用`Thinkphp`,但从其社区来看,从我个人角度来看开发组的心思已经不在维护框架上,因为据观察,每一次小版本发布都会引发一些小问题,虽然不大,但给人一种不够稳定的感觉,所以思索再三,使用 `Laravel`。`Laravel` 社区非常繁荣,他们每周都会发布新版本,以及围绕`Laravel`构建的生态也非常完善,有 `Horizon` 队列管理工具, `Telescope` 调试工具,`Octane`(基于 `Swoole` 和 `RoadRunner` 提高性能)等等一系列的工具,而且都是免费的。
|
||||
[thinkphp 8.0 仓库,开发中...](https://gitee.com/catchamin/catchadmin-tp)
|
||||
|
||||
## 功能
|
||||
- [x] 用户管理 后台用户管理
|
||||
@@ -21,6 +29,14 @@
|
||||
- [x] Schema 管理 生成表结构
|
||||
- [x] 模块管理 系统模块管理
|
||||
|
||||
|
||||
## 讨论
|
||||
- 可以提 `ISSUE`,请按照 `issue` 模板提问
|
||||
- 加入 Q 群 `302266230` 暗号 `catchadmin`。
|
||||
- 加微信入群,新建🆕
|
||||
|
||||
<img src="wechat.png" width="300"/>
|
||||
|
||||
## 额外模块
|
||||
- [CMS 模块](https://github.com/catch-admin/cms)
|
||||
|
||||
@@ -45,11 +61,6 @@
|
||||
- [catchadmin 开发之模块创建](https://www.bilibili.com/video/BV1jP41127aW/)
|
||||
- [catchadmin 之快速开发](https://www.bilibili.com/video/BV1Qh4y1J7eB/)
|
||||
|
||||
## 赞助
|
||||
如果项目对你有帮助,或者在工作上帮你节省了开发时间。在力所能及的情况下,可以支持下`Catchadmin`项目, 非常感谢🙏
|
||||
|
||||
<img src="https://i.imgtg.com/2023/02/16/dAV0a.jpg" width = "200" alt="support"/>
|
||||
|
||||
## 规范
|
||||
### PHP
|
||||
使用 fixer 进行代码检查, 具体请查看根目录下 `.php-cs-fixer.dist.php` 文件的规范,还需要进行以下两步骤
|
||||
@@ -68,12 +79,6 @@ composer cs
|
||||
composer cs-diff
|
||||
```
|
||||
|
||||
## 讨论
|
||||
- [论坛讨论](https://bbs.catchadmin.com)
|
||||
- 可以提 `ISSUE`,请按照 `issue` 模板提问
|
||||
- 加入 Q 群 `302266230` 暗号 `catchadmin`。
|
||||
|
||||
|
||||
## 感谢🙏
|
||||
> 排名不分先后
|
||||
|
||||
|
@@ -18,7 +18,7 @@
|
||||
"guzzlehttp/guzzle": "^7.2",
|
||||
"laravel/framework": "^10.0",
|
||||
"laravel/tinker": "^2.8",
|
||||
"catchadmin/core": "^0.2.1"
|
||||
"catchadmin/core": "^0.2.7"
|
||||
},
|
||||
"require-dev": {
|
||||
"fakerphp/faker": "^1.9.1",
|
||||
@@ -42,7 +42,8 @@
|
||||
"scripts": {
|
||||
"post-autoload-dump": [
|
||||
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
||||
"@php artisan package:discover --ansi"
|
||||
"@php artisan package:discover --ansi",
|
||||
"@composer dump-autoload --no-scripts"
|
||||
],
|
||||
"post-update-cmd": [
|
||||
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
|
||||
|
@@ -185,7 +185,6 @@ return [
|
||||
/*
|
||||
* Package Service Providers...
|
||||
*/
|
||||
\Catch\Providers\CatchAdminServiceProvider::class,
|
||||
|
||||
/*
|
||||
* Application Service Providers...
|
||||
|
@@ -20,23 +20,27 @@ class Components implements OptionInterface
|
||||
|
||||
public function get(): array
|
||||
{
|
||||
if ($module = request()->get('module')) {
|
||||
$components = File::glob(CatchAdmin::getModuleViewsPath($module).'*'.DIRECTORY_SEPARATOR.'*.vue');
|
||||
try {
|
||||
if ($module = request()->get('module')) {
|
||||
$components = File::glob(CatchAdmin::getModuleViewsPath($module) . '*' . DIRECTORY_SEPARATOR . '*.vue');
|
||||
|
||||
foreach ($components as $component) {
|
||||
$_component = Str::of($component)
|
||||
->replace(CatchAdmin::moduleRootPath(), '')
|
||||
->explode(DIRECTORY_SEPARATOR);
|
||||
$_component->shift(2);
|
||||
foreach ($components as $component) {
|
||||
$_component = Str::of($component)
|
||||
->replace(CatchAdmin::moduleRootPath(), '')
|
||||
->explode(DIRECTORY_SEPARATOR);
|
||||
$_component->shift(2);
|
||||
|
||||
$this->components[] = [
|
||||
'label' => Str::of($_component->implode('/'))->replace('.vue', ''),
|
||||
$this->components[] = [
|
||||
'label' => Str::of($_component->implode('/'))->replace('.vue', ''),
|
||||
|
||||
'value' => Str::of($component)->replace(CatchAdmin::moduleRootPath(), '')->prepend('/')
|
||||
];
|
||||
'value' => Str::of($component)->replace(CatchAdmin::moduleRootPath(), '')->prepend('/')
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->components;
|
||||
return $this->components;
|
||||
} catch (\Throwable $exception) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -81,6 +81,13 @@ class Module
|
||||
*/
|
||||
protected function createRoute(): void
|
||||
{
|
||||
File::copy(__DIR__.DIRECTORY_SEPARATOR.'stubs'.DIRECTORY_SEPARATOR.'route.stub', CatchAdmin::getModuleRoutePath($this->module));
|
||||
$content = Str::of(
|
||||
File::get(__DIR__.DIRECTORY_SEPARATOR.'stubs'.DIRECTORY_SEPARATOR.'route.stub')
|
||||
)->replace(['{module}'], [lcfirst($this->module)]);
|
||||
|
||||
File::put(
|
||||
CatchAdmin::getModuleRoutePath($this->module),
|
||||
$content
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -21,7 +21,7 @@ class {request} extends Request
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function message(): array
|
||||
public function messages(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@
|
||||
{ label: 'ZIP 安装', value: 2 },
|
||||
]"
|
||||
:key="item.value"
|
||||
:label="item.value"
|
||||
:value="item.value"
|
||||
name="type"
|
||||
>{{ item.label }}
|
||||
</el-radio-button>
|
||||
|
@@ -28,7 +28,9 @@ class PermissionsController extends Controller
|
||||
public function index(Request $request): mixed
|
||||
{
|
||||
if ($request->get('from') == 'role') {
|
||||
return $this->model->getList();
|
||||
return $this->model->setBeforeGetList(function ($query){
|
||||
return $query->orderByDesc('sort');
|
||||
})->getList();
|
||||
}
|
||||
|
||||
return $this->model->setBeforeGetList(function ($query) {
|
||||
|
@@ -6,6 +6,7 @@ namespace Modules\Permissions\Http\Controllers;
|
||||
|
||||
use Catch\Base\CatchController as Controller;
|
||||
use Catch\Exceptions\FailedException;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Http\Request;
|
||||
use Modules\Permissions\Enums\DataRange;
|
||||
use Modules\Permissions\Models\Roles;
|
||||
@@ -41,9 +42,13 @@ class RolesController extends Controller
|
||||
public function store(RoleRequest $request)
|
||||
{
|
||||
$data = $request->all();
|
||||
$data['data_range'] = (int) $data['data_range'];
|
||||
if (!$data['data_range'] || !DataRange::Personal_Choose->assert($data['data_range'])) {
|
||||
$data['departments'] = [];
|
||||
if (!isset($data['data_range'])) {
|
||||
$data['data_range'] = 0;
|
||||
} else {
|
||||
$data['data_range'] = (int)$data['data_range'];
|
||||
if (!DataRange::Personal_Choose->assert($data['data_range'])) {
|
||||
$data['departments'] = [];
|
||||
}
|
||||
}
|
||||
|
||||
return $this->model->storeBy($data);
|
||||
@@ -52,7 +57,8 @@ class RolesController extends Controller
|
||||
/**
|
||||
*
|
||||
* @param $id
|
||||
* @return \Illuminate\Database\Eloquent\Model|null
|
||||
* @param Request $request
|
||||
* @return Model|null
|
||||
*/
|
||||
public function show($id, Request $request)
|
||||
{
|
||||
@@ -79,7 +85,7 @@ class RolesController extends Controller
|
||||
{
|
||||
$data = $request->all();
|
||||
$data['data_range'] = (int) $data['data_range'];
|
||||
if (!$data['data_range'] || !DataRange::Personal_Choose->assert($data['data_range'])) {
|
||||
if (!DataRange::Personal_Choose->assert($data['data_range'])) {
|
||||
$data['departments'] = [];
|
||||
}
|
||||
|
||||
|
@@ -200,7 +200,9 @@ class Permissions extends Model
|
||||
$data['route'] = '/'.trim($data['route'], '/');
|
||||
}
|
||||
|
||||
$data['component'] = Str::of($data['component'])->replace('\\', '/')->toString();
|
||||
if (isset($data['component'])) {
|
||||
$data['component'] = Str::of($data['component'])->replace('\\', '/')->toString();
|
||||
}
|
||||
return parent::storeBy($data);
|
||||
});
|
||||
}
|
||||
@@ -246,7 +248,9 @@ class Permissions extends Model
|
||||
$data['permission_mark'] = $parentMenu->permission_mark.'@'.$data['permission_mark'];
|
||||
}
|
||||
|
||||
$data['component'] = Str::of($data['component'])->replace('\\', '/')->toString();
|
||||
if (isset($data['component'])) {
|
||||
$data['component'] = Str::of($data['component'])->replace('\\', '/')->toString();
|
||||
}
|
||||
return parent::updateBy($id, $data);
|
||||
}
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-radio-group v-model="formData.status">
|
||||
<el-radio v-for="item in options" :key="item.value" :label="item.value" name="status">{{ item.label }}</el-radio>
|
||||
<el-radio v-for="item in options" :key="item.value" :value="item.value" name="status">{{ item.label }}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" prop="sort">
|
||||
@@ -30,7 +30,7 @@ import { useShow } from '/admin/composables/curd/useShow'
|
||||
import { onMounted } from 'vue'
|
||||
|
||||
const props = defineProps({
|
||||
primary: String | Number,
|
||||
primary: [Number, String],
|
||||
api: String,
|
||||
})
|
||||
|
||||
|
@@ -11,7 +11,7 @@
|
||||
{ label: '按钮', value: 3 },
|
||||
]"
|
||||
:key="item.value"
|
||||
:label="item.value"
|
||||
:value="item.value"
|
||||
name="type"
|
||||
>{{ item.label }}
|
||||
</el-radio-button>
|
||||
@@ -63,7 +63,7 @@
|
||||
{ label: '隐藏', value: 2 },
|
||||
]"
|
||||
:key="item.value"
|
||||
:label="item.value"
|
||||
:value="item.value"
|
||||
name="hidden"
|
||||
>{{ item.label }}</el-radio
|
||||
>
|
||||
@@ -77,7 +77,7 @@
|
||||
{ label: '禁用', value: 2 },
|
||||
]"
|
||||
:key="item.value"
|
||||
:label="item.value"
|
||||
:value="item.value"
|
||||
name="keepalive"
|
||||
>{{ item.label }}
|
||||
</el-radio>
|
||||
@@ -110,7 +110,7 @@ import http from '/admin/support/http'
|
||||
import { MenuType } from '/admin/enum/app'
|
||||
|
||||
const props = defineProps({
|
||||
primary: String | Number,
|
||||
primary: [String,Number],
|
||||
api: String,
|
||||
})
|
||||
|
||||
|
@@ -18,10 +18,10 @@
|
||||
<el-tag v-for="action in scope.row.actions" class="cursor-pointer min-w-fit" @click="open(action.id)" closable @close="destroy(api, action.id)">{{ action.permission_name }}</el-tag>
|
||||
</div>
|
||||
<div v-else>
|
||||
<el-popconfirm confirm-button-text="确认" title="添加基础actions" @confirm="actionGenerate(scope.row.id)" placement="top">
|
||||
<el-popconfirm v-if="scope.row.type === MenuType.PAGE_TYPE" confirm-button-text="确认" title="添加基础actions" @confirm="actionGenerate(scope.row.id)" placement="top">
|
||||
<template #reference>
|
||||
<el-tag class="cursor-pointer w-8" v-if="scope.row.type === MenuType.PAGE_TYPE">
|
||||
<Icon name="cog-6-tooth" class="animate-spin w-5 h-5" v-if="actionLoading" />
|
||||
<el-tag class="cursor-pointer w-8">
|
||||
<Icon name="cog-6-tooth" class="animate-spin w-5 h-5" v-if="generateId === scope.row.id" />
|
||||
<Icon name="plus" className="w-4 h-4" v-else />
|
||||
</el-tag>
|
||||
</template>
|
||||
@@ -73,11 +73,18 @@ onMounted(() => {
|
||||
})
|
||||
|
||||
const actionLoading = ref<boolean>(false)
|
||||
const generateId = ref<number>(0)
|
||||
const actionGenerate = async (id: number) => {
|
||||
actionLoading.value = true
|
||||
http.post(api, { parent_id: id, actions: true }).then(r => {
|
||||
search()
|
||||
actionLoading.value = false
|
||||
})
|
||||
generateId.value = id
|
||||
http
|
||||
.post(api, { parent_id: id, actions: true })
|
||||
.then(r => {
|
||||
search()
|
||||
generateId.value = 0
|
||||
})
|
||||
.catch(e => {
|
||||
generateId.value = 0
|
||||
catchtable.value.reset()
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
@@ -22,11 +22,17 @@ class AuthController extends Controller
|
||||
/* @var User $user */
|
||||
$user = User::query()->where('email', $request->get('email'))->first();
|
||||
|
||||
Event::dispatch(new Login($request, $user));
|
||||
Event::dispatch(new Login($request, $user ? ($user->isDisabled() ? null : $user) : null));
|
||||
|
||||
if ($user && Hash::check($request->get('password'), $user->password)) {
|
||||
$token = $user->createToken('token')->plainTextToken;
|
||||
return compact('token');
|
||||
if ($user) {
|
||||
if ($user->isDisabled()) {
|
||||
throw new FailedException('账号被禁用,请联系管理员');
|
||||
}
|
||||
|
||||
if (Hash::check($request->get('password'), $user->password)) {
|
||||
$token = $user->createToken('token')->plainTextToken;
|
||||
return compact('token');
|
||||
}
|
||||
}
|
||||
|
||||
throw new FailedException('登录失败!请检查邮箱或者密码');
|
||||
|
@@ -3,6 +3,7 @@
|
||||
namespace Modules\User\Models;
|
||||
|
||||
use Catch\Base\CatchModel as Model;
|
||||
use Catch\Enums\Status;
|
||||
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
@@ -102,4 +103,10 @@ class User extends Model implements AuthenticatableContract
|
||||
|
||||
return parent::updateBy($id, $data);
|
||||
}
|
||||
|
||||
public function isDisabled(): bool
|
||||
{
|
||||
|
||||
return $this->status == Status::Disable->value;
|
||||
}
|
||||
}
|
||||
|
@@ -2,8 +2,8 @@
|
||||
<div class="table-default">
|
||||
<div class="w-full flex justify-end">
|
||||
<el-radio-group v-model="query.scope" size="small" @change="search">
|
||||
<el-radio-button label="self">只看自己</el-radio-button>
|
||||
<el-radio-button label="all">全部</el-radio-button>
|
||||
<el-radio-button value="self">只看自己</el-radio-button>
|
||||
<el-radio-button value="all">全部</el-radio-button>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
<el-table :data="tableData" class="mt-3" v-loading="loading">
|
||||
|
58
package.json
58
package.json
@@ -8,48 +8,48 @@
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"@heroicons/vue": "^2.0.18",
|
||||
"@tinymce/tinymce-vue": "^5.1.0",
|
||||
"@vueuse/core": "^10.1.2",
|
||||
"element-plus": "^2.3.5",
|
||||
"@heroicons/vue": "^2.1.3",
|
||||
"@tinymce/tinymce-vue": "^5.1.1",
|
||||
"@vueuse/core": "^10.9.0",
|
||||
"element-plus": "^2.6.2",
|
||||
"nprogress": "^0.2.0",
|
||||
"pinia": "^2.1.3",
|
||||
"terser": "^5.16.6",
|
||||
"vue": "^3.3.4",
|
||||
"pinia": "^2.1.7",
|
||||
"terser": "^5.29.2",
|
||||
"vue": "^3.4.21",
|
||||
"vue-i18n": "9",
|
||||
"vue-router": "4.2.1",
|
||||
"vue-router": "4.3.0",
|
||||
"vuedraggable": "^2.24.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@iconify-json/logos": "^1.1.31",
|
||||
"@rollup/plugin-alias": "^5.0.0",
|
||||
"@iconify-json/logos": "^1.1.42",
|
||||
"@rollup/plugin-alias": "^5.1.0",
|
||||
"@types/mockjs": "^1.0.7",
|
||||
"@types/node": "^20.2.3",
|
||||
"@types/node": "^20.11.30",
|
||||
"@types/nprogress": "^0.2.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.59.7",
|
||||
"@typescript-eslint/parser": "^5.59.7",
|
||||
"@vitejs/plugin-vue": "^4.2.3",
|
||||
"@vitejs/plugin-vue-jsx": "^3.0.1",
|
||||
"autoprefixer": "^10.4.14",
|
||||
"axios": "^1.4.0",
|
||||
"eslint": "^8.41.0",
|
||||
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
||||
"@typescript-eslint/parser": "^6.21.0",
|
||||
"@vitejs/plugin-vue": "^5.0.4",
|
||||
"@vitejs/plugin-vue-jsx": "^3.1.0",
|
||||
"autoprefixer": "^10.4.19",
|
||||
"axios": "^1.6.8",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-standard": "^17.0.0",
|
||||
"eslint-plugin-import": "^2.27.5",
|
||||
"eslint-plugin-n": "^16.0.0",
|
||||
"eslint-plugin-promise": "^6.1.1",
|
||||
"eslint-plugin-vue": "^9.14.0",
|
||||
"eslint-plugin-vue": "^9.23.0",
|
||||
"mockjs": "^1.1.0",
|
||||
"postcss": "^8.4.23",
|
||||
"prettier": "2.8.8",
|
||||
"sass": "^1.62.1",
|
||||
"tailwindcss": "^3.3.2",
|
||||
"typescript": "^5.0.4",
|
||||
"unplugin-auto-import": "^0.16.2",
|
||||
"unplugin-icons": "^0.16.1",
|
||||
"unplugin-vue-components": "^0.24.0",
|
||||
"vite": "^4.3.8",
|
||||
"postcss": "^8.4.38",
|
||||
"prettier": "3.2.5",
|
||||
"sass": "^1.72.0",
|
||||
"tailwindcss": "^3.4.1",
|
||||
"typescript": "^5.4.3",
|
||||
"unplugin-auto-import": "^0.17.5",
|
||||
"unplugin-icons": "^0.18.5",
|
||||
"unplugin-vue-components": "^0.26.0",
|
||||
"vite": "^5.2.3",
|
||||
"vite-plugin-html": "^3.2.0",
|
||||
"vite-plugin-mock": "^3.0.0",
|
||||
"vue-tsc": "^1.6.5"
|
||||
"vue-tsc": "^2.0.7"
|
||||
}
|
||||
}
|
||||
|
@@ -12,7 +12,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<slot />
|
||||
<div class="pt-4">
|
||||
<slot />
|
||||
</div>
|
||||
<template #footer v-if="showFooter">
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="close">{{ $t('system.cancel') }}</el-button>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="flex justify-end pt-5">
|
||||
<el-pagination background :layout="layout" :current-page="page" :page-size="limit" @current-change="changePage" @size-change="changeLimit" :total="total" :page-sizes="pageSizes" />
|
||||
<el-pagination background :layout="layout" :current-page="page" :page-size="limit" @current-change="changePage" @size-change="changeLimit" :total="parseInt(total)" :page-sizes="pageSizes" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -14,12 +14,10 @@ const pageSizes = [10, 20, 30, 50]
|
||||
interface paginate {
|
||||
page: number
|
||||
limit: number
|
||||
total: number
|
||||
total: string
|
||||
changePage: number
|
||||
changeLimit: number
|
||||
}
|
||||
|
||||
const { page, limit, total, changePage, changeLimit } = inject('paginate') as paginate
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
|
@@ -8,7 +8,7 @@ function checkAction(el: any, action: any) {
|
||||
action = action.value.replace('@', '.').toLowerCase()
|
||||
const hasAction = permissions?.some(permission => {
|
||||
if (permission.type === MenuType.Button_Type) {
|
||||
const a: string = permission.module + '.' + permission.permission_mark.replace('@', '.')
|
||||
const a: string = permission.module + '.' + permission.permission_mark.replaceAll('@', '.')
|
||||
return action === a.toLowerCase()
|
||||
}
|
||||
})
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<el-sub-menu :index="menu?.path" :class="subMenuClass" v-if="menu?.children?.length">
|
||||
<el-sub-menu :index="menu?.path" :class="subMenuClass" v-if="menu?.children?.length" :key="menu?.path">
|
||||
<template #title>
|
||||
<el-icon>
|
||||
<Icon :name="menu?.meta?.icon" v-if="menu?.meta?.icon" class="text-sm" />
|
||||
@@ -9,7 +9,7 @@
|
||||
<slot />
|
||||
</el-sub-menu>
|
||||
|
||||
<el-menu-item v-else class="ct-menu-item" :index="menu?.path" @click="isMiniScreen() && store.changeExpaned()">
|
||||
<el-menu-item v-else class="ct-menu-item" :index="menu?.path" @click="isMiniScreen() && store.changeExpaned()" :key="menu?.name">
|
||||
<el-icon>
|
||||
<Icon :name="menu?.meta?.icon" v-if="menu?.meta?.icon" class="text-sm" />
|
||||
</el-icon>
|
||||
|
@@ -14,8 +14,25 @@
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
import { useAppStore } from '/admin/stores/modules/app'
|
||||
import { watch } from 'vue'
|
||||
import router from '/admin/router'
|
||||
import { useNavTabStore } from '/admin/stores/modules/tabs'
|
||||
|
||||
const appStore = useAppStore()
|
||||
const navTabStore = useNavTabStore()
|
||||
watch(() => router.currentRoute, (to, from) => {
|
||||
const tab: any = {
|
||||
name: to.value.name,
|
||||
fullPath: to.value.fullPath,
|
||||
path: to.value.path,
|
||||
is_active: true,
|
||||
meta: {
|
||||
title: to.value.meta.title,
|
||||
affix: false,
|
||||
}
|
||||
}
|
||||
navTabStore.addTabs(tab)
|
||||
}, {deep:true, immediate:true})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
|
70
resources/admin/layout/components/header/contextMenu.vue
Normal file
70
resources/admin/layout/components/header/contextMenu.vue
Normal file
@@ -0,0 +1,70 @@
|
||||
<template>
|
||||
<div @contextmenu.prevent="handleContextMenu" class="flex gap-x-2">
|
||||
<slot></slot>
|
||||
<!-- 右击菜单 -->
|
||||
<div v-if="showMenu" class="absolute z-[1000] bg-white dark:bg-regal-dark shadow-xl rounded border border-gray-200" :style="{ top: `${position.y}px`, left: `${position.x}px` }">
|
||||
<ul class="w-20 text-center py-1">
|
||||
<li v-for="(item, index) in menuItems" :key="index" @click="item.action()" class="hover:bg-gray-50 px-2 py-1 hover:cursor-pointer text-[12px]">
|
||||
{{ item.label }}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, onUnmounted } from 'vue';
|
||||
import { useNavTabStore } from '/admin/stores/modules/tabs';
|
||||
|
||||
const navTabStore = useNavTabStore();
|
||||
interface MenuItem {
|
||||
label: string;
|
||||
action: Function;
|
||||
}
|
||||
|
||||
const position = reactive({ x: 0, y: 0 });
|
||||
const showMenu = ref(false);
|
||||
const menuItems = ref<Array<MenuItem>>([
|
||||
{ label: '刷新', action: () => {
|
||||
navTabStore.refreshCurrentTab();
|
||||
}
|
||||
},
|
||||
{ label: '关闭', action: () => {
|
||||
navTabStore.removeCurrentTab();
|
||||
}
|
||||
},
|
||||
{ label: '关闭其他', action: () => { navTabStore.removeOtherTabs() } },
|
||||
{ label: '关闭所有', action: () => { navTabStore.removeAllTabs() } },
|
||||
]);
|
||||
|
||||
const handleContextMenu = (event: MouseEvent) => {
|
||||
event.preventDefault();
|
||||
position.x = event.clientX;
|
||||
position.y = event.clientY;
|
||||
showMenu.value = true;
|
||||
};
|
||||
|
||||
const handleClickOutside = () => {
|
||||
showMenu.value = false;
|
||||
};
|
||||
|
||||
window.addEventListener('click', handleClickOutside);
|
||||
|
||||
onUnmounted(() => {
|
||||
window.removeEventListener('click', handleClickOutside);
|
||||
});
|
||||
|
||||
const handleMenuItemClick = (action: string) => {
|
||||
console.log('执行操作:', action);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.context-menu {
|
||||
position: absolute;
|
||||
background-color: #fff;
|
||||
border: 1px solid #ccc;
|
||||
box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
|
||||
z-index: 1000;
|
||||
}
|
||||
</style>
|
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="flex flex-row h-16 w-full drop-shadow border-l dark:border-l-0 border-gray-200" style="background-color: var(--header-bg-color)">
|
||||
<div class="flex flex-row justify-between w-full h-16">
|
||||
<div class="flex flex-row h-14 w-full drop-shadow border-l border-gray-200" style="background-color: var(--header-bg-color)">
|
||||
<div class="flex flex-row justify-between w-full h-14">
|
||||
<div class="flex flex-row min-w-[17rem]">
|
||||
<div class="h-full flex items-center w-8 ml-2 hover:cursor-pointer" @click="store.changeExpaned">
|
||||
<Icon name="list-bullet" class="w-6 h-8" />
|
||||
@@ -24,11 +24,12 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<Tabs/>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { useAppStore } from '/admin/stores/modules/app'
|
||||
import Notification from './notification.vue'
|
||||
import MenuSearch from './menuSearch.vue'
|
||||
|
||||
import Tabs from './tabs.vue'
|
||||
const store = useAppStore()
|
||||
</script>
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="w-10 h-10 grid place-items-center rounded-full mt-3 hover:cursor-pointer">
|
||||
<div class="w-10 h-10 grid place-items-center rounded-full mt-2 hover:cursor-pointer">
|
||||
<div class="flex hover:cursor-pointer pl-1 pr-1">
|
||||
<el-dropdown size="large" class="flex items-center justify-center hover:cursor-pointer w-full" @command="selectLanguage">
|
||||
<Icon name="language" />
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="w-10 h-10 grid place-items-center rounded-full mt-3 hover:cursor-pointer">
|
||||
<div class="w-10 h-10 grid place-items-center rounded-full mt-2 hover:cursor-pointer">
|
||||
<div class="flex flex-row w-96">
|
||||
<Icon name="magnifying-glass" class="hidden sm:block" @click="searchMenuVisiable = true" />
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<!-- 通知 -->
|
||||
<div class="w-10 h-10 grid place-items-center rounded-full mt-3 hover:cursor-pointer" ref="messageRef" v-click-outside="onClickOutside">
|
||||
<div class="w-10 h-10 grid place-items-center rounded-full mt-2 hover:cursor-pointer" ref="messageRef" v-click-outside="onClickOutside">
|
||||
<el-badge :value="3">
|
||||
<Icon name="bell" />
|
||||
</el-badge>
|
||||
|
29
resources/admin/layout/components/header/tabs.vue
Normal file
29
resources/admin/layout/components/header/tabs.vue
Normal file
@@ -0,0 +1,29 @@
|
||||
<script setup lang="ts">
|
||||
import { useNavTabStore } from '/admin/stores/modules/tabs'
|
||||
import ContextMenu from './contextMenu.vue'
|
||||
import { computed, ref, onMounted,onBeforeUnmount, watch } from 'vue'
|
||||
const navTabStore = useNavTabStore()
|
||||
const tabs = computed(() => navTabStore.getNavTabs)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="h-10 bg-white dark:bg-regal-dark px-1 sm:px-3 w-full flex gap-x-2" ref="container" v-if="tabs.length > 0">
|
||||
<ContextMenu>
|
||||
<el-tag
|
||||
class="mt-1.5 hover:cursor-pointer"
|
||||
v-for="(tag, index) in tabs" :key="index"
|
||||
:closable="!tag.meta.affix"
|
||||
:disable-transitions="false"
|
||||
:effect="tag.is_active ? 'dark' : 'plain'"
|
||||
@click.prevent="navTabStore.selectTab(tag)"
|
||||
@close="navTabStore.removeTab(index)"
|
||||
>
|
||||
{{ tag.meta.title }}
|
||||
</el-tag>
|
||||
</ContextMenu>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="w-10 h-10 grid place-items-center rounded-full mt-3 hover:cursor-pointer">
|
||||
<div class="w-10 h-10 grid place-items-center rounded-full mt-2 hover:cursor-pointer">
|
||||
<Icon name="moon" @click="changeTheme()" v-if="isDark" />
|
||||
<Icon name="sun" @click="changeTheme()" v-else />
|
||||
</div>
|
||||
|
124
resources/admin/stores/modules/tabs/index.ts
Normal file
124
resources/admin/stores/modules/tabs/index.ts
Normal file
@@ -0,0 +1,124 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import router from '/admin/router'
|
||||
interface meta {
|
||||
title: string
|
||||
affix: boolean
|
||||
}
|
||||
interface tab {
|
||||
name: string
|
||||
fullPath: string
|
||||
path: string
|
||||
is_active:boolean,
|
||||
meta: meta
|
||||
}
|
||||
|
||||
const defaultTab: tab = {
|
||||
name: 'Dashboard',
|
||||
fullPath: '/dashboard',
|
||||
path: '/dashboard',
|
||||
is_active: true,
|
||||
meta: {
|
||||
title: 'Dashboard',
|
||||
affix: true,
|
||||
},
|
||||
}
|
||||
|
||||
export const useNavTabStore = defineStore('nav_tabs', {
|
||||
state: ()=> {
|
||||
return {
|
||||
tabs: [defaultTab] as Array<tab>,
|
||||
}
|
||||
},
|
||||
|
||||
getters: {
|
||||
getNavTabs(state): Array<tab> {
|
||||
return state.tabs
|
||||
},
|
||||
},
|
||||
|
||||
actions: {
|
||||
addTabs(Tab: tab): void {
|
||||
if (this.tabs.length >= 20) {
|
||||
console.log('最多添加 20 个 tab 标签');
|
||||
return;
|
||||
}
|
||||
|
||||
let isExist = false
|
||||
|
||||
this.tabs.map(t => {
|
||||
if (t.name === Tab.name) {
|
||||
isExist = true
|
||||
t.is_active = true
|
||||
} else {
|
||||
t.is_active = false
|
||||
}
|
||||
})
|
||||
|
||||
if (!isExist) {
|
||||
this.tabs.push(Tab)
|
||||
}
|
||||
},
|
||||
|
||||
getActiveTabIndex(): number|null {
|
||||
for (let i = 0; i < this.tabs.length; i++) {
|
||||
if (this.tabs[i].is_active) {
|
||||
return i
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
},
|
||||
|
||||
selectTab(tab: tab): void {
|
||||
this.tabs.map(t => {
|
||||
if (t.name === tab.name) {
|
||||
t.is_active = true
|
||||
} else {
|
||||
t.is_active = false
|
||||
}
|
||||
})
|
||||
|
||||
router.push(tab.fullPath)
|
||||
},
|
||||
|
||||
removeTab(index: number): void {
|
||||
const goPath = this.tabs[index - 1].fullPath
|
||||
this.tabs = this.tabs.filter((_, idx) => idx !== index);
|
||||
router.push(goPath)
|
||||
},
|
||||
|
||||
|
||||
// 右击菜单操作
|
||||
// 刷新
|
||||
refreshCurrentTab() {
|
||||
const index = this.getActiveTabIndex()
|
||||
if (index) {
|
||||
router.replace({ path: this.tabs[index].fullPath });
|
||||
|
||||
// router.push({ path: this.tabs[index].fullPath });
|
||||
}
|
||||
},
|
||||
// 关闭当前
|
||||
removeCurrentTab() {
|
||||
const index = this.getActiveTabIndex()
|
||||
if (index) {
|
||||
if (this.tabs[index].meta.affix) {
|
||||
return
|
||||
}
|
||||
this.removeTab(index)
|
||||
}
|
||||
},
|
||||
// 关闭所有
|
||||
removeAllTabs() {
|
||||
this.tabs = [defaultTab]
|
||||
router.push('/dashboard')
|
||||
},
|
||||
// 关闭其他
|
||||
removeOtherTabs() {
|
||||
const index = this.getActiveTabIndex()
|
||||
if (index) {
|
||||
this.tabs = this.tabs.filter((_, idx) => idx === index || idx === 0)
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
@@ -4,11 +4,14 @@ import App from '/admin/App.vue'
|
||||
import router, { bootstrapRouter } from '/admin/router'
|
||||
import ElementPlus from 'element-plus'
|
||||
import zh from 'element-plus/es/locale/lang/zh-cn'
|
||||
import en from 'element-plus/es/locale/lang/en'
|
||||
|
||||
import { bootstrapStore } from '/admin/stores'
|
||||
import Cache from './cache'
|
||||
import { bootstrapI18n } from '/admin/i18n'
|
||||
import guard from '/admin/router/guard'
|
||||
import { bootstrapDirectives } from '/admin/directives'
|
||||
import { Language } from 'element-plus/es/locale'
|
||||
|
||||
/**
|
||||
* catchadmin
|
||||
@@ -63,9 +66,13 @@ export default class CatchAdmin {
|
||||
* @returns
|
||||
*/
|
||||
protected useElementPlus(): CatchAdmin {
|
||||
// @ts-ignore
|
||||
const languages: Record<string, Language> = {
|
||||
zh, en
|
||||
}
|
||||
|
||||
const language = Cache.get('language') || 'zh'
|
||||
this.app.use(ElementPlus, {
|
||||
locale: Cache.get('language') === 'zh' && zh,
|
||||
locale: languages[language]
|
||||
})
|
||||
return this
|
||||
}
|
||||
|
BIN
wechat.png
Normal file
BIN
wechat.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 91 KiB |
Reference in New Issue
Block a user