网站
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

discussions.js 12 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  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. },
  15. };
  16. var tools = new Tools();
  17. module.init = function (page) {
  18. // //新闻列表
  19. // tools.doGet(listSiyigongkai, {
  20. // pageNum:1,
  21. // pageSize:10,
  22. // bookId: JSON.parse(tools.getCookie('user')).bookId,
  23. // deptId: JSON.parse(tools.getCookie('user')).deptId
  24. // }, module.newsList4 , true);
  25. tools.doGet(webList, {}, module.webList , true);
  26. // new Swiper('#bannerFocusNextWrap', {
  27. // paginationClickable: true,
  28. // pagination: '.a2',
  29. // autoplay : 2000,
  30. // loop:true
  31. // })
  32. console.log(JSON.parse(tools.getCookie('user')))
  33. $("#deptName").html(JSON.parse(tools.getCookie('user')).deptName);
  34. if (tools.getCookie('user')){
  35. $("#loginF").css('display','none');
  36. $("#listB").css('display','flex');
  37. changeList('1');
  38. }
  39. };
  40. module.newsList4 = function (data) {
  41. if (data.code == 200) {
  42. var content = data.rows;
  43. module.data.newList4 = content;
  44. var newListData4 = template('newListData4', module.data);
  45. $("#newListContent_ul_4").html(newListData4);
  46. }
  47. }
  48. module.newsList7 = function (data) {
  49. if (data.code == 200) {
  50. var content = data.rows;
  51. module.data.newList7 = content;
  52. var newListData7 = template('newListData7', module.data);
  53. $("#newListContent_ul_7").html(newListData7);
  54. }
  55. }
  56. module.newsList8 = function (data) {
  57. if (data.code == 200) {
  58. var content = data.rows;
  59. module.data.newList8 = content;
  60. var newListData8 = template('newListData8', module.data);
  61. $("#newListContent_ul_8").html(newListData8);
  62. }
  63. }
  64. module.newsList9 = function (data) {
  65. if (data.code == 200) {
  66. var content = data.rows;
  67. module.data.newList9 = content;
  68. var newListData9 = template('newListData9', module.data);
  69. $("#newListContent_ul_9").html(newListData9);
  70. }
  71. }
  72. module.webList = function (data) {
  73. if (data.code == 200) {
  74. var content = data.data;
  75. module.data.webList = content;
  76. var webData = template('webData', module.data);
  77. $("#webContent").html(webData);
  78. var titData = template('titData', module.data);
  79. $("#titContent").html(titData);
  80. $('#ewm').attr('src', 'static/images/'+content.top.bz);
  81. }
  82. }
  83. searchChange = function () {
  84. console.log(1111111111);
  85. tools.doGet(listSiyigongkai, {pageNum:1,pageSize:8,openName:$("#searchInput").val()}, module.newsList , true);
  86. }
  87. submitUser = function () {
  88. tools.doPost(checkFarmer, {memberName:$("#userName").val(),idcard:$("#password").val()}, module.checkFarmer , true);
  89. }
  90. clearCook = function () {
  91. tools.setCookie('user','');
  92. tools.setCookie('farmerCode','');
  93. $('#loginF').css('display','flex');
  94. $('#listB').css('display','none');
  95. }
  96. module.checkFarmer = function (data) {
  97. if (data.code == 200) {
  98. let seconds = 3600;
  99. let expires = new Date(new Date() * 1 + seconds * 1000);
  100. tools.setCookie("user", JSON.stringify(data.data), { expires: expires });
  101. tools.doGet(familyMember, {idcard:$("#password").val(),familyStatus:"02"}, module.familyMember , true);
  102. }
  103. }
  104. module.familyMember = function (data) {
  105. if (data.code == 200) {
  106. const farmerCode = data.rows[0].farmerCode;
  107. tools.setCookie("farmerCode",farmerCode, { expires: 30 });
  108. $('#loginF').css('display','none');
  109. $('#listB').css('display','flex');
  110. changeList('1');
  111. }
  112. }
  113. changeList = function (type) {
  114. $('#new_list_1').css('display','none');
  115. $('#new_list_2').css('display','none');
  116. $('#new_list_3').css('display','none');
  117. $('#new_list_4').css('display','none');
  118. $('#new_list_5').css('display','none');
  119. $('#new_list_6').css('display','none');
  120. $('#new_list_7').css('display','none');
  121. $('#new_list_8').css('display','none');
  122. $('#new_list_9').css('display','none');
  123. switch (type) {
  124. case '1':
  125. $('#new_list_1').css('display','block');
  126. $("#nowDateNYR1").html(new Date().getFullYear()+'-'+(new Date().getMonth()+1)+'-'+new Date().getDate());
  127. tools.doGet(financePublicList, {
  128. pageNum:1,
  129. pageSize:10,
  130. orderByColumn: 'openNy',
  131. isAsc: 'desc',
  132. bookId: JSON.parse(tools.getCookie('user')).bookId,
  133. deptId: JSON.parse(tools.getCookie('user')).deptId
  134. }, module.newsList1 , true);
  135. break;
  136. case '2':
  137. $('#new_list_2').css('display','block');
  138. $("#nowDateNYR2").html(new Date().getFullYear()+'-'+(new Date().getMonth()+1)+'-'+new Date().getDate());
  139. tools.doGet(contractionList, {
  140. pageNum:1,
  141. pageSize:10,
  142. orderByColumn: 'buildingTime',
  143. translate_dict: 1,
  144. isAsc: 'desc',
  145. bookId: JSON.parse(tools.getCookie('user')).bookId,
  146. deptId: JSON.parse(tools.getCookie('user')).deptId
  147. }, module.newsList2 , true);
  148. break;
  149. case '3':
  150. $('#new_list_3').css('display','block');
  151. $("#nowDateNYR3").html(new Date().getFullYear()+'-'+(new Date().getMonth()+1)+'-'+new Date().getDate());
  152. tools.doGet(majorEventPublicList, {
  153. pageNum:1,
  154. pageSize:10,
  155. orderByColumn: 'openNy',
  156. isAsc: 'desc',
  157. bookId: JSON.parse(tools.getCookie('user')).bookId,
  158. deptId: JSON.parse(tools.getCookie('user')).deptId
  159. }, module.newsList3 , true);
  160. break;
  161. case '4':
  162. $('#new_list_4').css('display','block');
  163. $("#nowDateNYR4").html(new Date().getFullYear()+'-'+(new Date().getMonth()+1)+'-'+new Date().getDate());
  164. tools.doGet(listSiyigongkai, {
  165. pageNum:1,
  166. pageSize:10,
  167. bookId: JSON.parse(tools.getCookie('user')).bookId,
  168. deptId: JSON.parse(tools.getCookie('user')).deptId
  169. }, module.newsList4 , true);
  170. break;
  171. case '5':
  172. $('#new_list_5').css('display','block');
  173. $("#nowDateNYR5").html(new Date().getFullYear()+'-'+(new Date().getMonth()+1)+'-'+new Date().getDate());
  174. break;
  175. case '6':
  176. $('#new_list_6').css('display','block');
  177. $("#nowDateNYR6").html(new Date().getFullYear()+'-'+(new Date().getMonth()+1)+'-'+new Date().getDate());
  178. break;
  179. case '7':
  180. tools.doGet(orcodeList, {
  181. translate_dict:1,
  182. orderByColumn: 'code',
  183. isAsc: 'asc',
  184. pageNum:1,
  185. pageSize:10,
  186. bookId: JSON.parse(tools.getCookie('user')).bookId,
  187. deptId: JSON.parse(tools.getCookie('user')).deptId
  188. }, module.newsList7 , true);
  189. $('#new_list_7').css('display','block');
  190. $("#nowDateNYR7").html(new Date().getFullYear()+'-'+(new Date().getMonth()+1)+'-'+new Date().getDate());
  191. break;
  192. case '8':
  193. tools.doGet(assetresourceOrcodeList, {
  194. translate_dict:1,
  195. orderByColumn: 'code',
  196. isAsc: 'asc',
  197. pageNum:1,
  198. pageSize:10,
  199. bookId: JSON.parse(tools.getCookie('user')).bookId
  200. }, module.newsList8 , true);
  201. $('#new_list_8').css('display','block');
  202. $("#nowDateNYR8").html(new Date().getFullYear()+'-'+(new Date().getMonth()+1)+'-'+new Date().getDate());
  203. break;
  204. case '9':
  205. tools.doGet(tempWorkerPublicList, {
  206. translate_dict:1,
  207. orderByColumn: 'openNy',
  208. isAsc: 'asc',
  209. pageNum:1,
  210. pageSize:10,
  211. bookId: JSON.parse(tools.getCookie('user')).bookId,
  212. deptId: JSON.parse(tools.getCookie('user')).deptId
  213. }, module.newsList9 , true);
  214. $('#new_list_9').css('display','block');
  215. $("#nowDateNYR9").html(new Date().getFullYear()+'-'+(new Date().getMonth()+1)+'-'+new Date().getDate());
  216. break;
  217. default:
  218. break;
  219. }
  220. }
  221. module.newsList1 = function (data) {
  222. if (data.code == 200) {
  223. var content = data.rows;
  224. module.data.newList1 = content;
  225. var newListData1 = template('newListData1', module.data);
  226. $("#newListContent_ul_1").html(newListData1);
  227. }
  228. }
  229. module.newsList2 = function (data) {
  230. if (data.code == 200) {
  231. var content = data.rows;
  232. module.data.newList2 = content;
  233. var newListData2 = template('newListData2', module.data);
  234. $("#newListContent_ul_2").html(newListData2);
  235. }
  236. }
  237. module.newsList3 = function (data) {
  238. if (data.code == 200) {
  239. var content = data.rows;
  240. module.data.newList3 = content;
  241. var newListData3 = template('newListData3', module.data);
  242. $("#newListContent_ul_3").html(newListData3);
  243. }
  244. }
  245. function roll(t) {
  246. var ul1 = document.getElementById("newListContent");
  247. var ul2 = document.getElementById("newListContent2");
  248. var ulbox = document.getElementById("review_box");
  249. ul2.innerHTML = ul1.innerHTML;
  250. ulbox.scrollTop = 0; // 开始无滚动时设为0
  251. var timer = setInterval(rollStart, t); // 设置定时器,参数t用在这为间隔时间(单位毫秒),参数t越小,滚动速度越快
  252. // 鼠标移入div时暂停滚动
  253. ulbox.onmouseover = function () {
  254. clearInterval(timer);
  255. }
  256. // 鼠标移出div后继续滚动
  257. ulbox.onmouseout = function () {
  258. timer = setInterval(rollStart, t);
  259. }
  260. }
  261. // 开始滚动函数
  262. function rollStart() {
  263. // 上面声明的DOM对象为局部对象需要再次声明
  264. var ul1 = document.getElementById("newListContent");
  265. var ul2 = document.getElementById("newListContent2");
  266. var ulbox = document.getElementById("review_box");
  267. // 正常滚动不断给scrollTop的值+1,当滚动高度大于列表内容高度时恢复为0
  268. console.log(ulbox.scrollTop+'--------'+ul1.scrollHeight)
  269. if (ulbox.scrollTop >= ul1.scrollHeight) {
  270. ulbox.scrollTop = 0;
  271. } else {
  272. ulbox.scrollTop += 1;
  273. }
  274. }
  275. return module;
  276. });