| xqd
@@ -39,45 +39,57 @@ class ProductController extends AdminController
|
|
|
$grid->column('cover_img')->image('',80);
|
|
|
$grid->column('cases')->display(function (){
|
|
|
$html = '';
|
|
|
- foreach ($this->cases as $case){
|
|
|
- $html .= '<img data-action="preview-img" src="'.$case.'"
|
|
|
+ if($this->cases){
|
|
|
+ foreach ($this->cases as $case){
|
|
|
+ $html .= '<img data-action="preview-img" src="'.$case.'"
|
|
|
style="max-width:80px;max-height:80px;cursor:pointer"
|
|
|
class="img img-thumbnail">';
|
|
|
+ }
|
|
|
}
|
|
|
return $html;
|
|
|
})->width(300);
|
|
|
$grid->column('tech_param')->display(function (){
|
|
|
$html = '';
|
|
|
- foreach ($this->tech_param as $key => $item){
|
|
|
- $html .= "<a href='{$item['url']}' download target='_blank'>技术参数</a><br>";
|
|
|
+ if($this->tech_param){
|
|
|
+ foreach ($this->tech_param as $key => $item){
|
|
|
+ $html .= "<a href='{$item['url']}' download target='_blank'>技术参数</a><br>";
|
|
|
+ }
|
|
|
}
|
|
|
return $html;
|
|
|
});
|
|
|
$grid->column('cad_model')->display(function (){
|
|
|
$html = '';
|
|
|
- foreach ($this->cad_model as $key => $item){
|
|
|
- $html .= "<a href='{$item['url']}' download target='_blank'>CAD模型</a><br>";
|
|
|
+ if($this->cad_model){
|
|
|
+ foreach ($this->cad_model as $key => $item){
|
|
|
+ $html .= "<a href='{$item['url']}' download target='_blank'>CAD模型</a><br>";
|
|
|
+ }
|
|
|
}
|
|
|
return $html;
|
|
|
});
|
|
|
$grid->column('cad_design')->display(function (){
|
|
|
$html = '';
|
|
|
- foreach ($this->cad_design as $key => $item){
|
|
|
- $html .= "<a href='{$item['url']}' download target='_blank'>CAD设计</a><br>";
|
|
|
+ if($this->cad_design){
|
|
|
+ foreach ($this->cad_design as $key => $item){
|
|
|
+ $html .= "<a href='{$item['url']}' download target='_blank'>CAD设计</a><br>";
|
|
|
+ }
|
|
|
}
|
|
|
return $html;
|
|
|
});
|
|
|
$grid->column('su_model')->display(function (){
|
|
|
$html = '';
|
|
|
- foreach ($this->su_model as $key => $item){
|
|
|
- $html .= "<a href='{$item['url']}' download target='_blank'>SU模型</a><br>";
|
|
|
+ if($this->su_model){
|
|
|
+ foreach ($this->su_model as $key => $item){
|
|
|
+ $html .= "<a href='{$item['url']}' download target='_blank'>SU模型</a><br>";
|
|
|
+ }
|
|
|
}
|
|
|
return $html;
|
|
|
});
|
|
|
$grid->column('other')->display(function (){
|
|
|
$html = '';
|
|
|
- foreach ($this->other as $key => $item){
|
|
|
- $html .= "<a href='{$item['url']}' download target='_blank'>{$item['name']}</a><br>";
|
|
|
+ if($this->other){
|
|
|
+ foreach ($this->other as $key => $item){
|
|
|
+ $html .= "<a href='{$item['url']}' download target='_blank'>{$item['name']}</a><br>";
|
|
|
+ }
|
|
|
}
|
|
|
return $html;
|
|
|
});
|