网站
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.

discussions.js 23 KiB

16 小時之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613
  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()}, 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. }, module.newsList4 , true);
  372. break;
  373. case '5':
  374. $('#new_list_5').css('display','block');
  375. $("#nowDateNYR5").html(new Date().getFullYear()+'-'+(new Date().getMonth()+1)+'-'+new Date().getDate());
  376. break;
  377. case '6':
  378. $('#new_list_6').css('display','block');
  379. $("#nowDateNYR6").html(new Date().getFullYear()+'-'+(new Date().getMonth()+1)+'-'+new Date().getDate());
  380. break;
  381. case '7':
  382. tools.doGet(orcodeList, {
  383. translate_dict:1,
  384. orderByColumn: 'code',
  385. isAsc: 'asc',
  386. pageNum:module.data.pageNum7,
  387. pageSize:10,
  388. bookId: JSON.parse(tools.getCookie('user')).bookId,
  389. deptId: JSON.parse(tools.getCookie('user')).deptId
  390. }, module.newsList7 , true);
  391. $('#new_list_7').css('display','block');
  392. $("#nowDateNYR7").html(new Date().getFullYear()+'-'+(new Date().getMonth()+1)+'-'+new Date().getDate());
  393. break;
  394. case '8':
  395. tools.doGet(assetresourceOrcodeList, {
  396. translate_dict:1,
  397. orderByColumn: 'code',
  398. isAsc: 'asc',
  399. pageNum:module.data.pageNum8,
  400. pageSize:10,
  401. bookId: JSON.parse(tools.getCookie('user')).bookId
  402. }, module.newsList8 , true);
  403. $('#new_list_8').css('display','block');
  404. $("#nowDateNYR8").html(new Date().getFullYear()+'-'+(new Date().getMonth()+1)+'-'+new Date().getDate());
  405. break;
  406. case '9':
  407. tools.doGet(tempWorkerPublicList, {
  408. translate_dict:1,
  409. orderByColumn: 'openNy',
  410. isAsc: 'asc',
  411. pageNum:module.data.pageNum9,
  412. pageSize:10,
  413. bookId: JSON.parse(tools.getCookie('user')).bookId,
  414. deptId: JSON.parse(tools.getCookie('user')).deptId
  415. }, module.newsList9 , true);
  416. $('#new_list_9').css('display','block');
  417. $("#nowDateNYR9").html(new Date().getFullYear()+'-'+(new Date().getMonth()+1)+'-'+new Date().getDate());
  418. break;
  419. case '10':
  420. $('#new_list_10').css('display','block');
  421. $("#nowDateNYR10").html(new Date().getFullYear()+'-'+(new Date().getMonth()+1)+'-'+new Date().getDate());
  422. tools.doGet(otherPublicList, {
  423. pageNum:module.data.pageNum10,
  424. pageSize:10,
  425. bookId: JSON.parse(tools.getCookie('user')).bookId,
  426. deptId: JSON.parse(tools.getCookie('user')).deptId,
  427. otherType: 13
  428. }, module.newsList10 , true);
  429. break;
  430. case '11':
  431. $('#new_list_11').css('display','block');
  432. $("#nowDateNYR11").html(new Date().getFullYear()+'-'+(new Date().getMonth()+1)+'-'+new Date().getDate());
  433. tools.doGet(specialPublicityList, {
  434. pageNum:module.data.pageNum12,
  435. translate_dict:"1",
  436. pageSize:10,
  437. bookId: JSON.parse(tools.getCookie('user')).bookId,
  438. deptId: JSON.parse(tools.getCookie('user')).deptId,
  439. }, module.newsList12 , true);
  440. break;
  441. default:
  442. break;
  443. }
  444. }
  445. module.newsList1 = function (data) {
  446. if (data.code == 200) {
  447. var content = data.rows;
  448. if (module.data.newList1.length >= data.total){
  449. return;
  450. }else{
  451. for (let i = 0 ; i < content.length ; i++){
  452. module.data.newList1.push(content[i]);
  453. }
  454. }
  455. var newListData1 = template('newListData1', module.data);
  456. $("#newListContent_ul_1").html(newListData1);
  457. }
  458. }
  459. module.newsList2 = function (data) {
  460. if (data.code == 200) {
  461. var content = data.rows;
  462. if (module.data.newList2.length >= data.total){
  463. return;
  464. }else{
  465. for (let i = 0 ; i < content.length ; i++){
  466. module.data.newList2.push(content[i]);
  467. }
  468. }
  469. var newListData2 = template('newListData2', module.data);
  470. $("#newListContent_ul_2").html(newListData2);
  471. }
  472. }
  473. module.newsList3 = function (data) {
  474. if (data.code == 200) {
  475. var content = data.rows;
  476. if (module.data.newList3.length >= data.total){
  477. return;
  478. }else{
  479. for (let i = 0 ; i < content.length ; i++){
  480. module.data.newList3.push(content[i]);
  481. }
  482. }
  483. // module.data.newList3 = content;
  484. var newListData3 = template('newListData3', module.data);
  485. $("#newListContent_ul_3").html(newListData3);
  486. }
  487. }
  488. module.newsList11 = function (data) {
  489. if (data.code == 200) {
  490. var content = data.rows;
  491. if (module.data.newList11.length >= data.total){
  492. return;
  493. }else{
  494. for (let i = 0 ; i < content.length ; i++){
  495. module.data.newList11.push(content[i]);
  496. }
  497. }
  498. // module.data.newList3 = content;
  499. var newListData3_zy = template('newListData3_zy', module.data);
  500. $("#newListContent_ul_3_zy").html(newListData3_zy);
  501. }
  502. }
  503. module.newsList12 = function (data) {
  504. if (data.code == 200) {
  505. var content = data.rows;
  506. if (module.data.newList12.length >= data.total){
  507. return;
  508. }else{
  509. for (let i = 0 ; i < content.length ; i++){
  510. module.data.newList12.push(content[i]);
  511. }
  512. }
  513. // module.data.newList3 = content;
  514. var newListData11 = template('newListData11', module.data);
  515. $("#newListContent_ul_11").html(newListData11);
  516. }
  517. }
  518. function roll(t) {
  519. var ul1 = document.getElementById("newListContent");
  520. var ul2 = document.getElementById("newListContent2");
  521. var ulbox = document.getElementById("review_box");
  522. ul2.innerHTML = ul1.innerHTML;
  523. ulbox.scrollTop = 0; // 开始无滚动时设为0
  524. var timer = setInterval(rollStart, t); // 设置定时器,参数t用在这为间隔时间(单位毫秒),参数t越小,滚动速度越快
  525. // 鼠标移入div时暂停滚动
  526. ulbox.onmouseover = function () {
  527. clearInterval(timer);
  528. }
  529. // 鼠标移出div后继续滚动
  530. ulbox.onmouseout = function () {
  531. timer = setInterval(rollStart, t);
  532. }
  533. }
  534. // 开始滚动函数
  535. function rollStart() {
  536. // 上面声明的DOM对象为局部对象需要再次声明
  537. var ul1 = document.getElementById("newListContent");
  538. var ul2 = document.getElementById("newListContent2");
  539. var ulbox = document.getElementById("review_box");
  540. // 正常滚动不断给scrollTop的值+1,当滚动高度大于列表内容高度时恢复为0
  541. console.log(ulbox.scrollTop+'--------'+ul1.scrollHeight)
  542. if (ulbox.scrollTop >= ul1.scrollHeight) {
  543. ulbox.scrollTop = 0;
  544. } else {
  545. ulbox.scrollTop += 1;
  546. }
  547. }
  548. return module;
  549. });