Skip to content

Commit ecc55ac

Browse files
committed
添加资源控制器接口
1 parent 1d9607a commit ecc55ac

File tree

9 files changed

+103
-39
lines changed

9 files changed

+103
-39
lines changed

public/app.js

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,29 @@ __webpack_require__.r(__webpack_exports__);
388388
//
389389
//
390390
//
391+
//
392+
//
393+
//
394+
//
395+
//
396+
//
397+
//
398+
//
399+
//
400+
//
401+
//
402+
//
403+
//
404+
//
405+
//
406+
//
407+
//
408+
//
409+
//
410+
//
411+
//
412+
//
413+
//
391414

392415
/* harmony default export */ __webpack_exports__["default"] = ({
393416
props: {
@@ -1401,7 +1424,6 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
14011424
//
14021425
//
14031426
//
1404-
//
14051427

14061428

14071429
/* harmony default export */ __webpack_exports__["default"] = ({
@@ -1473,11 +1495,15 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
14731495
});
14741496
},
14751497
onNodeDrop: function onNodeDrop(node, before, after, inner) {
1498+
var _this3 = this;
1499+
14761500
this.$http.post(this.attrs.attributes.draggableUrl, {
14771501
self: node.data,
14781502
target: before.data,
14791503
type: after
1480-
}).then(function () {});
1504+
}).then(function () {
1505+
_this3.$Message.success("排序成功");
1506+
});
14811507
console.log(node);
14821508
console.log(before);
14831509
console.log(after);
@@ -27807,11 +27833,7 @@ var render = function() {
2780727833
"el-button",
2780827834
{
2780927835
staticClass: "mr-10",
27810-
attrs: {
27811-
type: "primary",
27812-
size: "medium",
27813-
icon: "el-icon-plus"
27814-
}
27836+
attrs: { type: "primary", icon: "el-icon-plus" }
2781527837
},
2781627838
[_vm._v("新建")]
2781727839
)
@@ -32897,8 +32919,9 @@ axios__WEBPACK_IMPORTED_MODULE_2___default.a.interceptors.response.use(function
3289732919
return data;
3289832920
}, function (_ref2) {
3289932921
var response = _ref2.response;
32900-
console.log(response.status); // 对响应错误做点什么
3290132922

32923+
//console.log(response.status);
32924+
// 对响应错误做点什么
3290232925
switch (response.status) {
3290332926
case 404:
3290432927
view_design_src_components_notice__WEBPACK_IMPORTED_MODULE_0__["default"].error({

public/mix-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"/app.js": "/app.js?id=6c8d28b670b7528d3aef",
2+
"/app.js": "/app.js?id=fe8a9b23760b6394bc45",
33
"/manifest.js": "/manifest.js?id=d9708e48a6c10ccee4bb",
44
"/vendor.js": "/vendor.js?id=f4679ac178c0e413cb28"
55
}

resources/js/components/Root.vue

Lines changed: 44 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<el-aside
55
ref="contentSide"
66
class="content-side"
7-
:class="{'content-side-fixed':fixedSide,'side-dark':isDark}"
8-
:width="isCollapsed?'64px':'200px'"
7+
:class="{ 'content-side-fixed': fixedSide, 'side-dark': isDark }"
8+
:width="isCollapsed ? '64px' : '200px'"
99
>
1010
<div class="content-side-logo">
1111
<template v-if="!isCollapsed">
@@ -19,36 +19,56 @@
1919
<el-menu
2020
:default-active="route"
2121
:collapse="isCollapsed"
22-
:background-color="isDark?'#1d1e23':''"
23-
:text-color="isDark?'#ffffff':''"
22+
:background-color="isDark ? '#1d1e23' : ''"
23+
:text-color="isDark ? '#ffffff' : ''"
2424
:collapse-transition="false"
2525
:router="true"
2626
unique-opened
2727
>
2828
<template v-for="menu in page_data.menu">
29-
<MenuItem :menu="menu" :key="menu.id" :is_collapsed="isCollapsed" />
29+
<MenuItem
30+
:menu="menu"
31+
:key="menu.id"
32+
:is_collapsed="isCollapsed"
33+
/>
3034
</template>
3135
</el-menu>
3236
</el-scrollbar>
3337
</el-aside>
3438
<el-container
35-
:class="{'el-container-fixed':fixedSide,'el-container-fixed-collapsed':isCollapsed}"
39+
:class="{
40+
'el-container-fixed': fixedSide,
41+
'el-container-fixed-collapsed': isCollapsed
42+
}"
3643
>
3744
<el-header
38-
:style="{padding: 0}"
45+
:style="{ padding: 0 }"
3946
class="layout-header-bar"
40-
:class="{'layout-header-bar-dark':isDarkHeader,'layout-header-bar-fixed':fixedHeader,'layout-header-bar-fixed-collapsed':isCollapsed}"
47+
:class="{
48+
'layout-header-bar-dark': isDarkHeader,
49+
'layout-header-bar-fixed': fixedHeader,
50+
'layout-header-bar-fixed-collapsed': isCollapsed
51+
}"
4152
height="55px"
4253
>
4354
<div class="layout-header-l">
4455
<div class="layout-header-trigger hover" @click="collapsedSide">
45-
<i class="el-icon-s-fold fs-20 menu-icon" :class="{'rotate-icon':isCollapsed}" />
56+
<i
57+
class="el-icon-s-fold fs-20 menu-icon"
58+
:class="{ 'rotate-icon': isCollapsed }"
59+
/>
4660
</div>
4761
<div class="layout-header-breadcrumb">
4862
<el-breadcrumb separator="/">
49-
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
63+
<el-breadcrumb-item :to="{ path: '/' }"
64+
>首页</el-breadcrumb-item
65+
>
5066
<template v-for="menu in page_data.menuList">
51-
<el-breadcrumb-item v-if="menu.route==route" :key="menu.route">{{menu.title}}</el-breadcrumb-item>
67+
<el-breadcrumb-item
68+
v-if="menu.route == route"
69+
:key="menu.route"
70+
>{{ menu.title }}</el-breadcrumb-item
71+
>
5272
</template>
5373
</el-breadcrumb>
5474
</div>
@@ -58,7 +78,9 @@
5878
<el-dropdown>
5979
<div class="layout-header-user">
6080
<el-avatar :src="page_data.user.avatar" :size="25" />
61-
<span class="layout-header-user-name">{{page_data.user.name}}</span>
81+
<span class="layout-header-user-name">{{
82+
page_data.user.name
83+
}}</span>
6284
</div>
6385
<el-dropdown-menu slot="dropdown">
6486
<a>
@@ -77,14 +99,14 @@
7799
</el-dropdown>
78100
</div>
79101
<div
80-
@click="showAdminSet=true"
102+
@click="showAdminSet = true"
81103
class="layout-header-trigger layout-header-trigger-min hover"
82104
>
83105
<i class="el-icon-setting icon-btn"></i>
84106
</div>
85107
</div>
86108
</el-header>
87-
<el-main :class="{'el-main-fixed':fixedHeader}">
109+
<el-main :class="{ 'el-main-fixed': fixedHeader }">
88110
<div class="layout-content-main">
89111
<transition name="fade-transform" mode="out-in">
90112
<router-view></router-view>
@@ -94,13 +116,14 @@
94116
<el-footer class="admin-footer">
95117
<div class="footer-links">
96118
<el-link
97-
v-for="(item,index) in page_data.footerLinks"
119+
v-for="(item, index) in page_data.footerLinks"
98120
:key="index"
99121
type="text"
100122
:href="item.href"
101123
target="_blank"
102124
:underline="false"
103-
>{{item.title}}</el-link>
125+
>{{ item.title }}</el-link
126+
>
104127
</div>
105128
<div v-html="page_data.copyright"></div>
106129
</el-footer>
@@ -115,7 +138,7 @@
115138
<div>
116139
<el-tooltip content="亮色菜单风格" placement="top">
117140
<el-image
118-
@click="isDark=false"
141+
@click="isDark = false"
119142
class="hover"
120143
src="https://gw.alipayobjects.com/zos/antfincdn/NQ%24zoisaD2/jpRkZQMyYRryryPNtyIC.svg"
121144
/>
@@ -126,7 +149,7 @@
126149
<div class="ml-20">
127150
<el-tooltip content="暗色菜单风格" placement="top">
128151
<el-image
129-
@click="isDark=true"
152+
@click="isDark = true"
130153
class="hover"
131154
src="https://gw.alipayobjects.com/zos/antfincdn/XwFOFbLkSM/LCkqqYNmvBEbokSDscrm.svg"
132155
/>
@@ -136,7 +159,7 @@
136159
</div>
137160
<div class="mt-30">
138161
<el-badge type="success" is-dot :hidden="isDarkHeader">
139-
<div @click="isDarkHeader=false">
162+
<div @click="isDarkHeader = false">
140163
<el-tooltip content="亮色顶栏风格" placement="top">
141164
<el-image
142165
class="hover"
@@ -146,7 +169,7 @@
146169
</div>
147170
</el-badge>
148171
<el-badge type="success" is-dot :hidden="!isDarkHeader">
149-
<div class="ml-20" @click="isDarkHeader=true">
172+
<div class="ml-20" @click="isDarkHeader = true">
150173
<el-tooltip content="暗色顶栏风格" placement="top">
151174
<el-image
152175
class="hover"
@@ -253,7 +276,7 @@ export default {
253276
};
254277
</script>
255278

256-
<style lang="scss" >
279+
<style lang="scss">
257280
$header-bar-height: 55px;
258281
.admin-layout {
259282
min-height: 100vh;

resources/js/components/grid/Tree.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
<el-button
2929
type="primary"
3030
class="mr-10"
31-
size="medium"
3231
icon="el-icon-plus"
3332
>新建</el-button
3433
>
@@ -159,7 +158,9 @@ export default {
159158
target: before.data,
160159
type: after
161160
})
162-
.then(() => {});
161+
.then(() => {
162+
this.$Message.success("排序成功")
163+
});
163164
164165
console.log(node);
165166
console.log(before);

resources/js/util/axios.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ axios.interceptors.response.use(
4949
return data;
5050
},
5151
({ response }) => {
52-
console.log(response.status);
52+
//console.log(response.status);
5353
// 对响应错误做点什么
5454
switch (response.status) {
5555
case 404:

src/Admin.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,10 @@ public function menu()
6767
/** @var Menu $menuModel */
6868
$menuModel = new $menuClass();
6969

70+
$allNodes = $menuModel->allNodes();
7071

7172

72-
return $this->menu = $menuModel->buildNestedArray($menuModel->allNodes());
73+
return $this->menu = $menuModel->buildNestedArray($allNodes);
7374
}
7475

7576
public function menuList()
@@ -83,7 +84,10 @@ public function menuList()
8384
/** @var Menu $menuModel */
8485
$menuModel = new $menuClass();
8586

87+
88+
8689
return $this->menuList = $menuModel->get(['uri', 'title']);
90+
8791
}
8892

8993

src/Controllers/AdminResource.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
4+
namespace SmallRuralDog\Admin\Controllers;
5+
6+
7+
interface AdminResource
8+
{
9+
public function grid();
10+
11+
public function form();
12+
13+
}

src/Controllers/MenuController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ protected function form()
9898
$form = new Form(new $model());
9999
$items = [
100100
$form->item('parent_id', '上级目录')->displayComponent(Select::make(0)->options(function () use ($model) {
101-
return $model::query()->where('parent_id', 0)->get()->map(function ($item) {
101+
return $model::query()->where('parent_id', 0)->orderBy('order')->get()->map(function ($item) {
102102
return SelectOption::make($item->id, $item->title);
103103
})->prepend(SelectOption::make(0, '根目录'));
104104
})),

src/Controllers/PermissionController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,16 @@ protected function grid()
3232

3333
$grid->columns([
3434
$grid->column('id', 'ID')->sortable()->width('80px'),
35-
$grid->column('slug', trans('admin::admin.slug')),
36-
$grid->column('name', trans('admin::admin.name')),
35+
$grid->column('slug', trans('admin::admin.slug'))->width(120),
36+
$grid->column('name', trans('admin::admin.name'))->width(120),
3737
$grid->column('http_method', trans('admin::admin.http_method'))->displayComponent(Tag::make()),
3838
$grid->column('http_path', trans('admin::admin.route'))->customValue(function ($row, $value) {
3939
return explode("\n", $value);
4040
})->displayComponent(function () {
4141
return Tag::make();
4242
}),
43-
$grid->column('created_at', trans('admin::admin.created_at')),
44-
$grid->column('updated_at', trans('admin::admin.updated_at'))
43+
//$grid->column('created_at', trans('admin::admin.created_at')),
44+
//$grid->column('updated_at', trans('admin::admin.updated_at'))
4545
]);
4646
return $grid;
4747
}

0 commit comments

Comments
 (0)