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

883 lines
34 KiB

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