增加配置信息下单图上传方法

This commit is contained in:
睡不够先森
2017-11-17 11:49:41 +08:00
parent cc85851d46
commit 681c6cbff5

View File

@@ -37,4 +37,27 @@ class Form {
$view->assign($data); $view->assign($data);
return $view->fetch('common@default/form/' . $type); 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);
}
} }