@@ -59,6 +59,9 @@
|
||||
<option value="{$key}" {eq name="item['value']" value="$key"}selected{/eq}>{$vo}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
{/case}
|
||||
{case value="image"}
|
||||
{:widget('common/Form/showConfig',array($item,$item))}
|
||||
{/case}
|
||||
{/switch}
|
||||
{if condition="$item['remark']"}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
<div class="picker-box">
|
||||
<div id="picker_{$field}" class="picker_button">上传图片</div>
|
||||
{if isset($value) && $value}
|
||||
<input type="hidden" name="config[{$field}]" id="field_{$field}" value="{$value}">
|
||||
{else/}
|
||||
<input type="hidden" name="config[{$field}]" id="field_{$field}" value="">
|
||||
{/if}
|
||||
<div id="fileList_{$field}" class="upload-file-list-info" style="width:280px;">
|
||||
{if $value}
|
||||
{php}
|
||||
$images = get_cover($value);
|
||||
{/php}
|
||||
<li class="affix-list-item" id="WU_FILE_0">
|
||||
<div class="upload-file-info">
|
||||
<span class="webuploader-pick-file-close" data-queued-id="WU_FILE_0" data-id="{$value}" data-fileurl="{$images['path']}"><i class="close"></i></span>
|
||||
<span class="fname"></span>
|
||||
<span class="fsize">上传时间:{$images['create_time']|date='Y-m-d H:i:s',###}</span>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="filebox image">
|
||||
<img src="{:config('base_url')}{$images['path']}" class="img-responsive">
|
||||
</div>
|
||||
</li>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
uploadsize = 2;
|
||||
$(function(){
|
||||
$("#picker_{$field}").SentUploader({
|
||||
fileNumLimit:1,
|
||||
uploadEvents: {
|
||||
uploadComplete:function(file){}
|
||||
},
|
||||
listName : 'fileList_{$field}',
|
||||
hiddenName: 'field_{$field}',
|
||||
hiddenValType:1,
|
||||
fileSingleSizeLimit:uploadsize*1024*1024,
|
||||
closeX:true
|
||||
},
|
||||
{
|
||||
fileType: 'service',
|
||||
filename : 'images',
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -37,4 +37,27 @@ class Form {
|
||||
$view->assign($data);
|
||||
return $view->fetch('common@default/form/' . $type);
|
||||
}
|
||||
public function showConfig($field, $info) {
|
||||
$type = isset($field['type']) ? $field['type'].'_Config' : 'text';
|
||||
//类型合并
|
||||
if (in_array($type, array('string'))) {
|
||||
$type = 'text';
|
||||
}
|
||||
if (in_array($type, array('picture'))) {
|
||||
$type = 'image';
|
||||
}
|
||||
|
||||
$data = array(
|
||||
'type' => $type,
|
||||
'field' => isset($field['name']) ? $field['name'] : '',
|
||||
'value' => isset($info[$field['name']]) ? $info[$field['name']] : (isset($field['value']) ? $field['value'] : ''),
|
||||
'size' => isset($field['size']) ? $field['size'] : 12,
|
||||
'option' => isset($field['option']) ? $field['option'] : '',
|
||||
);
|
||||
$no_tem = array('readonly', 'text', 'password','checkbox', 'textarea', 'select', 'bind', 'checkbox', 'radio', 'num', 'bool', 'decimal');
|
||||
$type = !in_array($type, $no_tem) ? $type : 'show';
|
||||
$view = new \think\View();
|
||||
$view->assign($data);
|
||||
return $view->fetch('common@default/form/'.$type);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user