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

index.js 38 KiB

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