| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 |
- <%@ page language="java" contentType="text/html; charset=UTF-8"
- pageEncoding="UTF-8" %>
- <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>产品知识列表</title>
- <%@include file="/views/common.jsp" %>
- <style type="text/css">
- .layui-table-cell {
- height: 32px;
- line-height: 32px;
- }
- .layui-table td, .layui-table th, .layui-table-header, .layui-table-page, .layui-table-tool, .layui-table-total, .layui-table-view {
- border-color: #6666;
- font-size: 16px;
- }
- .ztree * {
- font-size: 20px;
- }
- .edge .layui-edge {
- right: 35px;
- }
- </style>
- </head>
- <script type="text/html" id="toolbarDemo">
- </script>
- <body>
- <br>
- <form class="layui-form" action="">
- <div class="layui-inline">
- <label class="layui-form-label">内容</label>
- <div class="layui-input-inline">
- <input type="text" id="content" name="content" placeholder="请输入内容"
- autocomplete="off" class="layui-input">
- </div>
- </div>
- <div class="layui-inline">
- <div class="layui-input-inline">
- <button class="layui-btn" id="searchBtn" lay-submit lay-filter="formDemo" style="margin-left: 15px">
- <i class="layui-icon layui-icon-search"></i> 查询
- </button>
- <button type="reset" class="layui-btn layui-btn-primary">重置</button>
- </div>
- </div>
- </form>
- <table class="layui-hide" id="informationTable" lay-filter="informationTable"></table>
- <style>
- .layui-table-body .layui-table tr {
- height: 80px;
- }
- </style>
- <script type="text/javascript">
- function viewImage(item) {
- let html = "<div style='width: 100%;height: 100%;display: flex;align-items: center;justify-content: center'>";
- if (item != "" && (item.indexOf(".mp4") > -1 || item.indexOf(".MP4") > -1)) {
- html += "<video src='" + item + "' class='layui-upload-img' controls style='width: 400px;height: 400px;margin-right: 5px;'/>";
- } else if (item != "" && (item.indexOf(".PDF") > -1 || item.indexOf(".pdf") > -1)) {
- let pdfUrl = "/js/pdf/web/viewer.html?file=" + item.replace("https://dfdiyfile.oss-cn-fuzhou.aliyuncs.com/", "http://imagediy.lingtao8.com/");
- html += "<iframe src='" + pdfUrl + "' style='width: 400px;height: 400px;margin-right: 5px;'/>";
- } else if (item != "") {
- html += "<img src='" + item + "' class='layui-upload-img' style='width: 400px;height: 400px;margin-right: 5px;'/>";
- }
- html += "</div>";
- layer.open({
- type: 1,
- title: false,
- closeBtn: 0,
- offset: 'auto',
- area: ['400px', '400px'],
- skin: 'layui-layer-nobg', //没有背景色
- shadeClose: true,
- content: html
- });
- }
- layui.use(['element', 'table', 'laydate', 'form'], function () {
- var $ = layui.jquery;
- var table = layui.table;
- var laydate = layui.laydate;
- var element = layui.element;
- var form = layui.form;
- // 生成表格
- table.render({
- elem: '#informationTable',
- url: '../../../../getInformations',
- toolbar: '#toolbarDemo',
- title: '用户表',// 导出文件名
- id: 'informationTableAll',
- // 开启分页
- // page : true,
- page: {
- layout: ['count', 'prev', 'page', 'next', 'skip', 'limit']
- },
- limits: [10, 30, 50, 80, 100, 999],
- /*request : {
- 'limitName' : 'pageSize' // 分页每页条数默认字段改为pageSize
- },*/
- where: {
- content: '', type: '2'
- },
- cellMinWidth: 80, // 全局定义常规单元格的最小宽度,layui 2.2.1 新增
- cols: [[{
- type: 'numbers',
- title: '序号',
- width: 50,
- fixed: "left"
- }, {
- field: 'content',
- title: '内容',
- }, {
- field: 'content',
- title: '图片视频',
- templet: function (d) {
- let html = "<div style='width: 100%;height: 100%;display: flex;align-items: center;justify-content: center'>";
- if (d.attachment) {
- let list = d.attachment.split(",");
- for (let i = 0; i < list.length; i++) {
- let item = list[i];
- if (item != "" && (item.indexOf(".mp4") > -1 || item.indexOf(".MP4") > -1)) {
- html += "<video src='" + item + "' class='layui-upload-img' style='width: 40px;height: 40px;margin-right: 5px;' onclick='viewImage(\"" + item + "\")'/>";
- } else if (item != "" && (item.indexOf(".PDF") > -1 || item.indexOf(".pdf") > -1)) {
- html += "<img src='https://dfdiyfile.oss-cn-fuzhou.aliyuncs.com/priceImages/20250905/PDF.png' class='layui-upload-img' style='width: 40px;height: 40px;margin-right: 5px;' onclick='viewImage(\"" + item + "\")'/>";
- } else if (item != "") {
- html += "<img src='" + item + "' class='layui-upload-img' style='width: 40px;height: 40px;margin-right: 5px;' onclick='viewImage(\"" + item + "\")'/>";
- }
- }
- }
- html += "</div>";
- return html;
- }
- }, {
- field: 'createBy',
- align: 'center',
- width: 150,
- title: '创建人'
- }, {
- field: 'createDate',
- title: '创建时间',
- width: 220,
- align: 'center',
- templet: function (d) {
- return d.createDate != null ? layui.util.toDateString(d.createDate, "yyyy-MM-dd HH:mm:ss") : "";
- }
- }]],
- parseData: function (res) { //将原始数据解析成 table 组件所规定的数据
- return {
- "code": 0, //解析接口状态
- "msg": "", //解析提示文本
- "count": res.data.list.total,//解析数据长度
- "data": res.data.list.list//解析数据列表
- };
- }
- });
- //点击查询按钮,重载表格
- $('#searchBtn').on('click', function () {
- table.reload('informationTableAll', {
- method: 'get',
- where: {
- content: $("#content").val()
- },
- page: {
- curr: 1
- }
- });
- return false;
- });
- })
- </script>
- </body>
- </html>
|