!34 处理 issues

* 优化自动完成删除搜索文字后对应id 也删除、优化 php 变量写法 、优化报错信息显示等
* 处理后台商品设置选择税类后无法撤回 -> https://guangdagit.com/beike/beikeshop/issues/281
* 404页面返回上一步链接优化 -> https://gitee.com/beikeshop/beikeshop/issues/I6EG7Z?…
This commit is contained in:
蒲硕 2023-02-15 06:36:17 +00:00 committed by Edward Yang
parent 13e46886a8
commit 6803b0e05d
7 changed files with 66 additions and 39 deletions

View File

@ -137,6 +137,8 @@ class ProductController extends Controller
}
$product = hook_filter('admin.product.form.product', $product);
$taxClasses = TaxClassRepo::getList();
array_unshift($taxClasses, ['title' => trans('admin/builder.text_no'), 'id' => 0]);
$data = [
'product' => $product,
@ -145,7 +147,7 @@ class ProductController extends Controller
'product_attributes' => ProductAttributeResource::collection($product->attributes),
'relations' => ProductResource::collection($product->relations)->resource,
'languages' => LanguageRepo::all(),
'tax_classes' => TaxClassRepo::getList(),
'tax_classes' => $taxClasses,
'source' => [
'categories' => CategoryRepo::flatten(locale()),
],

View File

@ -21,6 +21,27 @@ hr.horizontal.dark {
background-image: linear-gradient(90deg,transparent,rgba(0,0,0,.4),transparent);
}
.nav-tabs {
.nav-item {
.nav-link {
&.error-invalid {
color: #dc3545 !important;
font-weight: bold;
position: relative;
padding-left: 17px;
&:before {
content: '\F333';
left: 0;
top: 1px;
font-family: 'bootstrap-icons';
position: absolute;
}
}
}
}
}
.nav-tabs.nav-bordered {
// border-width: 2px;
@ -40,20 +61,6 @@ hr.horizontal.dark {
color: #6c757d;
border: none;
padding: 0 .2rem 0.7rem;
&.error-invalid {
color: #dc3545 !important;
font-weight: bold;
position: relative;
padding-left: 17px;
&:before {
content: '\F333';
left: 0;
top: 1px;
font-family: 'bootstrap-icons';
position: absolute;
}
}
&.active {
// color: $primary;

View File

@ -20,6 +20,7 @@ $btn-border-radius: 0;
$btn-border-radius-sm: 0;
$btn-border-radius-lg: 0;
$input-btn-focus-box-shadow: 0 0 11px 0 rgba($color: $primary, $alpha: .1);
$input-bg: #fff;
$form-select-focus-box-shadow: 0 0 11px 0 rgba($color: $primary, $alpha: .1);
// $btn-border-width: 0;

View File

@ -3,7 +3,7 @@
* @link https://beikeshop.com
* @Author pu shuo <pushuo@guangda.work>
* @Date 2022-08-17 15:42:46
* @LastEditTime 2022-09-16 20:57:54
* @LastEditTime 2023-02-15 11:45:11
*/
// Example starter JavaScript for disabling form submissions if there are invalid fields
@ -29,7 +29,6 @@ $(function () {
if ($(el).css('display') == 'block') {
// 兼容使用 element ui input、autocomplete 组件在传统提交报错ui显示
if ($(el).siblings('div[class^="el-"]')) {
console.log(11)
$(el).siblings('div[class^="el-"]').find('.el-input__inner').addClass('error-invalid-input')
}

View File

@ -68,15 +68,26 @@
</div>
<div class="tab-pane fade" id="tab-set">
<x-admin::form.row title="{{ __('admin/category.parent_category') }}">
<div class="wp-400">
<input type="text" value="{{ $page_category->parent->description->title ?? '' }}" id="categories-autocomplete" class="form-control wp-400 " />
<input type="hidden" name="parent_id" value="{{ old('categories_id', $page_category->parent->id ?? '') }}" />
<div class="wp-400" id="app">
<el-autocomplete
v-model="category_name"
value-key="name"
size="small"
name="category_name"
class="w-100"
:fetch-suggestions="relationsQuerySearch"
placeholder="{{ __('common.input') }}"
@select="handleSelect"
></el-autocomplete>
<input type="hidden" name="parent_id" :value="category_name ? category_id : ''" />
</div>
</x-admin::form.row>
<x-admin-form-input name="position" title="{{ __('common.sort_order') }}" value="{{ old('position', $page_category->position ?? 0) }}" />
<x-admin-form-switch name="active" title="{{ __('common.status') }}" value="{{ old('active', $page_category->active ?? 1) }}" />
</div>
</div>
<button type="submit" class="d-none">{{ __('common.save') }}</button>
</form>
</div>
</div>
@ -86,27 +97,31 @@
<script>
$(document).ready(function($) {
$('.submit-form').click(function () {
$('.needs-validation').submit()
// $('.needs-validation').submit()
$('.needs-validation').find('button[type="submit"]').click()
})
})
$('#categories-autocomplete').autocomplete({
'source': function(request, response) {
$http.get(`page_categories/autocomplete?name=${encodeURIComponent(request)}`, null, {
hload: true
}).then((res) => {
response($.map(res.data, function(item) {
return {
label: item['name'],
value: item['id']
}
}));
var app = new Vue({
el: '#app',
data: {
category_name: '{{ old('category_name', $page_category->parent->description->title ?? '') }}',
category_id: '{{ old('categories_id', $page_category->parent->id ?? '') }}',
},
methods: {
relationsQuerySearch(keyword, cb) {
$http.get('page_categories/autocomplete?name=' + encodeURIComponent(keyword), null, {hload:true}).then((res) => {
cb(res.data);
})
},
'select': function(item) {
$(this).val(item['label']);
$('input[name="parent_id"]').val(item['value']);
}
});
handleSelect(item) {
this.category_name = item.name
this.category_id = item.id
},
}
})
</script>
@endpush

View File

@ -94,7 +94,7 @@
placeholder="{{ __('common.input') }}"
@select="(e) => {handleSelect(e, 'page_categories')}"
></el-autocomplete>
<input type="hidden" name="page_category_id" :value="page_category_id" />
<input type="hidden" name="page_category_id" :value="page_category_name ? page_category_id : ''" />
</div>
</x-admin::form.row>
<x-admin-form-input name="views" title="{{ __('page_category.views') }}" value="{{ old('views', $page->views ?? '') }}" />

View File

@ -2,5 +2,8 @@
@section('title', __('common.error_page'))
@section('content')
<x-shop-no-data text="{{ __('common.error_page') }}" link="javascript:history.go(-1)" btn="{{ __('common.error_page_btn') }}" />
<x-shop-no-data
text="{{ __('common.error_page') }}"
link="{{ request()->headers->get('referer') ? 'javascript:history.go(-1)' : '/' }}"
btn="{{ __('common.error_page_btn') }}" />
@endsection