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

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