网站
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

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