网站
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 35 KiB

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