home.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>中科在线(长春)</title>
  6. <!-- layui -->
  7. <link rel="stylesheet" href="static/home/lib/layui/css/layui.css">
  8. <link rel="stylesheet" href="static/home/css/lib.css">
  9. <link rel="stylesheet" href="static/home/css/road.css">
  10. <link rel="stylesheet" href="static/home/css/index.css">
  11. <style>
  12. .canvas-stats {
  13. display: none;
  14. }
  15. #a{
  16. position: absolute;
  17. bottom: -20px;
  18. color: #fff;
  19. right: 0;
  20. }
  21. #a:hover{
  22. cursor: pointer;
  23. }
  24. .floating{
  25. width: 350px;
  26. height: 150px;
  27. background-image: url(./static/images/fuchuang.jpg);
  28. background-repeat: no-repeat;
  29. background-size: 100%;
  30. }
  31. .floatingInfo{
  32. color: #F6FE6A;
  33. text-align: center;
  34. height: 150px;
  35. padding: 40px 0;
  36. font-size: 30px;
  37. font-family: cursive;
  38. text-shadow: 5px 5px 5px #000;
  39. }
  40. .floatingInfo:hover{
  41. cursor: pointer;
  42. color: #76bdfe;
  43. }
  44. </style>
  45. </head>
  46. <body>
  47. <div class="header">
  48. <div class='left'>
  49. <img class='image' src="static/images/logo.png" alt="">
  50. <p class='title'>中科在线(长春)</p>
  51. </div>
  52. <div class='right'>
  53. <button onclick="window.open('http://free.liaoningdoupo.com/platlive/webLogin')">平台登录</button>
  54. <button onclick="window.open('http://free.liaoningdoupo.com/platlive/adminLogin')">管理登录</button>
  55. </div>
  56. </div>
  57. <img class="sci-wheel" src="static/home/images/sci.gif" alt="">
  58. <!-- 导航 -->
  59. <div class="center">
  60. <a class="list fn_1 moveUpDownFla1" target="_blank" href="market/index">
  61. <p>科技超市</p>
  62. </a>
  63. <a class="list fn_2 moveUpDownFla2" target="_blank" href="hallList/index">
  64. <p>直播大厅</p>
  65. </a>
  66. <a class="list fn_3 moveUpDownFla1" target="_blank" href="dynamic/index">
  67. <p>动态监测</p>
  68. </a>
  69. <a class="list fn_4 moveUpDownFla2" target="_blank" href="live/service">
  70. <p>新闻资讯</p>
  71. </a>
  72. <a class="list fn_5 moveUpDownFla2" target="_blank" href="technical/index">
  73. <p>技术交流</p>
  74. </a>
  75. </div>
  76. <!-- 浮窗 -->
  77. <div id="floatingDiv" style="position:absolute;left:50px;top:60px;z-index: 9999;">
  78. <div id="a" onClick="javascript:this.parentNode.style.display='none';">关闭窗口</div>
  79. <div class='floating' onclick="noticeBtn()">
  80. <p id="floatingid" class='floatingInfo'></p>
  81. </div>
  82. </div>
  83. <!--流星-->
  84. <div class="liuxing liuxing1 liuxingFla"></div>
  85. <div class="liuxing liuxing2 liuxingFla2"></div>
  86. <div class="liuxing liuxing3 liuxingFla3"></div>
  87. <div class="liuxing liuxing4 liuxingFla4"></div>
  88. <div id="canvas-container-1" class="canvas-container">
  89. <canvas id="canvas-1"></canvas>
  90. </div>
  91. <script src="static/home/js/stats.min.js"></script>
  92. <script src="static/home/js/three.min.js"></script>
  93. <script src="static/js/jquery-1.8.3.min.js"></script>
  94. <script>
  95. window.onload = function () {
  96. $.ajax({
  97. url:'/api/market/notice',
  98. type:"GET",
  99. contentType:'application/json',
  100. success:function(res){
  101. // console.log(res);
  102. if(res.errcode =='0') {
  103. if(res.data.length>0) {
  104. var head = res.data[0];
  105. $('#floatingid').text(head.title)
  106. }
  107. }
  108. },
  109. error:function (e) {
  110. console.error(e)
  111. }
  112. })
  113. }
  114. function ThreeJSCanvas(CANVAS_ID) {
  115. var SCREEN_HEIGHT = Math.min(window.innerWidth, window.innerHeight);
  116. var SCREEN_WIDTH = SCREEN_HEIGHT;
  117. var SCREEN_ASPECT_RATIO = SCREEN_WIDTH / SCREEN_HEIGHT;
  118. var canvas, container;
  119. var container, loader, stats;
  120. var renderer, camera, scene;
  121. var raycaster, controls;
  122. var ANIMATION_FRAME_LENGTH = 30,
  123. INTERACT_DISTANCE = 2.5;
  124. var objetArray = [],
  125. animationQueue = [];
  126. var color1 = [0 / 255, 110 / 255, 255 / 255],
  127. color2 = [0 / 255, 255 / 255, 140 / 255];
  128. var bitmap = [];
  129. var BITMAP_SKIP = 1;
  130. var fov = 90;
  131. var cameraPos = [0, 0, 30];
  132. var cameraLookAt = [0, 0, 0];
  133. var viewHeight = 2 * Math.tan(THREE.Math.degToRad(fov / 2)) * cameraPos[2],
  134. viewWidth = viewHeight * SCREEN_ASPECT_RATIO;
  135. var mouse = new THREE.Vector3(10000, 10000, -1),
  136. mouseScaled = new THREE.Vector3(10000, 10000, -1);
  137. var frame = 0;
  138. function init() {
  139. // Global Variables
  140. container = document.getElementById("canvas-container-" + CANVAS_ID);
  141. canvas = document.getElementById("canvas-" + CANVAS_ID);
  142. canvas.addEventListener('mousemove', onDocumentMouseMove, false);
  143. loader = new THREE.JSONLoader();
  144. stats = new Stats();
  145. stats.domElement.classList.add("canvas-stats");
  146. stats.domElement.id = "canvas-stats-" + CANVAS_ID;
  147. /* If you are familiar with python and opencv
  148. you can use this python script to generate custom bitmaps
  149. --------------------
  150. https://git.io/vdBAu
  151. --------------------
  152. */
  153. var data = '#000000000000000000011110000000000000000000' +
  154. '#000000000000000011111111110000000000000000' +
  155. '#000000000000001111111111111100000000000000' +
  156. '#000000000000011111111111111110000000000000' +
  157. '#000000000000111111111111111111000000000000' +
  158. '#000000000001111111111111111111100000000000' +
  159. '#000000000011111111111111111111110000000000' +
  160. '#000000000011111111111111111111110000000000' +
  161. '#000000000111111111111111111111111000000000' +
  162. '#000000000111111111111111111111111000000000' +
  163. '#000000001111111111111111111111111100000000' +
  164. '#000000001111111111111111111111111100000000' +
  165. '#000000001111111111111111111111111100000000' +
  166. '#000000001111111111111111111111111100000000' +
  167. '#000000001111111111111111111111111100000000' +
  168. '#000000000111111111111111111111111000000000' +
  169. '#000000000111111111111111111111111000000000' +
  170. '#000000000111111111111111111111111000000000' +
  171. '#000000000011111111111111111111110000000000' +
  172. '#000000000011111111111111111111110000000000' +
  173. '#000000000001111111111111111111100000000000' +
  174. '#000000000001111111111111111111100000000000' +
  175. '#000000000000111111111111111111000000000000' +
  176. '#000000000000111111111111111110000000000000' +
  177. '#000000000000011111111111111110000000000000' +
  178. '#000000000000001111111111111100000000000000' +
  179. '#000000000000001111111111111100000000000000' +
  180. '#000000000000001111111111111000000000000000' +
  181. '#000000000000000111111111111000000000000000' +
  182. '#000000000000000111111111111000000000000000' +
  183. '#000000000000000111111111111000000000000000' +
  184. '#000000000000000111111111111000000000000000' +
  185. '#000000000000000011111111110000000000000000' +
  186. '#000000000000000010000000010000000000000000' +
  187. '#000000000000000011111111110000000000000000' +
  188. '#000000000000000010000000010000000000000000' +
  189. '#000000000000000011111111110000000000000000' +
  190. '#000000000000000010000000010000000000000000' +
  191. '#000000000000000011111111110000000000000000' +
  192. '#000000000000000000100001000000000000000000' +
  193. '#000000000000000000110011000000000000000000' +
  194. '#000000000000000000011110000000000000000000';
  195. for (var i = 0; i < data.length; i++) {
  196. if (data[i] == '#') {
  197. bitmap.push([]);
  198. } else {
  199. bitmap[bitmap.length - 1].push(data[i] - '0');
  200. }
  201. }
  202. container.appendChild(stats.domElement);
  203. // Renderer
  204. renderer = new THREE.WebGLRenderer({
  205. alpha: true,
  206. antialias: true,
  207. canvas: canvas,
  208. });
  209. renderer.setClearColor(0x212121, 0);
  210. renderer.setPixelRatio(window.devicePixelRatio);
  211. renderer.shadowMap.enabled = true;
  212. renderer.shadowMap.type = THREE.PCFSoftShadowMap;
  213. renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT);
  214. // Camera and Controls
  215. camera = new THREE.PerspectiveCamera(fov, SCREEN_ASPECT_RATIO, 0.1, 1000);
  216. // camera = new THREE.OrthographicCamera(-viewWidth, viewWidth, viewHeight, -viewHeight, 1, 300);
  217. camera.position.set(cameraPos[0], cameraPos[1], cameraPos[2]);
  218. camera.lookAt(new THREE.Vector3(cameraLookAt[0], cameraLookAt[1], cameraLookAt[2]));
  219. raycaster = new THREE.Raycaster();
  220. // controls = new THREE.OrbitControls(camera);
  221. // controls.rotateSpeed = 2.0;
  222. // controls.zoomSpeed = 2.0;
  223. // controls.enableZoom = true;
  224. // controls.enablePan = true;
  225. // controls.dampingFactor = 0.2;
  226. // controls.addEventListener('change', render);
  227. //Scene
  228. scene = new THREE.Scene();
  229. //Lights
  230. // Making Object Array
  231. var xOffset = -bitmap[0].length / (BITMAP_SKIP * 2);
  232. var yOffset = bitmap.length / (BITMAP_SKIP * 2);
  233. for (var i = 0; i < bitmap.length; i += BITMAP_SKIP) {
  234. for (var j = 0; j < bitmap[i].length; j += BITMAP_SKIP) {
  235. if (bitmap[i][j] == 1) {
  236. planeGeometry = new THREE.PlaneGeometry(1, 1);
  237. var circleGeometry = new THREE.CircleGeometry(1, 5);
  238. var frac = i / bitmap.length;
  239. // Materials
  240. planeMaterial = new THREE.MeshBasicMaterial({
  241. color: new THREE.Color(
  242. color1[0] * frac + color2[0] * (1 - frac),
  243. color1[1] * frac + color2[1] * (1 - frac),
  244. color1[2] * frac + color2[2] * (1 - frac)
  245. ),
  246. transparent: true,
  247. opacity: THREE.Math.randFloat(0.4, 0.6),
  248. side: THREE.DoubleSide
  249. });
  250. var circleMaterial = new THREE.MeshBasicMaterial({
  251. color: new THREE.Color(1, 1, 1),
  252. transparent: true,
  253. opacity: THREE.Math.randFloat(0.8, 1),
  254. side: THREE.DoubleSide
  255. });
  256. // Mesh
  257. planeMesh = new THREE.Mesh(planeGeometry, planeMaterial);
  258. planeMesh.position.set(xOffset + j / BITMAP_SKIP, yOffset - i / BITMAP_SKIP, 0);
  259. var randWidth = THREE.Math.randFloat(0.6, 1.2);
  260. var randHeight = randWidth
  261. planeMesh.scale.set(randWidth, randHeight, 1);
  262. scene.add(planeMesh);
  263. objetArray.push([planeMesh, false]);
  264. circleMesh = new THREE.Mesh(circleGeometry, circleMaterial);
  265. circleMesh.position.set(xOffset + j / BITMAP_SKIP + THREE.Math.randFloat(-0.5, 0.5), yOffset - i / BITMAP_SKIP + THREE.Math.randFloat(-0.5, 0.5), 0.1);
  266. var randRadius = THREE.Math.randFloat(0.05, 0.1);
  267. circleMesh.scale.set(randRadius, randRadius, 1);
  268. scene.add(circleMesh);
  269. objetArray.push([circleMesh, false]);
  270. }
  271. }
  272. }
  273. //Geometry
  274. // Materials
  275. // Mesh
  276. // Helpers
  277. //Add Stuff to Scene
  278. }
  279. function animate() {
  280. requestAnimationFrame(animate);
  281. render();
  282. stats.update();
  283. // controls.update();
  284. frame++;
  285. }
  286. function render() {
  287. while (animationQueue.length > 0) {
  288. var obj_index = animationQueue[0][0];
  289. var ani_frame = animationQueue[0][1];
  290. if (ani_frame > ANIMATION_FRAME_LENGTH) {
  291. objetArray[obj_index][1] = false;
  292. animationQueue.shift();
  293. } else {
  294. break;
  295. }
  296. }
  297. for (var i = 0; i < objetArray.length; i++) {
  298. var obj = objetArray[i][0];
  299. var isAnimating = objetArray[i][1];
  300. if (isAnimating == false) {
  301. var px = obj.position.x;
  302. var py = obj.position.y;
  303. var dist = Math.sqrt(Math.pow(px - mouseScaled.x, 2) + Math.pow(py - mouseScaled.y, 2));
  304. if (dist < INTERACT_DISTANCE) {
  305. var startPosVector = obj.position.clone();
  306. var mouseRepelVector = new THREE.Vector3().subVectors(startPosVector, mouseScaled).multiplyScalar(THREE.Math.randFloat(INTERACT_DISTANCE + 0.5, INTERACT_DISTANCE + 2) - dist);
  307. var endPosVector = new THREE.Vector3().addVectors(startPosVector, mouseRepelVector);
  308. animationQueue.push([i, 0, startPosVector, endPosVector]);
  309. objetArray[i][1] = true;
  310. }
  311. }
  312. }
  313. for (var i = 0; i < animationQueue.length; i++) {
  314. var obj = objetArray[animationQueue[i][0]][0];
  315. var ani_frame = animationQueue[i][1];
  316. var startPosVector = animationQueue[i][2];
  317. var endPosVector = animationQueue[i][3];
  318. var curPosVector = new THREE.Vector3();
  319. var frac = 1 - Math.abs(ani_frame - (ANIMATION_FRAME_LENGTH / 2)) / (ANIMATION_FRAME_LENGTH / 2);
  320. frac = easeOutQuad(frac);
  321. curPosVector.lerpVectors(startPosVector, endPosVector, frac);
  322. obj.position.x = curPosVector.x;
  323. obj.position.y = curPosVector.y;
  324. obj.position.z = curPosVector.z;
  325. animationQueue[i][1] += 1;
  326. }
  327. mouse = new THREE.Vector3(10000, 10000, -2);
  328. mouseScaled = new THREE.Vector3(10000, 10000, -2);
  329. renderer.render(scene, camera);
  330. }
  331. function onWindowResize() {
  332. SCREEN_HEIGHT = Math.min(window.innerWidth, window.innerHeight);
  333. SCREEN_WIDTH = SCREEN_HEIGHT;
  334. SCREEN_ASPECT_RATIO = SCREEN_WIDTH / SCREEN_HEIGHT;
  335. camera.aspect = SCREEN_ASPECT_RATIO;
  336. camera.updateProjectionMatrix();
  337. renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT);
  338. console.log(SCREEN_WIDTH + "x" + SCREEN_HEIGHT)
  339. }
  340. function onDocumentMouseMove(event) {
  341. var rect = canvas.getBoundingClientRect();
  342. mouse.x = event.clientX - rect.left;
  343. mouse.y = event.clientY - rect.top;
  344. mouseScaled.x = mouse.x * viewWidth / SCREEN_WIDTH - viewWidth / 2;
  345. mouseScaled.y = -mouse.y * viewHeight / SCREEN_HEIGHT + viewHeight / 2;
  346. }
  347. function sigmoid(t) {
  348. return 1 / (1 + Math.pow(Math.E, -t));
  349. }
  350. // no easing, no acceleration
  351. function linear(t) {
  352. return t;
  353. }
  354. // accelerating from zero velocity
  355. function easeInQuad(t) {
  356. return t * t;
  357. }
  358. // decelerating to zero velocity
  359. function easeOutQuad(t) {
  360. return t * (2 - t);
  361. }
  362. // acceleration until halfway, then deceleration
  363. function easeInOutQuad(t) {
  364. return t < .5 ? 2 * t * t : -1 + (4 - 2 * t) * t;
  365. }
  366. // accelerating from zero velocity
  367. function easeInCubic(t) {
  368. return t * t * t;
  369. }
  370. // decelerating to zero velocity
  371. function easeOutCubic(t) {
  372. return (--t) * t * t + 1;
  373. }
  374. // acceleration until halfway, then deceleration
  375. function easeInOutCubic(t) {
  376. return t < .5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1;
  377. }
  378. // accelerating from zero velocity
  379. function easeInQuart(t) {
  380. return t * t * t * t;
  381. }
  382. // decelerating to zero velocity
  383. function easeOutQuart(t) {
  384. return 1 - (--t) * t * t * t;
  385. }
  386. // acceleration until halfway, then deceleration
  387. function easeInOutQuart(t) {
  388. return t < .5 ? 8 * t * t * t * t : 1 - 8 * (--t) * t * t * t;
  389. }
  390. // accelerating from zero velocity
  391. function easeInQuint(t) {
  392. return t * t * t * t * t;
  393. }
  394. // decelerating to zero velocity
  395. function easeOutQuint(t) {
  396. return 1 + (--t) * t * t * t * t;
  397. }
  398. // acceleration until halfway, then deceleration
  399. function easeInOutQuint(t) {
  400. return t < .5 ? 16 * t * t * t * t * t : 1 + 16 * (--t) * t * t * t * t;
  401. }
  402. //Event Handlers
  403. window.addEventListener("resize", onWindowResize);
  404. init();
  405. animate();
  406. }
  407. ThreeJSCanvas(1);
  408. </script>
  409. <script>
  410. function noticeBtn() {
  411. window.location.href="../platlive/notice/index"
  412. }
  413. </script>
  414. <script>
  415. var xin = true,
  416. yin = true;
  417. var step = 2;
  418. var delay = 10;
  419. var $obj;
  420. $(function () {
  421. $obj = $('#floatingDiv');
  422. var time = window.setInterval('move()', delay);
  423. $obj.mouseover(function () {
  424. clearInterval(time);
  425. });
  426. $obj.mouseout(function () {
  427. time = window.setInterval('move()', delay);
  428. });
  429. });
  430. function move() {
  431. var left = $obj.offset().left;
  432. // console.log(left);
  433. var top = $obj.offset().top;
  434. var L = (T = 0); //左边界和顶部边界
  435. var R = $(window).width() - $obj.width(); // 右边界
  436. var B = $(window).height() - $obj.height(); //下边界
  437. //难点:怎样判断广告的4个边框有没有超出可视化范围!
  438. if (left < L) {
  439. xin = true; // 水平向右移动
  440. }
  441. if (left > R) {
  442. xin = false;
  443. }
  444. if (top < T) {
  445. yin = true;
  446. }
  447. if (top > B) {
  448. yin = false;
  449. }
  450. //根据有没有超出范围来确定广告的移动方向
  451. left += step * (xin == true ? 1 : -1);
  452. top += step * (yin == true ? 1 : -1);
  453. // 给div 元素重新定位
  454. $obj.offset({
  455. top: top,
  456. left: left,
  457. });
  458. }
  459. </script>
  460. </body>
  461. <!-- layui -->
  462. <script type="text/javascript" src="static/home/lib/layui/layui.all.js"></script>
  463. </html>