网站
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

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