home.html 18 KB

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