作者 zhangwei
... ... @@ -98,6 +98,15 @@ class AdminRegionGalleryController extends AdminBaseController
}
}
//移动相册
if (!empty($data['m_photo_names']) && !empty($data['m_photo_urls'])) {
$data['post']['more']['m_photos'] = [];
foreach ($data['m_photo_urls'] as $key => $url) {
$photoUrl = cmf_asset_relative_url($url);
array_push($data['post']['more']['m_photos'], ["url" => $photoUrl, "name" => $data['m_photo_names'][$key]]);
}
}
if (!empty($data['file_names']) && !empty($data['file_urls'])) {
$data['post']['more']['files'] = [];
foreach ($data['file_urls'] as $key => $url) {
... ... @@ -171,6 +180,7 @@ class AdminRegionGalleryController extends AdminBaseController
$portalPostModel = new PortalPostModel();
//pc相册
if (!empty($data['photo_names']) && !empty($data['photo_urls'])) {
$data['post']['more']['photos'] = [];
foreach ($data['photo_urls'] as $key => $url) {
... ... @@ -178,6 +188,15 @@ class AdminRegionGalleryController extends AdminBaseController
array_push($data['post']['more']['photos'], ["url" => $photoUrl, "name" => $data['photo_names'][$key]]);
}
}
//移动相册
if (!empty($data['m_photo_names']) && !empty($data['m_photo_urls'])) {
$data['post']['more']['m_photos'] = [];
foreach ($data['m_photo_urls'] as $key => $url) {
$photoUrl = cmf_asset_relative_url($url);
array_push($data['post']['more']['m_photos'], ["url" => $photoUrl, "name" => $data['m_photo_names'][$key]]);
}
}
if (!empty($data['file_names']) && !empty($data['file_urls'])) {
$data['post']['more']['files'] = [];
... ...
... ... @@ -236,6 +236,7 @@ class RegionController extends HomeBaseController
if($res){
$more = json_decode($res['more'],true);
$res['image_url'] = isset($more['photos']) && !empty($more['photos'])?$more['photos']:'';
$res['m_image_url'] = isset($more['m_photos']) && !empty($more['m_photos'])?$more['m_photos']:'';
}
$this->assign('res',$res);
return $this->fetch();
... ...
... ... @@ -15,6 +15,18 @@
<a href="javascript:(function(){$('#saved-image{id}').remove();})();">移除</a>
</li>
</script>
<!--移动相册-->
<script type="text/html" id="m_photos-item-tpl">
<li id="m_saved-image{id}">
<input id="m_photo-{id}" type="hidden" name="m_photo_urls[]" value="{filepath}">
<input class="form-control" id="m_photo-{id}-name" type="text" name="m_photo_names[]" value="{name}"
style="width: 200px;" title="图片名称">
<img id="m_photo-{id}-preview" src="{url}" style="height:36px;width: 36px;"
onclick="imagePreviewDialog(this.src);">
<a href="javascript:uploadOneImage('图片上传','#m_photo-{id}');">替换</a>
<a href="javascript:(function(){$('#m_saved-image{id}').remove();})();">移除</a>
</li>
</script>
<script type="text/html" id="files-item-tpl">
<li id="saved-file{id}">
<input id="file-{id}" type="hidden" name="file_urls[]" value="{filepath}">
... ... @@ -54,6 +66,17 @@
</td>
</tr>
<tr>
<th>移动相册<span class="form-required">*</span></th>
<td>
<ul id="m_photos" class="pic-list list-unstyled form-inline"></ul>
<a href="javascript:uploadMultiImage('图片上传','#m_photos','m_photos-item-tpl');"
class="btn btn-default btn-sm">选择图片</a>
<div style="margin-top:30px;">
<span class="form-required">图片参考尺寸:420*740</span>
</div>
</td>
</tr>
<tr>
<th>权重</th>
<td>
<input class="form-control" type="number" name="post[weigh]" value="0">
... ...
... ... @@ -15,6 +15,19 @@
<a href="javascript:(function(){$('#saved-image{id}').remove();})();">移除</a>
</li>
</script>
<!--移动端相册-->
<script type="text/html" id="m_photos-item-tpl">
<li id="m_saved-image{id}">
<input id="m_photo-{id}" type="hidden" name="m_photo_urls[]" value="{filepath}">
<input class="form-control" id="m_photo-{id}-name" type="text" name="m_photo_names[]" value="{name}"
style="width: 200px;" title="图片名称">
<img id="m_photo-{id}-preview" src="{url}" style="height:36px;width: 36px;"
onclick="imagePreviewDialog(this.src);">
<a href="javascript:uploadOneImage('图片上传','#m_photo-{id}');">替换</a>
<a href="javascript:(function(){$('#m_saved-image{id}').remove();})();">移除</a>
</li>
</script>
<script type="text/html" id="files-item-tpl">
<li id="saved-file{id}">
<input id="file-{id}" type="hidden" name="file_urls[]" value="{filepath}">
... ... @@ -77,6 +90,36 @@
</td>
</tr>
<tr>
<th>移动相册<span class="form-required">*</span></th>
<td>
<ul id="m_photos" class="pic-list list-unstyled form-inline">
<notempty name="post.more.m_photos">
<foreach name="post.more.m_photos" item="vo">
<php>$img_url=cmf_get_image_preview_url($vo['url']);</php>
<li id="m_saved-image{$key}">
<input id="m_photo-{$key}" type="hidden" name="m_photo_urls[]"
value="{$vo.url}">
<input class="form-control" id="m_photo-{$key}-name" type="text"
name="m_photo_names[]"
value="{$vo.name|default=''}" style="width: 200px;" title="图片名称">
<img id="m_photo-{$key}-preview"
src="{:cmf_get_image_preview_url($vo['url'])}"
style="height:36px;width: 36px;"
onclick="parent.imagePreviewDialog(this.src);">
<a href="javascript:uploadOneImage('图片上传','#m_photos-{$key}');">替换</a>
<a href="javascript:(function(){$('#m_saved-image{$key}').remove();})();">移除</a>
</li>
</foreach>
</notempty>
</ul>
<a href="javascript:uploadMultiImage('图片上传','#m_photos','m_photos-item-tpl');"
class="btn btn-sm btn-default">选择图片</a>
<div style="margin-top:30px;">
<span class="form-required">图片参考尺寸:420*740</span>
</div>
</td>
</tr>
<tr>
<th>权重</th>
<td>
<input class="form-control" type="number" name="post[weigh]" value="{$post.weigh}">
... ...
... ... @@ -48,7 +48,7 @@
<body>
<div class="index_fourth swiper-container">
<ul class="swiper-wrapper">
<volist name="res['image_url']" id="vo">
<volist name="res['m_image_url']" id="vo">
<li class="swiper-slide">
<!-- <img src="__TMPL__/public/assets/images/cicon_43@2x.png" alt=""> -->
<img src="{:cmf_get_image_url($vo.url)}" alt="" />
... ...