wip
This commit is contained in:
parent
fc6174f940
commit
70df115c6e
|
|
@ -4,7 +4,7 @@ namespace Beike\Admin\Http\Controllers;
|
|||
|
||||
use Beike\Admin\Http\Requests\CategoryRequest;
|
||||
use Beike\Admin\Http\Resources\CategoryResource;
|
||||
use Beike\Admin\Repositories\CategoryRepo;
|
||||
use Beike\Repositories\CategoryRepo;
|
||||
use Beike\Models\Category;
|
||||
use Beike\Admin\Services\CategoryService;
|
||||
use Beike\Repositories\ProductRepo;
|
||||
|
|
@ -63,7 +63,7 @@ class CategoryController extends Controller
|
|||
$data = [
|
||||
'category' => $category ?? new Category(),
|
||||
'descriptions' => $descriptions ?? null,
|
||||
'categories' => CategoryRepo::flatten(locale()),
|
||||
'categories' => \Beike\Admin\Repositories\CategoryRepo\CategoryRepo::flatten(locale()),
|
||||
'_redirect' => $this->getRedirect(),
|
||||
];
|
||||
|
||||
|
|
@ -76,4 +76,11 @@ class CategoryController extends Controller
|
|||
(new CategoryService())->createOrUpdate($request->all(), $category);
|
||||
return redirect($this->getRedirect())->with('success', 'Category created successfully');
|
||||
}
|
||||
|
||||
public function autocomplete(Request $request)
|
||||
{
|
||||
$categories = CategoryRepo::autocomplete($request->get('name') ?? '');
|
||||
|
||||
return json_success('获取成功!', $categories);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,4 +114,12 @@ class ProductController extends Controller
|
|||
|
||||
return json_success('获取成功', $name);
|
||||
}
|
||||
|
||||
|
||||
public function autocomplete(Request $request)
|
||||
{
|
||||
$products = ProductRepo::autocomplete($request->get('name') ?? '');
|
||||
|
||||
return json_success('获取成功!', $products);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,14 +36,4 @@ class CategoryRepo
|
|||
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getName($id)
|
||||
{
|
||||
$category = Category::query()->find($id);
|
||||
|
||||
if ($category) {
|
||||
return $category->description->name;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@ Route::prefix($adminName)
|
|||
Route::post('forgotten/send_code', [ForgottenController::class, 'sendVerifyCode'])->name('forgotten.send_code');
|
||||
Route::post('forgotten/password', [ForgottenController::class, 'changePassword'])->name('forgotten.password');
|
||||
|
||||
Route::get('categories/autocomplete', [Controllers\CategoryController::class, 'autocomplete'])->name('categories.autocomplete');
|
||||
Route::get('products/autocomplete', [Controllers\ProductController::class, 'autocomplete'])->name('products.autocomplete');
|
||||
|
||||
Route::middleware('admin_auth:' . \Beike\Models\AdminUser::AUTH_GUARD)
|
||||
->group(function () {
|
||||
Route::get('/', [Controllers\HomeController::class, 'index'])->name('home.index');
|
||||
|
|
|
|||
|
|
@ -91,5 +91,15 @@ class CategoryRepo
|
|||
return $results;
|
||||
}
|
||||
|
||||
|
||||
public static function getName($id)
|
||||
{
|
||||
$category = Category::query()->find($id);
|
||||
|
||||
if ($category) {
|
||||
return $category->description->name;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,11 +26,4 @@ class CategoryController extends Controller
|
|||
|
||||
return view('category', $data);
|
||||
}
|
||||
|
||||
public function autocomplete(Request $request)
|
||||
{
|
||||
$categories = CategoryRepo::autocomplete($request->get('name') ?? '');
|
||||
|
||||
return json_success('获取成功!', $categories);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,11 +18,4 @@ class ProductController extends Controller
|
|||
|
||||
return view('product', $data);
|
||||
}
|
||||
|
||||
public function autocomplete(Request $request)
|
||||
{
|
||||
$products = ProductRepo::autocomplete($request->get('name') ?? '');
|
||||
|
||||
return json_success('获取成功!', $products);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,11 +31,9 @@ Route::prefix('/')
|
|||
Route::post('carts/select', [CartController::class, 'select'])->name('carts.select');
|
||||
Route::delete('carts/{cart}', [CartController::class, 'destroy'])->name('carts.destroy');
|
||||
|
||||
Route::get('categories/autocomplete', [CategoryController::class, 'autocomplete'])->name('categories.autocomplete');
|
||||
Route::get('categories', [CategoryController::class, 'index'])->name('categories.index');
|
||||
Route::get('categories/{category}', [CategoryController::class, 'show'])->name('categories.show');
|
||||
|
||||
Route::get('products/autocomplete', [ProductController::class, 'autocomplete'])->name('products.autocomplete');
|
||||
Route::get('products/{product}', [ProductController::class, 'show'])->name('products.show');
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -301,39 +301,43 @@ body.page-design .autocomplete-group-wrapper .item-group-wrapper {
|
|||
body.page-design .autocomplete-group-wrapper .item-group-wrapper .item {
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
padding: 5px 19px 5px 26px;
|
||||
margin-bottom: 1px;
|
||||
padding: 5px 8px;
|
||||
margin-bottom: 4px;
|
||||
background: #fff;
|
||||
border: 1px solid #eee;
|
||||
cursor: move;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
body.page-design .autocomplete-group-wrapper .item-group-wrapper .item:before {
|
||||
content: "\f0c9";
|
||||
font-family: "fontawesome";
|
||||
position: absolute;
|
||||
left: 6px;
|
||||
top: 50%;
|
||||
margin-top: -10px;
|
||||
color: #999;
|
||||
body.page-design .autocomplete-group-wrapper .item-group-wrapper .item:hover {
|
||||
border-color: #aaa;
|
||||
}
|
||||
body.page-design .autocomplete-group-wrapper .item-group-wrapper .item div {
|
||||
display: flex;
|
||||
line-height: 1;
|
||||
width: calc(100% - 16px);
|
||||
align-items: center;
|
||||
}
|
||||
body.page-design .autocomplete-group-wrapper .item-group-wrapper .item div i {
|
||||
margin-right: 4px;
|
||||
}
|
||||
body.page-design .autocomplete-group-wrapper .item-group-wrapper .item span {
|
||||
height: 19px;
|
||||
overflow: hidden;
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
display: -webkit-box;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
-webkit-line-clamp: 1;
|
||||
-webkit-box-orient: vertical;
|
||||
word-break: break-all;
|
||||
white-space: nowrap;
|
||||
}
|
||||
body.page-design .autocomplete-group-wrapper .item-group-wrapper .item i {
|
||||
position: absolute;
|
||||
right: 6px;
|
||||
top: 50%;
|
||||
margin-top: -8px;
|
||||
color: #999;
|
||||
font-weight: 400;
|
||||
}
|
||||
body.page-design .autocomplete-group-wrapper .item-group-wrapper .item i.right {
|
||||
cursor: pointer;
|
||||
}
|
||||
body.page-design .autocomplete-group-wrapper .item-group-wrapper .item i.right:hover {
|
||||
color: #222;
|
||||
}
|
||||
|
||||
.file-manager-box .layui-layer-title {
|
||||
background-color: #293042;
|
||||
|
|
|
|||
|
|
@ -367,39 +367,47 @@ body.page-design {
|
|||
.item {
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
padding: 5px 19px 5px 26px;
|
||||
margin-bottom: 1px;
|
||||
padding: 5px 8px;
|
||||
margin-bottom: 4px;
|
||||
background: #fff;
|
||||
border: 1px solid #eee;
|
||||
cursor: move;
|
||||
&:before {
|
||||
content: "\f0c9";
|
||||
font-family: "fontawesome";
|
||||
position: absolute;
|
||||
left: 6px;
|
||||
top: 50%;
|
||||
margin-top: -10px;
|
||||
color: #999;
|
||||
display: flex;
|
||||
align-items: center; // flex-start | center
|
||||
justify-content: space-between; // flex-end | center | space-between
|
||||
&:hover {
|
||||
border-color: #aaa;
|
||||
}
|
||||
|
||||
div {
|
||||
display: flex;
|
||||
line-height: 1;
|
||||
width: calc(100% - 16px);
|
||||
align-items: center; // flex-start | center
|
||||
|
||||
i {
|
||||
margin-right: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
span {
|
||||
height: 19px;
|
||||
overflow: hidden;
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
display: -webkit-box;
|
||||
text-overflow: ellipsis;
|
||||
-webkit-line-clamp: 1;
|
||||
-webkit-box-orient: vertical;
|
||||
word-break: break-all;
|
||||
overflow: hidden;
|
||||
text-overflow:ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
i {
|
||||
position: absolute;
|
||||
right: 6px;
|
||||
top: 50%;
|
||||
margin-top: -8px;
|
||||
cursor: pointer;
|
||||
// position: absolute;
|
||||
color: #999;
|
||||
font-weight: 400;
|
||||
&.right {
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
color: #222;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
:visible.sync="linkDialog.show"
|
||||
class="link-dialog-box"
|
||||
:append-to-body="true"
|
||||
:close-on-click-modal="false"
|
||||
@open="linkDialogOpen"
|
||||
@closed="linkDialogClose"
|
||||
width="460px">
|
||||
|
|
@ -211,7 +212,7 @@
|
|||
const self = this;
|
||||
this.link.value = '';
|
||||
this.querySearch(this.keyword, null, function (data) {
|
||||
self.linkDialog.data = data;
|
||||
self.linkDialog.data = data.data;
|
||||
})
|
||||
},
|
||||
|
||||
|
|
@ -273,13 +274,12 @@
|
|||
null;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: url + encodeURIComponent(keyword) + (all ? '&all=all' : ''),
|
||||
dataType: 'json',
|
||||
beforeSend: function() { self.loading = true;; },
|
||||
complete: function() { self.loading = false; },
|
||||
success: function (json) {if (json) {cb(json)}}
|
||||
});
|
||||
this.loading = true;
|
||||
|
||||
$http.get(url + encodeURIComponent(keyword), null, {hload: true}).then((res) => {
|
||||
if (res) {cb(res)};
|
||||
this.loading = false;
|
||||
}).finally(() => {this.loading = false});
|
||||
},
|
||||
|
||||
linksNewBack() {
|
||||
|
|
@ -321,10 +321,6 @@
|
|||
null;
|
||||
}
|
||||
|
||||
// beforeSend: function() { self.loading = true;; },
|
||||
|
||||
// complete: function() { self.loading = false; },
|
||||
// this.loading = true;
|
||||
$http.get(url, null, {hload: true}).then((res) => {
|
||||
if (res.data) {
|
||||
self.name = res.data;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<div class="text-i18n-template">
|
||||
<el-tabs v-if="languages.length > 1" value="language-{{ current_language_code() }}" :stretch="languages.length > 5 ? true : false" type="card">
|
||||
<el-tab-pane v-for="(item, index) in languages" :key="index" :label="item.name" :name="'language-' + item.code">
|
||||
<span slot="label" style="padding: 0 4px; font-size: 12px">@{{ item.name }}</span>
|
||||
<span slot="label" style="padding: 0 8px; font-size: 12px">@{{ item.name }}</span>
|
||||
|
||||
<div class="i18n-inner">
|
||||
<el-input :type="type" :rows="4" :placeholder="item.name" :key="index" :size="size" v-model="value[item.code]" @input="valueChanged(item.code)"></el-input>
|
||||
|
|
|
|||
|
|
@ -48,8 +48,11 @@
|
|||
:options="{animation: 330}"
|
||||
>
|
||||
<div v-for="(item, index) in productData" :key="index" class="item">
|
||||
<span>${item.name}</span>
|
||||
<i class="fa fa-minus-circle" @click="removeProduct(index)"></i>
|
||||
<div>
|
||||
<i class="el-icon-s-unfold"></i>
|
||||
<span>${item.name}</span>
|
||||
</div>
|
||||
<i class="el-icon-delete right" @click="removeProduct(index)"></i>
|
||||
</div>
|
||||
</draggable>
|
||||
</template>
|
||||
|
|
@ -120,7 +123,7 @@ Vue.component('module-editor-tab-product', {
|
|||
return;
|
||||
}
|
||||
|
||||
$http.get('products/autocomplete', {name: keyword}, null).then((res) => {
|
||||
$http.get('products/autocomplete?name=' + encodeURIComponent(keyword)).then((res) => {
|
||||
cb(res);
|
||||
})
|
||||
},
|
||||
|
|
@ -144,7 +147,7 @@ Vue.component('module-editor-tab-product', {
|
|||
|
||||
handleTabsEdit(targetName, action) {
|
||||
if (action === 'add') {
|
||||
this.module.tabs.push({title: languagesFill('标题'), products: []});
|
||||
this.module.tabs.push({title: languagesFill('Tab ' + (this.module.tabs.length + 1)), products: []});
|
||||
this.editableTabsValue = this.module.tabs.length - 1 + '';
|
||||
}
|
||||
|
||||
|
|
@ -166,7 +169,7 @@ setTimeout(() => {
|
|||
background_color: ''
|
||||
},
|
||||
floor: languagesFill(''),
|
||||
tabs: [{title: languagesFill('标题'), products: []}],
|
||||
tabs: [{title: languagesFill('Tab 1'), products: []}],
|
||||
title: languagesFill('模块标题'),
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue