117 lines
4.2 KiB
PHP
117 lines
4.2 KiB
PHP
@extends('admin.content')
|
|
|
|
@section('title', '照片')
|
|
|
|
@section('content')
|
|
@php $portal = $portal ?? 'admin'; @endphp
|
|
<div class="layui-card">
|
|
<form class="layui-form layui-card-header layuiadmin-card-header-auto" lay-filter="LAY-photo-search">
|
|
<div class="layui-form-item">
|
|
<div class="layui-inline">
|
|
<label class="layui-form-label">渠道 ID</label>
|
|
<div class="layui-input-block">
|
|
<input type="text" name="channel_id" class="layui-input" autocomplete="off">
|
|
</div>
|
|
</div>
|
|
<div class="layui-inline">
|
|
<label class="layui-form-label">设备 ID</label>
|
|
<div class="layui-input-block">
|
|
<input type="text" name="device_key" class="layui-input" autocomplete="off">
|
|
</div>
|
|
</div>
|
|
@if ($portal === 'admin')
|
|
<div class="layui-inline">
|
|
<label class="layui-form-label">代理用户</label>
|
|
<div class="layui-input-block">
|
|
<select name="agent_user_id">
|
|
<option value="">全部</option>
|
|
<option value="0">官方</option>
|
|
@foreach ($agents as $a)
|
|
<option value="{{ $a->id }}">{{ $a->username }}</option>
|
|
@endforeach
|
|
</select>
|
|
</div>
|
|
</div>
|
|
@endif
|
|
<div class="layui-inline">
|
|
<label class="layui-form-label">敏感词</label>
|
|
<div class="layui-input-block">
|
|
<select name="sensitive">
|
|
<option value="">全部</option>
|
|
<option value="1">含敏感词</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="layui-inline">
|
|
<button class="layui-btn" lay-submit lay-filter="LAY-photo-search">搜索</button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
<div class="layui-card-body">
|
|
<table id="LAY-photo-list" lay-filter="LAY-photo-list"></table>
|
|
<script type="text/html" id="LAY-photo-thumb">
|
|
<img src="@{{d.url}}" lay-event="preview" title="点击预览" style="max-height:48px;max-width:72px;cursor:pointer;">
|
|
</script>
|
|
<script type="text/html" id="LAY-photo-ops">
|
|
<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="detail">设备详情</a>
|
|
</script>
|
|
</div>
|
|
</div>
|
|
@endsection
|
|
|
|
@push('scripts')
|
|
<script>
|
|
layui.use(['table', 'form', 'layer'], function () {
|
|
var table = layui.table, form = layui.form, layer = layui.layer;
|
|
table.render({
|
|
elem: '#LAY-photo-list',
|
|
id: 'LAY-photo-list',
|
|
url: @json(route($portal.'.photos.data')),
|
|
cols: [[
|
|
{ field: 'id', title: 'ID', width: 70, sort: true },
|
|
{ field: 'thumb', title: '预览', width: 100, templet: '#LAY-photo-thumb' },
|
|
{ field: 'device_key', title: '设备 ID', width: 150 },
|
|
{ field: 'channel_id', title: '渠道 ID', minWidth: 220 },
|
|
{ field: 'x_hit', title: '敏感词', width: 90, sort: true },
|
|
{ field: 'size', title: '大小', width: 100, sort: true },
|
|
{ field: 'created_at', title: '创建时间', width: 170, sort: true },
|
|
{ title: '操作', width: 110, align: 'center', fixed: 'right', toolbar: '#LAY-photo-ops' }
|
|
]],
|
|
page: true, limit: 15, height: 'full-220',
|
|
request: { pageName: 'page', limitName: 'limit' },
|
|
response: { statusName: 'code', statusCode: 0, msgName: 'msg', countName: 'count', dataName: 'data' }
|
|
});
|
|
form.on('submit(LAY-photo-search)', function (data) {
|
|
table.reload('LAY-photo-list', { where: data.field, page: { curr: 1 } });
|
|
return false;
|
|
});
|
|
table.on('tool(LAY-photo-list)', function (obj) {
|
|
if (obj.event === 'detail') {
|
|
var url = obj.data.detail_url;
|
|
var title = '设备 ' + (obj.data.device_key || ('#' + obj.data.id));
|
|
try {
|
|
if (parent && parent.layui && parent.layui.index) {
|
|
parent.layui.index.openTabsPage(url, title);
|
|
return;
|
|
}
|
|
} catch (e) {}
|
|
location.href = url;
|
|
return;
|
|
}
|
|
if (obj.event === 'preview') {
|
|
var url = obj.data.url;
|
|
layer.open({
|
|
type: 1,
|
|
title: '照片预览 #' + obj.data.id,
|
|
area: ['80%', '80%'],
|
|
shadeClose: true,
|
|
content: '<div style="padding:12px;text-align:center;height:100%;box-sizing:border-box;overflow:auto;">' +
|
|
'<img src="' + url + '" style="max-width:100%;max-height:100%;">' +
|
|
'</div>'
|
|
});
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
@endpush
|