网站
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 

615 Zeilen
23 KiB

  1. /**
  2. * Created by Administrator on 2021/4/5.
  3. */
  4. define(['jquery', "template", "Tools", 'swiper'], function ($, template, Tools, swiper) {
  5. //数据存储
  6. var module = {
  7. data: {
  8. //服务器地址
  9. serverApi:'',
  10. //焦点图数据
  11. focusList: [],
  12. communicateList: [],
  13. newImgList:[],
  14. newList1:[],
  15. newList2:[],
  16. newList3:[],
  17. newList4:[],
  18. newList5:[],
  19. newList6:[],
  20. newList7:[],
  21. newList8:[],
  22. newList9:[],
  23. newList10:[],
  24. newList11:[],
  25. newList12:[],
  26. pageNum1: 1,
  27. pageNum2: 1,
  28. pageNum3: 1,
  29. pageNum4: 1,
  30. pageNum5: 1,
  31. pageNum6: 1,
  32. pageNum7: 1,
  33. pageNum8: 1,
  34. pageNum9: 1,
  35. pageNum10: 1,
  36. pageNum11: 1,
  37. pageNum12: 1,
  38. },
  39. };
  40. var tools = new Tools();
  41. module.init = function (page) {
  42. // //新闻列表
  43. // tools.doGet(listSiyigongkai, {
  44. // pageNum:1,
  45. // pageSize:10,
  46. // bookId: JSON.parse(tools.getCookie('user')).bookId,
  47. // deptId: JSON.parse(tools.getCookie('user')).deptId
  48. // }, module.newsList4 , true);
  49. tools.doGet(webList, {}, module.webList , true);
  50. // new Swiper('#bannerFocusNextWrap', {
  51. // paginationClickable: true,
  52. // pagination: '.a2',
  53. // autoplay : 2000,
  54. // loop:true
  55. // })
  56. console.log(JSON.parse(tools.getCookie('user')))
  57. $("#deptName").html(JSON.parse(tools.getCookie('user')).deptName);
  58. if (tools.getCookie('user')){
  59. $("#loginF").css('display','none');
  60. $("#listB").css('display','flex');
  61. changeList('1');
  62. }
  63. var ulbox1 = document.getElementById("review_box1");
  64. ulbox1.scrollTop = 0; // 开始无滚动时设为0
  65. ulbox1.addEventListener('scroll', function() {
  66. if (ulbox1.scrollHeight - ulbox1.scrollTop === ulbox1.clientHeight) {
  67. module.data.pageNum1 += 1;
  68. changeList('1');
  69. }
  70. });
  71. var ulbox2 = document.getElementById("review_box2");
  72. ulbox2.scrollTop = 0; // 开始无滚动时设为0
  73. ulbox2.addEventListener('scroll', function() {
  74. if (ulbox2.scrollHeight - ulbox2.scrollTop === ulbox2.clientHeight) {
  75. module.data.pageNum2 += 1;
  76. changeList('2');
  77. }
  78. });
  79. var ulbox3 = document.getElementById("review_box3");
  80. ulbox3.scrollTop = 0; // 开始无滚动时设为0
  81. ulbox3.addEventListener('scroll', function() {
  82. if (ulbox3.scrollHeight - ulbox3.scrollTop === ulbox3.clientHeight) {
  83. module.data.pageNum3 += 1;
  84. changeList('3');
  85. }
  86. });
  87. var ulbox3_zy = document.getElementById("review_box3_zy");
  88. ulbox3_zy.scrollTop = 0; // 开始无滚动时设为0
  89. ulbox3_zy.addEventListener('scroll', function() {
  90. if (ulbox3_zy.scrollHeight - ulbox3_zy.scrollTop === ulbox3_zy.clientHeight) {
  91. module.data.pageNum11 += 1;
  92. ZDSXTabClick('zy');
  93. }
  94. });
  95. var ulbox4 = document.getElementById("review_box4");
  96. ulbox4.scrollTop = 0; // 开始无滚动时设为0
  97. ulbox4.addEventListener('scroll', function() {
  98. if (ulbox4.scrollHeight - ulbox4.scrollTop === ulbox4.clientHeight) {
  99. module.data.pageNum4 += 1;
  100. changeList('4');
  101. }
  102. });
  103. var ulbox5 = document.getElementById("review_box5");
  104. ulbox5.scrollTop = 0; // 开始无滚动时设为0
  105. ulbox5.addEventListener('scroll', function() {
  106. if (ulbox5.scrollHeight - ulbox5.scrollTop === ulbox5.clientHeight) {
  107. module.data.pageNum5 += 1;
  108. changeList('5');
  109. }
  110. });
  111. var ulbox6 = document.getElementById("review_box6");
  112. ulbox6.scrollTop = 0; // 开始无滚动时设为0
  113. ulbox6.addEventListener('scroll', function() {
  114. if (ulbox6.scrollHeight - ulbox6.scrollTop === ulbox6.clientHeight) {
  115. module.data.pageNum6 += 1;
  116. changeList('6');
  117. }
  118. });
  119. var ulbox7 = document.getElementById("review_box7");
  120. ulbox7.scrollTop = 0; // 开始无滚动时设为0
  121. ulbox7.addEventListener('scroll', function() {
  122. if (ulbox7.scrollHeight - ulbox7.scrollTop === ulbox7.clientHeight) {
  123. module.data.pageNum7 += 1;
  124. changeList('7');
  125. }
  126. });
  127. var ulbox8 = document.getElementById("review_box8");
  128. ulbox8.scrollTop = 0; // 开始无滚动时设为0
  129. ulbox8.addEventListener('scroll', function() {
  130. if (ulbox8.scrollHeight - ulbox8.scrollTop === ulbox8.clientHeight) {
  131. module.data.pageNum8 += 1;
  132. changeList('8');
  133. }
  134. });
  135. var ulbox9 = document.getElementById("review_box9");
  136. ulbox9.scrollTop = 0; // 开始无滚动时设为0
  137. ulbox9.addEventListener('scroll', function() {
  138. if (ulbox9.scrollHeight - ulbox9.scrollTop === ulbox9.clientHeight) {
  139. module.data.pageNum9 += 1;
  140. changeList('9');
  141. }
  142. });
  143. var ulbox10 = document.getElementById("review_box10");
  144. ulbox10.scrollTop = 0; // 开始无滚动时设为0
  145. ulbox10.addEventListener('scroll', function() {
  146. if (ulbox10.scrollHeight - ulbox10.scrollTop === ulbox10.clientHeight) {
  147. module.data.pageNum10 += 1;
  148. changeList('10');
  149. }
  150. });
  151. var ulbox11 = document.getElementById("review_box11");
  152. ulbox11.scrollTop = 0; // 开始无滚动时设为0
  153. ulbox11.addEventListener('scroll', function() {
  154. if (ulbox11.scrollHeight - ulbox11.scrollTop === ulbox11.clientHeight) {
  155. module.data.pageNum12 += 1;
  156. changeList('11');
  157. }
  158. });
  159. };
  160. module.newsList4 = function (data) {
  161. if (data.code == 200) {
  162. var content = data.rows;
  163. if (module.data.newList4.length >= data.total){
  164. return;
  165. }else{
  166. for (let i = 0 ; i < content.length ; i++){
  167. module.data.newList4.push(content[i]);
  168. }
  169. }
  170. // module.data.newList4 = content;
  171. var newListData4 = template('newListData4', module.data);
  172. $("#newListContent_ul_4").html(newListData4);
  173. }
  174. }
  175. module.newsList10 = function (data) {
  176. if (data.code == 200) {
  177. var content = data.rows;
  178. if (module.data.newList10.length >= data.total){
  179. console.log(111111111111)
  180. return;
  181. }else{
  182. console.log(222222222222)
  183. for (let i = 0 ; i < content.length ; i++){
  184. module.data.newList10.push(content[i]);
  185. }
  186. }
  187. console.log(module.data.newList10)
  188. // module.data.newList4 = content;
  189. var newListData10 = template('newListData10', module.data);
  190. $("#newListContent_ul_10").html(newListData10);
  191. }
  192. }
  193. module.newsList7 = function (data) {
  194. if (data.code == 200) {
  195. var content = data.rows;
  196. if (module.data.newList7.length >= data.total){
  197. return;
  198. }else{
  199. for (let i = 0 ; i < content.length ; i++){
  200. module.data.newList7.push(content[i]);
  201. }
  202. }
  203. // module.data.newList7 = content;
  204. var newListData7 = template('newListData7', module.data);
  205. $("#newListContent_ul_7").html(newListData7);
  206. }
  207. }
  208. module.newsList8 = function (data) {
  209. if (data.code == 200) {
  210. var content = data.rows;
  211. if (module.data.newList8.length >= data.total){
  212. return;
  213. }else{
  214. for (let i = 0 ; i < content.length ; i++){
  215. module.data.newList8.push(content[i]);
  216. }
  217. }
  218. // module.data.newList8 = content;
  219. var newListData8 = template('newListData8', module.data);
  220. $("#newListContent_ul_8").html(newListData8);
  221. }
  222. }
  223. module.newsList9 = function (data) {
  224. if (data.code == 200) {
  225. var content = data.rows;
  226. if (module.data.newList9.length >= data.total){
  227. return;
  228. }else{
  229. for (let i = 0 ; i < content.length ; i++){
  230. module.data.newList9.push(content[i]);
  231. }
  232. }
  233. // module.data.newList9 = content;
  234. var newListData9 = template('newListData9', module.data);
  235. $("#newListContent_ul_9").html(newListData9);
  236. }
  237. }
  238. module.webList = function (data) {
  239. if (data.code == 200) {
  240. var content = data.data;
  241. module.data.webList = content;
  242. var webData = template('webData', module.data);
  243. $("#webContent").html(webData);
  244. var titData = template('titData', module.data);
  245. $("#titContent").html(titData);
  246. $('#ewm').attr('src', 'static/images/'+content.top.bz);
  247. }
  248. }
  249. searchChange = function () {
  250. console.log(1111111111);
  251. tools.doGet(listSiyigongkai, {pageNum:1,pageSize:8,openName:$("#searchInput").val(), isAsc:'desc', orderByColumn:'createTime'}, module.newsList , true);
  252. }
  253. submitUser = function () {
  254. tools.doPost(checkFarmer, {memberName:$("#userName").val(),idcard:$("#password").val()}, module.checkFarmer , true);
  255. }
  256. clearCook = function () {
  257. tools.setCookie('user','');
  258. tools.setCookie('farmerCode','');
  259. $('#loginF').css('display','flex');
  260. $('#listB').css('display','none');
  261. }
  262. module.checkFarmer = function (data) {
  263. if (data.code == 200) {
  264. let seconds = 3600;
  265. let expires = new Date(new Date() * 1 + seconds * 1000);
  266. tools.setCookie("user", JSON.stringify(data.data), { expires: expires });
  267. tools.doGet(familyMember, {idcard:$("#password").val()}, module.familyMember , true);
  268. }
  269. }
  270. module.familyMember = function (data) {
  271. if (data.code == 200) {
  272. const farmerCode = data.rows[0].farmerCode;
  273. tools.setCookie("farmerCode",farmerCode, { expires: 30 });
  274. $('#loginF').css('display','none');
  275. $('#listB').css('display','flex');
  276. changeList('1');
  277. }
  278. }
  279. ZDSXTabClick = function (type) {
  280. document.getElementById('zd').className = '';
  281. document.getElementById('zy').className = '';
  282. document.getElementById(type).className = 'act';
  283. $('#review_box3').css('display','none');
  284. $('#review_box3_zy').css('display','none');
  285. switch (type) {
  286. case 'zd':
  287. $('#review_box3').css('display','block');
  288. tools.doGet(majorEventPublicList, {
  289. pageNum:module.data.pageNum3,
  290. pageSize:10,
  291. orderByColumn: 'openNy',
  292. isAsc: 'desc',
  293. bookId: JSON.parse(tools.getCookie('user')).bookId,
  294. deptId: JSON.parse(tools.getCookie('user')).deptId
  295. }, module.newsList3 , true);
  296. break;
  297. case 'zy':
  298. $('#review_box3_zy').css('display','block');
  299. tools.doGet(importantList, {
  300. pageNum:module.data.pageNum11,
  301. translate_dict:"1",
  302. pageSize:10,
  303. orderByColumn: 'openNy',
  304. isAsc: 'desc',
  305. bookId: JSON.parse(tools.getCookie('user')).bookId,
  306. deptId: JSON.parse(tools.getCookie('user')).deptId
  307. }, module.newsList11 , true);
  308. break;
  309. default:
  310. break;
  311. }
  312. }
  313. changeList = function (type) {
  314. $('#new_list_1').css('display','none');
  315. $('#new_list_2').css('display','none');
  316. $('#new_list_3').css('display','none');
  317. $('#new_list_4').css('display','none');
  318. $('#new_list_5').css('display','none');
  319. $('#new_list_6').css('display','none');
  320. $('#new_list_7').css('display','none');
  321. $('#new_list_8').css('display','none');
  322. $('#new_list_9').css('display','none');
  323. $('#new_list_10').css('display','none');
  324. $('#new_list_11').css('display','none');
  325. switch (type) {
  326. case '1':
  327. $('#new_list_1').css('display','block');
  328. $("#nowDateNYR1").html(new Date().getFullYear()+'-'+(new Date().getMonth()+1)+'-'+new Date().getDate());
  329. tools.doGet(financePublicList, {
  330. pageNum:module.data.pageNum1,
  331. pageSize:10,
  332. orderByColumn: 'openNy',
  333. isAsc: 'desc',
  334. bookId: JSON.parse(tools.getCookie('user')).bookId,
  335. deptId: JSON.parse(tools.getCookie('user')).deptId
  336. }, module.newsList1 , true);
  337. break;
  338. case '2':
  339. $('#new_list_2').css('display','block');
  340. $("#nowDateNYR2").html(new Date().getFullYear()+'-'+(new Date().getMonth()+1)+'-'+new Date().getDate());
  341. tools.doGet(contractionList, {
  342. pageNum:module.data.pageNum2,
  343. pageSize:10,
  344. orderByColumn: 'buildingTime',
  345. translate_dict: 1,
  346. isAsc: 'desc',
  347. bookId: JSON.parse(tools.getCookie('user')).bookId,
  348. deptId: JSON.parse(tools.getCookie('user')).deptId
  349. }, module.newsList2 , true);
  350. break;
  351. case '3':
  352. $('#new_list_3').css('display','block');
  353. $("#nowDateNYR3").html(new Date().getFullYear()+'-'+(new Date().getMonth()+1)+'-'+new Date().getDate());
  354. tools.doGet(majorEventPublicList, {
  355. pageNum:module.data.pageNum3,
  356. pageSize:10,
  357. orderByColumn: 'openNy',
  358. isAsc: 'desc',
  359. bookId: JSON.parse(tools.getCookie('user')).bookId,
  360. deptId: JSON.parse(tools.getCookie('user')).deptId
  361. }, module.newsList3 , true);
  362. break;
  363. case '4':
  364. $('#new_list_4').css('display','block');
  365. $("#nowDateNYR4").html(new Date().getFullYear()+'-'+(new Date().getMonth()+1)+'-'+new Date().getDate());
  366. tools.doGet(listSiyigongkai, {
  367. pageNum:module.data.pageNum4,
  368. pageSize:10,
  369. bookId: JSON.parse(tools.getCookie('user')).bookId,
  370. deptId: JSON.parse(tools.getCookie('user')).deptId,
  371. isAsc:'desc', orderByColumn:'createTime'
  372. }, module.newsList4 , true);
  373. break;
  374. case '5':
  375. $('#new_list_5').css('display','block');
  376. $("#nowDateNYR5").html(new Date().getFullYear()+'-'+(new Date().getMonth()+1)+'-'+new Date().getDate());
  377. break;
  378. case '6':
  379. $('#new_list_6').css('display','block');
  380. $("#nowDateNYR6").html(new Date().getFullYear()+'-'+(new Date().getMonth()+1)+'-'+new Date().getDate());
  381. break;
  382. case '7':
  383. tools.doGet(orcodeList, {
  384. translate_dict:1,
  385. orderByColumn: 'code',
  386. isAsc: 'asc',
  387. pageNum:module.data.pageNum7,
  388. pageSize:10,
  389. bookId: JSON.parse(tools.getCookie('user')).bookId,
  390. deptId: JSON.parse(tools.getCookie('user')).deptId
  391. }, module.newsList7 , true);
  392. $('#new_list_7').css('display','block');
  393. $("#nowDateNYR7").html(new Date().getFullYear()+'-'+(new Date().getMonth()+1)+'-'+new Date().getDate());
  394. break;
  395. case '8':
  396. tools.doGet(assetresourceOrcodeList, {
  397. translate_dict:1,
  398. orderByColumn: 'code',
  399. isAsc: 'asc',
  400. pageNum:module.data.pageNum8,
  401. pageSize:10,
  402. bookId: JSON.parse(tools.getCookie('user')).bookId
  403. }, module.newsList8 , true);
  404. $('#new_list_8').css('display','block');
  405. $("#nowDateNYR8").html(new Date().getFullYear()+'-'+(new Date().getMonth()+1)+'-'+new Date().getDate());
  406. break;
  407. case '9':
  408. tools.doGet(tempWorkerPublicList, {
  409. translate_dict:1,
  410. orderByColumn: 'openNy',
  411. isAsc: 'asc',
  412. pageNum:module.data.pageNum9,
  413. pageSize:10,
  414. bookId: JSON.parse(tools.getCookie('user')).bookId,
  415. deptId: JSON.parse(tools.getCookie('user')).deptId
  416. }, module.newsList9 , true);
  417. $('#new_list_9').css('display','block');
  418. $("#nowDateNYR9").html(new Date().getFullYear()+'-'+(new Date().getMonth()+1)+'-'+new Date().getDate());
  419. break;
  420. case '10':
  421. $('#new_list_10').css('display','block');
  422. $("#nowDateNYR10").html(new Date().getFullYear()+'-'+(new Date().getMonth()+1)+'-'+new Date().getDate());
  423. tools.doGet(otherPublicList, {
  424. pageNum:module.data.pageNum10,
  425. pageSize:10,
  426. bookId: JSON.parse(tools.getCookie('user')).bookId,
  427. deptId: JSON.parse(tools.getCookie('user')).deptId,
  428. otherType: 13
  429. }, module.newsList10 , true);
  430. break;
  431. case '11':
  432. $('#new_list_11').css('display','block');
  433. $("#nowDateNYR11").html(new Date().getFullYear()+'-'+(new Date().getMonth()+1)+'-'+new Date().getDate());
  434. tools.doGet(specialPublicityList, {
  435. pageNum:module.data.pageNum12,
  436. translate_dict:"1",
  437. pageSize:10,
  438. bookId: JSON.parse(tools.getCookie('user')).bookId,
  439. deptId: JSON.parse(tools.getCookie('user')).deptId,
  440. }, module.newsList12 , true);
  441. break;
  442. default:
  443. break;
  444. }
  445. }
  446. module.newsList1 = function (data) {
  447. if (data.code == 200) {
  448. var content = data.rows;
  449. if (module.data.newList1.length >= data.total){
  450. return;
  451. }else{
  452. for (let i = 0 ; i < content.length ; i++){
  453. module.data.newList1.push(content[i]);
  454. }
  455. }
  456. var newListData1 = template('newListData1', module.data);
  457. $("#newListContent_ul_1").html(newListData1);
  458. }
  459. }
  460. module.newsList2 = function (data) {
  461. if (data.code == 200) {
  462. var content = data.rows;
  463. if (module.data.newList2.length >= data.total){
  464. return;
  465. }else{
  466. for (let i = 0 ; i < content.length ; i++){
  467. module.data.newList2.push(content[i]);
  468. }
  469. }
  470. var newListData2 = template('newListData2', module.data);
  471. $("#newListContent_ul_2").html(newListData2);
  472. }
  473. }
  474. module.newsList3 = function (data) {
  475. if (data.code == 200) {
  476. var content = data.rows;
  477. if (module.data.newList3.length >= data.total){
  478. return;
  479. }else{
  480. for (let i = 0 ; i < content.length ; i++){
  481. module.data.newList3.push(content[i]);
  482. }
  483. }
  484. // module.data.newList3 = content;
  485. var newListData3 = template('newListData3', module.data);
  486. $("#newListContent_ul_3").html(newListData3);
  487. }
  488. }
  489. module.newsList11 = function (data) {
  490. if (data.code == 200) {
  491. var content = data.rows;
  492. if (module.data.newList11.length >= data.total){
  493. return;
  494. }else{
  495. for (let i = 0 ; i < content.length ; i++){
  496. module.data.newList11.push(content[i]);
  497. }
  498. }
  499. // module.data.newList3 = content;
  500. var newListData3_zy = template('newListData3_zy', module.data);
  501. $("#newListContent_ul_3_zy").html(newListData3_zy);
  502. }
  503. }
  504. module.newsList12 = function (data) {
  505. if (data.code == 200) {
  506. var content = data.rows;
  507. if (module.data.newList12.length >= data.total){
  508. return;
  509. }else{
  510. for (let i = 0 ; i < content.length ; i++){
  511. module.data.newList12.push(content[i]);
  512. }
  513. }
  514. // module.data.newList3 = content;
  515. var newListData11 = template('newListData11', module.data);
  516. $("#newListContent_ul_11").html(newListData11);
  517. }
  518. }
  519. function roll(t) {
  520. var ul1 = document.getElementById("newListContent");
  521. var ul2 = document.getElementById("newListContent2");
  522. var ulbox = document.getElementById("review_box");
  523. ul2.innerHTML = ul1.innerHTML;
  524. ulbox.scrollTop = 0; // 开始无滚动时设为0
  525. var timer = setInterval(rollStart, t); // 设置定时器,参数t用在这为间隔时间(单位毫秒),参数t越小,滚动速度越快
  526. // 鼠标移入div时暂停滚动
  527. ulbox.onmouseover = function () {
  528. clearInterval(timer);
  529. }
  530. // 鼠标移出div后继续滚动
  531. ulbox.onmouseout = function () {
  532. timer = setInterval(rollStart, t);
  533. }
  534. }
  535. // 开始滚动函数
  536. function rollStart() {
  537. // 上面声明的DOM对象为局部对象需要再次声明
  538. var ul1 = document.getElementById("newListContent");
  539. var ul2 = document.getElementById("newListContent2");
  540. var ulbox = document.getElementById("review_box");
  541. // 正常滚动不断给scrollTop的值+1,当滚动高度大于列表内容高度时恢复为0
  542. console.log(ulbox.scrollTop+'--------'+ul1.scrollHeight)
  543. if (ulbox.scrollTop >= ul1.scrollHeight) {
  544. ulbox.scrollTop = 0;
  545. } else {
  546. ulbox.scrollTop += 1;
  547. }
  548. }
  549. return module;
  550. });