文件管理备注

This commit is contained in:
evoxwht 2023-04-10 10:27:00 +08:00
parent 9de2754961
commit 7d03e8dca7
11 changed files with 514 additions and 233 deletions

View File

@ -72,6 +72,29 @@ class SystemFile extends AuthController
return app('json')->success($this->services->opendir());
}
//文件备注
public function fileMark()
{
[$path, $fileToken] = $this->request->postMore([
['path', ''],
['fileToken', ''],
], true);
if ($path == '') return app('json')->fail(100100);
return app('json')->success($this->services->markForm($path, $fileToken));
}
//文件备注保存
public function fileMarkSave()
{
[$full_path, $mark] = $this->request->postMore([
['full_path', ''],
['mark', ''],
], true);
if ($full_path == '') return app('json')->fail(100100);
$this->services->fileMarkSave($full_path, $mark);
return app('json')->success(100000);
}
//读取文件
public function openfile()
{

View File

@ -160,6 +160,10 @@ Route::group('system', function () {
Route::get('file/delFolder', 'v1.system.SystemFile/delFolder')->option(['real_name' => '删除文件夹']);
//重命名文件
Route::get('file/rename', 'v1.system.SystemFile/rename')->option(['real_name' => '重命名文件夹']);
//目录文件备注表单
Route::get('file/mark', 'v1.system.SystemFile/fileMark')->option(['real_name' => '目录文件备注表单']);
//目录文件备注保存
Route::post('file/mark/save', 'v1.system.SystemFile/fileMarkSave')->option(['real_name' => '目录文件备注保存']);
})->middleware([
\app\http\middleware\AllowOriginMiddleware::class,
\app\adminapi\middleware\AdminAuthTokenMiddleware::class,

View File

@ -681,7 +681,11 @@ class PublicController
$data['recharge_switch'] = sys_config('recharge_switch');//小程序充值开关
$data['member_card_status'] = sys_config('member_card_status');//是否开启付费会员
$data['member_price_status'] = sys_config('member_price_status');//商品会员折扣价展示启用
$data['ali_pay_status'] = (int)sys_config('ali_pay_status');//支付宝是否启用
$data['pay_weixin_open'] = (int)sys_config('pay_weixin_open');//微信是否启用
$data['yue_pay_status'] = (int)sys_config('yue_pay_status');//余额是否启用
$data['offline_pay_status'] = (int)sys_config('offline_pay_status');//线下是否启用
$data['friend_pay_status'] = (int)sys_config('friend_pay_status');//好友是否启用
return app('json')->success($data);
}
}

View File

@ -47,6 +47,9 @@ Route::group(function () {
//查询版权
Route::get('copyright', 'v1.PublicController/copyright')->option(['real_name' => '申请版权']);
//商城基础配置汇总接口
Route::get('basic_config', 'v1.PublicController/getMallBasicConfig')->option(['real_name' => '商城基础配置汇总接口']);
})->middleware(\app\http\middleware\AllowOriginMiddleware::class)->middleware(\app\api\middleware\StationOpenMiddleware::class);

View File

@ -0,0 +1,23 @@
<?php
namespace app\dao\system\log;
use app\dao\BaseDao;
use app\model\system\log\SystemFileInfo;
/**
* @author 吴汐
* @email 442384644@qq.com
* @date 2023/04/07
*/
class SystemFileInfoDao extends BaseDao
{
/**
* 设置模型
* @return string
*/
protected function setModel(): string
{
return SystemFileInfo::class;
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace app\model\system\log;
use crmeb\basic\BaseModel;
use crmeb\traits\ModelTrait;
/**
* @author 吴汐
* @email 442384644@qq.com
* @date 2023/04/07
*/
class SystemFileInfo extends BaseModel
{
use ModelTrait;
/**
* 数据表主键
* @var string
*/
protected $pk = 'id';
/**
* 模型名称
* @var string
*/
protected $name = 'system_file_info';
}

View File

@ -335,6 +335,7 @@ class StoreOrderSplitServices extends BaseServices
* 部分发货重新计算订单商品:实际金额、优惠、积分等金额
* @param int $cart_num
* @param array $cart_info
* @param string $orderType
* @return array
*/
public function slpitComputeOrderCart(int $cart_num, array $cart_info, $orderType = 'new')

View File

@ -0,0 +1,24 @@
<?php
namespace app\services\system\log;
use app\dao\system\log\SystemFileInfoDao;
use app\services\BaseServices;
/**
* @author 吴汐
* @email 442384644@qq.com
* @date 2023/04/07
*/
class SystemFileInfoServices extends BaseServices
{
/**
* 构造方法
* SystemLogServices constructor.
* @param SystemFileInfoDao $dao
*/
public function __construct(SystemFileInfoDao $dao)
{
$this->dao = $dao;
}
}

View File

@ -19,9 +19,11 @@ use crmeb\exceptions\AdminException;
use crmeb\exceptions\AuthException;
use crmeb\services\CacheService;
use crmeb\services\FileService as FileClass;
use crmeb\services\FormBuilder as Form;
use crmeb\utils\JwtAuth;
use Firebase\JWT\ExpiredException;
use think\facade\Log;
use think\facade\Route as Url;
/**
* 文件校验
@ -233,10 +235,10 @@ class SystemFileServices extends BaseServices
//打开目录
public function opendir()
{
$markList = app()->make(SystemFileInfoServices::class)->getColumn([], 'mark', 'full_path');
$fileAll = array('dir' => [], 'file' => []);
//根目录
$rootdir = $this->formatPath(app()->getRootPath());
// return $rootdir;
//当前目录
$request_dir = app('request')->param('dir');
//防止查看站点以外的目录
@ -285,6 +287,7 @@ class SystemFileServices extends BaseServices
$navList[$key]['isDir'] = $value['isDir'];
$navList[$key]['pathname'] = $value['pathname'];
$navList[$key]['contextmenu'] = true;
$list[$key]['mark'] = $markList[str_replace(root_path(), '/', $value['pathname'])] ?? '';
}
return compact('dir', 'list', 'navList');
}
@ -426,11 +429,46 @@ class SystemFileServices extends BaseServices
$path = rtrim($path, DS);
if ($name) $path = $path . DS . $name;
$uname = php_uname('s');
// $search = '/';
if (strstr($uname, 'Windows') !== false)
$path = ltrim(str_replace('\\', '\\\\', $path), '.');
}
return $path;
}
/**
* 文件备注表单
* @param $path
* @param $fileToken
* @return array
* @throws \FormBuilder\Exception\FormBuilderException
* @author 吴汐
* @email 442384644@qq.com
* @date 2023/04/10
*/
public function markForm($path, $fileToken)
{
$full_path = str_replace(root_path(), '/', $path);
$mark = app()->make(SystemFileInfoServices::class)->value(['full_path' => str_replace(root_path(), '/', $path)], 'mark');
$f = [];
$f[] = Form::hidden('full_path', $full_path);
$f[] = Form::input('mark', '文件备注', $mark);
return create_form('文件备注', $f, Url::buildUrl('/system/file/mark/save?fileToken=' . $fileToken . '&type=mark'), 'POST');
}
/**
* 保存文件备注
* @param $full_path
* @param $mark
* @author 吴汐
* @email 442384644@qq.com
* @date 2023/04/10
*/
public function fileMarkSave($full_path, $mark)
{
$res = app()->make(SystemFileInfoServices::class)->update(['full_path' => $full_path], ['mark' => $mark]);
if (!$res) {
throw new AdminException(100006);
}
}
}

View File

@ -404,6 +404,21 @@ export function delFolder(params) {
});
}
/**
* 文件备注
* @param {*} id
* @param {*} params
* @returns
*/
export function fileMark(params) {
return request({
url: `system/file/mark`,
method: 'get',
params,
file_edit: true,
});
}
/**
* @description 安全维护 -- 更换域名
*/

View File

@ -27,6 +27,8 @@
<template slot-scope="{ row, index }" slot="action">
<a @click="open(row)" v-if="row.isDir">打开</a>
<a @click="edit(row)" v-else>编辑</a>
<Divider type="vertical" />
<a @click.stop="mark(row)">备注</a>
</template>
</Table>
</Card>
@ -144,6 +146,7 @@ import {
createFile,
delFolder,
rename,
fileMark,
} from '@/api/system';
import CodeMirror from 'codemirror/lib/codemirror';
import loginFrom from './components/loginFrom';
@ -200,16 +203,16 @@ export default {
key: 'size',
minWidth: 100,
},
{
title: '是否可写',
slot: 'isWritable',
minWidth: 100,
},
{
title: '更新时间',
key: 'mtime',
minWidth: 150,
},
{
title: '备注',
key: 'mark',
minWidth: 150,
},
{
title: '操作',
slot: 'action',
@ -348,6 +351,17 @@ export default {
}
this.openfile(row.pathname, false);
},
/**
* 备注
*/
mark(row) {
this.$modalForm(
fileMark({
path: row.pathname,
fileToken: this.fileToken,
}),
).then(() => this.getList(true, false));
},
/**
* 保存
* @param {Object} index // 当前索引
@ -836,237 +850,341 @@ export default {
}
</style>
<style scoped lang="stylus">
.file-left
padding-left 10px
>>>.ivu-icon-ios-arrow-forward
font-size 18px !important;
color #cccccc
>>>.ivu-icon-ios-folder-outline
font-size 14px !important;
>>>.ivu-icon-ios-document-outline
font-size 18px !important;
>>>.ivu-icon-md-folder{
font-size 18px !important;
color #d6ab34 !important;
}
>>> .ivu-table-row
cursor pointer;
.mr5
margin-right 5px
.backs
cursor pointer;
display inline-block;
.icon
margin-bottom 3px
>>>.CodeMirror
height: 70vh !important;
.file-left {
padding-left: 10px;
.file-box
display: flex;
align-items: flex-start;
justify-content: space-between;
position: relative;
height: 95%;
min-height: 600px;
overflow: hidden;
.file-box
.file-left
position: absolute;
top: 53px;
left: 0;
height: 90%;
// height: 100%;
// min-height: 600px;
width:25%;
max-width: 250px;
overflow: auto;
background-color: #222222;
box-shadow: #000000 -6px 0 6px -6px inset;
.file-fix
flex: 1;
max-width: 250px;
height: 76vh;
min-height: 600px;
// bottom: 0px;
// overflow: auto;
min-height: 600px;
background-color: #222222;
.file-box
.file-content
// position: absolute;
// top: 53px;
// left: 25%;
flex: 3;
overflow: hidden;
min-height: 600px;
height: 100%;
>>>.ivu-modal-body
padding: 0;
>>>.ivu-modal-content
background-color: #292929
.diy-button
// float: left;
height: 35px;
padding: 0 15px;
font-size: 13px;
text-align: center;
color: #fff;
border: 0;
border-right: 1px solid #4c4c4c;
cursor: pointer;
border-radius: 0
background-color: #565656
>>>.ivu-icon-ios-arrow-forward {
font-size: 18px !important;
}
.form-mask
z-index: -1;
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
background: rgba(0,0,0,0.3);
.diy-from-header
height: 30px
line-height: 30px;
background-color: #fff;
text-align: left;
padding-left: 20px
font-size: 16px;
margin-bottom: 15px;
span
display: inline-block;
float: right;
color: #999;
text-align: right;
font-size: 12px;
width: 280px;
word-break:keep-all;/* 不换行 */
white-space:nowrap;/* 不换行 */
overflow:hidden;
text-overflow:ellipsis;
.diy-from
z-index: 9999;
width: 400px;
height: 100px;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
text-align: center;
background-color: #2f2f2f;
.show-info
background-color: #383838;
color: #FFF;
width: 25%;
max-width: 250px;
position: absolute;
top: 0;
left: 0;
z-index: 1122;
.diy-button
width: 50%;
height: 25px;
.diy-button-list
display: flex;
align-items: center;
.show-text
padding-left: 10px;
word-break:keep-all;/* 不换行 */
white-space:nowrap;/* 不换行 */
overflow:hidden;
text-overflow:ellipsis;
padding: 7px 5px;
body >>>.ivu-select-dropdown{
background: #fff;
color: #cccccc;
>>>.ivu-icon-ios-folder-outline {
font-size: 14px !important;
}
>>>.ivu-icon-ios-document-outline {
font-size: 18px !important;
}
}
.diy-tree-render
>>>li
overflow: hidden;
>>>.ivu-tree-title
width: 90%;
max-width:250px;
padding: 0;
padding-left: 5px
>>>.ivu-tree-children
.ivu-tree-title:hover
background-color:#2f2f2f !important;
.file-box
.file-left::-webkit-scrollbar
width: 4px;
.file-box
.file-left::-webkit-scrollbar-thumb
border-radius: 10px;
-webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
background: rgba(255, 255, 255, 0.2);
.file-box
.file-left::-webkit-scrollbar-track
-webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
border-radius: 0;
background: rgba(0,0,0,0.1);
.diy-header
display: flex;
align-items: center;
justify-content: space-between;
.diy-header-icon
margin-right: 30px;
cursor: pointer;
.diy-header-icon:hover
opacity: 0.8;
>>>.ivu-icon-md-folder {
font-size: 18px !important;
color: #d6ab34 !important;
}
>>> .ivu-table-row {
cursor: pointer;
}
.mr5 {
margin-right: 5px;
}
.backs {
cursor: pointer;
display: inline-block;
.icon {
margin-bottom: 3px;
}
}
>>>.CodeMirror {
height: 70vh !important;
}
.file-box {
display: flex;
align-items: flex-start;
justify-content: space-between;
position: relative;
height: 95%;
min-height: 600px;
overflow: hidden;
}
.file-box {
.file-left {
position: absolute;
top: 53px;
left: 0;
height: 90%;
// height: 100%;
// min-height: 600px;
width: 25%;
max-width: 250px;
overflow: auto;
background-color: #222222;
box-shadow: #000000 -6px 0 6px -6px inset;
}
.file-fix {
flex: 1;
max-width: 250px;
height: 76vh;
min-height: 600px;
// bottom: 0px;
// overflow: auto;
min-height: 600px;
background-color: #222222;
}
}
.file-box {
.file-content {
// position: absolute;
// top: 53px;
// left: 25%;
flex: 3;
overflow: hidden;
min-height: 600px;
height: 100%;
}
}
>>>.ivu-modal-body {
padding: 0;
}
>>>.ivu-modal-content {
background-color: #292929;
}
.diy-button {
// float: left;
height: 35px;
padding: 0 15px;
font-size: 13px;
text-align: center;
color: #fff;
border: 0;
border-right: 1px solid #4c4c4c;
cursor: pointer;
border-radius: 0;
background-color: #565656;
}
.form-mask {
z-index: -1;
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
background: rgba(0, 0, 0, 0.3);
}
.diy-from-header {
height: 30px;
line-height: 30px;
background-color: #fff;
text-align: left;
padding-left: 20px;
font-size: 16px;
margin-bottom: 15px;
span {
display: inline-block;
float: right;
color: #999;
text-align: right;
font-size: 12px;
width: 280px;
word-break: keep-all; /* 不换行 */
white-space: nowrap; /* 不换行 */
overflow: hidden;
text-overflow: ellipsis;
}
}
.diy-from {
z-index: 9999;
width: 400px;
height: 100px;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
text-align: center;
background-color: #2f2f2f;
}
.show-info {
background-color: #383838;
color: #FFF;
width: 25%;
max-width: 250px;
position: absolute;
top: 0;
left: 0;
z-index: 1122;
.diy-button {
width: 50%;
height: 25px;
}
.diy-button-list {
display: flex;
align-items: center;
}
.show-text {
padding-left: 10px;
word-break: keep-all; /* 不换行 */
white-space: nowrap; /* 不换行 */
overflow: hidden;
text-overflow: ellipsis;
padding: 7px 5px;
}
}
body >>>.ivu-select-dropdown {
background: #fff;
}
.diy-tree-render {
>>>li {
overflow: hidden;
}
>>>.ivu-tree-title {
width: 90%;
max-width: 250px;
padding: 0;
padding-left: 5px;
}
}
>>>.ivu-tree-children {
.ivu-tree-title:hover {
background-color: #2f2f2f !important;
}
}
.file-box {
.file-left::-webkit-scrollbar {
width: 4px;
}
}
.file-box {
.file-left::-webkit-scrollbar-thumb {
border-radius: 10px;
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
background: rgba(255, 255, 255, 0.2);
}
}
.file-box {
.file-left::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2);
border-radius: 0;
background: rgba(0, 0, 0, 0.1);
}
}
.diy-header {
display: flex;
align-items: center;
justify-content: space-between;
.diy-header-icon {
margin-right: 30px;
cursor: pointer;
}
.diy-header-icon:hover {
opacity: 0.8;
}
}
// 自定义方法缩小
>>>.diy-fullscreen
overflow: hidden;
.ivu-modal
top: 0px;
left: 0px;
right: 0px;
bottom: 0px;
height: 100%;
width: 100% !important;
.ivu-modal-content
height: 100%;
.ivu-modal-body
height: 100%;
.ivu-tabs
.ivu-tabs-content-animated
height: 92%;
background-color:#2f2f2f !important;
.ivu-tabs-content
height: 100%
.ivu-tabs
.ivu-tabs-tabpane
height: 92%
>>>.ivu-modal
top: 70px;
.ivu-modal-content
.ivu-modal-body
min-height: 632px;
height: 80vh;
overflow: hidden;
.ivu-tabs
.ivu-tabs-content-animated
min-height:560px;
height: 73vh;
margin-top: -1px;
.ivu-tabs-tabpane
min-height:560px;
height: 73vh;
margin-top: -1px;
.ivu-tabs-nav .ivu-tabs-tab .ivu-icon
color: #f00;
>>>body .ivu-select-dropdown .ivu-dropdown-transfer
background:red !important;
// 导航栏右键样式 无效
>>>.diy-fullscreen {
overflow: hidden;
.ivu-modal {
top: 0px;
left: 0px;
right: 0px;
bottom: 0px;
height: 100%;
width: 100% !important;
.file-left /deep/ .ivu-select-dropdown.ivu-dropdown-transfer .ivu-dropdown-menu .ivu-dropdown-item:hover{
background-color: #e5e5e5 !important;
.ivu-modal-content {
height: 100%;
.ivu-modal-body {
height: 100%;
}
}
.ivu-tabs {
.ivu-tabs-content-animated {
height: 92%;
background-color: #2f2f2f !important;
}
}
.ivu-tabs-content {
height: 100%;
}
.ivu-tabs {
.ivu-tabs-tabpane {
height: 92%;
}
}
}
}
>>>.ivu-modal {
top: 70px;
}
.ivu-modal-content {
.ivu-modal-body {
min-height: 632px;
height: 80vh;
overflow: hidden;
}
}
.ivu-tabs {
.ivu-tabs-content-animated {
min-height: 560px;
height: 73vh;
margin-top: -1px;
}
.ivu-tabs-tabpane {
min-height: 560px;
height: 73vh;
margin-top: -1px;
}
}
.ivu-tabs-nav .ivu-tabs-tab .ivu-icon {
color: #f00;
}
>>>body .ivu-select-dropdown .ivu-dropdown-transfer {
background: red !important;
}
// 导航栏右键样式 无效
.file-left /deep/ .ivu-select-dropdown.ivu-dropdown-transfer .ivu-dropdown-menu .ivu-dropdown-item:hover {
background-color: #e5e5e5 !important;
}
// 选项卡头部
>>>.ivu-tabs.ivu-tabs-card > .ivu-tabs-bar .ivu-tabs-nav-container
background-color: #333;
>>>.ivu-tabs.ivu-tabs-card > .ivu-tabs-bar .ivu-tabs-nav-container {
background-color: #333;
}
</style>