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

326 行
12 KiB

  1. /**
  2. * Created by Administrator on 2021/4/5.
  3. */
  4. define(['jquery', "template", "Tools", "biddingApi", "itemsApi", "paging",'dateTime', 'swiper'], function ($, template, Tools ) {
  5. //数据存储
  6. var module = {
  7. data: {
  8. //焦点图数据
  9. focusListTop: [],
  10. //标的物类型
  11. deptTypeList:[],
  12. //标的物所在地
  13. deptLocationList:[],
  14. //竞价大厅列表
  15. biddingInformationList:'',
  16. //页码
  17. pageNum: 1,
  18. //页码集合
  19. pageList: [],
  20. //每页数量
  21. pageSize: 50,
  22. //总页数
  23. pageCount:0,
  24. //标的物选中项id
  25. deptId:'',
  26. //标的所在地选中
  27. secondDeptId:'',
  28. //标的物类型ID
  29. projectNumber:'',
  30. //项目状态
  31. projectShowStatus:'',
  32. //报名开始时间
  33. signupStartTime:'',
  34. //报名结束时间
  35. signupStopTime:'',
  36. //竞价开始时间
  37. biddingStartTime:'',
  38. //竞价结束时间
  39. biddingStopTime:'',
  40. form:{
  41. deptId:'',
  42. projectNumber:'',
  43. projectShowStatus:'',
  44. signupStartTime:'',
  45. signupStopTime:'',
  46. biddingStartTime:'',
  47. biddingStopTime:'',
  48. pageNum:1,
  49. pageSize:1,
  50. }
  51. },
  52. };
  53. var tools = new Tools();
  54. module.init = function (page) {
  55. //获取焦点图信息
  56. tools.doGet(websitePicture, {picType:1,status:0,orderByColumn:'picSort',isAsc:'desc'}, module.focusNewsTop , true);
  57. //底部友情链接
  58. tools.doGet(friendsLinks, {}, module.bottomFriendsLinks, true);
  59. //新闻资讯
  60. tools.doGet(biddingList, {deptId:100,pageNum:module.data.pageNum,pageSize:module.data.pageSize}, module.biddingList,true);
  61. //标的物类型
  62. tools.doGet(webDeptType+"/project_type", {}, module.deptType,true);
  63. //标的物所在地
  64. tools.doGet(webDept, {deptId:''}, module.deptLocation, true);
  65. //网站配置信息(网站名称 底部联系方式 公安备案号 网站备案号)
  66. tools.getWebConfig();
  67. $("#signStartTimeStr").datetime({
  68. type: "date",
  69. value: [new Date().getFullYear(),new Date().getMonth()+1,new Date().getDate()],
  70. success: function (res) {
  71. console.log(res)
  72. }
  73. })
  74. $("#signEndTimeStr").datetime({
  75. type: "date",
  76. value: [new Date().getFullYear(),new Date().getMonth()+1,new Date().getDate()],
  77. success: function (res) {
  78. console.log(res)
  79. }
  80. })
  81. $("#auctionStartTimeStr").datetime({
  82. type: "date",
  83. value: [new Date().getFullYear(),new Date().getMonth()+1,new Date().getDate()],
  84. success: function (res) {
  85. console.log(res)
  86. }
  87. })
  88. $("#endTimeStr").datetime({
  89. type: "date",
  90. value: [new Date().getFullYear(),new Date().getMonth()+1,new Date().getDate()],
  91. success: function (res) {
  92. console.log(res)
  93. }
  94. })
  95. setTimeout(function(){
  96. //主题图片切换
  97. module.switchTheme();
  98. },500)
  99. };
  100. //焦点图数据
  101. module.focusNewsTop = function (data) {
  102. if (data.code == 200) {
  103. module.data.focusListTop = data.data;
  104. var bannerFocusDataTop = template('bannerFocusDataTop', module.data);
  105. $("#bannerFocusTopContent").html(bannerFocusDataTop);
  106. new Swiper('#bannerFocusWrapTop', {
  107. paginationClickable: true,
  108. autoplay : 4000,
  109. loop:true
  110. })
  111. }
  112. }
  113. //主题图片切换
  114. module.switchTheme = function(){
  115. if(themeColor == 'red'){
  116. document.getElementById('bannerBottom').src = '../../static/images/bannerBottom_red.jpg'
  117. }else if(themeColor == 'green'){
  118. document.getElementById('bannerBottom').src = '../../static/images/bannerBottom.jpg'
  119. }
  120. }
  121. //挂牌项目列表
  122. module.biddingList = function (data) {
  123. if (data.code == 200) {
  124. console.log(data)
  125. var content = data.rows;
  126. var pageCount = (data.total/module.data.pageSize).toFixed(0);
  127. if (pageCount < 1){
  128. pageCount = 1;
  129. }
  130. if(module.data.biddingInformationList == ''){
  131. // 初始化 分页器
  132. var page_s1=createPage('.page_s1');
  133. // 设置分页
  134. setPage(page_s1,{
  135. pageTotal: data.total, // 数据总条数
  136. pageSize: module.data.pageSize, // 每页显示条数
  137. pageCurrent: 1, // 当前页
  138. maxBtnNum: 5, // 最多按钮个数 (最少5个)
  139. })
  140. $('#page_s1').html('共'+pageCount+'页')
  141. }
  142. module.data.pageCount = pageCount;
  143. module.data.biddingInformationList = content;
  144. for(var i = 0 ; i < content.length ; i++){
  145. if(content[i].biddingStopTime == null || content[i].biddingStartTime == null){continue;}
  146. var endTimes=content[i].biddingStopTime.substring(0,10).split('-');
  147. var biddingStopTime=endTimes[1]+'/'+endTimes[2]+'/'+endTimes[0]+' '+content[i].biddingStopTime.substring(10,19);
  148. var startTimes=content[i].biddingStartTime.substring(0,10).split('-');
  149. var biddingStartTime=startTimes[1]+'/'+startTimes[2]+'/'+startTimes[0]+' '+content[i].biddingStartTime.substring(10,19);
  150. var nowTime = Date.parse(new Date());
  151. var leftTime = Date.parse(biddingStopTime)-nowTime;
  152. var rightTime = Date.parse(biddingStartTime)-nowTime;
  153. console.log(biddingStopTime)
  154. console.log(leftTime)
  155. if(leftTime>0){
  156. console.log('进行中')
  157. content[i].timeType = '进行中'
  158. }
  159. if(leftTime<0){
  160. console.log('已结束')
  161. content[i].timeType = '已结束'
  162. }
  163. if(rightTime>0){
  164. console.log('未开始')
  165. content[i].timeType = '未开始'
  166. }
  167. }
  168. var biddingInformationData = template('biddingInformationData', module.data);
  169. $("#biddingInformationContent").html(biddingInformationData);
  170. }
  171. }
  172. //标的物类型
  173. module.deptType = function (data) {
  174. console.log(data)
  175. if (data.code == 200) {
  176. var content = data.data ;
  177. module.data.deptTypeList = content;
  178. var deptTypeData = template('deptTypeData', module.data);
  179. $("#deptTypeContent").html(deptTypeData);
  180. }
  181. }
  182. //标的物所在地
  183. module.deptLocation = function (data) {
  184. if (data.code == 200) {
  185. var content = data.data ;
  186. module.data.deptLocationList = content;
  187. var deptLocationData = template('deptLocationData', module.data);
  188. $("#deptLocationContent").html(deptLocationData);
  189. }
  190. }
  191. //标的物所在地(二级)
  192. module.deptSecondLocation = function (data) {
  193. if ( data.data.length == 0){
  194. document.getElementById('secondDept').style.display = 'none';
  195. return;
  196. }else{
  197. document.getElementById('secondDept').style.display = 'block';
  198. }
  199. if (data.code == 200) {
  200. console.log(data)
  201. var content = data.data;
  202. module.data.deptSecondLocationList = content;
  203. var deptSecondLocationData = template('deptSecondLocationData', module.data);
  204. $("#secondDept").html(deptSecondLocationData);
  205. console.log(module.data.deptId)
  206. }
  207. }
  208. tabCheck = function (deptId) {
  209. module.data.deptId = deptId;
  210. $('#locInfoall').attr("class","auction_hall_table_tab auction_loc");
  211. $("#deptLocationContent div").attr("class","auction_hall_table_tab auction_loc");
  212. if(deptId == ''){
  213. $('#locInfoall').addClass('auction_hall_table_tab_select');
  214. document.getElementById('secondDept').style.display = 'none';
  215. }else{
  216. $('#locInfoall'+deptId).addClass('auction_hall_table_tab_select');
  217. tools.doGet(webDept, {deptId:deptId}, module.deptSecondLocation, true);
  218. }
  219. }
  220. secondCheck = function(id,secondDeptId){
  221. $('#locInfoSecondall').attr("class","auction_hall_table_tab auction_loc");
  222. $("#secondDept div").attr("class","auction_hall_table_tab auction_loc");
  223. if(id == '' && secondDeptId == ''){
  224. $('#locInfoSecondall').addClass('auction_hall_table_tab_select');
  225. module.data.deptId = $('#deptLocationContent div.auction_hall_table_tab_select').attr("data");
  226. }else{
  227. $('#locInfoall'+id).addClass('auction_hall_table_tab_select');
  228. module.data.deptId = secondDeptId;
  229. }
  230. }
  231. allDept = function (){
  232. module.data.deptSize = 30
  233. document.getElementById('allDept').innerHTML = "<i class='sanjiao-top'></i>";
  234. document.getElementById('allDept').onclick = upDept;
  235. tools.doGet(webDept + '/0', {}, module.deptLocation, true);
  236. }
  237. turnThePage = function (pageNum) {
  238. module.data.pageNum = pageNum ;
  239. tools.doGet(biddingList, {deptId:100,pageNum:module.data.pageNum,pageSize:module.data.pageSize}, module.itemList,true);
  240. }
  241. typeCheck = function(id,projectNumber){
  242. if(projectNumber==undefined){
  243. // projectNumber为undefined时,置空(直接传递给后台接口导致搜索问题)
  244. projectNumber = "";
  245. }
  246. module.data.projectNumber = projectNumber;//标的物类型ID
  247. document.getElementById('standardTypeAll').className = 'auction_hall_table_tab';
  248. if(id == ''){
  249. id = 'All';
  250. }
  251. if(projectNumber == undefined){
  252. module.data.projectNumber = '';
  253. }
  254. for (var i = 0 ; i < module.data.deptTypeList.length ; i++){
  255. document.getElementById('standardType'+(i+1)).className = 'auction_hall_table_tab';
  256. }
  257. document.getElementById('standardType'+id).className = 'auction_hall_table_tab auction_hall_table_tab_select';
  258. }
  259. selectedStatus = function(id,projectShowStatus){
  260. module.data.projectShowStatus = projectShowStatus;
  261. document.getElementById('statusall').className = 'auction_hall_table_tab'
  262. for (var i = 0 ; i < 5 ; i++){
  263. document.getElementById('status'+(1+i)).className = 'auction_hall_table_tab'
  264. }
  265. document.getElementById('status'+id).className = 'auction_hall_table_tab auction_hall_table_tab_select'
  266. }
  267. //底部友情链接
  268. module.bottomFriendsLinks = function (data) {
  269. if (data.code == 200) {
  270. var content = data.data;
  271. console.log(content)
  272. module.data.friendsLinksList = content;
  273. var friendsLinksData = template('friendsLinksData', module.data);
  274. $("#friendsLinksContent").html(friendsLinksData);
  275. }
  276. }
  277. goSearch = function(){
  278. module.data.itemsInformationList = '';
  279. $('.page_s1').html('')
  280. $('#page_s1').html('')
  281. module.data.form.deptId = module.data.deptId;
  282. module.data.form.projectNumber = module.data.projectNumber;
  283. module.data.form.projectShowStatus= module.data.projectShowStatus;
  284. module.data.form.signupStartTime= $('#signStartTimeStr').val();
  285. module.data.form.signupStopTime= $('#signEndTimeStr').val();
  286. module.data.form.biddingStartTime= $('#auctionStartTimeStr').val();
  287. module.data.form.biddingStopTime= $('#endTimeStr').val();
  288. module.data.form.pageNum= module.data.pageNum;
  289. module.data.form.pageSize= module.data.pageSize;
  290. console.log(module.data.form)
  291. tools.doGet(biddingList, module.data.form, module.biddingList, true);
  292. }
  293. goDetail = function (id) {
  294. tools.skip('../listingItems/itemsDetail.html?id='+id);
  295. }
  296. return module;
  297. });