diff --git a/application/wechat/controller/News.php b/application/wechat/controller/News.php
index 03b960204..c189f31a8 100644
--- a/application/wechat/controller/News.php
+++ b/application/wechat/controller/News.php
@@ -33,6 +33,24 @@ class News extends BasicAdmin {
*/
protected $table = 'WechatNews';
+ /**
+ * 图文列表
+ */
+ public function index() {
+ $this->assign('title', '图文列表');
+ parent::_list();
+ }
+
+ /**
+ * 图文列表数据处理
+ * @param $data
+ */
+ protected function _index_data_filter(&$data) {
+ foreach ($data as &$vo) {
+ $vo = WechatService::getNewsById($vo['id']);
+ }
+ }
+
/**
* 添加图文
* @return \think\response\View
diff --git a/application/wechat/view/news.form.html b/application/wechat/view/news.form.html
index 88b86a7b7..b1efa71ec 100644
--- a/application/wechat/view/news.form.html
+++ b/application/wechat/view/news.form.html
@@ -140,11 +140,11 @@
/*! 编辑器初始化成功 */
editor.ready(function () {
- var $form = $('form[name="news"]');
+ var $form = $('form[name="news"]'), $body = $('body');
$form.validate();
- // 数据提交
+ /*! 数据提交 */
$form.find('button[data-submit]').on('click', function () {
var data = [];
$form.submit();
@@ -160,7 +160,7 @@
$.form.load('__SELF__', {data: data}, "post");
});
- // 输入标题显示
+ /*! 输入标题显示 */
$form.find('[name="title"]').on('keyup', function () {
if ($item) {
if (('' + this.value).length > 0) {
@@ -220,34 +220,38 @@
editor.setContent(data.content);
}
- /*! jQuery事件绑定 */
- $('body').off('click', '.news-box .article-add').on('click', '.news-box .article-add', function () {
- /*! 添加新图文 */
+ /*! 添加新图文 */
+ $body.off('click', '.news-box .article-add').on('click', '.news-box .article-add', function () {
var $html = $('
');
$html.insertBefore(this).trigger('click');
- if ($('.news-item').size() >= 7) {
- return $(this).hide();
- }
- }).off('click', '.news-item').on('click', '.news-item', function () {
- /*! 列表选择 */
+ $('.news-item').size() >= 7 && $(this).hide();
+ });
+
+ /*! 列表选择 */
+ $body.off('click', '.news-item').on('click', '.news-item', function () {
if (syncEditor($('.news-item.active'))) {
$(this).addClass('active').siblings().removeClass('active');
showEditor($item);
}
- }).off('mouseleave').on('mouseleave', '.news-item', function () {
- /*! 隐藏删除按钮 */
+ });
+
+ /*! 隐藏删除按钮 */
+ $body.off('mouseleave').on('mouseleave', '.news-item', function () {
$(this).find('.upload-multiple-close').addClass('hide');
- }).off('mouseenter', '.news-item').on('mouseenter', '.news-item', function () {
- /*! 显示删除按钮 */
+ });
+
+ /*! 显示删除按钮 */
+ $body.off('mouseenter', '.news-item').on('mouseenter', '.news-item', function () {
$('.upload-multiple-close').addClass('hide');
$(this).find('.upload-multiple-close').removeClass('hide');
- }).off('click', '.upload-multiple-close').on('click', '.upload-multiple-close', function () {
- /*! 删除操作图文 */
- $(this).parents('.news-item').remove();
- if ($('.news-item').size() < 7) {
- $('.news-box .article-add').show();
- }
});
+
+ /*! 删除操作图文 */
+ $body.off('click', '.upload-multiple-close').on('click', '.upload-multiple-close', function () {
+ $(this).parents('.news-item').remove();
+ $('.news-item').size() < 7 && $('.news-box .article-add').show();
+ });
+
/*! 默认显示第一个 */
$('.news-box .news-item:first').trigger('click');
});
diff --git a/application/wechat/view/news.index.html b/application/wechat/view/news.index.html
new file mode 100644
index 000000000..d9d317241
--- /dev/null
+++ b/application/wechat/view/news.index.html
@@ -0,0 +1,95 @@
+{extend name='extra@admin/content' /}
+
+{block name='content'}
+
+{foreach $list as $key=>$vo}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+{/foreach}
+{/block}
+
+
+{block name='script'}
+{/block}
+
+{block name="style"}
+{/block}
\ No newline at end of file