|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186 |
- /**
- * Created by Administrator on 2021/4/5.
- */
- define(['jquery', "template", "Tools", "user", "paging","cupload","kindeditor", 'swiper'], function ($, template, Tools ) {
- //数据存储
- var module = {
- data: {
- //焦点图数据
- focusListTop: [],
- userInformationDetail:[],
- userSupplyInformationList:'',
- consultingInformationList:'',
- biddingInformationList:'',
- //页码
- pageNum: 1,
- //页码集合
- pageList: [],
- //每页数量
- pageSize: 5,
- //总页数
- pageCount:0,
- //用户ID
- memberId:0,
- //用户资料form
- form:{
-
- },
- modifyUrl:'',
- detailUrl:'',
- sheng:[],
- shi:[],
- sfzList:[],
- yhkList:[],
- sfz:'',
- yhk:'',
- khzm:'',
- companyLicense:'',
- upType1:false,
- upType2:false,
- upType5:false,
- },
- };
- var tools = new Tools();
- module.init = function (page) {
- //获取焦点图信息
- tools.doGet(websitePicture, {picType:1,status:0,orderByColumn:'picSort',isAsc:'desc'}, module.focusNewsTop , true);
- //底部友情链接
- tools.doGet(friendsLinks, {}, module.bottomFriendsLinks, true);
- //用户资料
- tools.doGet(userData, {}, module.userData);
-
- if(!tools.getCookie('Admin-Token')){
- tools.skip('../../index.html')
- }
- //用户资料
- //tools.doPut(userData, {id:}, module.userData,true);
-
- //个人中心选项卡鼠标悬浮
- module.userListHover();
-
- //网站配置信息(网站名称 底部联系方式 公安备案号 网站备案号)
- tools.getWebConfig();
-
- //所属银行
- tools.doGet(dictionaries+"/bank_type_all", {}, module.bankType, true);
-
- //账户类型
- tools.doGet(dictionaries+"/bank_account_type", {}, module.accountType, true);
-
- window.KindEditor.create('#editor_id')
-
- //console.log(tools.getParam('type'))
-
- var type = tools.getParam('type');
-
- module.getType(type);
-
- setTimeout(function(){
- //主题图片切换
- module.switchTheme();
- },2000)
-
- module.data.sheng = options;
- module.data.shi = options[0].children;
- var shengData = template('shengData', module.data);
- $("#sheng").html(shengData);
- var shiData = template('shiData', module.data);
- $("#shi").html(shiData);
-
- };
-
- getShi = function () {
- console.log($('#bankTypeData').val())
- // if (!$('#bankTypeData').val()){
- // return;
- // }
- module.data.shi = module.data.sheng.filter(function (e) { return e.label == $('#sheng').val(); })[0].children;
- var shiData = template('shiData', module.data);
- $("#shi").html(shiData);
-
- // tools.doGet(depositList, {sheng:$('#sheng').val(),shi:$('#shi').val()}, module.depositList, true);
- }
- getDeposit = function () {
- let data = {
- sheng:$('#sheng').val(),
- shi:$('#shi').val(),
- bankType:$('#bankType').val(),
- bankDeposit:$('#bankDeposit').val(),
- }
- console.log(data)
- tools.doPost(depositList, data,module.depositList);
- }
- changeBankAddress = function () {
- console.log($('#bankAddress').val())
- console.log(module.data.bankAddress.filter(function (e) { return e.bankDeposit == $('#bankAddress').val(); }))
-
- document.getElementById('payeePaymentLines').value =
- module.data.bankAddress.filter(function (e) { return e.bankDeposit == $('#bankAddress').val(); })[0].payeePaymentLines;
- }
-
- module.depositList = function (data) {
- var content = data.data;
- module.data.bankAddress = content;
- var bankAddressData = template('bankAddressData', module.data);
- $("#bankAddress").html(bankAddressData);
- if (content.length>0){
- // changeBankAddress();
- }else{
- document.getElementById('payeePaymentLines').value = '';
- }
- }
-
- //底部友情链接
- module.bankType = function (data) {
- if (data.code == 200) {
- var content = data.data;
- module.data.bankTypeOption = content;
- var bankTypeData = template('bankTypeData', module.data);
- $("#bankType").html(bankTypeData);
- }
- }
-
- //账户类型
- module.accountType = function (data) {
- if (data.code == 200) {
- var content = data.data;
- module.data.accountTypeOption = content;
- var accountTypeData = template('accountTypeData', module.data);
- $("#accountType").html(accountTypeData);
- }
- }
-
- //焦点图数据
- module.focusNewsTop = function (data) {
- if (data.code == 200) {
-
- let focusArray = [];
-
- if(data.data.length<1){
- focusArray.push({
- picUrl:'../../../static/images/banner1.png'
- },{
- picUrl:'../../../static/images/banner2.png'
- },{
- picUrl:'../../../static/images/banner3.png'
- })
- }else{
- data.data.forEach(res=>{
- focusArray.push({
- picUrl:'/api'+res.picUrl
- })
- })
- }
-
- module.data.focusListTop = focusArray;
- var bannerFocusDataTop = template('bannerFocusDataTop', module.data);
- $("#bannerFocusTopContent").html(bannerFocusDataTop);
-
- new Swiper('#bannerFocusWrapTop', {
- paginationClickable: true,
- autoplay : 4000,
- loop:true
- })
-
- }
- }
-
- //主题图片切换
- module.switchTheme = function(){
- if(themeColor == 'red'){
- module.data.modifyUrl = '../../static/images/modify_red.png';
- module.data.detailUrl = '../../static/images/detail_red.png';
- }else if(themeColor == 'green'){
- module.data.modifyUrl = '../../static/images/modify.png';
- module.data.detailUrl = '../../static/images/detail.png';
- }
- }
- //底部友情链接
- module.bottomFriendsLinks = function (data) {
- if (data.code == 200) {
- var content = data.data;
- //console.log(content)
- module.data.friendsLinksList = content;
- var friendsLinksData = template('friendsLinksData', module.data);
- $("#friendsLinksContent").html(friendsLinksData);
- }
- }
-
- //获取类型
- module.getType = function(type){
- if (type == 'info'){
- document.getElementById("icon-list1").click();
- }
- if (type == 'demand'){
- document.getElementById("icon-list2").click();
- }
- if (type == 'interact'){
- document.getElementById("icon-list3").click();
- }
- if (type == 'bidding'){
- document.getElementById("icon-list4").click();
- }
- if (type == 'goDemand'){
- document.getElementById("icon-list2").click();
- document.getElementById("goSupply").click();
- }
- if (type == 'goInteract'){
- document.getElementById("icon-list3").click();
- document.getElementById("goRelease").click();
- }
- }
-
- //个人中心用户信息
- module.userData = function(data){
- if (data.code == 200) {
- var content = data.user;
- //console.log(content)
- module.data.userId = content.userId;
- tools.doGet(userMember + '/' + content.userId, {}, module.userMember);//memberType 1个人 2单位
- }
- }
-
- //个人中心用户资料
- module.userMember = function(data){
- if (data.code == 200) {
- var content = data.data;
- //console.log(data)
- module.data.userInformationDetail = content;
- module.data.memberType = content.memberType;
- var bankTypeData = template('bankTypeData', module.data);
- $("#bankType").html(bankTypeData);
- var bankAddressData = template('bankAddressData', module.data);
- $("#bankAddress").html(bankAddressData);
-
- if(content.memberType == '1'){
- document.getElementById('companyInformationContent').style.display = 'none';
- document.getElementById('userInformationContent').style.display = 'block';
- var userInformationData = template('userInformationData', module.data);
- $("#userInformationContent").html(userInformationData);
- }else{
- document.getElementById('companyInformationContent').style.display = 'block';
- document.getElementById('userInformationContent').style.display = 'none';
- var companyInformationData = template('companyInformationData', module.data);
- $("#companyInformationContent").html(companyInformationData);
- }
- document.getElementById('bankAddress').value = content.bankAddress;
- document.getElementById('bankCardName').value = content.bankCardName;
- document.getElementById('bankCardNum').value = content.bankCardNum;
- document.getElementById('bankType').value = content.bankType;
- document.getElementById('accountType').value = content.accountType;
- document.getElementById('payeePaymentLines').value = content.payeePaymentLines;
- document.getElementById('phone').innerHTML = content.phone;
-
- module.data.memberId = content.id;
- //console.log(module.data.userId)
-
- //用户图片
- module.showUserImage(content);
- //我的供求
- tools.doGet(userSupply, {memberId:content.id,pageNum:module.data.pageNum,pageSize:10}, module.userSupply);
- //我的咨询
- tools.doGet(userConsulting, {memberId:content.id,pageNum:module.data.pageNum,pageSize:module.data.pageSize}, module.consulting);
- //我的竞价
- tools.doGet(userBidding, {memberId:content.id,pageNum:module.data.pageNum,pageSize:module.data.pageSize}, module.bidding);
- //个人资料提交
- $('#supplyAction').on('click', module.supplyAction)
- $('#releaseAction').on('click', module.releaseAction)
-
- //获取附件的值
- //$('#upLoadBtn').on('click',module.upLoadAction)
-
- //document.getElementById('userAction').addEventListener('click',module.formAction);
- }
- }
-
- module.showUserImage = function(data){
- console.log(data)
- var accountOpenCert = data.accountOpenCert==null||data.accountOpenCert == ''?null:['/api'+data.accountOpenCert];
- var idCardPic = data.idCardPic==null||data.idCardPic == ''?null:['/api'+data.idCardPic];
- var companyLicense = data.companyLicense==null||data.companyLicense == ''?null:['/api'+data.companyLicense];
-
- console.log(accountOpenCert)
- console.log(idCardPic)
- if(module.data.memberType == '1'){
- var cupload2 = new Cupload ({
- ele: '#cupload-3',
- num: 1,
- data:idCardPic
- });
- var cupload4 = new Cupload ({
- ele: '#cupload-4',
- num: 1,
- data:accountOpenCert
- });
- }else{
- var cupload5 = new Cupload ({
- ele: '#cupload-5',
- num: 1,
- data:accountOpenCert
- });
- var cupload6 = new Cupload ({
- ele: '#cupload-6',
- num: 1,
- data:idCardPic
- });
- var cupload7 = new Cupload ({
- ele: '#cupload-7',
- num: 1,
- data:companyLicense
- });
- }
- }
-
- module.showSupplyImage = function(data){
- //console.log(data)
- if (data.code == 200) {
- var content = data.data;
- var fileUrlList = [];
- var fileNum = [];
- for (var i = 0 ; i < content.length ; i++){
- fileUrlList[i] = serverApi + content[i].fileUrl ;
- fileNum[i] = content[i].id;
- }
- if (fileUrlList.length == 0){
- fileUrlList = '';
- }
- //console.log(fileUrlList)
- document.getElementById('cupload-1').innerHTML = '';
- module.data.fileNum = fileNum;
- var cupload1 = new Cupload ({
- ele: '#cupload-1',
- num: 5,
- data:fileUrlList
- });
- }
- }
-
- deleteList = function(){
- //console.log(module.data.fileNum[deleteNum])
- // tools.doGet(deleteUserImg+'/'+module.data.fileNum[deleteNum], {}, module.Tips);
- }
-
- module.getData = function(data){
- upLoadAction(data.data)
- }
-
- //获取上传图片list
- upLoadAction = function(type){
- //console.log(type)
- var upLoadList = [];
- var data = {};
- if(type == 'user'||type == 'company'){
- if(module.data.memberType == '1'){
- $('#cupload-3').find('input').each(function() {
- if($(this).val()!=''&&$(this).val().indexOf('http') == -1){
- upLoadList.push($(this).val())
- }
- })
- }else{
- $('#cupload-5').find('input').each(function() {
- if($(this).val()!=''&&$(this).val().indexOf('http') == -1){
- upLoadList.push($(this).val())
- }
- })
- data["files"] = upLoadList;
- }
- // tools.doPostImg(base64Upload, data, module.submitInfo());//memberType 1个人 2单位
-
- }else{
- $('#cupload-1').find('input').each(function() {
- if($(this).val()!=''&&$(this).val().indexOf('http') == -1){
- upLoadList.push($(this).val())
- }
- })
- data["tableName"] = 't_transaction_supply_demand';
- data["tableId"] = type?type:module.data.supplyId;
- data["files"] = upLoadList;
- data["fileType"] = '';
- data["bizPath"] = 'transaction';
- tools.doPostImg(base64Attach, data, module.upLoadOver);//memberType 1个人 2单位
- setTimeout(function(){
- tools.doGet(userSupply, {memberId:module.data.memberId,pageNum:module.data.pageNum,pageSize:module.data.pageSize}, module.userSupply)
- document.getElementById('supplyInformation').style.display = "block";
- document.getElementById('releaseSupply').style.display = "none";
- $('#demandType').val('');
- $('#projectName').val('');
- $('#location').val('');
- $('#projectRealName').val('');
- $('#projectPhone').val('');
- $('#projectContent').val('');
- },2000)
- }
- // tools.initError('发布成功');
- }
-
- module.upLoadOver = function(type){
-
- }
-
- module.upLoadOverInfo1 = function(data){
- if (data.code == 200)
- module.data.sfz = data.fileName;
- }
-
- module.upLoadOverInfo2 = function(data){
- if (data.code == 200)
- module.data.yhk = data.fileName;
- }
-
- module.upLoadOverInfo5 = function(data){
- if (data.code == 200)
- module.data.khzm = data.fileName;
- }
-
- module.upLoadOverInfo6 = function(data){
- if (data.code == 200)
- module.data.frzjz = data.fileName;
- }
-
- module.upLoadOverInfo7 = function(data){
- if (data.code == 200)
- module.data.companyLicense = data.fileName;
- }
-
- submitInfo = function(type){
- var upLoadList = [];
- var data = {};
- if(type == 'user'||type == 'company'){
- if(module.data.memberType == '1'){
- $('#cupload-3').find('input').each(function() {
- if($(this).val()!=''&&$(this).val().indexOf('http') == -1){
- module.data.upType1 = true;
- tools.doPostImg(base64Upload, {file:$(this).val()}, module.upLoadOverInfo1);
- }
- })
- $('#cupload-4').find('input').each(function() {
- if($(this).val()!=''&&$(this).val().indexOf('http') == -1){
- module.data.upType2 = true;
- tools.doPostImg(base64Upload, {file:$(this).val()}, module.upLoadOverInfo2);
- }
- })
- console.log(type);
- setTimeout(function(){
- formAction(type)
- },1000);
-
- }else{
- $('#cupload-5').find('input').each(function() {
- if($(this).val()!=''&&$(this).val().indexOf('http') == -1){
- module.data.upType5 = true;
- tools.doPostImg(base64Upload, {file:$(this).val()}, module.upLoadOverInfo5);
- }
- })
- $('#cupload-6').find('input').each(function() {
- if($(this).val()!=''&&$(this).val().indexOf('http') == -1){
- module.data.upType6 = true;
- tools.doPostImg(base64Upload, {file:$(this).val()}, module.upLoadOverInfo6);
- }
- })
- $('#cupload-7').find('input').each(function() {
- if($(this).val()!=''&&$(this).val().indexOf('http') == -1){
- module.data.upType7 = true;
- tools.doPostImg(base64Upload, {file:$(this).val()}, module.upLoadOverInfo7);
- }
- })
- setTimeout(function(){
- formAction(type)
- },1000);
- }
- //memberType 1个人 2单位
- }
- }
-
- //删除供求
- deleteUserSupply = function(ids){
- tools.doGet(deleteSupply+'/'+ids, {}, module.Tips);
- }
-
- //个人中心我的供求
- module.userSupply = function(data){
- //console.log(data)
- if (data.code == 200) {
- var content = data.rows;
- //console.log(data)
- var pageCount = (data.total/10).toFixed(0);
- if (pageCount < 1){
- pageCount = 1;
- }
- if(module.data.userSupplyInformationList == ''){
- $('.page_s1').html('');
- // 初始化 分页器
- var page_s1 = createPage('.page_s1');
- // 设置分页
- setPage(page_s1, {
- pageTotal: data.total, // 数据总条数
- pageSize: 10, // 每页显示条数
- pageCurrent: 1, // 当前页
- maxBtnNum: 5, // 最多按钮个数 (最少5个)
- })
- $('#page_s1').html('共' + pageCount + '页')
-
- }
- module.data.userSupplyInformationList = content;
- var userSupplyInformationData = template('userSupplyInformationData', module.data);
- $("#userSupplyInformationContent").html(userSupplyInformationData);
- }
- }
-
- //个人中心我的咨询
- module.consulting = function(data){
- if (data.code == 200) {
- var content = data.rows;
- //console.log(data )
- var pageCount = (data.total/module.data.pageSize).toFixed(0);
- if (pageCount < 1){
- pageCount = 1;
- }
- $('.page_s2').html('');
- // 初始化 分页器
- var page_s1 = createPage('.page_s2');
- // 设置分页
- setPage(page_s1, {
- pageTotal: data.total, // 数据总条数
- pageSize: module.data.pageSize, // 每页显示条数
- pageCurrent: 1, // 当前页
- maxBtnNum: 5, // 最多按钮个数 (最少5个)
- })
- module.data.consultingInformationList = content;
- $('#page_s2').html('共'+pageCount+'页')
- var consultingInformationData = template('consultingInformationData', module.data);
- $("#consultingInformationContent").html(consultingInformationData);
- }
- }
-
- //个人中心我的竞价
- module.bidding = function(data){
- if (data.code == 200) {
- var content = data.rows;
- //console.log(content)
- var pageCount = (data.total/module.data.pageSize).toFixed(0);
- if (pageCount < 1){
- pageCount = 1;
- }
- if(module.data.biddingInformationList == '') {
- // 初始化 分页器
- var page_s1=createPage('.page_s3');
- // 设置分页
- setPage(page_s1, {
- pageTotal: data.total, // 数据总条数
- pageSize: module.data.pageSize, // 每页显示条数
- pageCurrent: 1, // 当前页
- maxBtnNum: 5, // 最多按钮个数 (最少5个)
- })
- $('#page_s3').html('共' + pageCount + '页')
- }
- module.data.biddingInformationList = content;
- var biddingInformationData = template('biddingInformationData', module.data);
- $("#biddingInformationContent").html(biddingInformationData);
- }
- }
-
- tabCheck = function(type){
- document.getElementById('user').className = '';
- document.getElementById('bank').className = '';
- document.getElementById('passWord').className = '';
- document.getElementById(type).className = 'active';
-
- //console.log(type)
- document.getElementById('userInformationContent').style.display = 'none';
- document.getElementById('companyInformationContent').style.display = 'none';
- document.getElementById('bankInformationContent').style.display = 'none';
- document.getElementById('phoneInformationContent').style.display = 'none';
- document.getElementById('passWordInformationContent').style.display = 'none';
- if (module.data.memberType == '2' && type == 'user'){
- document.getElementById('companyInformationContent').style.display = 'block';
- }else if (module.data.memberType == '1' && type == 'user'){
- document.getElementById('userInformationContent').style.display = 'block';
- }else{
- document.getElementById(type+'InformationContent').style.display = 'block';
- }
-
- }
-
- phoneUpdate = function(type){
- document.getElementById(type+'InformationContent').style.display = 'none';
- document.getElementById('phoneInformationContent').style.display = 'block';
- }
-
- tabLeftCheck = function(type){
- for (var i = 1 ; i < 5 ; i++){
- document.getElementById('icon-list'+i).className = '';
- }
- document.getElementById(type).className = 'active';
- document.getElementById('userInformation').style.display = 'none';
- document.getElementById('supplyInformation').style.display = 'none';
- document.getElementById('consultingInformation').style.display = 'none';
- document.getElementById('biddingInformation').style.display = 'none';
-
- document.getElementById('releaseSupply').style.display = 'none';
- document.getElementById('release').style.display = 'none';
-
- if(type == 'icon-list1'){
- document.getElementById('userInformation').style.display = 'block';
- }
- if(type == 'icon-list2'){
- document.getElementById('supplyInformation').style.display = 'block';
- module.data.clickType = 'supply';
- $('#demandType').val('');
- $('#projectName').val('');
- $('#location').val('');
- $('#projectRealName').val('');
- $('#projectPhone').val('');
- $('#projectContent').val('');
- }
- if(type == 'icon-list3'){
- document.getElementById('consultingInformation').style.display = 'block';
- module.data.clickType = 'consulting';
- $('#title').val('');
- $('#releaseContent').val('');
- $('#releaseRealName').val('');
- $('#releasePhone').val('');
- }
- if(type == 'icon-list4'){
- document.getElementById('biddingInformation').style.display = 'block';
- module.data.clickType = 'bidding';
- }
- module.data.pageNum = 1 ;
- }
-
- goSupply = function(){
- document.getElementById('supplyInformation').style.display = "none";
- document.getElementById('releaseSupply').style.display = "block";
- document.getElementById('cupload-1').innerHTML = '';
- module.data.supplyType = 'add'
- var cupload1 = new Cupload ({
- ele: '#cupload-1',
- num: 5,
- });
- }
-
- gosupplyTable = function(){
- document.getElementById('supplyInformation').style.display = "block";
- document.getElementById('releaseSupply').style.display = "none";
- $('#demandType').val('');
- $('#projectName').val('');
- $('#location').val('');
- $('#projectRealName').val('');
- $('#projectPhone').val('');
- $('#projectContent').val('');
- }
-
- goRelease = function(){
- document.getElementById('consultingInformation').style.display = "none";
- document.getElementById('release').style.display = "block";
- }
-
- goReleaseTable = function(){
- document.getElementById('consultingInformation').style.display = "block";
- document.getElementById('release').style.display = "none";
- $('#title').val('');
- $('#releaseContent').val('');
- $('#releaseRealName').val('');
- $('#releasePhone').val('');
- }
-
- //翻页
- turnThePage = function (pageNum) {
- module.data.pageNum = pageNum ;
- if(module.data.clickType == 'supply'){
- tools.doGet(userSupply, {memberId:module.data.memberId,pageNum:pageNum,pageSize:module.data.pageSize}, module.userSupply);
- }
- if(module.data.clickType == 'consulting'){
- tools.doGet(userConsulting, {memberId:module.data.memberId,pageNum:pageNum,pageSize:module.data.pageSize}, module.consulting);
- }
- if(module.data.clickType == 'bidding'){
- tools.doGet(userBidding, {memberId:module.data.memberId,pageNum:pageNum,pageSize:module.data.pageSize}, module.bidding);
- }
- }
-
- //个人用户资料修改
- formAction = function (type){
- var data = {};
- //var password = $('#password').val();
- module.data.userFormType = type ;
- if(type == 'company'){
- //公司用户信息
- var companyName = $('#companyName').val();
- var idCardNum = $('#idCardNum').val();
- var realname = $('#realname').val();
- var companyCode = $('#companyCode').val();
- var companyNature = $('#companyNature').val();
- var companyScope = $('#companyScope').val();
- var companyTimeLimit = $('#companyTimeLimit').val();
- var companySetupTime = $('#companySetupTime').val();
- var companyCapital = $('#companyCapital').val();
- var companyLicense = $('#companyLicense').val();
- var address = $('#address').val();
- var accountOpenCert = module.data.khzm;
- var idCardPic = module.data.frzjz;
-
- if (companyName == '') {
- $('#companyName')[0].focus()
- tools.initTips('请输入公司名称', 'right', $('#companyName')[0], 2000)
- return false;
- }
-
- if (idCardNum == '') {
- $('#idCardNum')[0].focus()
- tools.initTips('请输入身份证号', 'right', $('#idCardNum')[0], 2000)
- return false;
- }
-
- if (realname == '') {
- $('#realname')[0].focus()
- tools.initTips('请输入负责人姓名', 'right', $('#realname')[0], 2000)
- return false;
- }
-
- let array = []
- $('#cupload-5').find('input').each(function() {
- if($(this).val()!=''){
- array.push($(this).val())
- }
- });
- if(array.length<1){
- $('#cupload-5')[0].focus()
- tools.initTips('请上传相关附件', 'right', $('#cupload-5')[0], 2000)
- return false;
- }
-
- let array6 = []
- $('#cupload-6').find('input').each(function() {
- if($(this).val()!=''){
- array6.push($(this).val())
- }
- });
- if(array6.length<1){
- $('#cupload-6')[0].focus()
- tools.initTips('请上传法人证件照', 'right', $('#cupload-6')[0], 2000)
- return false;
- }
-
- data['accountOpenCert'] = accountOpenCert;
- data['companyName'] = companyName;
- data['idCardNum'] = idCardNum;
- data['realname'] = realname;
- data['companyCode'] = companyCode;
- data['companyName'] = companyName;
- data['companyNature'] = companyNature;
- data['companyScope'] = companyScope;
- data['companyTimeLimit'] = companyTimeLimit;
- data['companySetupTime'] = companySetupTime;
- data['companyCapital'] = companyCapital;
- data['companyLicense'] = companyLicense;
- data['address'] = address;
- data['idCardPic'] = idCardPic;
-
- tools.setCookie('userName',realname,24 * 60 * 60)
- tools.setCookie('idCardNum',idCardNum,24 * 60 * 60)
- tools.setCookie('address',address,24 * 60 * 60)
- // upLoadAction('user');
- }
- if(type == 'user'){
- //个人用户信息
- var userFormRealName = $('#userFormRealName').val();
- var userFormIdCard = $('#userFormIdCard').val();
- var userFormAddress = $('#userFormAddress').val();
- var idCardPic = module.data.sfz;
- var accountOpenCert = module.data.yhk;
-
- if (userFormRealName == '') {
- $('#userFormRealName')[0].focus()
- tools.initTips('请输入姓名', 'right', $('#userFormRealName')[0], 2000)
- return false;
- }
-
- if (userFormIdCard == '') {
- $('#userFormIdCard')[0].focus()
- tools.initTips('请输入身份证号码', 'right', $('#userFormIdCard')[0], 2000)
- return false;
- }
-
- let array = []
- $('#cupload-3').find('input').each(function() {
- if($(this).val()!=''){
- array.push($(this).val())
- }
- });
- if(array.length<1){
- $('#cupload-3')[0].focus()
- tools.initTips('请上传身份证', 'right', $('#cupload-3')[0], 2000)
- return false;
- }
-
- let array2 = []
- $('#cupload-4').find('input').each(function() {
- if($(this).val()!=''){
- array2.push($(this).val())
- }
- });
- if(array2.length<1){
- $('#cupload-4')[0].focus()
- tools.initTips('请上传银行卡', 'right', $('#cupload-4')[0], 2000)
- return false;
- }
-
- data['idCardPic'] = idCardPic;
- data['accountOpenCert'] = accountOpenCert;
- data['idCardNum'] = userFormIdCard;
- data['realname'] = userFormRealName;
- data['address'] = userFormAddress;
-
- tools.setCookie('userName',userFormRealName,24 * 60 * 60)
- tools.setCookie('idCardNum',userFormIdCard,24 * 60 * 60)
- tools.setCookie('address',userFormAddress,24 * 60 * 60)
- // upLoadAction('user');
- }
- if(type == 'bank'){
-
- //银行卡信息
- var bankCardName = $('#bankCardName').val();
- var bankCardNum = $('#bankCardNum').val();
- var bankAddress = $('#bankAddress').val();
- var bankType = $('#bankType').val();
- var accountType = $('#accountType').val();
- var payeePaymentLines = $('#payeePaymentLines').val();
-
- if (bankCardName == '') {
- $('#bankCardName')[0].focus()
- tools.initTips('请输入开户姓名', 'right', $('#bankCardName')[0], 2000)
- return false;
- }
-
- if (bankCardNum == '') {
- $('#bankCardNum')[0].focus()
- tools.initTips('请输入开户账号', 'right', $('#bankCardNum')[0], 2000)
- return false;
- }
-
- if (bankType == '') {
- $('#bankType')[0].focus()
- tools.initTips('请选择所属银行', 'right', $('#bankType')[0], 2000)
- return false;
- }
-
- if (bankAddress == '') {
- $('#bankAddress')[0].focus()
- tools.initTips('请选择开户银行', 'right', $('#bankAddress')[0], 2000)
- return false;
- }
-
- if (payeePaymentLines == '') {
- $('#payeePaymentLines')[0].focus()
- tools.initTips('请输入联行号', 'right', $('#payeePaymentLines')[0], 2000)
- return false;
- }
- data['bankCardName'] = bankCardName;
- data['bankCardNum'] = bankCardNum;
- data['bankAddress'] = bankAddress;
- data['bankType'] = bankType;
- data['accountType'] = accountType;
- data['payeePaymentLines'] = payeePaymentLines;
- tools.setCookie('bankCardName',bankCardName,24 * 60 * 60)
- tools.setCookie('bankCardNum',bankCardNum,24 * 60 * 60)
- tools.setCookie('bankAddress',bankAddress,24 * 60 * 60)
- tools.setCookie('bankType',bankType,24 * 60 * 60)
- tools.setCookie('accountType',accountType,24 * 60 * 60)
- tools.setCookie('payeePaymentLines',payeePaymentLines,24 * 60 * 60)
- }
- //data['password'] = password;
- data['id'] = module.data.memberId;
-
- tools.doPost(userUpdate, data, module.Tips)
- }
-
- editPassword = function(){
- var data = {};
- if(module.passWordCompare()){
- var oldPassWord = $('#originalPassWord').val();
- var newPassWord = $('#newPassWord').val();
- data['oldPassword'] = oldPassWord;
- data['newPassword'] = newPassWord;
- tools.doPost(updatePwd, data, module.Tips)
- }
- }
-
- //手动验证密码是否一致
- module.passWordCompare = function(){
- var newPassword = $('#newPassWord').val();
- var determinePassWord = $('#determinePassWord').val();
- var originalPassWord = $('#originalPassWord').val();
- /*原密码*/
- if (originalPassWord == '') {
- $('#originalPassWord')[0].focus()
- tools.initTips('请输入原密码', 'right', $('#originalPassWord')[0], 2000)
- return false;
- }
- /* 新密码 */
- if (newPassword == '') {
- $('#newPassWord')[0].focus()
- tools.initTips('请输入新密码', 'right', $('#newPassWord')[0], 2000)
- return false;
- }
- /* 确认密码 */
- if (determinePassWord == '') {
- $('#determinePassWord')[0].focus()
- tools.initTips('请确认密码', 'right', $('#determinePassWord')[0], 2000)
- return false;
- }
- return true;
- }
-
- //发布供求
- module.supplyAction = function (){
- var data = {};
- if(module.supplyCheck()){
- //供求信息
- var demandType = $('#demandType').val();
- var projectName = $('#projectName').val();
- var location = $('#location').val();
- var projectRealName = $('#projectRealName').val();
- var projectPhone = $('#projectPhone').val();
- var projectContent = $('#projectContent').val();
- var logintime = tools.getNowFormatDate();
-
- //console.log(demandType);
- data['projectName'] = projectName;
- data['location'] = location;
- data['realname'] = projectRealName;
- data['phone'] = projectPhone;
- data['projectContent'] = projectContent;
- data['logintime'] = logintime;
- data['supplyDemandType'] = demandType;
- data['deptId'] = 100;
-
- data['memberId'] = module.data.memberId;
-
- if(module.data.supplyType == 'edit'){
- data['id'] = module.data.supplyId;
- tools.doPost(userEdit, data, module.getData)
- }else{
- tools.doPost(userDemand, data, module.getData)
- }
-
- }
- }
-
- //发布咨询
- module.releaseAction = function (){
- var data = {};
- if(module.releaseCheck()){
- //供求信息
- var title = $('#title').val();
- var releaseContent = $('#releaseContent').val();
- var releaseRealName = $('#releaseRealName').val();
- var releasePhone = $('#releasePhone').val();
- var logintime = tools.getNowFormatDate();
-
- data['title'] = title;
- data['content'] = releaseContent;
- data['realname'] = releaseRealName;
- data['phone'] = releasePhone;
- data['logintime'] = logintime;
- data['deptId'] = 100;
- data['memberId'] = module.data.memberId;
-
- tools.doPost(userCommunicate, data, module.releaseActionYes)
- }
- }
- module.releaseActionYes = function(data){
- tools.initError(data.msg);
- setTimeout(function(){
- tools.doGet(userConsulting, {memberId:module.data.memberId,pageNum:module.data.pageNum,pageSize:module.data.pageSize}, module.consulting);
- document.getElementById('consultingInformation').style.display = "block";
- document.getElementById('release').style.display = "none";
- $('#title').val('');
- $('#releaseContent').val('');
- $('#releaseRealName').val('');
- $('#releasePhone').val('');
- },2000)
-
- }
- module.Tips = function(data){
-
- tools.initError(data.msg);
- }
-
- //手动验证表单
- module.check = function () {
- var usernameVal = $('#username').val();
- var passwordVal = $('#password').val();
- var codeVal = $('#code').val();
- /* 手机号 */
- if (usernameVal == '') {
- $('#username')[0].focus()
- tools.initTips('请输入用户名', 'right', $('#username')[0], 2000)
- return false;
- }
- /* 密码 */
- if (passwordVal == '') {
- $('#password')[0].focus()
- tools.initTips('请输入密码', 'right', $('#password')[0], 2000)
- return false;
- } else if (parseInt(passwordVal.length) < 6 || parseInt(passwordVal.length) > 18) {
- $('#password')[0].focus()
- tools.initTips('请输入正确格式密码', 'right', $('#password')[0], 2000)
- return false;
- }
- /*图形验证码*/
- if (module.uuid == '' || codeVal == '') {
- $('#code')[0].focus()
- tools.initTips('请输入图形验证码', 'right', $('#code')[0], 2000)
- return false;
- }
- return true;
- }
-
- module.supplyCheck = function () {
- var projectName = $('#projectName').val();
- var location = $('#location').val();
- var projectRealName = $('#projectRealName').val();
- var projectPhone = $('#projectPhone').val();
- var projectContent = $('#projectContent').val();
- if (projectName == '') {
- $('#projectName')[0].focus()
- tools.initTips('请输入项目名称', 'right', $('#projectName')[0], 2000)
- return false;
- }
- if (location == '') {
- $('#location')[0].focus()
- tools.initTips('请输入项目地址', 'right', $('#location')[0], 2000)
- return false;
- }
- if (projectRealName == '') {
- $('#projectRealName')[0].focus()
- tools.initTips('请输入姓名', 'right', $('#projectRealName')[0], 2000)
- return false;
- }
- if (projectPhone == '') {
- $('#projectPhone')[0].focus()
- tools.initTips('请输入联系电话', 'right', $('#projectPhone')[0], 2000)
- return false;
- }
- if (projectContent == '') {
- $('#projectContent')[0].focus()
- tools.initTips('请输入项目详情', 'right', $('#projectContent')[0], 2000)
- return false;
- }
- return true;
- }
-
- module.releaseCheck = function () {
- var title = $('#title').val();
- var releaseContent = $('#releaseContent').val();
- var releaseRealName = $('#releaseRealName').val();
- var releasePhone = $('#releasePhone').val();
- if (title == '') {
- $('#title')[0].focus()
- tools.initTips('请输入标题', 'right', $('#title')[0], 2000)
- return false;
- }
- if (releaseContent == '') {
- $('#releaseContent')[0].focus()
- tools.initTips('请输入咨询内容', 'right', $('#releaseContent')[0], 2000)
- return false;
- }
- if (releaseRealName == '') {
- $('#releaseRealName')[0].focus()
- tools.initTips('请输入姓名', 'right', $('#releaseRealName')[0], 2000)
- return false;
- }
- if (releasePhone == '') {
- $('#releasePhone')[0].focus()
- tools.initTips('请输入联系电话', 'right', $('#releasePhone')[0], 2000)
- return false;
- }
- return true;
- }
-
- //个人中心选项卡鼠标悬浮
- module.userListHover = function(){
- document.getElementById('icon-list1').onmouseout = function(){
- document.getElementById('icon1').src = '../../static/images/user_index_icon1.png'
- }
- document.getElementById('icon-list1').onmouseover = function(){
- if(themeColor == 'red'){
- document.getElementById('icon1').src = '../../static/images/user_index_icon5_red.png'
- }else if(themeColor == 'green'){
- document.getElementById('icon1').src = '../../static/images/user_index_icon5.png'
- }
- }
-
- document.getElementById('icon-list2').onmouseout = function(){
- document.getElementById('icon2').src = '../../static/images/user_index_icon2.png'
- }
- document.getElementById('icon-list2').onmouseover = function(){
- if(themeColor == 'red'){
- document.getElementById('icon2').src = '../../static/images/user_index_icon6_red.png'
- }else if(themeColor == 'green') {
- document.getElementById('icon2').src = '../../static/images/user_index_icon6.png'
- }
- }
-
- document.getElementById('icon-list3').onmouseout = function(){
- document.getElementById('icon3').src = '../../static/images/user_index_icon3.png'
- }
- document.getElementById('icon-list3').onmouseover = function(){
- if(themeColor == 'red'){
- document.getElementById('icon3').src = '../../static/images/user_index_icon7_red.png'
- }else if(themeColor == 'green') {
- document.getElementById('icon3').src = '../../static/images/user_index_icon7.png'
- }
- }
-
- document.getElementById('icon-list4').onmouseout = function(){
- document.getElementById('icon4').src = '../../static/images/user_index_icon4.png'
- }
- document.getElementById('icon-list4').onmouseover = function(){
- if(themeColor == 'red'){
- document.getElementById('icon4').src = '../../static/images/user_index_icon8_red.png'
- }else if(themeColor == 'green') {
- document.getElementById('icon4').src = '../../static/images/user_index_icon8.png'
- }
- }
-
-
- }
-
- goSearch = function () {
- var searchTitle = $('#searchTitle').val();
- var searchContent = $('#searchContent').val();
- //console.log(searchTitle)
- module.data.searchType = 'YES';
- tools.doGet(userConsulting,{title:searchTitle,content:searchContent,memberId:module.data.memberId,pageNum:module.data.pageNum,pageSize:module.data.pageSize},module.consulting);
- }
-
- selectUserSupply = function(ids) {
- module.data.supplyType = 'edit';
- module.data.supplyId = ids;
-
- //console.log('点击修改')
- tools.doGet(selectSupply + '/' + ids, {}, module.selectSupplyDetail);//memberType 1个人 2单位
- }
- module.selectSupplyDetail = function(data){
- console.log('进入修改供求')
- document.getElementById('supplyInformation').style.display = "none";
- document.getElementById('releaseSupply').style.display = "block";
-
- var content = data.data
-
- $('#demandType').val(content.supplyDemandType);
- $('#projectName').val(content.projectName);
- $('#location').val(content.location);
- $('#projectRealName').val(content.realname);
- $('#projectPhone').val(content.phone);
- $('#projectContent').val(content.projectContent);
-
- tools.doGet(supplyDemandImg+'/'+content.id, {}, module.showSupplyImage);
- }
-
- goProject = function(id){
- tools.skip('../listingItems/itemsDetail.html?id='+id)
- }
-
- return module;
- });
|