网站
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

index.js 41 KiB

il y a 4 ans
il y a 2 ans
il y a 4 ans
il y a 2 ans
il y a 4 ans
il y a 4 ans
il y a 2 ans
il y a 2 ans
il y a 4 ans
il y a 2 ans
il y a 3 ans
il y a 4 ans
il y a 4 ans
il y a 2 ans
il y a 2 ans
il y a 4 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 4 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 3 ans
il y a 3 ans
il y a 4 ans
il y a 4 ans
il y a 2 ans
il y a 2 ans
il y a 4 ans
il y a 2 ans
il y a 4 ans
il y a 4 ans
il y a 4 ans
il y a 4 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 3 ans
il y a 3 ans
il y a 3 ans
il y a 2 ans
il y a 3 ans
il y a 4 ans
il y a 3 ans
il y a 4 ans
il y a 2 ans
il y a 3 ans
il y a 2 ans
il y a 3 ans
il y a 2 ans
il y a 3 ans
il y a 2 ans
il y a 3 ans
il y a 3 ans
il y a 2 ans
il y a 3 ans
il y a 2 ans
il y a 2 ans
il y a 3 ans
il y a 4 ans
il y a 2 ans
il y a 2 ans
il y a 4 ans
il y a 4 ans
il y a 4 ans
il y a 3 ans
il y a 3 ans
il y a 4 ans
il y a 3 ans
il y a 3 ans
il y a 4 ans
il y a 3 ans
il y a 2 ans
il y a 3 ans
il y a 4 ans
il y a 3 ans
il y a 4 ans
il y a 3 ans
il y a 4 ans
il y a 4 ans
il y a 4 ans
il y a 4 ans
il y a 4 ans
il y a 2 ans
il y a 4 ans
il y a 4 ans
il y a 2 ans
il y a 4 ans
il y a 2 ans
il y a 2 ans
il y a 4 ans
il y a 4 ans
il y a 2 ans
il y a 4 ans
il y a 2 ans
il y a 4 ans
il y a 2 ans
il y a 2 ans
il y a 4 ans
il y a 2 ans
il y a 4 ans
il y a 2 ans
il y a 2 ans
il y a 4 ans
il y a 4 ans
il y a 4 ans
il y a 3 ans
il y a 3 ans
il y a 2 ans
il y a 3 ans
il y a 4 ans
il y a 3 ans
il y a 4 ans
il y a 3 ans
il y a 4 ans
il y a 3 ans
il y a 4 ans
il y a 3 ans
il y a 4 ans
il y a 3 ans
il y a 4 ans
il y a 4 ans
il y a 3 ans
il y a 2 ans
il y a 3 ans
il y a 3 ans
il y a 3 ans
il y a 4 ans
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072
  1. /**
  2. * Created by Administrator on 2021/4/5.
  3. */
  4. define(['jquery', "template", "Tools", "user", "paging","cupload","kindeditor", 'swiper'], function ($, template, Tools ) {
  5. //数据存储
  6. var module = {
  7. data: {
  8. //焦点图数据
  9. focusListTop: [],
  10. userInformationDetail:[],
  11. userSupplyInformationList:'',
  12. consultingInformationList:'',
  13. biddingInformationList:'',
  14. //页码
  15. pageNum: 1,
  16. //页码集合
  17. pageList: [],
  18. //每页数量
  19. pageSize: 5,
  20. //总页数
  21. pageCount:0,
  22. //用户ID
  23. memberId:0,
  24. //用户资料form
  25. form:{
  26. },
  27. modifyUrl:'',
  28. detailUrl:'',
  29. sheng:[],
  30. shi:[],
  31. sfzList:[],
  32. yhkList:[],
  33. sfz:'',
  34. yhk:'',
  35. khzm:'',
  36. upType1:false,
  37. upType2:false,
  38. upType5:false,
  39. },
  40. };
  41. var tools = new Tools();
  42. module.init = function (page) {
  43. //获取焦点图信息
  44. tools.doGet(websitePicture, {picType:1,status:0,orderByColumn:'picSort',isAsc:'desc'}, module.focusNewsTop , true);
  45. //底部友情链接
  46. tools.doGet(friendsLinks, {}, module.bottomFriendsLinks, true);
  47. //用户资料
  48. tools.doGet(userData, {}, module.userData);
  49. if(!tools.getCookie('Admin-Token')){
  50. tools.skip('../../index.html')
  51. }
  52. //用户资料
  53. //tools.doPut(userData, {id:}, module.userData,true);
  54. //个人中心选项卡鼠标悬浮
  55. module.userListHover();
  56. //网站配置信息(网站名称 底部联系方式 公安备案号 网站备案号)
  57. tools.getWebConfig();
  58. //所属银行
  59. tools.doGet(dictionaries+"/bank_type_all", {}, module.bankType, true);
  60. //账户类型
  61. tools.doGet(dictionaries+"/bank_account_type", {}, module.accountType, true);
  62. window.KindEditor.create('#editor_id')
  63. //console.log(tools.getParam('type'))
  64. var type = tools.getParam('type');
  65. module.getType(type);
  66. setTimeout(function(){
  67. //主题图片切换
  68. module.switchTheme();
  69. },2000)
  70. module.data.sheng = options;
  71. module.data.shi = options[0].children;
  72. var shengData = template('shengData', module.data);
  73. $("#sheng").html(shengData);
  74. var shiData = template('shiData', module.data);
  75. $("#shi").html(shiData);
  76. };
  77. getShi = function () {
  78. console.log($('#bankTypeData').val())
  79. // if (!$('#bankTypeData').val()){
  80. // return;
  81. // }
  82. module.data.shi = module.data.sheng.filter(function (e) { return e.label == $('#sheng').val(); })[0].children;
  83. var shiData = template('shiData', module.data);
  84. $("#shi").html(shiData);
  85. // tools.doGet(depositList, {sheng:$('#sheng').val(),shi:$('#shi').val()}, module.depositList, true);
  86. }
  87. getDeposit = function () {
  88. let data = {
  89. sheng:$('#sheng').val(),
  90. shi:$('#shi').val(),
  91. bankType:$('#bankType').val(),
  92. bankDeposit:$('#bankDeposit').val(),
  93. }
  94. console.log(data)
  95. tools.doPost(depositList, data,module.depositList);
  96. }
  97. changeBankAddress = function () {
  98. console.log($('#bankAddress').val())
  99. console.log(module.data.bankAddress.filter(function (e) { return e.bankDeposit == $('#bankAddress').val(); }))
  100. document.getElementById('payeePaymentLines').value =
  101. module.data.bankAddress.filter(function (e) { return e.bankDeposit == $('#bankAddress').val(); })[0].payeePaymentLines;
  102. }
  103. module.depositList = function (data) {
  104. var content = data.data;
  105. module.data.bankAddress = content;
  106. var bankAddressData = template('bankAddressData', module.data);
  107. $("#bankAddress").html(bankAddressData);
  108. if (content.length>0){
  109. // changeBankAddress();
  110. }else{
  111. document.getElementById('payeePaymentLines').value = '';
  112. }
  113. }
  114. //底部友情链接
  115. module.bankType = function (data) {
  116. if (data.code == 200) {
  117. var content = data.data;
  118. module.data.bankTypeOption = content;
  119. var bankTypeData = template('bankTypeData', module.data);
  120. $("#bankType").html(bankTypeData);
  121. }
  122. }
  123. //账户类型
  124. module.accountType = function (data) {
  125. if (data.code == 200) {
  126. var content = data.data;
  127. module.data.accountTypeOption = content;
  128. var accountTypeData = template('accountTypeData', module.data);
  129. $("#accountType").html(accountTypeData);
  130. }
  131. }
  132. //焦点图数据
  133. module.focusNewsTop = function (data) {
  134. if (data.code == 200) {
  135. let focusArray = [];
  136. if(data.data.length<1){
  137. focusArray.push({
  138. picUrl:'../../../static/images/banner1.png'
  139. },{
  140. picUrl:'../../../static/images/banner2.png'
  141. },{
  142. picUrl:'../../../static/images/banner3.png'
  143. })
  144. }else{
  145. data.data.forEach(res=>{
  146. focusArray.push({
  147. picUrl:'/api'+res.picUrl
  148. })
  149. })
  150. }
  151. module.data.focusListTop = focusArray;
  152. var bannerFocusDataTop = template('bannerFocusDataTop', module.data);
  153. $("#bannerFocusTopContent").html(bannerFocusDataTop);
  154. new Swiper('#bannerFocusWrapTop', {
  155. paginationClickable: true,
  156. autoplay : 4000,
  157. loop:true
  158. })
  159. }
  160. }
  161. //主题图片切换
  162. module.switchTheme = function(){
  163. if(themeColor == 'red'){
  164. module.data.modifyUrl = '../../static/images/modify_red.png';
  165. module.data.detailUrl = '../../static/images/detail_red.png';
  166. }else if(themeColor == 'green'){
  167. module.data.modifyUrl = '../../static/images/modify.png';
  168. module.data.detailUrl = '../../static/images/detail.png';
  169. }
  170. }
  171. //底部友情链接
  172. module.bottomFriendsLinks = function (data) {
  173. if (data.code == 200) {
  174. var content = data.data;
  175. //console.log(content)
  176. module.data.friendsLinksList = content;
  177. var friendsLinksData = template('friendsLinksData', module.data);
  178. $("#friendsLinksContent").html(friendsLinksData);
  179. }
  180. }
  181. //获取类型
  182. module.getType = function(type){
  183. if (type == 'info'){
  184. document.getElementById("icon-list1").click();
  185. }
  186. if (type == 'demand'){
  187. document.getElementById("icon-list2").click();
  188. }
  189. if (type == 'interact'){
  190. document.getElementById("icon-list3").click();
  191. }
  192. if (type == 'bidding'){
  193. document.getElementById("icon-list4").click();
  194. }
  195. if (type == 'goDemand'){
  196. document.getElementById("icon-list2").click();
  197. document.getElementById("goSupply").click();
  198. }
  199. if (type == 'goInteract'){
  200. document.getElementById("icon-list3").click();
  201. document.getElementById("goRelease").click();
  202. }
  203. }
  204. //个人中心用户信息
  205. module.userData = function(data){
  206. if (data.code == 200) {
  207. var content = data.user;
  208. //console.log(content)
  209. module.data.userId = content.userId;
  210. tools.doGet(userMember + '/' + content.userId, {}, module.userMember);//memberType 1个人 2单位
  211. }
  212. }
  213. //个人中心用户资料
  214. module.userMember = function(data){
  215. if (data.code == 200) {
  216. var content = data.data;
  217. //console.log(data)
  218. module.data.userInformationDetail = content;
  219. module.data.memberType = content.memberType;
  220. var bankTypeData = template('bankTypeData', module.data);
  221. $("#bankType").html(bankTypeData);
  222. var bankAddressData = template('bankAddressData', module.data);
  223. $("#bankAddress").html(bankAddressData);
  224. if(content.memberType == '1'){
  225. document.getElementById('companyInformationContent').style.display = 'none';
  226. document.getElementById('userInformationContent').style.display = 'block';
  227. var userInformationData = template('userInformationData', module.data);
  228. $("#userInformationContent").html(userInformationData);
  229. }else{
  230. document.getElementById('companyInformationContent').style.display = 'block';
  231. document.getElementById('userInformationContent').style.display = 'none';
  232. var companyInformationData = template('companyInformationData', module.data);
  233. $("#companyInformationContent").html(companyInformationData);
  234. }
  235. document.getElementById('bankAddress').value = content.bankAddress;
  236. document.getElementById('bankCardName').value = content.bankCardName;
  237. document.getElementById('bankCardNum').value = content.bankCardNum;
  238. document.getElementById('bankType').value = content.bankType;
  239. document.getElementById('accountType').value = content.accountType;
  240. document.getElementById('payeePaymentLines').value = content.payeePaymentLines;
  241. document.getElementById('phone').innerHTML = content.phone;
  242. module.data.memberId = content.id;
  243. //console.log(module.data.userId)
  244. //用户图片
  245. module.showUserImage(content);
  246. //我的供求
  247. tools.doGet(userSupply, {memberId:content.id,pageNum:module.data.pageNum,pageSize:10}, module.userSupply);
  248. //我的咨询
  249. tools.doGet(userConsulting, {memberId:content.id,pageNum:module.data.pageNum,pageSize:module.data.pageSize}, module.consulting);
  250. //我的竞价
  251. tools.doGet(userBidding, {memberId:content.id,pageNum:module.data.pageNum,pageSize:module.data.pageSize}, module.bidding);
  252. //个人资料提交
  253. $('#supplyAction').on('click', module.supplyAction)
  254. $('#releaseAction').on('click', module.releaseAction)
  255. //获取附件的值
  256. //$('#upLoadBtn').on('click',module.upLoadAction)
  257. //document.getElementById('userAction').addEventListener('click',module.formAction);
  258. }
  259. }
  260. module.showUserImage = function(data){
  261. console.log(data)
  262. var accountOpenCert = data.accountOpenCert==null||data.accountOpenCert == ''?null:['/api'+data.accountOpenCert];
  263. var idCardPic = data.idCardPic==null||data.idCardPic == ''?null:['/api'+data.idCardPic];
  264. console.log(accountOpenCert)
  265. console.log(idCardPic)
  266. if(module.data.memberType == '1'){
  267. var cupload2 = new Cupload ({
  268. ele: '#cupload-3',
  269. num: 1,
  270. data:idCardPic
  271. });
  272. var cupload4 = new Cupload ({
  273. ele: '#cupload-4',
  274. num: 1,
  275. data:accountOpenCert
  276. });
  277. }else{
  278. var cupload5 = new Cupload ({
  279. ele: '#cupload-5',
  280. num: 1,
  281. data:accountOpenCert
  282. });
  283. }
  284. }
  285. module.showSupplyImage = function(data){
  286. //console.log(data)
  287. if (data.code == 200) {
  288. var content = data.data;
  289. var fileUrlList = [];
  290. var fileNum = [];
  291. for (var i = 0 ; i < content.length ; i++){
  292. fileUrlList[i] = serverApi + content[i].fileUrl ;
  293. fileNum[i] = content[i].id;
  294. }
  295. if (fileUrlList.length == 0){
  296. fileUrlList = '';
  297. }
  298. //console.log(fileUrlList)
  299. document.getElementById('cupload-1').innerHTML = '';
  300. module.data.fileNum = fileNum;
  301. var cupload1 = new Cupload ({
  302. ele: '#cupload-1',
  303. num: 5,
  304. data:fileUrlList
  305. });
  306. }
  307. }
  308. deleteList = function(){
  309. //console.log(module.data.fileNum[deleteNum])
  310. // tools.doGet(deleteUserImg+'/'+module.data.fileNum[deleteNum], {}, module.Tips);
  311. }
  312. module.getData = function(data){
  313. upLoadAction(data.data)
  314. }
  315. //获取上传图片list
  316. upLoadAction = function(type){
  317. //console.log(type)
  318. var upLoadList = [];
  319. var data = {};
  320. if(type == 'user'||type == 'company'){
  321. if(module.data.memberType == '1'){
  322. $('#cupload-3').find('input').each(function() {
  323. if($(this).val()!=''&&$(this).val().indexOf('http') == -1){
  324. upLoadList.push($(this).val())
  325. }
  326. })
  327. }else{
  328. $('#cupload-5').find('input').each(function() {
  329. if($(this).val()!=''&&$(this).val().indexOf('http') == -1){
  330. upLoadList.push($(this).val())
  331. }
  332. })
  333. data["files"] = upLoadList;
  334. }
  335. // tools.doPostImg(base64Upload, data, module.submitInfo());//memberType 1个人 2单位
  336. }else{
  337. $('#cupload-1').find('input').each(function() {
  338. if($(this).val()!=''&&$(this).val().indexOf('http') == -1){
  339. upLoadList.push($(this).val())
  340. }
  341. })
  342. data["tableName"] = 't_transaction_supply_demand';
  343. data["tableId"] = type?type:module.data.supplyId;
  344. data["files"] = upLoadList;
  345. data["fileType"] = '';
  346. data["bizPath"] = 'transaction';
  347. tools.doPostImg(base64Attach, data, module.upLoadOver);//memberType 1个人 2单位
  348. setTimeout(function(){
  349. tools.doGet(userSupply, {memberId:module.data.memberId,pageNum:module.data.pageNum,pageSize:module.data.pageSize}, module.userSupply)
  350. document.getElementById('supplyInformation').style.display = "block";
  351. document.getElementById('releaseSupply').style.display = "none";
  352. $('#demandType').val('');
  353. $('#projectName').val('');
  354. $('#location').val('');
  355. $('#projectRealName').val('');
  356. $('#projectPhone').val('');
  357. $('#projectContent').val('');
  358. },2000)
  359. }
  360. // tools.initError('发布成功');
  361. }
  362. module.upLoadOver = function(type){
  363. }
  364. module.upLoadOverInfo1 = function(data){
  365. if (data.code == 200)
  366. module.data.sfz = data.fileName;
  367. }
  368. module.upLoadOverInfo2 = function(data){
  369. if (data.code == 200)
  370. module.data.yhk = data.fileName;
  371. }
  372. module.upLoadOverInfo5 = function(data){
  373. if (data.code == 200)
  374. module.data.khzm = data.fileName;
  375. }
  376. submitInfo = function(type){
  377. var upLoadList = [];
  378. var data = {};
  379. if(type == 'user'||type == 'company'){
  380. if(module.data.memberType == '1'){
  381. $('#cupload-3').find('input').each(function() {
  382. if($(this).val()!=''&&$(this).val().indexOf('http') == -1){
  383. module.data.upType1 = true;
  384. tools.doPostImg(base64Upload, {file:$(this).val()}, module.upLoadOverInfo1);
  385. }
  386. })
  387. $('#cupload-4').find('input').each(function() {
  388. if($(this).val()!=''&&$(this).val().indexOf('http') == -1){
  389. module.data.upType2 = true;
  390. tools.doPostImg(base64Upload, {file:$(this).val()}, module.upLoadOverInfo2);
  391. }
  392. })
  393. console.log(type);
  394. setTimeout(function(){
  395. formAction(type)
  396. },1000);
  397. }else{
  398. $('#cupload-5').find('input').each(function() {
  399. if($(this).val()!=''&&$(this).val().indexOf('http') == -1){
  400. module.data.upType5 = true;
  401. tools.doPostImg(base64Upload, {file:$(this).val()}, module.upLoadOverInfo5);
  402. }
  403. })
  404. setTimeout(function(){
  405. formAction(type)
  406. },1000);
  407. }
  408. //memberType 1个人 2单位
  409. }
  410. }
  411. //删除供求
  412. deleteUserSupply = function(ids){
  413. tools.doGet(deleteSupply+'/'+ids, {}, module.Tips);
  414. }
  415. //个人中心我的供求
  416. module.userSupply = function(data){
  417. //console.log(data)
  418. if (data.code == 200) {
  419. var content = data.rows;
  420. //console.log(data)
  421. var pageCount = (data.total/10).toFixed(0);
  422. if (pageCount < 1){
  423. pageCount = 1;
  424. }
  425. if(module.data.userSupplyInformationList == ''){
  426. $('.page_s1').html('');
  427. // 初始化 分页器
  428. var page_s1 = createPage('.page_s1');
  429. // 设置分页
  430. setPage(page_s1, {
  431. pageTotal: data.total, // 数据总条数
  432. pageSize: 10, // 每页显示条数
  433. pageCurrent: 1, // 当前页
  434. maxBtnNum: 5, // 最多按钮个数 (最少5个)
  435. })
  436. $('#page_s1').html('共' + pageCount + '页')
  437. }
  438. module.data.userSupplyInformationList = content;
  439. var userSupplyInformationData = template('userSupplyInformationData', module.data);
  440. $("#userSupplyInformationContent").html(userSupplyInformationData);
  441. }
  442. }
  443. //个人中心我的咨询
  444. module.consulting = function(data){
  445. if (data.code == 200) {
  446. var content = data.rows;
  447. //console.log(data )
  448. var pageCount = (data.total/module.data.pageSize).toFixed(0);
  449. if (pageCount < 1){
  450. pageCount = 1;
  451. }
  452. $('.page_s2').html('');
  453. // 初始化 分页器
  454. var page_s1 = createPage('.page_s2');
  455. // 设置分页
  456. setPage(page_s1, {
  457. pageTotal: data.total, // 数据总条数
  458. pageSize: module.data.pageSize, // 每页显示条数
  459. pageCurrent: 1, // 当前页
  460. maxBtnNum: 5, // 最多按钮个数 (最少5个)
  461. })
  462. module.data.consultingInformationList = content;
  463. $('#page_s2').html('共'+pageCount+'页')
  464. var consultingInformationData = template('consultingInformationData', module.data);
  465. $("#consultingInformationContent").html(consultingInformationData);
  466. }
  467. }
  468. //个人中心我的竞价
  469. module.bidding = function(data){
  470. if (data.code == 200) {
  471. var content = data.rows;
  472. //console.log(content)
  473. var pageCount = (data.total/module.data.pageSize).toFixed(0);
  474. if (pageCount < 1){
  475. pageCount = 1;
  476. }
  477. if(module.data.biddingInformationList == '') {
  478. // 初始化 分页器
  479. var page_s1=createPage('.page_s3');
  480. // 设置分页
  481. setPage(page_s1, {
  482. pageTotal: data.total, // 数据总条数
  483. pageSize: module.data.pageSize, // 每页显示条数
  484. pageCurrent: 1, // 当前页
  485. maxBtnNum: 5, // 最多按钮个数 (最少5个)
  486. })
  487. $('#page_s3').html('共' + pageCount + '页')
  488. }
  489. module.data.biddingInformationList = content;
  490. var biddingInformationData = template('biddingInformationData', module.data);
  491. $("#biddingInformationContent").html(biddingInformationData);
  492. }
  493. }
  494. tabCheck = function(type){
  495. document.getElementById('user').className = '';
  496. document.getElementById('bank').className = '';
  497. document.getElementById('passWord').className = '';
  498. document.getElementById(type).className = 'active';
  499. //console.log(type)
  500. document.getElementById('userInformationContent').style.display = 'none';
  501. document.getElementById('companyInformationContent').style.display = 'none';
  502. document.getElementById('bankInformationContent').style.display = 'none';
  503. document.getElementById('phoneInformationContent').style.display = 'none';
  504. document.getElementById('passWordInformationContent').style.display = 'none';
  505. if (module.data.memberType == '2' && type == 'user'){
  506. document.getElementById('companyInformationContent').style.display = 'block';
  507. }else if (module.data.memberType == '1' && type == 'user'){
  508. document.getElementById('userInformationContent').style.display = 'block';
  509. }else{
  510. document.getElementById(type+'InformationContent').style.display = 'block';
  511. }
  512. }
  513. phoneUpdate = function(type){
  514. document.getElementById(type+'InformationContent').style.display = 'none';
  515. document.getElementById('phoneInformationContent').style.display = 'block';
  516. }
  517. tabLeftCheck = function(type){
  518. for (var i = 1 ; i < 5 ; i++){
  519. document.getElementById('icon-list'+i).className = '';
  520. }
  521. document.getElementById(type).className = 'active';
  522. document.getElementById('userInformation').style.display = 'none';
  523. document.getElementById('supplyInformation').style.display = 'none';
  524. document.getElementById('consultingInformation').style.display = 'none';
  525. document.getElementById('biddingInformation').style.display = 'none';
  526. document.getElementById('releaseSupply').style.display = 'none';
  527. document.getElementById('release').style.display = 'none';
  528. if(type == 'icon-list1'){
  529. document.getElementById('userInformation').style.display = 'block';
  530. }
  531. if(type == 'icon-list2'){
  532. document.getElementById('supplyInformation').style.display = 'block';
  533. module.data.clickType = 'supply';
  534. $('#demandType').val('');
  535. $('#projectName').val('');
  536. $('#location').val('');
  537. $('#projectRealName').val('');
  538. $('#projectPhone').val('');
  539. $('#projectContent').val('');
  540. }
  541. if(type == 'icon-list3'){
  542. document.getElementById('consultingInformation').style.display = 'block';
  543. module.data.clickType = 'consulting';
  544. $('#title').val('');
  545. $('#releaseContent').val('');
  546. $('#releaseRealName').val('');
  547. $('#releasePhone').val('');
  548. }
  549. if(type == 'icon-list4'){
  550. document.getElementById('biddingInformation').style.display = 'block';
  551. module.data.clickType = 'bidding';
  552. }
  553. module.data.pageNum = 1 ;
  554. }
  555. goSupply = function(){
  556. document.getElementById('supplyInformation').style.display = "none";
  557. document.getElementById('releaseSupply').style.display = "block";
  558. document.getElementById('cupload-1').innerHTML = '';
  559. module.data.supplyType = 'add'
  560. var cupload1 = new Cupload ({
  561. ele: '#cupload-1',
  562. num: 5,
  563. });
  564. }
  565. gosupplyTable = function(){
  566. document.getElementById('supplyInformation').style.display = "block";
  567. document.getElementById('releaseSupply').style.display = "none";
  568. $('#demandType').val('');
  569. $('#projectName').val('');
  570. $('#location').val('');
  571. $('#projectRealName').val('');
  572. $('#projectPhone').val('');
  573. $('#projectContent').val('');
  574. }
  575. goRelease = function(){
  576. document.getElementById('consultingInformation').style.display = "none";
  577. document.getElementById('release').style.display = "block";
  578. }
  579. goReleaseTable = function(){
  580. document.getElementById('consultingInformation').style.display = "block";
  581. document.getElementById('release').style.display = "none";
  582. $('#title').val('');
  583. $('#releaseContent').val('');
  584. $('#releaseRealName').val('');
  585. $('#releasePhone').val('');
  586. }
  587. //翻页
  588. turnThePage = function (pageNum) {
  589. module.data.pageNum = pageNum ;
  590. if(module.data.clickType == 'supply'){
  591. tools.doGet(userSupply, {memberId:module.data.memberId,pageNum:pageNum,pageSize:module.data.pageSize}, module.userSupply);
  592. }
  593. if(module.data.clickType == 'consulting'){
  594. tools.doGet(userConsulting, {memberId:module.data.memberId,pageNum:pageNum,pageSize:module.data.pageSize}, module.consulting);
  595. }
  596. if(module.data.clickType == 'bidding'){
  597. tools.doGet(userBidding, {memberId:module.data.memberId,pageNum:pageNum,pageSize:module.data.pageSize}, module.bidding);
  598. }
  599. }
  600. //个人用户资料修改
  601. formAction = function (type){
  602. var data = {};
  603. //var password = $('#password').val();
  604. module.data.userFormType = type ;
  605. if(type == 'company'){
  606. //公司用户信息
  607. var companyName = $('#companyName').val();
  608. var idCardNum = $('#idCardNum').val();
  609. var realname = $('#realname').val();
  610. var companyCode = $('#companyCode').val();
  611. var companyNature = $('#companyNature').val();
  612. var companyScope = $('#companyScope').val();
  613. var companyTimeLimit = $('#companyTimeLimit').val();
  614. var companySetupTime = $('#companySetupTime').val();
  615. var companyCapital = $('#companyCapital').val();
  616. var companyLicense = $('#companyLicense').val();
  617. var address = $('#address').val();
  618. var accountOpenCert = module.data.khzm;
  619. data['accountOpenCert'] = accountOpenCert;
  620. data['companyName'] = companyName;
  621. data['idCardNum'] = idCardNum;
  622. data['realname'] = realname;
  623. data['companyCode'] = companyCode;
  624. data['companyName'] = companyName;
  625. data['companyNature'] = companyNature;
  626. data['companyScope'] = companyScope;
  627. data['companyTimeLimit'] = companyTimeLimit;
  628. data['companySetupTime'] = companySetupTime;
  629. data['companyCapital'] = companyCapital;
  630. data['companyLicense'] = companyLicense;
  631. data['address'] = address;
  632. tools.setCookie('userName',realname,24 * 60 * 60)
  633. tools.setCookie('idCardNum',idCardNum,24 * 60 * 60)
  634. tools.setCookie('address',address,24 * 60 * 60)
  635. // upLoadAction('user');
  636. }
  637. if(type == 'user'){
  638. //个人用户信息
  639. var userFormRealName = $('#userFormRealName').val();
  640. var userFormIdCard = $('#userFormIdCard').val();
  641. var userFormAddress = $('#userFormAddress').val();
  642. var bankAddress = $('#bankAddress').val();
  643. var bankType = $('#bankType').val();
  644. var idCardPic = module.data.sfz;
  645. var accountOpenCert = module.data.yhk;
  646. data['idCardPic'] = idCardPic;
  647. data['accountOpenCert'] = accountOpenCert;
  648. data['idCardNum'] = userFormIdCard;
  649. data['realname'] = userFormRealName;
  650. data['address'] = userFormAddress;
  651. tools.setCookie('userName',userFormRealName,24 * 60 * 60)
  652. tools.setCookie('idCardNum',userFormIdCard,24 * 60 * 60)
  653. tools.setCookie('address',userFormAddress,24 * 60 * 60)
  654. // upLoadAction('user');
  655. }
  656. if(type == 'bank'){
  657. //银行卡信息
  658. var bankCardName = $('#bankCardName').val();
  659. var bankCardNum = $('#bankCardNum').val();
  660. var bankAddress = $('#bankAddress').val();
  661. var bankType = $('#bankType').val();
  662. var accountType = $('#accountType').val();
  663. var payeePaymentLines = $('#payeePaymentLines').val();
  664. if (bankCardName == '') {
  665. $('#bankCardName')[0].focus()
  666. tools.initTips('请输入开户姓名', 'right', $('#bankCardName')[0], 2000)
  667. return false;
  668. }
  669. if (bankCardNum == '') {
  670. $('#bankCardNum')[0].focus()
  671. tools.initTips('请输入开户账号', 'right', $('#bankCardNum')[0], 2000)
  672. return false;
  673. }
  674. if (bankType == '') {
  675. $('#bankType')[0].focus()
  676. tools.initTips('请选择所属银行', 'right', $('#bankType')[0], 2000)
  677. return false;
  678. }
  679. if (bankAddress == '') {
  680. $('#bankAddress')[0].focus()
  681. tools.initTips('请选择开户银行', 'right', $('#bankAddress')[0], 2000)
  682. return false;
  683. }
  684. if (payeePaymentLines == '') {
  685. $('#payeePaymentLines')[0].focus()
  686. tools.initTips('请输入联行号', 'right', $('#payeePaymentLines')[0], 2000)
  687. return false;
  688. }
  689. data['bankCardName'] = bankCardName;
  690. data['bankCardNum'] = bankCardNum;
  691. data['bankAddress'] = bankAddress;
  692. data['bankType'] = bankType;
  693. data['accountType'] = accountType;
  694. data['payeePaymentLines'] = payeePaymentLines;
  695. tools.setCookie('bankCardName',bankCardName,24 * 60 * 60)
  696. tools.setCookie('bankCardNum',bankCardNum,24 * 60 * 60)
  697. tools.setCookie('bankAddress',bankAddress,24 * 60 * 60)
  698. tools.setCookie('bankType',bankType,24 * 60 * 60)
  699. tools.setCookie('accountType',accountType,24 * 60 * 60)
  700. tools.setCookie('payeePaymentLines',payeePaymentLines,24 * 60 * 60)
  701. }
  702. //data['password'] = password;
  703. data['id'] = module.data.memberId;
  704. tools.doPost(userUpdate, data, module.Tips)
  705. }
  706. editPassword = function(){
  707. var data = {};
  708. if(module.passWordCompare()){
  709. var oldPassWord = $('#originalPassWord').val();
  710. var newPassWord = $('#newPassWord').val();
  711. data['oldPassword'] = oldPassWord;
  712. data['newPassword'] = newPassWord;
  713. tools.doPost(updatePwd, data, module.Tips)
  714. }
  715. }
  716. //手动验证密码是否一致
  717. module.passWordCompare = function(){
  718. var newPassword = $('#newPassWord').val();
  719. var determinePassWord = $('#determinePassWord').val();
  720. var originalPassWord = $('#originalPassWord').val();
  721. /*原密码*/
  722. if (originalPassWord == '') {
  723. $('#originalPassWord')[0].focus()
  724. tools.initTips('请输入原密码', 'right', $('#originalPassWord')[0], 2000)
  725. return false;
  726. }
  727. /* 新密码 */
  728. if (newPassword == '') {
  729. $('#newPassWord')[0].focus()
  730. tools.initTips('请输入新密码', 'right', $('#newPassWord')[0], 2000)
  731. return false;
  732. }
  733. /* 确认密码 */
  734. if (determinePassWord == '') {
  735. $('#determinePassWord')[0].focus()
  736. tools.initTips('请确认密码', 'right', $('#determinePassWord')[0], 2000)
  737. return false;
  738. }
  739. return true;
  740. }
  741. //发布供求
  742. module.supplyAction = function (){
  743. var data = {};
  744. if(module.supplyCheck()){
  745. //供求信息
  746. var demandType = $('#demandType').val();
  747. var projectName = $('#projectName').val();
  748. var location = $('#location').val();
  749. var projectRealName = $('#projectRealName').val();
  750. var projectPhone = $('#projectPhone').val();
  751. var projectContent = $('#projectContent').val();
  752. var logintime = tools.getNowFormatDate();
  753. //console.log(demandType);
  754. data['projectName'] = projectName;
  755. data['location'] = location;
  756. data['realname'] = projectRealName;
  757. data['phone'] = projectPhone;
  758. data['projectContent'] = projectContent;
  759. data['logintime'] = logintime;
  760. data['supplyDemandType'] = demandType;
  761. data['deptId'] = 100;
  762. data['memberId'] = module.data.memberId;
  763. if(module.data.supplyType == 'edit'){
  764. data['id'] = module.data.supplyId;
  765. tools.doPost(userEdit, data, module.getData)
  766. }else{
  767. tools.doPost(userDemand, data, module.getData)
  768. }
  769. }
  770. }
  771. //发布咨询
  772. module.releaseAction = function (){
  773. var data = {};
  774. if(module.releaseCheck()){
  775. //供求信息
  776. var title = $('#title').val();
  777. var releaseContent = $('#releaseContent').val();
  778. var releaseRealName = $('#releaseRealName').val();
  779. var releasePhone = $('#releasePhone').val();
  780. var logintime = tools.getNowFormatDate();
  781. data['title'] = title;
  782. data['content'] = releaseContent;
  783. data['realname'] = releaseRealName;
  784. data['phone'] = releasePhone;
  785. data['logintime'] = logintime;
  786. data['deptId'] = 100;
  787. data['memberId'] = module.data.memberId;
  788. tools.doPost(userCommunicate, data, module.releaseActionYes)
  789. }
  790. }
  791. module.releaseActionYes = function(data){
  792. tools.initError(data.msg);
  793. setTimeout(function(){
  794. tools.doGet(userConsulting, {memberId:module.data.memberId,pageNum:module.data.pageNum,pageSize:module.data.pageSize}, module.consulting);
  795. document.getElementById('consultingInformation').style.display = "block";
  796. document.getElementById('release').style.display = "none";
  797. $('#title').val('');
  798. $('#releaseContent').val('');
  799. $('#releaseRealName').val('');
  800. $('#releasePhone').val('');
  801. },2000)
  802. }
  803. module.Tips = function(data){
  804. tools.initError(data.msg);
  805. }
  806. //手动验证表单
  807. module.check = function () {
  808. var usernameVal = $('#username').val();
  809. var passwordVal = $('#password').val();
  810. var codeVal = $('#code').val();
  811. /* 手机号 */
  812. if (usernameVal == '') {
  813. $('#username')[0].focus()
  814. tools.initTips('请输入用户名', 'right', $('#username')[0], 2000)
  815. return false;
  816. }
  817. /* 密码 */
  818. if (passwordVal == '') {
  819. $('#password')[0].focus()
  820. tools.initTips('请输入密码', 'right', $('#password')[0], 2000)
  821. return false;
  822. } else if (parseInt(passwordVal.length) < 6 || parseInt(passwordVal.length) > 18) {
  823. $('#password')[0].focus()
  824. tools.initTips('请输入正确格式密码', 'right', $('#password')[0], 2000)
  825. return false;
  826. }
  827. /*图形验证码*/
  828. if (module.uuid == '' || codeVal == '') {
  829. $('#code')[0].focus()
  830. tools.initTips('请输入图形验证码', 'right', $('#code')[0], 2000)
  831. return false;
  832. }
  833. return true;
  834. }
  835. module.supplyCheck = function () {
  836. var projectName = $('#projectName').val();
  837. var location = $('#location').val();
  838. var projectRealName = $('#projectRealName').val();
  839. var projectPhone = $('#projectPhone').val();
  840. var projectContent = $('#projectContent').val();
  841. if (projectName == '') {
  842. $('#projectName')[0].focus()
  843. tools.initTips('请输入项目名称', 'right', $('#projectName')[0], 2000)
  844. return false;
  845. }
  846. if (location == '') {
  847. $('#location')[0].focus()
  848. tools.initTips('请输入项目地址', 'right', $('#location')[0], 2000)
  849. return false;
  850. }
  851. if (projectRealName == '') {
  852. $('#projectRealName')[0].focus()
  853. tools.initTips('请输入姓名', 'right', $('#projectRealName')[0], 2000)
  854. return false;
  855. }
  856. if (projectPhone == '') {
  857. $('#projectPhone')[0].focus()
  858. tools.initTips('请输入联系电话', 'right', $('#projectPhone')[0], 2000)
  859. return false;
  860. }
  861. if (projectContent == '') {
  862. $('#projectContent')[0].focus()
  863. tools.initTips('请输入项目详情', 'right', $('#projectContent')[0], 2000)
  864. return false;
  865. }
  866. return true;
  867. }
  868. module.releaseCheck = function () {
  869. var title = $('#title').val();
  870. var releaseContent = $('#releaseContent').val();
  871. var releaseRealName = $('#releaseRealName').val();
  872. var releasePhone = $('#releasePhone').val();
  873. if (title == '') {
  874. $('#title')[0].focus()
  875. tools.initTips('请输入标题', 'right', $('#title')[0], 2000)
  876. return false;
  877. }
  878. if (releaseContent == '') {
  879. $('#releaseContent')[0].focus()
  880. tools.initTips('请输入咨询内容', 'right', $('#releaseContent')[0], 2000)
  881. return false;
  882. }
  883. if (releaseRealName == '') {
  884. $('#releaseRealName')[0].focus()
  885. tools.initTips('请输入姓名', 'right', $('#releaseRealName')[0], 2000)
  886. return false;
  887. }
  888. if (releasePhone == '') {
  889. $('#releasePhone')[0].focus()
  890. tools.initTips('请输入联系电话', 'right', $('#releasePhone')[0], 2000)
  891. return false;
  892. }
  893. return true;
  894. }
  895. //个人中心选项卡鼠标悬浮
  896. module.userListHover = function(){
  897. document.getElementById('icon-list1').onmouseout = function(){
  898. document.getElementById('icon1').src = '../../static/images/user_index_icon1.png'
  899. }
  900. document.getElementById('icon-list1').onmouseover = function(){
  901. if(themeColor == 'red'){
  902. document.getElementById('icon1').src = '../../static/images/user_index_icon5_red.png'
  903. }else if(themeColor == 'green'){
  904. document.getElementById('icon1').src = '../../static/images/user_index_icon5.png'
  905. }
  906. }
  907. document.getElementById('icon-list2').onmouseout = function(){
  908. document.getElementById('icon2').src = '../../static/images/user_index_icon2.png'
  909. }
  910. document.getElementById('icon-list2').onmouseover = function(){
  911. if(themeColor == 'red'){
  912. document.getElementById('icon2').src = '../../static/images/user_index_icon6_red.png'
  913. }else if(themeColor == 'green') {
  914. document.getElementById('icon2').src = '../../static/images/user_index_icon6.png'
  915. }
  916. }
  917. document.getElementById('icon-list3').onmouseout = function(){
  918. document.getElementById('icon3').src = '../../static/images/user_index_icon3.png'
  919. }
  920. document.getElementById('icon-list3').onmouseover = function(){
  921. if(themeColor == 'red'){
  922. document.getElementById('icon3').src = '../../static/images/user_index_icon7_red.png'
  923. }else if(themeColor == 'green') {
  924. document.getElementById('icon3').src = '../../static/images/user_index_icon7.png'
  925. }
  926. }
  927. document.getElementById('icon-list4').onmouseout = function(){
  928. document.getElementById('icon4').src = '../../static/images/user_index_icon4.png'
  929. }
  930. document.getElementById('icon-list4').onmouseover = function(){
  931. if(themeColor == 'red'){
  932. document.getElementById('icon4').src = '../../static/images/user_index_icon8_red.png'
  933. }else if(themeColor == 'green') {
  934. document.getElementById('icon4').src = '../../static/images/user_index_icon8.png'
  935. }
  936. }
  937. }
  938. goSearch = function () {
  939. var searchTitle = $('#searchTitle').val();
  940. var searchContent = $('#searchContent').val();
  941. //console.log(searchTitle)
  942. module.data.searchType = 'YES';
  943. tools.doGet(userConsulting,{title:searchTitle,content:searchContent,memberId:module.data.memberId,pageNum:module.data.pageNum,pageSize:module.data.pageSize},module.consulting);
  944. }
  945. selectUserSupply = function(ids) {
  946. module.data.supplyType = 'edit';
  947. module.data.supplyId = ids;
  948. //console.log('点击修改')
  949. tools.doGet(selectSupply + '/' + ids, {}, module.selectSupplyDetail);//memberType 1个人 2单位
  950. }
  951. module.selectSupplyDetail = function(data){
  952. console.log('进入修改供求')
  953. document.getElementById('supplyInformation').style.display = "none";
  954. document.getElementById('releaseSupply').style.display = "block";
  955. var content = data.data
  956. $('#demandType').val(content.supplyDemandType);
  957. $('#projectName').val(content.projectName);
  958. $('#location').val(content.location);
  959. $('#projectRealName').val(content.realname);
  960. $('#projectPhone').val(content.phone);
  961. $('#projectContent').val(content.projectContent);
  962. tools.doGet(supplyDemandImg+'/'+content.id, {}, module.showSupplyImage);
  963. }
  964. goProject = function(id){
  965. tools.skip('../listingItems/itemsDetail.html?id='+id)
  966. }
  967. return module;
  968. });