网站
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 

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