diff --git a/application/wechat/controller/Menu.php b/application/wechat/controller/Menu.php index 359884836..e77aa174d 100644 --- a/application/wechat/controller/Menu.php +++ b/application/wechat/controller/Menu.php @@ -116,13 +116,16 @@ class Menu extends BasicAdmin { */ protected function _push() { $result = Db::name($this->table) - ->field('id,index,pindex,name,type,content') - ->where('status', '1') - ->order('sort ASC,id ASC') - ->select(); + ->field('id,index,pindex,name,type,content') + ->where('status', '1') + ->order('sort ASC,id ASC') + ->select(); foreach ($result as &$row) { empty($row['content']) && $row['content'] = uniqid(); switch ($row['type']) { + case 'miniprogram': + list($row['appid'], $row['pagepath']) = explode(',', $row['content']); + break; case 'view': $row['url'] = preg_match('#^(\w+:)?//#i', $row['content']) ? $row['content'] : url($row['content'], '', true, true); break; diff --git a/application/wechat/view/menu.index.html b/application/wechat/view/menu.index.html index 19c0591d8..d889c0600 100644 --- a/application/wechat/view/menu.index.html +++ b/application/wechat/view/menu.index.html @@ -89,6 +89,9 @@ + @@ -232,8 +235,17 @@ $html.find('input[name="menu-type"]').on('click', function () { $span.attr('data-type', this.value || 'text'); var content = $span.data('content') || ''; + var type = this.value; var html = function () { - switch (this.value) { + switch (type) { + case 'miniprogram': + var tpl = '