mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
[更新]修改微信菜单小程序支持
This commit is contained in:
parent
f22d1a3c40
commit
5e69f6ed56
@ -124,7 +124,7 @@ class Menu extends BasicAdmin {
|
||||
empty($row['content']) && $row['content'] = uniqid();
|
||||
switch ($row['type']) {
|
||||
case 'miniprogram':
|
||||
list($row['appid'], $row['pagepath']) = explode(',', $row['content'] . ',');
|
||||
list($row['appid'], $row['pagepath'], $row['url']) = explode(',', $row['content'] . ',,');
|
||||
break;
|
||||
case 'view':
|
||||
$row['url'] = preg_match('#^(\w+:)?//#i', $row['content']) ? $row['content'] : url($row['content'], '', true, true);
|
||||
|
@ -239,13 +239,18 @@
|
||||
var html = function () {
|
||||
switch (type) {
|
||||
case 'miniprogram':
|
||||
var tpl = '<div><div>小程序APPID<input style="display:block;margin-bottom:10px" class="form-control input-sm" value="{appid}" name="appid"/></div>Pagepath<textarea style="resize:none;height:165px;" name="pagepath" class="form-control input-sm">{content}</textarea></div>';
|
||||
var _appid = '', _content = '';
|
||||
var tpl = '<div>\
|
||||
<div>appid<input style="display:block;margin-bottom:10px" class="form-control input-sm" value="{appid}" name="appid"></div>\
|
||||
<div>url<input style="display:block;margin-bottom:10px" class="form-control input-sm" value="{url}" name="url"></div>\
|
||||
<div>pagepath<input style="display:block" name="pagepath" class="form-control input-sm" value={pagepath}></div>\
|
||||
</div>';
|
||||
var _appid = '', _pagepath = '', _url = '';
|
||||
if (content.indexOf(',') > 0) {
|
||||
_appid = content.split(',')[0];
|
||||
_content = content.split(',')[1];
|
||||
_appid = content.split(',')[0] || '';
|
||||
_url = content.split(',')[1] || '';
|
||||
_pagepath = content.split(',')[2] || '';
|
||||
}
|
||||
return tpl.replace('{appid}', _appid).replace('{content}', _content);
|
||||
return tpl.replace('{appid}', _appid).replace('{url}', _url).replace('{pagepath}', _pagepath);
|
||||
case 'customservice':
|
||||
case 'text':
|
||||
return '<div>回复内容<textarea style="resize:none;height:225px" name="content" class="form-control input-sm">{content}</textarea></div>'.replace('{content}', content);
|
||||
@ -278,7 +283,7 @@
|
||||
$span.data(this.name, $(this).val() || $(this).html());
|
||||
// 如果是小程序,合并内容到span的content上
|
||||
if (type === 'miniprogram') {
|
||||
$span.data('content', $span.data('appid') + ',' + $span.data('pagepath'));
|
||||
$span.data('content', $span.data('appid') + ',' + $span.data('url') + ',' + $span.data('pagepath'));
|
||||
}
|
||||
});
|
||||
$('.editor-content-input').html($html);
|
||||
@ -297,7 +302,7 @@
|
||||
menudata.type = $span.attr('data-type');
|
||||
// 小程序要特殊处理
|
||||
if (menudata.type === 'miniprogram') {
|
||||
menudata.content = $span.data('appid') + ',' + $span.data('pagepath');
|
||||
menudata.content = $span.data('appid') + ',' + $span.data('url') + ',' + $span.data('pagepath');
|
||||
} else {
|
||||
menudata.content = $span.data('content') || '';
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user