You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
simple-yewu/frontend/views/image/look-image.php

177 lines
7.4 KiB

5 years ago
<style>
#img-box {
width: 100%;
}
#img-box ul li {
list-style: none;
float: left;
padding: 10px;
}
#img-box ul li, #img-box ul li img {
width: 200px;
height: 100px;
}
#img-box ul li i {
position: absolute;
cursor: pointer;
}
</style>
<div id="img-box">
<?php if(count($images) > 0): ?>
<?php if(isset($images[2])): ?>
<h1>司机接车</h1>
<ul>
<?php foreach($images[2] as $img): ?>
<li>
<i data-fix-img="<?= $img['id'] ?>" onclick="rmImg(event,$(this))">删除</i>
<a href="javascript:void(0)" title="<?= \common\models\FixCarImageCategory::findOne($img['image_category_id'])->name ?>"><img src="\<?= $img['name'] ?>"></a>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php if(isset($images[3])): ?>
<div style="clear: both"></div>
<h1>前台审核</h1>
<ul>
<?php foreach($images[3] as $img): ?>
<li>
<i data-fix-img="<?= $img['id'] ?>" onclick="rmImg(event,$(this))">删除</i>
<a href="javascript:void(0)" title="<?= \common\models\FixCarImageCategory::findOne($img['image_category_id'])->name ?>"><img src="\<?= $img['name'] ?>"></a>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php if(isset($images[4])): ?>
<div style="clear: both"></div>
<h1>查勘定损</h1>
<ul>
<?php foreach($images[4] as $img): ?>
<li>
<i data-fix-img="<?= $img['id'] ?>" onclick="rmImg(event,$(this))">删除</i>
<a href="javascript:void(0)" title="<?= \common\models\FixCarImageCategory::findOne($img['image_category_id'])->name ?>"><img src="\<?= $img['name'] ?>"></a>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php if(isset($images[5])): ?>
<div style="clear: both"></div>
<h1>前台派工</h1>
<ul>
<?php foreach($images[5] as $img): ?>
<li>
<i data-fix-img="<?= $img['id'] ?>" onclick="rmImg(event,$(this))">删除</i>
<a href="javascript:void(0)" title="<?= \common\models\FixCarImageCategory::findOne($img['image_category_id'])->name ?>"><img src="\<?= $img['name'] ?>"></a>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php if(isset($images[6])): ?>
<div style="clear: both"></div>
<h1>钣金</h1>
<ul>
<?php foreach($images[6] as $img): ?>
<li>
<i data-fix-img="<?= $img['id'] ?>" onclick="rmImg(event,$(this))">删除</i>
<a href="javascript:void(0)" title="<?= \common\models\FixCarImageCategory::findOne($img['image_category_id'])->name ?>"><img src="\<?= $img['name'] ?>"></a>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php if(isset($images[7])): ?>
<div style="clear: both"></div>
<h1>底子工</h1>
<ul>
<?php foreach($images[7] as $img): ?>
<li>
<i data-fix-img="<?= $img['id'] ?>" onclick="rmImg(event,$(this))">删除</i>
<a href="javascript:void(0)" title="<?= \common\models\FixCarImageCategory::findOne($img['image_category_id'])->name ?>"><img src="\<?= $img['name'] ?>"></a>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php if(isset($images[8])): ?>
<div style="clear: both"></div>
<h1>喷漆工</h1>
<ul>
<?php foreach($images[8] as $img): ?>
<li>
<i data-fix-img="<?= $img['id'] ?>" onclick="rmImg(event,$(this))">删除</i>
<a href="javascript:void(0)" title="<?= \common\models\FixCarImageCategory::findOne($img['image_category_id'])->name ?>"><img src="\<?= $img['name'] ?>"></a>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php if(isset($images[9])): ?>
<div style="clear: both"></div>
<h1>钣金安装</h1>
<ul>
<?php foreach($images[9] as $img): ?>
<li>
<i data-fix-img="<?= $img['id'] ?>" onclick="rmImg(event,$(this))">删除</i>
<a href="javascript:void(0)" title="<?= \common\models\FixCarImageCategory::findOne($img['image_category_id'])->name ?>"><img src="\<?= $img['name'] ?>"></a>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php if(isset($images[10])): ?>
<div style="clear: both"></div>
<h1>机电</h1>
<ul>
<?php foreach($images[10] as $img): ?>
<li>
<i data-fix-img="<?= $img['id'] ?>" onclick="rmImg(event,$(this))">删除</i>
<a href="javascript:void(0)" title="<?= \common\models\FixCarImageCategory::findOne($img['image_category_id'])->name ?>"><img src="\<?= $img['name'] ?>"></a>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php if(isset($images[11])): ?>
<div style="clear: both"></div>
<h1>美容装饰</h1>
<ul>
<?php foreach($images[11] as $img): ?>
<li>
<i data-fix-img="<?= $img['id'] ?>" onclick="rmImg(event,$(this))">删除</i>
<a href="javascript:void(0)" title="<?= \common\models\FixCarImageCategory::findOne($img['image_category_id'])->name ?>"><img src="\<?= $img['name'] ?>"></a>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php if(isset($images[12])): ?>
<div style="clear: both"></div>
<h1>总检</h1>
<ul>
<?php foreach($images[12] as $img): ?>
<li>
<i data-fix-img="<?= $img['id'] ?>" onclick="rmImg(event,$(this))">删除</i>
<a href="javascript:void(0)" title="<?= \common\models\FixCarImageCategory::findOne($img['image_category_id'])->name ?>"><img src="\<?= $img['name'] ?>"></a>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php endif; ?>
</div>
<script src="/js/jquery-1.8.3.js">
</script>
<script>
//图片删除
function rmImg(event, obj) {
event.stopPropagation();
var id = obj.data('fix-img');
if (id > 0) {
$.post('/image/rm-img', {id:id,_csrf:'<?= Yii::$app->getRequest()->getCsrfToken() ?>'}, function (msg) {
if (msg.success) {
obj.parent().remove();
}
}, 'json');
} else {
var index = obj.next().attr('src') + '^#@#$';
fileCollect.splice($.inArray(index, fileCollect), 1);
obj.parent().remove();
}
}
</script>