网站
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

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