From d5bfb09802c2cb89aa6fc0a27406ee40eca2ae41 Mon Sep 17 00:00:00 2001 From: Anyon Date: Tue, 15 Sep 2020 11:37:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E6=96=87=E4=BB=B6=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/data/view/config/slider.html | 54 +++++++++++++--------------- app/data/view/news_item/select.html | 6 ++-- app/data/view/shop_goods/select.html | 6 ++-- 3 files changed, 31 insertions(+), 35 deletions(-) diff --git a/app/data/view/config/slider.html b/app/data/view/config/slider.html index 6dd16b9ee..a1c8c5734 100644 --- a/app/data/view/config/slider.html +++ b/app/data/view/config/slider.html @@ -27,24 +27,24 @@ - + @@ -53,7 +53,9 @@ (function (data) { /*! 默认数据处理 */ if (data.length < 1) addItem(); - for (this.index in data) addItem(data[this.index]); + else data.forEach(function (item) { + addItem(item) + }); /*! 初始化上传插件 */ (function initUpload() { $('[data-slider-box] input[data-upload-image]').map(function () { @@ -62,40 +64,34 @@ setTimeout(initUpload, 100); })(); /*! 轮播选项操作 */ - $('[data-slider-box]').on('click', '[data-item-news]', function ($that) { - $that = $(this), top.setCheckValue = function (id) { - $that.prevAll('input').val('news#{v}'.replace('{v}', id)); + $('[data-slider-box]').on('click', '[data-show-page]', function ($that) { + $that = $(this), top.setCheckValue = function (value) { + $that.prevAll('input').val(($that.data('prefix') + '#{v}').replace('{v}', value)); }; - $.form.iframe('{:url("data/news_item/select")}', '选择文章', ['930px', '600px']); - }).on('click', '[data-item-goods]', function ($that) { - $that = $(this), top.setCheckValue = function (id) { - $that.prevAll('input').val('goods#{v}'.replace('{v}', id)); - }; - $.form.iframe('{:url("data/shop_goods/select")}', '选择商品', ['930px', '600px']); + $.form.iframe($(this).data('show-page'), $that.data('title') || $that.text(), ['930px', '600px']); }).on('click', '[data-item-add]', function () { addItem(); - }).on('click', '[data-item-rm]', function () { + }).on('click', '[data-item-del]', function () { $(this).parents('[data-slider-item]').remove(); }).on('click', '[data-item-up]', function () { - this.item = $(this).parents('[data-slider-item]'); - this.prev = this.item.prev('[data-slider-item]'); - if (this.item.index() > 0) this.item.insertBefore(this.prev); + var item = $(this).parents('[data-slider-item]'); + var prev = item.prev('[data-slider-item]'); + if (item.index() > 0) item.insertBefore(prev); }).on('click', '[data-item-dn]', function () { - this.item = $(this).parents('[data-slider-item]'); - this.next = this.item.next('[data-slider-item]'); - if (this.next) this.item.insertAfter(this.next); + var item = $(this).parents('[data-slider-item]'); + var next = item.next('[data-slider-item]'); + if (next) item.insertAfter(next); }); /*! 表单提交处理 */ $('form#SliderForm').vali(function (ret) { - this.data = []; - for (this.index in ret.img) { - if (!ret.img[this.index]) return $.msg.tips('请上传展示图片哦!'); - this.data.push({img: ret.img[this.index], rule: ret.rule[this.index], name: ret.name[this.index]}); + var idx, data = []; + for (idx in ret.img) { + if (!ret.img[idx]) return $.msg.tips('请上传展示图片哦!'); + data.push({img: ret.img[idx], rule: ret.rule[idx], name: ret.name[idx]}); } - $.form.load('{$request->url()}', {data: JSON.stringify(this.data)}, 'post'); + $.form.load('{$request->url()}', {data: JSON.stringify(data)}, 'post'); }); - - })(JSON.parse(document.getElementById('default-data').innerHTML || '[]') || []); + })(JSON.parse(document.getElementById('DefaultData').innerHTML || '[]') || []); /*! 添加轮播项 */ function addItem(data) { diff --git a/app/data/view/news_item/select.html b/app/data/view/news_item/select.html index 7c265ff6f..b0db041cb 100644 --- a/app/data/view/news_item/select.html +++ b/app/data/view/news_item/select.html @@ -20,7 +20,7 @@ {$vo.title|default=''} {if $vo.status eq 0}已禁用{elseif $vo.status eq 1}使用中{/if} {$vo.create_at|format_datetime} - 选择文章 + 选择文章 {/foreach} @@ -46,8 +46,8 @@