农燊高科官方网站
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

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