diff options
| author | 段冬梅 <[email protected]> | 2018-12-15 20:51:29 +0800 |
|---|---|---|
| committer | 段冬梅 <[email protected]> | 2018-12-15 20:51:29 +0800 |
| commit | 4f65628dc01f32f35e6e17912fe2c0f032ab303b (patch) | |
| tree | 7f4e632b2aafc558b8385046bb01f7190d45d45a | |
| parent | 5087df3a7b6e808d941cbcbd50af24d3890e95d2 (diff) | |
缓存变更为使用shiroRedis缓存
| -rw-r--r-- | src/main/java/com/nis/util/AsnCacheUtils.java | 60 | ||||
| -rw-r--r-- | src/main/java/com/nis/util/CacheUtils.java | 198 | ||||
| -rw-r--r-- | src/main/webapp/WEB-INF/views/login.jsp_new | 608 |
3 files changed, 737 insertions, 129 deletions
diff --git a/src/main/java/com/nis/util/AsnCacheUtils.java b/src/main/java/com/nis/util/AsnCacheUtils.java index 329aaf0..2cd40ad 100644 --- a/src/main/java/com/nis/util/AsnCacheUtils.java +++ b/src/main/java/com/nis/util/AsnCacheUtils.java @@ -5,6 +5,7 @@ import java.util.Map; import java.util.Map.Entry; import org.apache.log4j.Logger; +import org.apache.shiro.cache.Cache; import com.beust.jcommander.internal.Lists; import com.nis.domain.specific.ConfigGroupInfo; @@ -12,8 +13,6 @@ import com.nis.web.dao.specific.ConfigGroupInfoDao; import com.nis.web.service.SpringContextHolder; import jersey.repackaged.com.google.common.collect.Maps; -import net.sf.ehcache.Cache; -import net.sf.ehcache.Element; /** * asn no缓存工具类 @@ -35,9 +34,12 @@ public class AsnCacheUtils{ * @return */ public static ConfigGroupInfo get(Long key) { - Element element = getCache(ASN_NO_CACHE).get(key/cache_rage); + Cache cache = getCache(ASN_NO_CACHE); + Object element = cache.get(key/cache_rage); + +// Element element = getCache(ASN_NO_CACHE).get(key/cache_rage); if(element!=null) { - Map<Long,ConfigGroupInfo> map=(Map<Long,ConfigGroupInfo>)element.getObjectValue(); + Map<Long,ConfigGroupInfo> map=(Map<Long,ConfigGroupInfo>)element; if(map.containsKey(key)) { return map.get(key); } @@ -45,20 +47,19 @@ public class AsnCacheUtils{ return null; } public static Map<Long,ConfigGroupInfo> getMap(Object key) { - Element element = getCache(ASN_NO_CACHE).get(key); - return (Map<Long,ConfigGroupInfo>)element.getObjectValue(); + Object element = getCache(ASN_NO_CACHE).get(key); + return (Map<Long,ConfigGroupInfo>)element; } public static void clearCache() { logger.warn("clear cache!"); - CacheUtils.getCacheManager().removeCache(ASN_NO_CACHE); + getCache(ASN_NO_CACHE).clear(); } public static List<ConfigGroupInfo> getAllAsnGroup(){ List<ConfigGroupInfo> configGroupInfos=Lists.newArrayList(); Cache cache=getCache(ASN_NO_CACHE); - for(Object key:cache.getKeys()) { - Element element = getCache(ASN_NO_CACHE).get(key); - if(element!=null) { - Map<Long,ConfigGroupInfo> map=(Map<Long,ConfigGroupInfo>)element.getObjectValue(); + for(Object val : cache.values()) { + if(val!=null) { + Map<Long,ConfigGroupInfo> map=(Map<Long,ConfigGroupInfo>)val; configGroupInfos.addAll(map.values()); } } @@ -89,19 +90,21 @@ public class AsnCacheUtils{ } } for(Entry<Long, Map<Long, ConfigGroupInfo>> e:groupMap.entrySet()) { - Element element = new Element(e.getKey(), e.getValue()); - cache.put(element); + cache.put(e.getKey(),e.getValue()); } }else { //查询总量 Long count=configGroupInfoDao.getCountByType(4); boolean loadDatabase=false; - if(cache.getKeys().size()==0) { + if(cache.keys().size()==0) { loadDatabase=true; }else { long c=0l; - for(Object key:cache.getKeys()) { - c+=getMap(key).size(); + for(Object key:cache.keys()) { + Map<Long, ConfigGroupInfo> map = getMap(key); + if(map != null) { + c+=getMap(key).size(); + } } if(c!=count) { loadDatabase=true; @@ -121,8 +124,7 @@ public class AsnCacheUtils{ } } for(Entry<Long, Map<Long, ConfigGroupInfo>> e:groupMap.entrySet()) { - Element element = new Element(e.getKey(), e.getValue()); - cache.put(element); + cache.put(e.getKey(), e.getValue()); } } } @@ -137,17 +139,16 @@ public class AsnCacheUtils{ */ public static void put(Long key, ConfigGroupInfo value) { Long _key=key/cache_rage; - Element element = getCache(ASN_NO_CACHE).get(_key); + Object element = getCache(ASN_NO_CACHE).get(_key); if(element==null) { Map<Long,ConfigGroupInfo> map=Maps.newHashMap(); map.put(key, value); - element = new Element(_key, map); + getCache(ASN_NO_CACHE).put(_key,map); }else { - Map<Long,ConfigGroupInfo> map=(Map<Long,ConfigGroupInfo>)element.getObjectValue(); + Map<Long,ConfigGroupInfo> map=(Map<Long,ConfigGroupInfo>)element; map.put(key, value); - element = new Element(_key, map); + getCache(ASN_NO_CACHE).put(_key,map); } - getCache(ASN_NO_CACHE).put(element); } /** * 从缓存中移除 @@ -159,30 +160,25 @@ public class AsnCacheUtils{ } public static void remove(Long key) { Long _key=key/cache_rage; - Element element = getCache(ASN_NO_CACHE).get(_key); + Object element = getCache(ASN_NO_CACHE).get(_key); if(element!=null) { - Map<Long,ConfigGroupInfo> map=(Map<Long,ConfigGroupInfo>)element.getObjectValue(); + Map<Long,ConfigGroupInfo> map=(Map<Long,ConfigGroupInfo>)element; if(map.containsKey(key)) { map.remove(key); } if(map.isEmpty()) { getCache(ASN_NO_CACHE).remove(_key); }else { - element=new Element(_key,map); - getCache(ASN_NO_CACHE).put(element); + getCache(ASN_NO_CACHE).put(_key, map); } } } private static Cache getCache(String cacheName){ Cache cache = CacheUtils.getCacheManager().getCache(cacheName); - if (cache == null){ - CacheUtils.getCacheManager().addCache(cacheName); - cache = CacheUtils.getCacheManager().getCache(cacheName); - cache.getCacheConfiguration().setEternal(true); - } return cache; } + public static String getCacheName() { return ASN_NO_CACHE; } diff --git a/src/main/java/com/nis/util/CacheUtils.java b/src/main/java/com/nis/util/CacheUtils.java index ca8642d..98d27f2 100644 --- a/src/main/java/com/nis/util/CacheUtils.java +++ b/src/main/java/com/nis/util/CacheUtils.java @@ -1,97 +1,101 @@ -package com.nis.util; - -import com.nis.web.service.SpringContextHolder; - -import net.sf.ehcache.Cache; -import net.sf.ehcache.CacheManager; -import net.sf.ehcache.Element; - -/** - * Cache工具类 - * @author darnell - * - */ -public class CacheUtils { - - private static CacheManager cacheManager = ((CacheManager)SpringContextHolder.getBean("cacheManager")); - - private static final String SYS_CACHE = "sysCache"; - - /** - * 获取SYS_CACHE缓存 - * @param key - * @return - */ - public static Object get(String key) { - return get(SYS_CACHE, key); - } - - /** - * 写入SYS_CACHE缓存 - * @param key - * @return - */ - public static void put(String key, Object value) { - put(SYS_CACHE, key, value); - } - - /** - * 从SYS_CACHE缓存中移除 - * @param key - * @return - */ - public static void remove(String key) { - remove(SYS_CACHE, key); - } - - /** - * 获取缓存 - * @param cacheName - * @param key - * @return - */ - public static Object get(String cacheName, String key) { - Element element = getCache(cacheName).get(key); - return element==null?null:element.getObjectValue(); - } - - /** - * 写入缓存 - * @param cacheName - * @param key - * @param value - */ - public static void put(String cacheName, String key, Object value) { - Element element = new Element(key, value); - getCache(cacheName).put(element); - } - - /** - * 从缓存中移除 - * @param cacheName - * @param key - */ - public static void remove(String cacheName, String key) { - getCache(cacheName).remove(key); - } - - /** - * 获得一个Cache,没有则创建一个。 - * @param cacheName - * @return - */ - private static Cache getCache(String cacheName){ - Cache cache = cacheManager.getCache(cacheName); - if (cache == null){ - cacheManager.addCache(cacheName); - cache = cacheManager.getCache(cacheName); - cache.getCacheConfiguration().setEternal(true); - } - return cache; - } - - public static CacheManager getCacheManager() { - return cacheManager; - } - -} +package com.nis.util;
+
+
+import org.apache.shiro.cache.Cache;
+import org.crazycake.shiro.RedisCacheManager;
+
+import com.nis.web.service.SpringContextHolder;
+
+
+/**
+ * Cache工具类
+ * @author darnell
+ *
+ */
+public class CacheUtils {
+
+ private static RedisCacheManager cacheManager = (RedisCacheManager)SpringContextHolder.getBean("shiroCacheManager");
+
+ private static final String SYS_CACHE = "sysCache";
+
+ /**
+ * 获取SYS_CACHE缓存
+ * @param key
+ * @return
+ */
+ public static Object get(String key) {
+ return get(SYS_CACHE, key);
+ }
+
+ /**
+ * 写入SYS_CACHE缓存
+ * @param key
+ * @return
+ */
+ public static void put(String key, Object value) {
+ put(SYS_CACHE, key, value);
+ }
+
+ /**
+ * 从SYS_CACHE缓存中移除
+ * @param key
+ * @return
+ */
+ public static void remove(String key) {
+ remove(SYS_CACHE, key);
+ }
+
+ /**
+ * 获取缓存
+ * @param cacheName
+ * @param key
+ * @return
+ */
+ public static Object get(String cacheName, String key) {
+ return getCache(cacheName).get(key);
+ }
+
+ /**
+ * 写入缓存
+ * @param cacheName
+ * @param key
+ * @param value
+ */
+ public static void put(String cacheName, String key, Object value) {
+ Cache cache=cacheManager.getCache(cacheName);
+ cache.put(key, value);
+ }
+
+ /**
+ * 从缓存中移除
+ * @param cacheName
+ * @param key
+ */
+ public static void remove(String cacheName, String key) {
+ getCache(cacheName).remove(key);
+ }
+
+ /**
+ * 获得一个Cache,没有则创建一个。
+ * @param cacheName
+ * @return
+ */
+ /*private static Cache getCache(String cacheName){
+ Cache cache = cacheManager.getCache(cacheName);
+ if (cache == null){
+ cacheManager.addCache(cacheName);
+ cache = cacheManager.getCache(cacheName);
+ cache.getCacheConfiguration().setEternal(true);
+ }
+ return cache;
+ }*/
+ private static Cache getCache(String cacheName){
+ Cache cache = cacheManager.getCache(cacheName);
+ return cache;
+ }
+
+ public static RedisCacheManager getCacheManager() {
+ return cacheManager;
+ }
+
+}
diff --git a/src/main/webapp/WEB-INF/views/login.jsp_new b/src/main/webapp/WEB-INF/views/login.jsp_new new file mode 100644 index 0000000..3511cbf --- /dev/null +++ b/src/main/webapp/WEB-INF/views/login.jsp_new @@ -0,0 +1,608 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8"
+ pageEncoding="UTF-8"%>
+<%@ page import="org.apache.shiro.web.filter.authc.FormAuthenticationFilter"%>
+<%@ include file="/WEB-INF/include/taglib.jsp"%>
+<!DOCTYPE html>
+<!--[if IE 8]> <html class="ie8 no-js"> <![endif]-->
+<!--[if IE 9]> <html class="ie9 no-js"> <![endif]-->
+<!--[if !IE]><!-->
+<html lang="en">
+ <head>
+ <meta charset="utf-8" />
+ <title>Login</title>
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta content="width=device-width, initial-scale=1" name="viewport" />
+ <meta content="" name="description" />
+ <meta content="" name="author" />
+ <link rel="shortcut icon" href="${pageContext.request.contextPath}/static/pages/img/logo.ico" />
+ <title>NTC</title>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <!-- basic styles -->
+
+ <link href="${pageContext.request.contextPath}/static/login/assets/css/bootstrap.min.css" rel="stylesheet" />
+ <link rel="stylesheet" href="${pageContext.request.contextPath}/static/login/assets/css/font-awesome.min.css" />
+
+<!-- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:400,300" /> -->
+ <!-- ace styles -->
+
+ <link rel="stylesheet" href="${pageContext.request.contextPath}/static/login/assets/css/ace.min.css" />
+ <link rel="stylesheet" href="${pageContext.request.contextPath}/static/login/assets/css/ace-rtl.min.css" />
+
+ <style type="text/css">
+ /*滚动条样式*/
+ body::-webkit-scrollbar {/*滚动条整体样式*/
+ width: 10px; /*高宽分别对应横竖滚动条的尺寸*/
+ height: 10px;
+ }
+ body::-webkit-scrollbar-thumb {/*滚动条里面小方块*/
+ border-radius: 5px;
+ -webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
+ background: rgba(228,230,233,0.2);
+ }
+ body::-webkit-scrollbar-track {/*滚动条里面轨道*/
+ -webkit-box-shadow: inset 0 0 5px rgba(0,0,0,0.2);
+ border-radius: 0;
+ background: rgba(0,0,0,0.1);
+ }
+ body::-webkit-scrollbar-corner{
+ width: 0px;
+ height: 0px;
+ background: rgba(255,255,255,0);
+ }
+
+ .row{
+ margin-left: 0px;
+ margin-right: 0px;
+ }
+ .col-sm-1 ,.col-sm-2 ,.col-sm-3 ,.col-sm-4 ,.col-sm-5 ,.col-sm-6 ,.col-sm-7 ,.col-sm-8,.col-sm-12{
+ margin: 0px;
+ padding: 0px;
+ }
+ body{
+ max-height:1080px;
+ max-width:1920px;
+ height:864px;
+ width:1518px;
+ background-color:rgba(255,255,255,0);
+ background-image: url("${pageContext.request.contextPath}/static/login/assets/images/login/backimg.png");
+ background-repeat:no-repeat;
+ background-size: cover;
+ color: white;
+ /* width: 1920px;
+ height: 1080px; */
+
+ }
+ .input-icon input{
+ outline:0;
+ height:2.7em;
+ border:none;
+ background-color: rgba(255,255,255,0);
+ color: white;
+ }
+ .input-icon input:focus {
+ border:none;
+ background-color: rgba(255,255,255,0);
+ background-color: rgba(255,255,255,0);
+ color: white;
+ }
+
+ .main_left{
+ background-image: url("${pageContext.request.contextPath}/static/login/assets/images/login/two/login_03.png");
+ background-repeat:no-repeat;
+ background-size:contain;
+ max-height: 695px;
+ max-width: 905px;
+
+ }
+ .main_right{
+ background-image: url("${pageContext.request.contextPath}/static/login/assets/images/login/login_06.png");
+ background-repeat:no-repeat;
+ background-size: 100% 100%;
+ max-height: 501px;
+ max-width: 439px;
+ }
+ .box_chart{
+
+ }
+ #ntc_chart{
+ height: 280px;
+ }
+ #ntc_chart img{
+ width: 300px;
+ height: 260px;
+ }
+ .foot{
+ position: absolute;
+ bottom: 0px;
+ left: 45%;
+ }
+ #messageBox{
+ border-radius: 10px;
+ }
+ </style>
+ </head>
+ <body class="login-layout" style="overflow-y: hidden;">
+ <div class="main-container" style="height: 100%">
+ <div class="row" style="height: 100%">
+ <div class="col-sm-12" style="height: 100%">
+ <div class="col-sm-7" style="height: 100%;padding-top: 6%;">
+ <div class="main_left" style="height: 100%">
+ <div class="box_chart">
+ <div id="ntc_chart">
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="col-sm-1" ></div>
+ <div class="col-sm-3" style="height: 100%;padding-top: 10%;padding-bottom: 5%;">
+ <div class="main_right" style="height: 100%">
+ <div class="widget-main" style="height: 100%">
+ <form style="margin: 160px 50px 0px 50px;" autocomplete="off" id="loginForm" action="${pageContext.request.contextPath }/login" method="post">
+ <!-- <form style="margin: 160px 50px 0px 50px;" id="loginForm" action="${pageContext.request.contextPath }/dynamicIndex" method="post"> -->
+ <fieldset>
+ <label class="block clearfix">
+ <span class="block input-icon input-icon-left" style="border-bottom:1px solid #565656;">
+ <i class="icon-user" style="padding-top: 4px;"></i>
+ <input id="username" type="text" name="username" class="form-control" value="${username}" placeholder="<spring:message code='fill_loginName'/>" style="padding-left: 30px;"/>
+ </span>
+ </label>
+ <label class="block clearfix" style="margin-top: 35px;">
+ <span class="block input-icon input-icon-left" style="border-bottom:1px solid #565656;">
+ <i class="icon-lock" style="padding-top: 4px;"></i>
+ <input id="password" type="password" name="password" class="form-control" placeholder="<spring:message code='fill_loginPassWord'/>" style="padding-left: 30px;"/>
+ </span>
+ </label>
+
+ <div class="space"></div>
+
+ <div class="clearfix" style="text-align: center;margin-top: 24%;">
+ <button type="submit" style="background-color: #4697d7!important;border-radius: 5px;" class="width-40 btn btn-sm btn-primary">
+ <spring:message code='login'/>
+ </button>
+ <!--
+ <button type="button" style="background-color: #4697d7!important;border-radius: 5px;" class="width-40 btn btn-sm btn-primary" onclick="fullScreen();">
+ fullscreen
+ </button>
+ -->
+ </div>
+
+ <div class="space-4"></div>
+ </fieldset>
+ </form>
+
+ </div><!-- /widget-main -->
+ <p class="messageBox" style="margin-top:0px;" align="center">
+ <div id="messageBox" class="alert alert-danger ${empty message ? 'hide' : ''}" style="width:376px;text-align: center">
+ <label id="loginError" class="error" style="width:100%;text-align: center"><spring:message code="${message}"></spring:message></label>
+ </div>
+ </p>
+ </div><!-- /widget-body -->
+ </div>
+ </div><!-- /.col -->
+ </div><!-- /.row -->
+ </div><!-- /.main-container -->
+ <div class="foot">
+ <span>CEIEC All Rights Reserved, CEIEC © </span>
+ </div>
+ <!--[if lt IE 9]>
+<script src="${pageContext.request.contextPath}/static/global/plugins/respond.min.js"></script>
+<script src="${pageContext.request.contextPath}/static/global/plugins/excanvas.min.js"></script>
+<![endif]-->
+ <!-- BEGIN CORE PLUGINS -->
+ <script src="${pageContext.request.contextPath}/static/global/plugins/jquery.min.js" type="text/javascript"></script>
+ <script src="${pageContext.request.contextPath}/static/global/plugins/js.cookie.min.js" type="text/javascript"></script>
+ <script src="${pageContext.request.contextPath}/static/global/plugins/jquery-validation/1.11.0/jquery.validate.min.js" type="text/javascript"></script>
+ <script src="${pageContext.request.contextPath}/static/global/plugins/jquery-validation/1.11.0/jquery.validate.method.js" type="text/javascript"></script>
+ <!-- END CORE PLUGINS --> <script type="text/javascript">
+ $(document).ready(function(){
+ $("#loginForm").validate({
+ rules: {
+ username: { required: true},
+ password: { required: true},
+ captcha: {remote: "${pageContext.request.contextPath}/validateCode"}
+ },
+ messages: {
+ username: {required: '<spring:message code="fill_loginName"/>...'},password: {required: '<spring:message code="fill_loginPassWord"/>...'},
+ captcha: {remote: '<spring:message code="captcha_error"/>...', required: '<spring:message code="enter_captcha"/>...'}
+ },
+ errorLabelContainer: "#messageBox",
+ errorPlacement: function(error, element) {
+ error.appendTo($("#loginError").parent());
+ }
+ });
+
+ // 如果在框架或在对话框中,则弹出提示并跳转到首页
+ if(self.frameElement && self.frameElement.tagName == "IFRAME" || $('#left').length > 0 || $('.jbox').length > 0){
+ top.$.jBox.confirm("<spring:message code='login_timeout'/>","<spring:message code='info'/>",function(v,h,f){
+
+ if(v=="ok"){
+ top.location = "${pageContext.request.contextPath }";
+ }else{
+ top.location = "${pageContext.request.contextPath }";
+ }
+ },{buttonsFocus:1});
+ top.$('.jbox-body .jbox-icon').css('top','55px');
+ }
+
+
+ });
+ </script>
+ <script type="text/javascript">
+ window.jQuery || document.write("<script src='${pageContext.request.contextPath}/static/login/assets/js/jquery-2.0.3.min.js'>"+"<"+"/script>");
+ </script>
+
+
+ <!-- dynamic_add -->
+ <script src="${pageContext.request.contextPath}/static/login/echarts/echarts.min.js"></script>
+ <script type="text/javascript">
+ if("ontouchend" in document) document.write("<script src='${pageContext.request.contextPath}/static/login/assets/js/jquery.mobile.custom.min.js'>"+"<"+"/script>");
+ </script>
+ <!-- inline scripts related to this page -->
+ <script type="text/javascript">
+ /*var bodyHeight = window.screen.height;*/
+ var bodyHeight = 864;
+ $("body").height(bodyHeight+"px");
+ $("#ntc_chart").height((bodyHeight-200)+"px");
+ $("#ntc_chart").width($(".main_left").width()+"px");
+ lineheight_y = 364;
+ lineheight_x = 362;
+ lineheight_y2 = 739;
+ lineheight_x2 = 767;
+ console.log(bodyHeight);
+ if(bodyHeight >800){
+ lineheight_y = 364;
+ lineheight_x = 362;
+ lineheight_y2 = 739;
+ lineheight_x2 = 767;
+ }
+
+
+ var lines_Chart_chu = echarts.init(document.getElementById('ntc_chart'));
+
+ /* 数据流出 */
+ var lines_chu = [
+
+ /* 出端 */
+ {
+ coords: [
+ [lineheight_x2+60, lineheight_y2-70],
+ [978, 809]
+ ],
+ effect: {
+ period: 0.5,
+ },
+ lineStyle: {
+ normal: {
+ color: '#119dd8'
+ }
+ }
+ },
+ {
+ coords: [
+ [lineheight_x2+60, lineheight_y2-120],
+ [970, 777]
+ ],
+ effect: {
+ period: 1,
+ },
+ lineStyle: {
+ normal: {
+ color: '#119dd8'
+ }
+ }
+ },{
+ coords: [
+ [lineheight_x2+60, lineheight_y2-140],
+ [985, 746]
+ ],
+ effect: {
+ period: 1,
+ },
+ lineStyle: {
+ normal: {
+ color: '#119dd8'
+ }
+ }
+ },
+ {
+ coords: [
+ [lineheight_x2-25, lineheight_y2+65],
+ [878, 986]
+ ],
+ effect: {
+ period: 0.8,
+ },
+ lineStyle: {
+ normal: {
+ color: '#119dd8'
+ }
+ }
+ },
+ {
+ coords: [
+ [lineheight_x2-10, lineheight_y2+40],
+ [904, 968]
+ ],
+ effect: {
+ period: 1,
+ },
+ lineStyle: {
+ normal: {
+ color: '#119dd8'
+ }
+ }
+ },
+ {
+ coords: [
+ [lineheight_x2, lineheight_y2+20],
+ [935, 952]
+ ],
+ effect: {
+ period: 0.5,
+ },
+ lineStyle: {
+ normal: {
+ color: '#119dd8'
+ }
+ }
+ },
+ {
+ coords: [
+ [lineheight_x2, lineheight_y2],
+ [967, 868]
+ ],
+ effect: {
+ period: 0.8,
+ },
+ lineStyle: {
+ normal: {
+ color: '#119dd8'
+ }
+ }
+ },
+ {
+ coords: [
+ [lineheight_x2+40, lineheight_y2-45],
+ [984, 824]
+ ],
+ effect: {
+ period: 0.8,
+ },
+ lineStyle: {
+ normal: {
+ color: '#119dd8'
+ }
+ }
+ },
+ /* 左下 */
+ {
+ coords: [
+ [68, 83],
+ [388, lineheight_y]
+ ],
+ effect: {
+ period: 1,
+ },
+ lineStyle: {
+ normal: {
+ color: '#119dd8'
+ }
+ }
+ },
+ {
+ coords: [
+ [68, 143],
+ [368, lineheight_y]
+ ],
+ effect: {
+ period: 1,
+ },
+ lineStyle: {
+ normal: {
+ color: '#d29781'
+ }
+ }
+ },
+ {
+ coords: [
+ [68, 73],
+ [368, lineheight_y]
+ ],
+ effect: {
+ period: 0.5,
+ },
+ lineStyle: {
+ normal: {
+ color: '#119dd8'
+ }
+ }
+ },
+ {
+ coords: [
+ [68, 273],
+ [lineheight_x, lineheight_y]
+ ],
+ effect: {
+ period: 1,
+ },
+ lineStyle: {
+ normal: {
+ color: '#119dd8'
+ }
+ }
+ },
+ {
+ coords: [
+ [28, 373],
+ [lineheight_x, lineheight_y]
+ ],
+ effect: {
+ period: 1,
+ },
+ lineStyle: {
+ normal: {
+ color: '#d29781'
+ }
+ }
+ },
+ {
+ coords: [
+ [248, 73],
+ [lineheight_x, lineheight_y]
+ ],
+ effect: {
+ period: 1,
+ },
+ lineStyle: {
+ normal: {
+ color: '#ebf546'
+ }
+ }
+ },
+ {
+ coords: [
+ [192, 105],
+ [lineheight_x, lineheight_y]
+ ],
+ effect: {
+ period: 0.5,
+ },
+ lineStyle: {
+ normal: {
+ color: '#d29781'
+ }
+ }
+ },
+ {
+ coords: [
+ [11, 216],
+ [lineheight_x, lineheight_y]
+ ],
+ effect: {
+ period: 1,
+ },
+ lineStyle: {
+ normal: {
+ color: '#ebf546'
+ }
+ }
+ },
+ {
+ coords: [
+ [321, 87],
+ [lineheight_x+20, lineheight_y -30]
+ ],
+ effect: {
+ period: 0.5,
+ },
+ lineStyle: {
+ normal: {
+ color: '#ebf546'
+ }
+ }
+ },
+ ]
+
+ var line_chu_option = {
+ backgroundColor: 'rgba(255,255,255,0)',
+ grid:{
+ top: 10,
+ bottom: 10,
+ left: 10,
+ right: 10,
+ },
+ xAxis: {
+ show: false,
+ min: 0,
+ max: 1000,
+ position: 'top',
+ axisPointer: {
+ show: false
+ }
+ },
+ yAxis: {
+ show: false,
+ min: 0,
+ max: 1000,
+ axisPointer: {
+ show: false
+ }
+ },
+
+ // 线条动画
+ series: [
+ {
+ type: 'lines',
+ coordinateSystem: 'cartesian2d',
+ zlevel: 1,
+
+ // 动画效果
+ effect: {
+ show: true,
+ period: 4, //特效动画的时间,单位为 s
+ trailLength: 0.5, //特效尾迹的长度。0~1数值越大尾迹越长
+ //color: '#d29781',
+ symbolSize: 6
+ },
+ lineStyle: {
+ normal: {
+ color: '#BF3EFF',
+ width: 0,
+ curveness: 0
+ }
+ },
+ data: lines_chu
+ }
+ ],
+ };
+ lines_Chart_chu.setOption(line_chu_option);
+ </script>
+
+ <script type="text/javascript">
+ var fullflag = false;
+ // 全屏代码
+ function fullScreen() {
+ if(fullflag){
+ exitFullScreen();
+ }else{
+ fullflag = true;
+ var elem = document.body;
+ if (elem.webkitRequestFullScreen) {
+ elem.webkitRequestFullScreen();
+ } else if (elem.mozRequestFullScreen) {
+ elem.mozRequestFullScreen();
+ } else if (elem.requestFullScreen) {
+ elem.requestFullscreen();
+ } else {
+ //notice.notice_show("浏览器不支持全屏API或已被禁用", null, null, null, true, true);
+ }
+ }
+ }
+ function exitFullScreen() {
+ fullflag = false;
+ var elem = document;
+ if (elem.webkitCancelFullScreen) {
+ elem.webkitCancelFullScreen();
+ } else if (elem.mozCancelFullScreen) {
+ elem.mozCancelFullScreen();
+ } else if (elem.cancelFullScreen) {
+ elem.cancelFullScreen();
+ } else if (elem.exitFullscreen) {
+ elem.exitFullscreen();
+ } else {
+ //notice.notice_show("浏览器不支持全屏API或已被禁用", null, null, null, true, true);
+ }
+ }
+
+ //document.addEventListener("fullscreenchange", function( event ) {
+ // if (document.fullscreenElement) {
+ // console.log('进入全屏');
+ // } else {
+ // console.log('退出全屏');
+ //}});
+ //window.onload = function() {
+ // fullScreen();//直接执行onclick中的函数就行
+ //}
+ </script>
+</body>
+</html>
|
