museum.htm 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  6. <meta name="viewport" content="width=device-width,initial-scale=1.0">
  7. <!--{if ($type == 'evaluation'){}-->
  8. <title>产品测评</title>
  9. <meta name="description" content="产品测评">
  10. <meta name="keywords" content="猫王收音机,猫王音响,RADIOOO,猫王音乐台,猫王1,猫王2,猫王3,猫王小王子">
  11. <!--{}}-->
  12. <!--{if ($type == 'dynamic'){}-->
  13. <title>热点动态</title>
  14. <meta name="description" content="热点动态">
  15. <meta name="keywords" content="猫王收音机,猫王音响,RADIOOO,猫王音乐台,猫王1,猫王2,猫王3,猫王小王子">
  16. <!--{}}-->
  17. <!--{if ($type == 'video'){}-->
  18. <title>视频专题</title>
  19. <meta name="description" content="视频专题">
  20. <meta name="keywords" content="猫王收音机,猫王音响,RADIOOO,猫王音乐台,猫王1,猫王2,猫王3,猫王小王子">
  21. <!--{}}-->
  22. <link rel="shortcut icon" href="/static/css/favicon.ico">
  23. <!--{ if ($lang == 'en') {}-->
  24. <link rel="stylesheet" type="text/css" href="/static/css/headerComponent_en.css">
  25. <!--{}else{}-->
  26. <link rel="stylesheet" type="text/css" href="/static/css/headerComponent.css">
  27. <!--{}}-->
  28. <link rel="stylesheet" type="text/css" href="/static/css/museumPage.css">
  29. <style type="text/css">
  30. <!--{if ($type == 'evaluation'){}-->
  31. .m-museum {
  32. background-image: url('http://airsmart-web.oss-cn-shanghai.aliyuncs.com/upload/images/%E5%8D%9A%E7%89%A9%E9%A6%86/review_bg.jpg');
  33. }
  34. <!--{}}-->
  35. <!--{if ($type == 'dynamic'){}-->
  36. .m-museum {
  37. background-image: url('http://airsmart-web.oss-cn-shanghai.aliyuncs.com/upload/images/%E5%8D%9A%E7%89%A9%E9%A6%86/hotspots_bg.jpg');
  38. }
  39. <!--{}}-->
  40. <!--{if ($type == 'video'){}-->
  41. .m-museum {
  42. background-image: url('http://airsmart-web.oss-cn-shanghai.aliyuncs.com/upload/images/%E5%8D%9A%E7%89%A9%E9%A6%86/video_bg.jpg');
  43. }
  44. .section-wrap {
  45. padding: 0;
  46. }
  47. <!--{ for($i=0;$i<count($museData);$i++){ }-->
  48. .section-wrap:nth-child(<!--{ echo $i+1; }-->) .section-videoplay {
  49. /*background: url(<!--{ echo $museData[$i]['video_img']; }-->) no-repeat center center;
  50. background-size: cover;*/
  51. }
  52. <!--{}}-->
  53. <!--{}}-->
  54. /*@media (max-device-width: 1081px) {
  55. <!--{ for($i=0;$i<count($museData);$i++){ }-->
  56. .section-wrap:nth-child(<!--{echo $i+1 }-->) {
  57. background-image: url(<!--{ echo $museData[$i]['icon']; }-->);
  58. }
  59. <!--{}}-->
  60. }*/
  61. </style>
  62. <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
  63. <script type="text/javascript" src="/static/js/module/TD.js"></script>
  64. <script>
  65. var _hmt = _hmt || [];
  66. (function() {
  67. var hm = document.createElement("script");
  68. hm.src = "https://hm.baidu.com/hm.js?ec21b876c66f6033f549fcd833ac3b7b";
  69. var s = document.getElementsByTagName("script")[0];
  70. s.parentNode.insertBefore(hm, s);
  71. })();
  72. </script>
  73. </head>
  74. <body>
  75. <!--{ echo $header; }-->
  76. <div class="m-museum">
  77. <div class="museum-wrap">
  78. <!--{ for($i=0;$i<count($museData);$i++){ }-->
  79. <!--{if ($type == 'video'){}-->
  80. <!--{ $row1 = count($museData)/3; }-->
  81. <!--{ $row2 = count($museData)*2/3; }-->
  82. <!--{if ($i == 0){}-->
  83. <div class="section-row">
  84. <!--{}}-->
  85. <!--{if ($i == ceil($row1)){}-->
  86. </div>
  87. <div class="section-row">
  88. <!--{}}-->
  89. <!--{if ($i == ceil($row2)){}-->
  90. </div>
  91. <div class="section-row">
  92. <!--{}}-->
  93. <div class="section-wrap mb-video-section" data-id="<!--{ echo $museData[$i]['id']; }-->">
  94. <div class="alpha-layer"></div>
  95. <div class="section-text">
  96. <h1 class="section-date mb-display-toggle" style="display:none;">
  97. <!--{ echo $museData[$i]['gotime']; }-->
  98. </h1>
  99. <h2 class="section-title"><!--{ echo $museData[$i]['title']; }--></h2>
  100. <p class="section-content mb-display-toggle" style="text-align:left;">
  101. <!--{ $str = str_replace('}','</strong>',str_replace('{','<strong>',$museData[$i]['content'])); echo $str; }-->
  102. </p>
  103. <div class="section-videoplay">
  104. <img src="<!--{ echo $museData[$i]['video_img']; }-->"></img>
  105. <div class="btn-videoplay"></div>
  106. </div>
  107. </div>
  108. <div class="btn-details-show"></div>
  109. <div class="btn-details-hide"></div>
  110. </div>
  111. <!--{if ($i == count($museData) - 1){}-->
  112. </div>
  113. <!--{}}-->
  114. <!--{}else{}-->
  115. <!--{ $row1 = count($museData)/3; }-->
  116. <!--{ $row2 = count($museData)*2/3; }-->
  117. <!--{if ($i == 0){}-->
  118. <div class="section-row">
  119. <!--{}}-->
  120. <!--{if ($i == ceil($row1)){}-->
  121. </div>
  122. <div class="section-row">
  123. <!--{}}-->
  124. <!--{if ($i == ceil($row2)){}-->
  125. </div>
  126. <div class="section-row">
  127. <!--{}}-->
  128. <div class="section-wrap" data-id="<!--{ echo $museData[$i]['id']; }-->">
  129. <div class="alpha-layer"></div>
  130. <div class="section-img">
  131. <img src="<!--{ echo $museData[$i]['icon']; }-->" alt="">
  132. </div>
  133. <div class="section-text">
  134. <h2 class="section-title"><!--{ echo $museData[$i]['title']; }-->
  135. </h2>
  136. <p class="section-content">
  137. <!--{ $str = str_replace('}','</strong>',str_replace('{','<strong>',$museData[$i]['content'])); echo $str; }-->
  138. </p>
  139. <p class="section-date">
  140. <!--{ echo $museData[$i]['gotime']; }-->
  141. </p>
  142. </div>
  143. <div class="btn-details-show"></div>
  144. <div class="btn-details-hide"></div>
  145. </div>
  146. <!--{if ($i == count($museData) - 1){}-->
  147. </div>
  148. <!--{}}-->
  149. <!--{}}-->
  150. <!--{}}-->
  151. </div>
  152. <!--{if ($type != 'video'){}-->
  153. <div class="details-wrap">
  154. <!--{ for($i=0;$i<count($museData);$i++){ }-->
  155. <div class="details-section" data-id="<!--{ echo $museData[$i]['id']; }-->">
  156. <h2 class="details-title">
  157. <!--{ echo $museData[$i]['title']; }-->
  158. </h2>
  159. <p class="details-message">
  160. 作者:<!--{ echo $museData[$i]['author']; }-->
  161. 发表时间:<!--{ echo $museData[$i]['gotime']; }-->
  162. 阅览:<!--{ echo $museData[$i]['views']; }-->次
  163. </p>
  164. <!--{ for($j=0;$j<count($museData[$i]['imgContent']);$j++){ }-->
  165. <div class="details-content">
  166. <span>
  167. <!--{ $str = $museData[$i]['imgContent'][$j]; echo htmlspecialchars_decode($str) }-->
  168. </span>
  169. </div>
  170. <!--{ } }-->
  171. <div class="btn-close">+</div>
  172. </div>
  173. <!--{ } }-->
  174. </div>
  175. <!--{ } }-->
  176. <!--{if ($type == 'video'){}-->
  177. <div class="video-wrap">
  178. <!--{ for($i=0;$i<count($museData);$i++){ }-->
  179. <div class="video-section" data-id="<!--{ echo $museData[$i]['id']; }-->">
  180. <video class="video-item" src="<!--{ echo $museData[$i]['video']; }-->" controls="true"></video>
  181. <div class="btn-close">+</div>
  182. </div>
  183. <!--{ } }-->
  184. </div>
  185. <!--{ } }-->
  186. </div>
  187. </body>
  188. <script type="text/javascript" src="/static/js/module/headerComponent.js"></script>
  189. <script type="text/javascript">
  190. <!--{if ($type != 'video'){}-->
  191. // 文字页面的处理函数
  192. var textTypeHandler = function (wrapEl) {
  193. $(document).ready(function () {
  194. var id = location.hash;
  195. var sectionArr = $('.section-wrap');
  196. sectionArr.each(function (ele) {
  197. if ('#' + $(this).data('id').toString() === id) {
  198. $(this).find('.btn-details-show').click();
  199. }
  200. })
  201. });
  202. $('.btn-details-show').on('click', function () {
  203. var viewCount = function () {
  204. var id;
  205. if (wrapEl.data('id') !== 'undefined') {
  206. id = wrapEl.data('id');
  207. } else {
  208. id = -1;
  209. }
  210. var readedStr = '';
  211. if (localStorage.getItem('readed')) {
  212. readedStr = localStorage.getItem('readed');
  213. }
  214. if(readedStr.match(id.toString()) !== null) {
  215. return;
  216. } else {
  217. readedStr = readedStr + id + ',';
  218. localStorage.setItem('readed',readedStr);
  219. TD.ajax({
  220. type: 'GET',
  221. url: '/index/museum/view',
  222. data: {
  223. id: id
  224. },
  225. success: function (res) {
  226. console.log(res);
  227. return res;
  228. },
  229. error: function (data) {
  230. console.log(data);
  231. return 0;
  232. }
  233. })
  234. }
  235. }
  236. // var index = $(this).parent().index();
  237. var id;
  238. var wrapEl = $(this).parent();
  239. if (wrapEl.data('id') !== 'undefined') {
  240. id = wrapEl.data('id');
  241. } else {
  242. id = -1;
  243. }
  244. // 移动端则不需要继续处理
  245. if (document.documentElement.clientWidth <= 1080) {
  246. // $('.details-section:nth-child(' + (index+1) + ')').fadeIn(300);
  247. $('.details-section').each(function (ele) {
  248. if ($(this).data('id') === id) {
  249. $(this).fadeIn(300);
  250. }
  251. });
  252. return;
  253. }
  254. // 位于左边不动,位于右边则先移动到左边
  255. // if (index%2 === 1) {
  256. // // 隐藏左边文章
  257. // $('.section-wrap:nth-child(' + index + ')').fadeOut(300);
  258. // wrapEl.animate({
  259. // left: '-46%'
  260. // }, 300, function () {
  261. // wrapEl.css('left', 0);
  262. // })
  263. // }
  264. //wrapEl.children('.btn-details-show').hide();
  265. //wrapEl.children('.btn-details-hide').show();
  266. // wrapEl.find('img').css('transform', 'scale(0.75)');
  267. $('.details-section').each(function () {
  268. if ($(this).css('display') === 'block') {
  269. $(this).fadeOut(300);
  270. }
  271. });
  272. // $('.details-section:nth-child(' + (index+1) + ')').fadeIn(300);
  273. $('.details-section').each(function (ele) {
  274. if ($(this).data('id') === id) {
  275. console.log($(this).data('id'))
  276. $(this).fadeIn(300);
  277. }
  278. })
  279. // $('.section-wrap').addClass('section-block');
  280. $('.section-row').addClass('section-block');
  281. viewCount(wrapEl);
  282. var hashHandler = function () {
  283. var id;
  284. if (wrapEl.data('id') !== 'undefined') {
  285. id = wrapEl.data('id');
  286. } else {
  287. id = -1;
  288. }
  289. location.hash = id;
  290. }
  291. hashHandler();
  292. });
  293. // $('.btn-details-hide').on('click', function () {
  294. // var index = $(this).parent().index();
  295. // var wrapEl = $(this).parent();
  296. // if (index%2 === 1) {
  297. // // 恢复左边文章
  298. // $('.section-wrap:nth-child(' + index + ')').fadeIn(300);
  299. // wrapEl.css('left', '-46%');
  300. // wrapEl.animate({
  301. // left: '0'
  302. // }, 300, function () {
  303. // // wrapEl.css('left', 0);
  304. // })
  305. // }
  306. // wrapEl.children('.btn-details-hide').hide();
  307. // wrapEl.children('.btn-details-show').show();
  308. // wrapEl.find('img').css('transform', 'scale(1)');
  309. // $('.details-section:nth-child(' + (index+1) + ')').fadeOut(300);
  310. // })
  311. $('.details-wrap .btn-close').on('click', function () {
  312. var index = $(this).parent().index();
  313. $(this).parent().fadeOut(300);
  314. // $('.details-section').each(function () {
  315. // if ($(this).css('display') === 'block') {
  316. // $(this).fadeOut(300);
  317. // }
  318. // });
  319. // $('.section-wrap').removeClass('section-block');
  320. $('.section-row').removeClass('section-block');
  321. location.hash = '';
  322. })
  323. }
  324. textTypeHandler();
  325. <!--{}}-->
  326. <!--{if ($type == 'video'){}-->
  327. // 视频页面的处理函数
  328. var videoTypeHandler = function () {
  329. // $('.btn-play').show();
  330. $('.details-wrap') && $('.details-wrap').hide();
  331. $('.btn-details-show').hide();
  332. // $('.section-videoplay').hover(function () {
  333. // $(this).css('opacity', 0.6);
  334. // },function () {
  335. // $(this).css('opacity', 1);
  336. // })
  337. $('.section-videoplay').on('click', function () {
  338. var id;
  339. var wrapEl = $(this).parent().parent();
  340. if (wrapEl.data('id') !== 'undefined') {
  341. id = wrapEl.data('id');
  342. } else {
  343. id = -1;
  344. }
  345. $('.video-section').each(function (ele) {
  346. if ($(this).data('id') === id) {
  347. $(this).fadeIn(300);
  348. var videoEl = $(this).find('.video-item')[0];
  349. videoEl.currentTime = 0;
  350. videoEl.play();
  351. }
  352. });
  353. // var index = $(this).parent().parent().index();
  354. // var videoSectionEl = $('.video-section:nth-child(' + (index+1) + ')');
  355. // var videoEl = videoSectionEl.find('.video-item')[0];
  356. // videoSectionEl.fadeIn(300);
  357. // videoEl.currentTime = 0;
  358. // videoEl.play();
  359. })
  360. if (document.documentElement.clientWidth <= 1080) {
  361. $('.section-wrap').on('click', function () {
  362. var id;
  363. var wrapEl = $(this).parent().parent();
  364. if (wrapEl.data('id') !== 'undefined') {
  365. id = wrapEl.data('id');
  366. } else {
  367. id = -1;
  368. }
  369. $('.video-section').each(function (ele) {
  370. if ($(this).data('id') === id) {
  371. $(this).fadeIn(300);
  372. var videoEl = $(this).find('.video-item')[0];
  373. videoEl.currentTime = 0;
  374. videoEl.play();
  375. }
  376. });
  377. // var index = $(this).parent().index();
  378. // var videoSectionEl = $('.video-section:nth-child(' + (index+1) + ')');
  379. // var videoEl = videoSectionEl.find('.video-item')[0];
  380. // videoSectionEl.fadeIn(300);
  381. // videoEl.currentTime = 0;
  382. // videoEl.play();
  383. })
  384. }
  385. $('.video-section').on('click', function (event) {
  386. var evt = event || window.event;
  387. var target = evt.target || evt.srcElement;
  388. if (target.nodeName.toLowerCase() === 'video') {
  389. console.log('video');
  390. return;
  391. }
  392. $(this).find('.video-item')[0].pause();
  393. $(this).fadeOut(300);
  394. })
  395. }
  396. videoTypeHandler();
  397. <!--{}}-->
  398. </script>
  399. </html>