优化页尾编辑器

This commit is contained in:
pushuo 2022-08-10 19:08:55 +08:00
parent 5898c5abd0
commit 16b7519258
10 changed files with 126 additions and 84 deletions

View File

@ -1,4 +1,11 @@
<?php
/*
* @copyright 2022 opencart.cn - All Rights Reserved.
* @link https://www.guangdawangluo.com
* @Author PS <pushuo@opencart.cn>
* @Date 2022-08-10 16:45:58
* @LastEditTime 2022-08-10 17:03:40
*/
/**
* ShareViewData.php
*

View File

@ -1,4 +1,11 @@
<?php
/*
* @copyright 2022 opencart.cn - All Rights Reserved.
* @link https://www.guangdawangluo.com
* @Author PS <pushuo@opencart.cn>
* @Date 2022-08-02 19:19:52
* @LastEditTime 2022-08-10 19:07:07
*/
/**
* BrandController.php
*
@ -56,7 +63,7 @@ class BrandController extends Controller
public function autocomplete(Request $request): array
{
$brands = BrandRepo::autocomplete($request->get('name') ?? '');
$brands = BrandRepo::autocomplete($request->get('name') ?? '', 0);
return json_success('获取成功!', $brands);
}

View File

@ -104,14 +104,16 @@ class BrandRepo
return $results;
}
public static function autocomplete($name)
public static function autocomplete($name, $onlyActive = 1)
{
$brands = Brand::query()
$builder = Brand::query()
->where('name', 'like', "$name%")
->where('status', 1)
->select('id', 'name')
->limit(10)->get();
return $brands;
->select('id', 'name', 'status');
if ($onlyActive) {
$builder->where('status', 1);
}
return $builder->limit(10)->get();
}
/**

View File

@ -2168,13 +2168,6 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/*
* @copyright 2022 opencart.cn - All Rights Reserved.
* @link https://www.guangdawangluo.com
* @Author PS <pushuo@opencart.cn>
* @Date 2022-08-09 09:39:34
* @LastEditTime 2022-08-09 09:43:18
*/
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
fileManagerIframe: function fileManagerIframe(callback) {
var base = document.querySelector('base').href;
@ -2199,6 +2192,21 @@ __webpack_require__.r(__webpack_exports__);
};
}
});
},
debounce: function debounce(fn, delay) {
var timeout = null; // 创建一个标记用来存放定时器的返回值
return function (e) {
var _arguments = arguments,
_this = this;
// 每当用户输入的时候把前一个 setTimeout clear 掉
clearTimeout(timeout); // 然后又创建一个新的 setTimeout, 这样就能保证interval 间隔内如果时间持续触发,就不会执行 fn 函数
timeout = setTimeout(function () {
fn.apply(_this, _arguments);
}, delay);
};
}
});

View File

@ -1,10 +1,3 @@
/*
* @copyright 2022 opencart.cn - All Rights Reserved.
* @link https://www.guangdawangluo.com
* @Author PS <pushuo@opencart.cn>
* @Date 2022-08-09 09:39:34
* @LastEditTime 2022-08-09 09:43:18
*/
export default {
fileManagerIframe(callback) {
const base = document.querySelector('base').href;
@ -31,4 +24,17 @@ export default {
}
});
},
debounce(fn, delay) {
var timeout = null; // 创建一个标记用来存放定时器的返回值
return function (e) {
// 每当用户输入的时候把前一个 setTimeout clear 掉
clearTimeout(timeout);
// 然后又创建一个新的 setTimeout, 这样就能保证interval 间隔内如果时间持续触发,就不会执行 fn 函数
timeout = setTimeout(() => {
fn.apply(this, arguments);
}, delay);
}
},
}

View File

@ -111,6 +111,13 @@
default: false
},
hideTypes: {
type: Array,
default: function () {
return [];
}
},
type: {
default: null
},
@ -125,8 +132,8 @@
types: [
{type: 'product',label: '商品'},
{type: 'category',label: '分类'},
// {type: 'information',label: ''},
// {type: 'manufacturer',label: '品牌'},
{type: 'page',label: '信息页面'},
{type: 'brand', label: '品牌'},
{type: 'static',label: '固定连接'},
// {type: 'blog',label: '博客'},
{type: 'custom',label: '自定义'}
@ -150,6 +157,11 @@
beforeMount() {
this.updateData();
if (this.hideTypes.length) {
this.types = this.types.filter((item) => {
return this.hideTypes.indexOf(item.type) == -1;
});
}
},
watch: {
@ -179,8 +191,8 @@
case 'category':
url = '{{ admin_route('categories.index') }}';
break;
case 'manufacturer':
url = '/';
case 'brand':
url = '';
break;
default:
null;
@ -267,8 +279,8 @@
case 'category':
url = 'categories/autocomplete?name=';
break;
case 'manufacturer':
url = '';
case 'brand':
url = 'brands/autocomplete?name=';
break;
default:
null;
@ -296,11 +308,13 @@
}
if (!this.link.value) return;
if (this.link.type == 'customer') return this.name = this.link.value;
if (this.link.type == 'custom') return this.name = this.link.value;
if (this.link.type == 'static') {
if (this.static.find(e => e.value == this.link.value)) {
this.name = this.static.find(e => e.value == this.link.value).name;
}
return;
}
this.nameLoading = true;
@ -314,8 +328,8 @@
case 'category':
url = `categories/${this.link.value}/name`;
break;
case 'manufacturer':
url = '';
case 'brand':
url = `brands/${this.link.value}/name`;
break;
default:
null;

View File

@ -97,7 +97,7 @@
<el-tooltip class="icon-rank" effect="dark" content="拖动排序" placement="left">
<i class="el-icon-rank"></i>
</el-tooltip>
<link-selector :show-text="true" v-model="form.content.link{{ $i }}.links[index]"></link-selector>
<link-selector :hide-types="['product', 'category']" :show-text="true" v-model="form.content.link{{ $i }}.links[index]"></link-selector>
<div class="remove-item" @click="removeLink('link{{ $i }}', index)"><i class="iconfont">&#xe63a;</i></div>
</div>
</draggable>
@ -141,7 +141,7 @@
<script>
var $languages = @json($languages);
var $languages = @json($admin_languages);
var $locale = '{{ locale() }}';
function languagesFill(text) {
@ -210,11 +210,13 @@
},
// 组件方法
methods: {
footerUpdate() {
footerUpdate: bk.debounce(function() {
$http.post('design_footer/builder/preview', this.form, {hload: true}).then((res) => {
// $(previewWindow.document).find('footer').replaceWith(res);
if (previewWindow) {
$(previewWindow.document).find('footer').replaceWith(res);
}
})
},
}, 300),
footerItemChange(val) {
// console.log(val)

View File

@ -61,7 +61,7 @@
@endforeach
<script>
var $languages = @json($languages);
var $languages = @json($admin_languages);
var $locale = '{{ locale() }}';
function languagesFill(text) {

View File

@ -29,7 +29,7 @@
</div>
</x-admin::form.row>
<x-admin-form-select title="默认语言" name="locale" :value="old('locale', system_setting('base.locale', 'zh_cn'))" :options="$languages->toArray()" key="code" label="name">
<x-admin-form-select title="默认语言" name="locale" :value="old('locale', system_setting('base.locale', 'zh_cn'))" :options="$admin_languages" key="code" label="name">
<div class="help-text font-size-12 lh-base">默认语言设置</div>
</x-admin-form-select>

View File

@ -1,17 +1,20 @@
<footer>
@php
$locale = locale();
@endphp
<div class="services-wrap">
<div class="container">
<div class="row">
@foreach ($footer_content['services']['items'] as $item)
<div class="col-lg-3 col-md-6 col-12">
<div class="service-item">
<div class="icon"><img src="{{ asset('image/default/footer-icon-1.png') }}" class="img-fluid"></div>
<div class="text">
<p class="title">{{ $item['title'][locale()] }}</p>
<p class="sub-title">{{ $item['sub_title'][locale()] }}</p>
<div class="col-lg-3 col-md-6 col-12">
<div class="service-item">
<div class="icon"><img src="{{ image_resize($item['image'], 80, 80) }}" class="img-fluid"></div>
<div class="text">
<p class="title">{{ $item['title'][locale()] ?? '' }}</p>
<p class="sub-title">{{ $item['sub_title'][locale()] ?? '' }}</p>
</div>
</div>
</div>
</div>
@endforeach
</div>
</div>
@ -21,48 +24,39 @@
<div class="row">
<div class="col-12 col-md-4">
<div class="footer-content-left">
<div class="logo"><a href="http://"><img src="{{ asset('image/logo.png') }}" class="img-fluid"></a></div>
<div class="text">Fashion is a popular
aesthetic expression at a particular time, place and in a specific context, especially in clothing, footwear, lifestyle
</div>
<div class="logo"><a href="http://"><img
src="{{ image_origin($footer_content['content']['intro']['logo']) }}" class="img-fluid"></a></div>
<div class="text">{!! $footer_content['content']['intro']['text'][$locale] ?? '' !!}</div>
</div>
</div>
<div class="col-lg-8">
<div class="row">
<div class="col-6 col-sm">
<h6 class="text-uppercase text-dark mb-3">Hot links</h6>
<ul class="list-unstyled">
<li><a href="">adsdasd</a></li>
<li><a href="">adsdasd</a></li>
<li><a href="">adsdasd</a></li>
<li><a href="">adsdasd</a></li>
</ul>
</div>
<div class="col-6 col-sm">
<h6 class="text-uppercase text-dark mb-3">Hot links</h6>
<ul class="list-unstyled">
<li><a href="">dsddslkdjccxz</a></li>
<li><a href="">dsddslkdjccxz</a></li>
<li><a href="">adsdasd</a></li>
<li><a href="">adsdasd</a></li>
</ul>
</div>
<div class="col-6 col-sm">
<h6 class="text-uppercase text-dark mb-3">Hot links</h6>
<ul class="list-unstyled">
<li><a href="">adsdasd</a></li>
<li><a href="">adsdasd</a></li>
<li><a href="">adsdasd</a></li>
<li><a href="">adsdasd</a></li>
</ul>
</div>
@for ($i = 1; $i <= 3; $i++)
@php
$link = $footer_content['content']['link' . $i];
@endphp
<div class="col-6 col-sm">
<h6 class="text-uppercase text-dark mb-3">{{ $link['title'][$locale] }}</h6>
<ul class="list-unstyled">
@foreach ($link['links'] as $item)
<li><a href="{{ type_route($item['type'], $item['value']) }}"
@if (isset($item['new_window']) && $item['new_window']) target="_blank" @endif>{{ $item['text'][$locale] }}</a></li>
@endforeach
</ul>
</div>
@endfor
<div class="col-6 col-sm">
<h6 class="text-uppercase text-dark mb-3">联系我们</h6>
<ul class="list-unstyled">
<li><a href="">dsddslkdjccxz</a></li>
<li><a href="">dsddslkdjccxz</a></li>
<li><a href="">dsddslkdjccxz</a></li>
<li><a href="">dsddslkdjccxz</a></li>
@if ($footer_content['content']['contact']['email'])
<li>{{ $footer_content['content']['contact']['email'] }}</li>
@endif
@if ($footer_content['content']['contact']['telephone'])
<li>{{ $footer_content['content']['contact']['telephone'] }}</li>
@endif
@if ($footer_content['content']['contact']['address'])
<li>{{ $footer_content['content']['contact']['address'] }}</li>
@endif
</ul>
</div>
</div>
@ -72,13 +66,15 @@
</div>
<div class="footer-bottom">
<div class="container">
<div class="row">
<div class="row align-items-center">
<div class="col">
© Clay Shop all rights reserved
</div>
<div class="col-auto">
<img src="{{ asset('image/default/footer-payment.png') }}" class="img-fluid">
{!! $footer_content['bottom']['copyright'][$locale] ?? '' !!}
</div>
@if (isset($footer_content['bottom']['image']))
<div class="col-auto">
<img src="{{ image_origin($footer_content['bottom']['image']) }}" class="img-fluid">
</div>
@endif
</div>
</div>
</div>