XZ_HTML5之HTML<div>和<span>以及两者的区别

HTML 块元素

可以通过 <div> 和 <span> 将 HTML 元素组合起来。

大多数 HTML 元素被定义为块级元素或内联元素。

“块元素”译为 block level element,“内联元素”译为 inline element。

块级元素在浏览器显示时,通常会以新行来开始(和结束)。

例如:<h1>, <p>, <ul>, <table>



HTML 内联元素

内联元素在显示时通常不会以新行开始。

例如:<b>, <td>, <a>, <img>


HTML <div> 元素

HTML <div> 元素是块级元素,它是可用于组合其他 HTML 元素的容器。

<div> 元素没有特定的含义。除此之外,由于它属于块级元素,浏览器会在其前后显示折行。

如果与 CSS 一同使用,<div> 元素可用于对大的内容块设置样式属性。

<div> 元素的另一个常见的用途是文档布局。它取代了使用表格定义布局的老式方法。使用 <table> 元素进行文档布局不是表格的正确用法。<table> 元素的作用是显示表格化的数据。

例如,文档中的颜色是绿色:

<div style=color:#00FF00>

  <h3>This header's color is greenColor.</h3>

  <p>This paragraph's color is greenColor.</p>

</div>

定义和用法

<div> 可定义文档中的分区或节(division/section)。

<div> 标签可以把文档分割为独立的、不同的部分。它可以用作严格的组织工具,并且不使用任何格式与其关联。

如果用 id 或 class 来标记 <div>,那么该标签的作用会变得更加有效。

用法

<div> 是一个块级元素。这意味着它的内容自动地开始一个新行。实际上,换行是 <div> 固有的唯一格式表现。可以通过 <div> 的 class 或 id 应用额外的样式。

不必为每一个 <div> 都加上类或 id,虽然这样做也有一定的好处。

可以对同一个 <div> 元素应用 class 或 id 属性,但是更常见的情况是只应用其中一种。这两者的主要差异是,class 用于元素组(类似的元素,或者可以理解为某一类元素),而 id 用于标识单独的唯一的元素。

注释:<div> 是一个块级元素,也就是说,浏览器通常会在 div 元素前后放置一个换行符。

提示:请使用 <div> 元素来组合块级元素,这样就可以使用样式对它们进行格式化。

例如1,模拟了新闻网站的结构

<div class="news">

<h2>First News Headline.</h2>

<p>Today is a good day.</p>

</div>

<div class="news">

<h2>Second News Headline.</h2>

<p>Today is sunny.</p>

</div>

上面这段 HTML 模拟了新闻网站的结构。其中的每个 div 把每条新闻的标题和摘要组合在一起,也就是说,div 为文档添加了额外的结构。同时,由于这些 div 属于同一类元素,所以可以使用 class="news" 对这些 div 进行标识,这么做不仅为 div 添加了合适的语义,而且便于进一步使用样式对 div 进行格式化,可谓一举两得。

例如2,使用div元素和table元素添加网页布局

<!--使用div元素添加网页布局-->

<head>

    <metacharset="utf-8">

    <styletype="text/css">

  div#container{width:500px;}

  div#header{background-color: royalblue;}

  div#menu{background-color: yellowgreen;height:200px;width:150px;float:left;}

  div#content{background-color: palevioletred;height:200px;width:350px;float:left;}

  div#footer{background-color: palegoldenrod;clear:both;text-align: center;width:500px;}

  h1 {margin-bottom:0;}

  h2 {margin-bottom:0;font-size:18px;}

  ul {margin:0;}

  li {list-style:none;}

    </style>

</head>

<body>

<div id="container">

<divid="header"><h1align="center">网站题目</h1></div>

</div>

<div id="menu">

<h2>Menu</h2>

<ul>

    <li>HTML</li>

    <li>CSS</li>

    <li>JavaScript</li>

</ul>

</div>

<div id="content">Content goes here.</div>

<div id="footer">Footer of Web Page</div

</body>

实现效果: 


<!--使用table元素添加网页布局-->

<tablewidth="500"border="0">

   <tr>

<tdcolspan="2"style="background-color:royalblue;">

  <h1align="center">网站题目</h1>

</td>

   </tr>

   <trvalign="top">

<tdstyle="background-color:yellowgreen;width:150px;text-align:top;">

  <b>Menu</b><br>

  <ul>

    <li>HTML</li>

    <li>CSS</li>

    <li>JavaScript</li>

  </ul>

</td>

<tdstyle="background-color:palevioletred;height:200px;width:350px;text-align:top;">Content goes here.</td>

   </tr>

   <tr>

<td colspan="2"style="background-color:palegoldenrod;text-align:center;">Footer of Web Page.</td>

   </tr>

</table>

实现效果: 


HTML 块元素

可以通过 <div> 和 <span> 将 HTML 元素组合起来。

大多数网站会把内容安排到多个列中(就像杂志或报纸那样)。

可以使用 <div> 或者 <table> 元素来创建多列。CSS 用于对元素进行定位,或者为页面创建背景以及色彩丰富的外观。

提示:即使可以使用 HTML 表格来创建漂亮的布局,但设计表格的目的是呈现表格化数据 - 表格不是布局工具!


HTML <span> 元素

HTML <span> 元素是内联元素,可用作文本的容器。

<span> 元素也没有特定的含义。

当与 CSS 一同使用时,<span> 元素可用于为部分文本设置样式属性。

定义和用法

<span> 标签被用来组合文档中的行内元素。

提示:请使用 <span> 来组合行内元素,以便通过样式来格式化它们。

注释:span 没有固定的格式表现。当对它应用样式时,它才会产生视觉上的变化。

例如,使用span元素实现对网站内的“注释”使用粗体黑色:对这个span元素的父元素,即p元素应用class,这样就可以对这个类的子元素span应用相应的样式了。

<p class="note"><span>注释:</span></p>

CSS:

p.note span {

  font-weight:bold;

  color:blackColor;

     }


div 、p和 span的区别
<span/>、<div/>和<p/>三个元素的效果有点类似。它们都可以作为其他内容的“容器”——— 容纳文本和其他内容。在默认情况下,<span/>元素不会导致换行,而<div/>元素会导致换行,而<p/>元素会产生一个段落,所以段落和段落之间默认有更大的间距。
 除此之外,还有一点需要指出:<span/>元素和<p/>元素只能包含文本、图像、超链接、文本格式化元素和表单控件元素等内容,<p/>可以包含<span/>元素,但<span/>不能包含<p/>;<div/>元素除了可以包含上面这些内容以外(包括<p/>和<span/>),还可以包含<h1/>到<h6/>、<form/>、<table/>、列表项元素和<div/>元素———由此可见,<div/>元素可以包含更多内容。
正因为<div/>元素可以包含各种各样的内容,因此在HTML5之前,经常会大量使用<div/>元素来完成页面布局。

<div class="wpwz"> <div class="wup_zl_xz"> <span><input type="checkbox" style="margin-left: 5px;">生命值</span> <span><input type="checkbox">攻击速度</span> <span><input type="checkbox">护甲穿透</span> </div> <div class="wup_zl_xz_1"> <span><input type="checkbox" style="margin-left: 5px;">暴击</span> <span><input type="checkbox" >攻击速度</span> <span><input type="checkbox">护甲穿透</span> </div> <div class="wup_zl_xz"> <span><input type="checkbox" style="margin-left: 5px;">法术伤害</span> <span><input type="checkbox">攻击速度</span> <span><input type="checkbox">消耗品</span> </div> <div class="wup_zl_xz"> <span><input type="checkbox" style="margin-left: 5px;">韧性</span> <span><input type="checkbox">法力值</span> <span><input type="checkbox">护甲穿透</span> </div> <div class="wup_zl_xz"> <span><input type="checkbox" style="margin-left: 5px;">生命值</span> <span><input type="checkbox">攻击速度</span> <span><input type="checkbox">附魔</span> </div> <div class="wup_zl_xz"> <span><input type="checkbox" style="margin-left: 5px;">法力回复</span> <span><input type="checkbox">法术吸血</span> <span><input type="checkbox">移动速度</span> </div> <div class="wup_zl_xz"> <span><input type="checkbox" style="margin-left: 5px;">护甲值</span> </div> </div>css代码.wup_zl_xz span{ margin: 10px; } .wup_zl_xz span input{ transform: translateY(2px) translateX(-5px); } .wpwz{ font-size: 12px; } .wup_zl_xz_1 { float: left; margin-top: 10px; } .wup_zl_xz_1 span{ margin: 13px; } .wup_zl_xz_1 span input{ transform: translateY(2px) translateX(-5px); }修改以上代码实现所有input与第一行对齐间距相同
05-30
<body> <div class="con_info"> <div class="info_left"> <div class="L_q"> <p>FAQ列表</p> </div> <ul class="dh"> <li class=""><a href="#">jQuery语法</a></li> <li class="xz"><a href="#">常见问题</a></li> </ul> </div> <div class="info_right"> <div class="liebiao"> <ul> <li id="1" class="click"><a class="link" href="#"><span class="num">1</span>jQuery 库中的 $() 是什么?</a> </li> <li id="zk_1" class="zk"> <div class="zk_con"> <div class="pc"> <p><span style="font-size: smaller">$() 函数是 jQuery() 函数的别称。$() 函数用于将任何对象包裹成 jQuery 对象,接着你就被允许调用定义在 jQuery 对象上的多个不同方法。</span></p> </div> </div> </li> <li id="2" class="click"><a class="link" href="#"><span class="num">2</span>$(document).ready() 是个什么函数</a></li> <li id="zk_2" class="zk"> <div class="zk_con"> <div class="pc"> <p><span style="font-size: smaller">ready() 函数用于在文档进入ready状态时执行代码</span></p> </div> </div> </li> <li id="3" class="click"><a class="link" href="#"><span class="num">3</span>如何在点击一个按钮时使用 jQuery 隐藏一个图片?</a></li> <li id="zk_3" class="zk"> <div class="zk_con"> <div class="pc"> <p><span style="font-size: smaller">jQuery为按钮点击之类的事件提供了很好的支持。通过ID或class定位到的图片,为按钮设置事件并执行hide() 方法即可隐藏元素。</span></p> </div> </div> </li> </ul> </div> </div> </div> </div> <script type="text/javascript"> $(document).ready(function () { $(".click").hover(function () { $(".zk").hide(); }) $(".num").click(function () { $(".zk").show(); }) }) </script> </body>点击小图标实现展开隐藏效果(使用动画)
07-20
<template> <div class="conts"> <img class="sanjioa" src="@/assets/images/zn/sanjiao.png" alt="" /> <div class="conts_top"> <!-- <div class="conts_top_tabs" :class="videoTrue ? 'conts_top_tabs_hover' : ''" @click="navigate('videoTrue')"> 宣传视频 </div> --> <div class="conts_top_tabs" :class="inventoryTrue ? 'conts_top_tabs_hover' : ''" @click="navigate('inventoryTrue')"> 存货标准化 </div> <div class="conts_top_tabs" :class="financeTrue ? 'conts_top_tabs_hover' : ''" @click="navigate('financeTrue')"> 金融服务 </div> <!-- <div class="conts_top_tabs" :class="libraryTrue ? 'conts_top_tabs_hover' : ''" @click="navigate('libraryTrue')"> 交收库位置 </div> --> </div> <div class="conts_bot"> <div class="conts_bot_left"> <div class="conts_bot_left_item" v-for="(item, index) in materialList" :key="index" @click="headDet(index)" :class="stockIndex == index ? 'conts_bot_left_index' : ''"> <div class="name">{{ item.name }}</div> <div class="data"> <div class="left">服务银行:</div> <div class="right">{{ item.pledgeeName }}</div> </div> <div class="data datas"> <div class="left">仓库地址:</div> <div class="right">{{ item.warehouseAddress }}</div> </div> <div class="data"> <div class="left">存货品类:</div> <div class="right">{{ item.pledgeRelationName }}</div> </div> </div> </div> <div class="conts_bot_right"> <div class="conts_bot_right_top"> <div class="conts_bot_right_top_data" v-if="materialList.length != 0"> <div class="conts_bot_right_top_data_img"> <img class="zheng" src="@/assets/images/zn/tuoyuan.png" alt="" /> <img src="@/assets/images/zn/jiage1.png" alt="" /> </div> <div class="conts_bot_right_top_data_txt"> <div v-if="materialList[stockIndex].baRenew && materialList[stockIndex].price"> <div class="textunm" v-if="materialList[stockIndex].baRenew.price"> <span style="margin-right: calc(100vw * 10 / 1920);"> {{ pricefmt(materialList[stockIndex].baRenew.price - materialList[stockIndex].price) }} </span> <img v-if="materialList[stockIndex].baRenew.price - materialList[stockIndex].price > 0" class="jiantou" src="@/assets/images/zn/jiantou.png"> <img v-if="materialList[stockIndex].baRenew.price - materialList[stockIndex].price < 0" class="jiantou" src="@/assets/images/zn/xiajiantou.png"> </div> <div v-else class="textunm"><span>暂无</span></div> </div> <div v-else class="textunm"><span>暂无</span></div> <div class="textmame">价格波动</div> </div> </div> <div class="conts_bot_right_top_data" v-if="materialList.length != 0"> <div class="conts_bot_right_top_data_img"> <img class="fan" src="@/assets/images/zn/tuoyuan.png" alt="" /> <img src="@/assets/images/zn/kucun1.png" alt="" /> </div> <div class="conts_bot_right_top_data_txt"> <div class="textunm" v-if="materialList[stockIndex].totalPledged"> <span>{{ pricefmt(materialList[stockIndex].totalPledged) }}</span> <span>{{ materialList[stockIndex].unitName }}</span> </div> <div v-else class="textunm"><span>暂无</span></div> <div class="textmame">库存量统计</div> </div> </div> <div class="conts_bot_right_top_data" v-if="materialList.length != 0"> <div class="conts_bot_right_top_data_img"> <img class="zheng" src="@/assets/images/zn/tuoyuan.png" alt="" /> <img src="@/assets/images/zn/huozhi1.png" alt="" /> </div> <div class="conts_bot_right_top_data_txt"> <div class="textunm" v-if="materialList[stockIndex].currentGoods"> <span>{{ pricefmt(materialList[stockIndex].currentGoods) }}</span> <span>元</span> </div> <div v-else class="textunm"><span>暂无</span></div> <div class="textmame">当前货值</div> </div> </div> <div class="conts_bot_right_top_data" v-if="materialList.length != 0"> <div class="conts_bot_right_top_data_img"> <img class="fan" src="@/assets/images/zn/tuoyuan.png" alt="" /> <img src="@/assets/images/zn/yongxin1.png" alt="" /> </div> <div class="conts_bot_right_top_data_txt"> <div class="textunm" v-if="materialList[stockIndex].creditAmount"> <span>{{ pricefmt(materialList[stockIndex].creditAmount) }}</span> <span>元</span> </div> <div v-else class="textunm"><span>暂无</span></div> <div class="textmame">用信金额</div> </div> </div> <div class="conts_bot_right_top_data" v-if="materialList.length != 0"> <div class="conts_bot_right_top_data_img"> <img class="zheng" src="@/assets/images/zn/tuoyuan.png" alt="" /> <img src="@/assets/images/zn/fangya1.png" alt="" /> </div> <div class="conts_bot_right_top_data_txt"> <div class="textunm" v-if="materialList[stockIndex].pledgeProportion"> <span>{{ pricefmt(materialList[stockIndex].pledgeProportion) }}</span> <span>%</span> </div> <div v-else class="textunm"><span>暂无</span></div> <div class="textmame">质押比例</div> </div> </div> </div> <div class="conts_bot_right_viedo"> <div class="left"> <div id="video" ref="vdo" :class="isDownLoad ? '' : 'video'"> <div class="oWebControl"> <img src="@/assets/images/chajian.png" alt=""> <el-link type="primary" @click="handleDownloadExe">插件启动失败,请下载插件并安装。</el-link> </div> </div> </div> <div class="right"> <div class="right_left animate__animated animate__flash animate__infinite"> <img src="@/assets/images/zn/shanxing.png" alt=""> </div> <div class="right_info" v-if="materialList.length != 0"> <div class="right_info_header">{{ materialList[stockIndex].name }}</div> <div class="right_info_data"> <div class="right_info_data_left">项目编号:</div> <div class="right_info_data_right">{{ materialList[stockIndex].projectNum }}</div> </div> <div class="right_info_data"> <div class="right_info_data_left">服务银行:</div> <div class="right_info_data_right">{{ materialList[stockIndex].pledgeeName }}</div> </div> <div class="right_info_data"> <div class="right_info_data_left">入库编号:</div> <div class="right_info_data_right" v-if="materialList[stockIndex].baStockPledges[0]"> {{ materialList[stockIndex].baStockPledges[0].stockId }} </div> </div> <div class="right_info_data"> <div class="right_info_data_left">存货品类:</div> <div class="right_info_data_right">{{ materialList[stockIndex].pledgeRelationName }}</div> </div> <div class="right_info_data"> <div class="right_info_data_left">批次号:</div> <div class="right_info_data_right" v-if="materialList[stockIndex].baStockPledges[0]"> {{ materialList[stockIndex].baStockPledges[0].batchNum }} </div> </div> <div class="right_info_data"> <div class="right_info_data_left">入库日期:</div> <div class="right_info_data_right" v-if="materialList[stockIndex].baStockPledges[0]"> <div v-if="materialList[stockIndex].baStockPledges[0].baMaterialStock"> {{ parseTime(materialList[stockIndex].baStockPledges[0].baMaterialStock.createTime, '{y}-{m}-{d}') }} </div> </div> </div> </div> </div> </div> <div class="conts_bot_right_bot"> <div class="item_bot"> <div class="header_text"> <div class="header_text_left"> <img src="@/assets/images/zn/loudou.png" alt=""> <span>货位图</span> </div> <div class="header_text_right" @click="CloseVideo"> <span>查看仓单凭证</span> <i class="el-icon-arrow-right" /> </div> </div> <div class="cont_box" v-if="materialList.length != 0"> <img v-if="materialList[stockIndex].goodsPic" :src="materialList[stockIndex].goodsPic" width="100%" height="100%" /> <img v-else src="@/assets/images/zn/pinmiantu.png" width="100%" height="100%" /> </div> </div> <div class="item_bot"> <div class="header_text"> <div class="header_text_left"> <img src="@/assets/images/zn/loudou.png" alt=""> <span>价格波动表</span> </div> </div> <div class="cont_box"> <div class="Echarts"> <LineMark v-if="loading" :DateArr="{ time: DateArr, data: DataObj, yAxis: yAxis, goodsName: goodsName }" /> </div> </div> </div> <div class="item_bot"> <div class="header_text"> <div class="header_text_left"> <img src="@/assets/images/zn/loudou.png" alt=""> <span>视频预警</span> </div> </div> <div class="cont_box"> <el-table :data="VideoWarning" header-cell-class-name="table_header_class" :row-style="{ height: '30px' }" :class="VideoWarning.length <= 4 || VideoWarning.length == 0 ? '' : 'table-top'" style="width: 100%;" :header-cell-style="{ background: 'transparent', color: '#47E9EC', fontSize: '14px', paddign: 0, height: '36px' }"> <el-table-column label="预警时间" prop="endTime" :show-overflow-tooltip="true"> <template slot-scope="scope"> <span class="textName" style="color: #3ed9f5">{{ parseTime(scope.row.endTime) }}</span> </template> </el-table-column> <el-table-column label="所在区域" prop="eventLogSrcList" width="100" :show-overflow-tooltip="true"> <template v-slot="{ row }"> <span class="textName">{{ row.eventLogSrcList[0].regionName }}</span> </template> </el-table-column> <el-table-column label="事件类型" prop="eventTypeName" width="80" :show-overflow-tooltip="true"> <template v-slot="{ row }"> <span class="textName">{{ row.eventTypeName }}</span> </template> </el-table-column> </el-table> <vue-seamless-scroll v-if="VideoWarning.length > 4" :data="VideoWarning" :class-option="classOption" class="vue-seamless-scroll"> <el-table :data="VideoWarning" class="table-bottom" :row-style="{ height: '30px' }" style="width: 100%;" :header-cell-style="{ background: 'transparent', color: '#47E9EC', fontSize: '14px', paddign: 0, height: '36px' }"> <el-table-column label="预警时间" prop="endTime" :show-overflow-tooltip="true"> <template slot-scope="scope"> <span class="textName" style="color: #3ed9f5">{{ parseTime(scope.row.endTime) }}</span> </template> </el-table-column> <el-table-column label="所在区域" prop="eventLogSrcList" width="100" :show-overflow-tooltip="true"> <template v-slot="{ row }"> <span class="textName">{{ row.eventLogSrcList[0].regionName }}</span> </template> </el-table-column> <el-table-column label="事件类型" prop="eventTypeName" width="80" :show-overflow-tooltip="true"> <template v-slot="{ row }"> <span class="textName">{{ row.eventTypeName }}</span> </template> </el-table-column> </el-table> </vue-seamless-scroll> </div> </div> </div> </div> </div> <el-dialog title="仓单存货凭证" :visible.sync="dialogVisible" width="70vw" :close-on-click-modal="false" :close-on-press-escape="false" :before-close="handleClose"> <div class="receipt"> <img class="tImg" src="@/assets/images/zn/t.png"> <img class="rImg" src="@/assets/images/zn/r.png"> <img class="bImg" src="@/assets/images/zn/b.png"> <img class="lImg" src="@/assets/images/zn/l.png"> <div class="receipt_top">仓单存货凭证</div> <div class="receipt_txt"> <div class="receipt_info"> <div class="left">存货方:</div> <div class="right">{{ form.bailor }}</div> </div> <div class="receipt_info"> <div class="left">仓库地址:</div> <div class="right">{{ form.storageAddress }}</div> </div> <div class="receipt_info"> <div class="left">存货数量:</div> <div class="right">{{ form.quantity || 0 }} 吨</div> </div> <div class="receipt_info"> <div class="left">存货时间:</div> <div class="right">{{ parseTime(form.storageTime, '{y}-{m}-{d}') }}</div> </div> </div> <div class="receipt_bot"> <viewer :images="form.annexList" class="cang"> <img :src="form.annex"> </viewer> <div class="rights"> <viewer :images="form.cargoInformationList" class="jilu"> <img :src="form.cargoInformation"> </viewer> <viewer :images="form.cameraInfo" class="jiankong"> <img class="img_nei" v-for="item in form.cameraInfo" :key="item.uid" width="100%" :src="item" /> </viewer> </div> </div> </div> </el-dialog> </div> </template> <script> //这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等) //例如:import 《组件名称》 from '《组件路径》'; import vueSeamlessScroll from 'vue-seamless-scroll'; import { initPlugin, initForPreview, startPreviewAll, closeVideo, onResize, onScroll } from './monitorVideo.js' import LineMark from '@/components/echarts_LineMarkHdpi'; //年度支出收入 import { listRenew } from '@/api/system/priceFluctuation'; import { listProjectOngoing } from "@/api/system/project"; //数据大屏 import { eventsSearchList } from "@/api/system/equipment";//预警 import moment from "moment"; import { getWarehouseReceipt, listWarehouseReceipt } from '@/api/system/inventoryCertificate'; export default { //import引入的组件需要注入到对象中才能使用 components: { vueSeamlessScroll, LineMark }, data() { //这里存放数据 return { videoTrue: false, inventoryTrue: false, financeTrue: true, libraryTrue: false, stockIndex: 0, isDownLoad: ‘’, loading: true, // 遮罩层 goodsName: ‘’, DateArr: [], DataObj: [], yAxis: ‘’, VideoWarning: [],//预警数组 materialList: [],//左侧列表 searchList: [],// 摄像头 // 查询参数 queryParamsWarning: { pageNo: 1, pageSize: 20, ability: '',//事件类型 startTime: '',//开始时间 endTime: '',//结束时间 eventLevels: '',//事件等级 eventRuleId: '',//事件规则* eventTypes: undefined,//事件类型* handleStatus: '',//确认状态.处理状态 locationIndexCodes: '',//所属位置 regionIndexCode: '',//所在区域.区域编号 resIndexCodes: undefined,//事件源编号 resName: '',//事件源名称 resTypes: '',//事件源类型 indexCode: '',//事件源类型 }, dialogVisible: false, form: {}, }; }, //监听属性 类似于data概念 computed: { classOption() { return { step: 0.4, // 数值越大速度滚动越快 limitMoveNum: 2, // 开始无缝滚动的数据量 this.dataList.length hoverStop: true, // 是否开启鼠标悬停stop direction: 1, // 0向下 1向上 2向左 3向右 openWatch: true, // 开启数据实时监控刷新dom singleHeight: 0, // 单步运动停止的高度(默认值0是无缝不停止的滚动) direction => 0/1 singleWidth: 0, // 单步运动停止的宽度(默认值0是无缝不停止的滚动) direction => 2/3 waitTime: 0, // 单步运动停止的时间(默认值1000ms) }; }, }, //生命周期 - 创建完成(可以访问当前this实例) created() { let startTime = new Date(new Date(new Date().toLocaleDateString()).getTime() - 144 * 60 * 60 * 1000 - 1)//当前天的23:59:59 this.queryParamsWarning.startTime = moment(startTime).format();//将7天前显示为开始时间 let today = new Date(new Date(new Date().toLocaleDateString()).getTime() + 24 * 60 * 60 * 1000 - 1)//当前天的23:59:59 this.queryParamsWarning.endTime = moment(today).format();//将当前时间显示为结束时间 this.getList() }, mounted() { this.initVideo(); window.addEventListener(“resize”, () => { onResize(this.$refs.vdo.clientWidth, this.$refs.vdo.clientHeight); onScroll(this.$refs.vdo.clientWidth, this.$refs.vdo.clientHeight); }, false); }, //方法集合 methods: { // 左侧项目列表 getList() { listProjectOngoing({ pageNum: 1, pageSize: 999, state: ‘all’ }).then((response) => { this.materialList = response.rows; this.headDet(0) }); }, navigate(name) { this.$emit(‘navigate’, name); }, headDet(val) { this.loading = false setTimeout(() => { listRenew({ pageNum: 1, pageSize: 15, goodsId: this.materialList[val].pledge, }).then((response) => { this.loading = true; if (response.rows.length != 0) { let DateArr = []; let DataObj = []; response.rows.forEach(item => { DateArr.push(this.parseTime(item.submitTime, ‘{m}-{d}’)) DataObj.push(item.price) }); this.goodsName = response.rows[0].goodsName; this.DateArr = DateArr.slice().reverse(); this.DataObj = DataObj.slice().reverse(); this.yAxis = response.rows[0].warningPrice ? response.rows[0].warningPrice : 0; this.updateTime = response.rows[0].submitTime; } else { this.DateArr = []; this.DataObj = []; this.yAxis = 0; this.updateTime = ‘’; this.goodsName = ‘’; } }); this.stockIndex = val;//获取索引 let indexCodeList = this.materialList[val].camera.split(',')//处理indexCode let searchList = []//显示的摄像头接口 indexCodeList.forEach((item, index) => { if (index <= 1) { searchList.push({ indexCode: item }) } })//取出前两个摄像头 this.searchList = searchList; // 预警接口 this.queryParamsWarning.indexCode = this.materialList[val].camera eventsSearchList(this.queryParamsWarning).then((response) => { this.VideoWarning = response.data.list; }); startPreviewAll(searchList)//配置摄像头 }, 10); }, initVideo() { initPlugin('video', this.$refs.vdo.clientWidth, this.$refs.vdo.clientHeight, () => { initForPreview({ mlayout: '1x2', mplayMode: 0, }).then(() => { startPreviewAll(this.searchList)//配置摄像头 }) }) }, //下载安装包 handleDownloadExe() { window.open("https://zhongnengxinlian.oss-cn-huhehaote.aliyuncs.com/haikang/VideoWebPlugin.exe") }, // 打开仓单凭证 CloseVideo() { listWarehouseReceipt({ pageNum: 1, pageSize: 10, projectName: this.materialList[this.stockIndex].name }).then((res) => { if (res.total == 1) { getWarehouseReceipt(res.rows[0].id).then(response => { if (res.rows[0].annex && res.rows[0].cargoInformation) { closeVideo(); response.data.cameraInfo = response.data.cameraInfo ? response.data.cameraInfo.split(',') : []; response.data.annexList = [response.data.annex]; response.data.cameraInfoList = [response.data.cameraInfo]; this.form = response.data; this.dialogVisible = true; } else { this.msgError('该项目下暂无仓单存货凭证'); } }) } else { this.$message.error('该项目下暂无仓单存货凭证'); } }); }, // 关闭仓单凭证 handleClose() { this.dialogVisible = false; this.initVideo(); startPreviewAll(this.searchList)//配置摄像头 }, }, beforeDestroy() { closeVideo(); } }; <style scoped lang="scss"> // 内容标题 .head_tit_box { @include flex(flex-start); .shu { @include wh(calc(100vw * 4 / 1920), calc(100vw * 17 / 1920)); @include borderRadius(2px); @include background(#4fffff); } .text { @include margin(0 0 0 calc(100vw * 4 / 1920)); @include LHTA(left, calc(100vw * 17 / 1920)); @include font(calc(100vw * 16 / 1920), 500, #4fffff, Microsoft YaHei); } } // 边框左下角的图片 .sanjioa { @include wh(calc(100vw * 33 / 1920), calc(100vw * 33 / 1920)); position: absolute; left: 0; bottom: 0; } .conts_top { @include flex(flex-start); .conts_top_tabs { @include wh(calc(100vw * 116 / 1920), calc(100vw * 34 / 1920)); @include margin(0 calc(100vw * 20 / 1920) 0 0); @include background(url(./../../../../assets/images/zn/wxz.png) no-repeat center center); background-size: 100% 100%; @include borderRadius(4px); @include font(calc(100vw * 14 / 1920), 400, #fff, Microsoft YaHei); @include LHTA(center, calc(100vw * 34 / 1920)); cursor: pointer; } .conts_top_tabs_hover { @include background(url(./../../../../assets/images/zn/xz.png) no-repeat center center); background-size: 100% 100%; } } .table-top ::v-deep .el-table__body-wrapper { display: none; } .el-table ::v-deep { border: 0; .el-table__body-wrapper { @include background(transparent); border: 0; } th.el-table__cell.is-leaf, .el-table td.el-table__cell { border: 0; } } ::v-deep .el-table__body-wrapper::-webkit-scrollbar { width: 0; } ::v-deep .el-table .el-table__cell { padding: 0 !important; background: transparent; } ::v-deep .el-table { background-color: transparent; //主体框透明透明 } ::v-deep .el-table tbody tr:hover > td { background-color: transparent !important; } ::v-deep .el-table tr { background-color: transparent !important; //每一行透明 } ::v-deep .el-table tr:nth-child(2n + 1) { background-color: transparent !important; //每一行透明 } ::v-deep .el-table--enable-row-transition .el-table__body td, .el-table .cell { background-color: transparent; //每一行的单元格透明 font-size: 14px; font-family: Microsoft YaHei; font-weight: 400; color: #d4eaf6; border: 0; } ::v-deep .el-table th.is-leaf { /* 去除上边框 */ border: none; } ::v-deep .el-table::before { /* 去除下边框 */ height: 0; } ::v-deep .el-table th.el-table__cell > .cell { padding: 0 5px; } ::v-deep .el-table .cell { padding: 0 5px; } .vue-seamless-scroll { overflow: hidden; height: 90%; } .table-bottom ::v-deep thead { display: none; } .textName { font-size: calc(100vw * 14 / 1920); } ::v-deep .el-table__body { width: 100% !important; } .conts { @include borderRadius(4px); @include border(2px, #3aceff); position: relative; @include padding(calc(100vw * 29 / 1920) calc(100vw * 20 / 1920) calc(100vw * 28 / 1920) calc(100vw * 30 / 1920)); .conts_bot { @include wh(100%, calc(100% - 3.33333vw)); @include margin(calc(100vw * 30 / 1920) 0 0); @include flex(flex-start); align-items: flex-start; .conts_bot_left { @include wh(calc(100vw * 436 / 1920), 100%); overflow: scroll; .conts_bot_left_item { width: calc(100vw * 433 / 1920); @include background(url(./../../../../assets/images/zn/sybj.png) no-repeat center center); background-size: 100% 100%; @include padding(calc(100vw * 35 / 1920) calc(100vw * 27 / 1920) calc(100vw * 25 / 1920)); @include margin(calc(100vw * 10 / 1920) 0 0); cursor: pointer; .name { @include margin(0 0 calc(100vw * 26 / 1920)); @include LHTA(left, calc(100vw * 16 / 1920)); @include font(calc(100vw * 16 / 1920), 400, #f8b62d, Microsoft YaHei); } .data { @include flex(flex-start); align-items: flex-start; @include font(calc(100vw * 14 / 1920), 400, #fff, Microsoft YaHei); .left { width: 70px; } .right { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } } .datas { @include margin(calc(100vw * 12 / 1920) 0); } } .conts_bot_left_index { width: calc(100vw * 436 / 1920); @include background(url(./../../../../assets/images/zn/jrbj.png) no-repeat center center); background-size: 100% 100%; @include border(0); @include padding(calc(100vw * 25 / 1920) calc(100vw * 28 / 1920) calc(100vw * 17 / 1920)); } :nth-child(1) { margin: 0; } } .conts_bot_left::-webkit-scrollbar { //隐藏或取消滚动条 display: none; } .conts_bot_right { flex: 1; height: 100%; @include margin(0 calc(100vw * 30 / 1920)); .conts_bot_right_top { @include wh(calc(100% - 3.125vw), calc(100vw * 59 / 1920)); @include flex(space-between, wrap); margin: 0 auto; .conts_bot_right_top_data { @include flex(flex-start); position: relative; cursor: pointer; .conts_bot_right_top_data_img { @include wh(calc(100vw * 59 / 1920), calc(100vw * 59 / 1920)); position: relative; @keyframes rotate1 { from { transform: rotate(0); } to { transform: rotate(360deg); } } @keyframes rotate2 { from { transform: rotate(360deg); } to { transform: rotate(0); } } img:nth-child(1) { @include wh(100%, 100%); animation: rotate2 10s linear infinite; } .zheng { animation: rotate1 10s linear infinite; } .fan { animation: rotate2 10s linear infinite; } img:nth-child(2) { @include wh(calc(100vw * 39 / 1920), calc(100vw * 39 / 1920)); position: absolute; left: calc(100vw * 10 / 1920); top: calc(100vw * 10 / 1920); } } .conts_bot_right_top_data_txt { @include margin(0 0 0 calc(100vw * 19 / 1920)); .textunm { span:nth-child(1) { @include font(calc(100vw * 24 / 1920), 500, transparent, heiti-Regular); background: linear-gradient(180deg, #ffffff 0%, #1983ed 100%); -webkit-background-clip: text; } span:nth-child(2) { @include margin(0 0 0 calc(100vw * 3 / 1920)); @include font(calc(100vw * 12 / 1920), 500, transparent, heiti-Regular); background: linear-gradient(180deg, #ffffff 0%, #1983ed 100%); -webkit-background-clip: text; } .jiantou { @include wh(calc(100vw * 8 / 1920), calc(100vw * 11 / 1920)); position: absolute; top: calc(100vw * 3 / 1920); } } .textmame { @include font(calc(100vw * 12 / 1920), 400, #ffffff, Microsoft YaHei); } } } } .conts_bot_right_viedo { @include flex(); @include wh(100%, calc(100% - 15.8854vw)); @include margin(calc(100vw * 25 / 1920) 0); .left { @include wh(calc(100vw * 910 / 1920), 100%); #video { @include wh(100%, 100%); .oWebControl { display: flex; align-items: center; img { width: 27px; height: 27px; margin-right: 5px; } ::v-deep .el-link--inner { color: #3e83fe; font-size: 20px; } ::v-deep .el-link--inner:hover { color: #3e83fe; } } } .video { display: flex; align-items: center; justify-content: center; background: #f5f5f5; border-radius: 4px; } } .right { flex: 1; height: 286px; @include flex(); position: relative; .right_left { @include wh(calc(100vw * 139 / 1920), 100%); img { width: 100%; height: 100%; } } .right_info { @include wh(calc(100vw * 268 / 1920), 100%); @include padding(37px calc(100vw * 24 / 1920)); @include background(url(./../../../../assets/images/zn/bangdan.png) no-repeat center center); background-size: 100% 100%; position: absolute; left: calc(100vw * 112 / 1920); top: 0; .right_info_header { // line-height: calc(100vw * 14 / 1920); @include font(calc(100vw * 14 / 1920), 400, #ffffff, Microsoft YaHei); @include margin(0 0 calc(100vw * 20 / 1920)); } .right_info_data { @include flex(flex-start); align-items: flex-start; @include margin(calc(100vw * 14 / 1920) 0 0); .right_info_data_left { width: 60px; @include font(calc(100vw * 12 / 1920), 400, #ffffff, Microsoft YaHei); } .right_info_data_right { flex: 1; white-space: normal; word-break: break-all; word-wrap: break-word; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; @include font(calc(100vw * 12 / 1920), 400, #ffffff, Microsoft YaHei); } } } } } .conts_bot_right_bot { @include flex(); height: calc(100vw * 196 / 1920); .item_bot { @include wh(calc(100vw * 356 / 1920), 100%); .header_text { @include flex(); @include border(0 0 1px, #4689b7); @include padding(0 0 calc(100vw * 8 / 1920)); .header_text_left { display: flex; align-items: center; img { @include margin(0 calc(100vw * 12 / 1920) 0 0); @include wh(calc(100vw * 9 / 1920), calc(100vw * 11 / 1920)); } span { @include font(calc(100vw * 16 / 1920), 400, #fff, Microsoft YaHei); } } .header_text_right { display: flex; align-items: center; cursor: pointer; span { @include font(calc(100vw * 12 / 1920), 400, #fff, Microsoft YaHei); } .el-icon-arrow-right { color: #fff; } } } .cont_box { @include wh(100%, calc(100vw * 148 / 1920)); @include margin(calc(100vw * 17 / 1920) 0 0); overflow: hidden; .Echarts { @include wh(100%, calc(100vw * 148 / 1920)); } } } } } } } ::v-deep .el-dialog { margin: 50px auto !important; background: transparent; .el-dialog__header { padding: 0 0 13px 0; .el-dialog__headerbtn { top: -6px; right: -10px; .el-dialog__close { color: #fff; font-size: 27px; } } } .el-dialog__body { padding: 0 20px !important; } } .receipt { height: calc(100vh - 137px); background: #144251; @include padding(0 calc(100vw * 45 / 1920)); position: relative; .tImg { @include wh(calc(100vw * 66 / 1920), calc(100vw * 66 / 1920)); position: absolute; top: calc(100vw * -5 / 1920); left: calc(100vw * -5 / 1920); } .rImg { @include wh(calc(100vw * 66 / 1920), calc(100vw * 66 / 1920)); position: absolute; top: calc(100vw * -5 / 1920); right: calc(100vw * -5 / 1920); } .bImg { @include wh(calc(100vw * 66 / 1920), calc(100vw * 66 / 1920)); position: absolute; bottom: calc(100vw * -5 / 1920); right: calc(100vw * -5 / 1920); } .lImg { @include wh(calc(100vw * 66 / 1920), calc(100vw * 66 / 1920)); position: absolute; bottom: calc(100vw * -5 / 1920); left: calc(100vw * -5 / 1920); } .receipt_top { @include padding(calc(100vw * 45 / 1920) 0 0); @include font(calc(100vw * 28 / 1920), 400, #fff, Microsoft YaHei); } .receipt_txt { @include flex(space-between); @include margin(calc(100vw * 40 / 1920) calc(100vw * 28 / 1920)); .receipt_info { @include flex(flex-start); @include margin(0 0 0 calc(100vw * 110 / 1920)); .left { @include font(calc(100vw * 14 / 1920), 400, #fff, Microsoft YaHei); } .right { min-width: calc(100vw * 60 / 1920); @include font(calc(100vw * 14 / 1920), 400, #f8b62d, Microsoft YaHei); } } :nth-child(1).receipt_info { margin: 0; } } .receipt_bot { height: calc(100% - 11.7vw); @include flex(space-around); align-items: flex-start; @include margin(0 0 0 calc(100vw * 32 / 1920)); overflow: auto; .cang { width: calc(100vw * 428 / 1920); background: #fff; img { width: 100%; } } .rights { width: calc(100vw * 425 / 1920); } .jilu { width: 100%; background: #fff; img { width: 100%; } } .jiankong { @include flex(flex-start, wrap); img { width: 45%; @include margin(calc(100vw * 14 / 1920) 0 0 calc(100vw * 15 / 1920)); } } } } </style> 把v-for="(item, index) in materialList"这个循环改为v-infinite-scroll的滚动分页,用的是element的
最新发布
11-11
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值