// 模板字符串 // var temp = ` //
//
//
//
//
//
// // //
//
基本信息
//
//
// // // // //
//
// // // //
//
// // // //
//
// // // @@codeText@@ // // //
//
//
//
//
公司信息
//
//
// // // // //
//
//
//
//
// // // // // // // // // // // //
//
// // // // // // //
//
// // // // // // //
//
//
//
// // 温馨提示:请提供准确的信息,我们将为您推荐更准确、更个性化的商机和服务 //
// //
//
//
//
// //
//
//
//
// //
//
您可以通过剑鱼标讯提供的全国招投标数据自助导出功能,指定关键词、发布时间、地区或行业等筛选条件,以Excel表格的形式打包下载,精准获取所需数据。
// //
//
//
// ` var temp = "\n
\n
\n
\n
\n
\n
\n \n \n
\n
\u57FA\u672C\u4FE1\u606F
\n
\n
\n \n \n \n \n
\n
\n \n \n \n
\n
\n \n \n \n
\n
\n \n \n @@codeText@@\n \n \n
\n
\n
\n
\n
\u516C\u53F8\u4FE1\u606F
\n
\n
\n \n \n \n \n
\n
\n
\n
\n
\n \n \n \n \n \n \n \n \n \n \n \n
\n
\n \n \n \n \n \n \n
\n
\n \n \n \n \n \n \n
\n
\n
\n
\n \n \u6E29\u99A8\u63D0\u793A\uFF1A\u8BF7\u63D0\u4F9B\u51C6\u786E\u7684\u4FE1\u606F\uFF0C\u6211\u4EEC\u5C06\u4E3A\u60A8\u63A8\u8350\u66F4\u51C6\u786E\u3001\u66F4\u4E2A\u6027\u5316\u7684\u5546\u673A\u548C\u670D\u52A1\n
\n
\n \u6682\u4E0D\u63D0\u4F9B\n \u63D0\u4EA4\n
\n
\n
\n
\n
\n
\n
\n
\n
\u63D0\u4EA4\u6210\u529F
\n
\u6211\u4EEC\u7684\u5BA2\u6237\u7ECF\u7406\u4F1A\u572824\u5C0F\u65F6\u5185\u5C3D\u5FEB\u4E0E\u60A8\u8054\u7CFB\u3002
\n
\u6211\u4EEC\u7A0D\u540E\u5C06\u4EE5\u90AE\u4EF6\u7684\u5F62\u5F0F\u53D1\u9001\u6570\u636E\u6837\u4F8B\u3002
\n
\n \n
\n
\n \n
\n
\n
\n
\n
\n
\n
\n \n
\n
\u60A8\u53EF\u4EE5\u901A\u8FC7\u5251\u9C7C\u6807\u8BAF\u63D0\u4F9B\u7684\u5168\u56FD\u62DB\u6295\u6807\u6570\u636E\u81EA\u52A9\u5BFC\u51FA\u529F\u80FD\uFF0C\u6307\u5B9A\u5173\u952E\u8BCD\u3001\u53D1\u5E03\u65F6\u95F4\u3001\u5730\u533A\u6216\u884C\u4E1A\u7B49\u7B5B\u9009\u6761\u4EF6\uFF0C\u4EE5Excel\u8868\u683C\u7684\u5F62\u5F0F\u6253\u5305\u4E0B\u8F7D\uFF0C\u7CBE\u51C6\u83B7\u53D6\u6240\u9700\u6570\u636E\u3002
\n
\n \n
\n
\n
\n
\n "; var jobJson = [ '总裁', '总经理', '总监', '经理', '主管', '职员' ] var branchJson = [ '市场', '产品', '销售', '渠道', '其他' ] var jobData = jobJson.map(function (item) { return { value: item, label: item } }) // 防抖 function debounce(fn, delay) { var timer return function () { var context = this var args = arguments clearTimeout(timer) timer = setTimeout(function () { fn.apply(context, args) }, delay) } } // 部门数据处理 var branchData = branchJson.map(function(item) { return { value: item, label: item } }) var vm = new Vue({ el: '#vue-collect-user-info', delimiters: ['@@', '@@'], props: ['type'], template: temp, data: function () { var validName = function(rule,value,callback) { if(value === '') { return callback(new Error('姓名为必填项')); } else { if (value.length < 2) { return callback(new Error('姓名填写不正确')); } callback(); } } var validPhone = function(rule,value,callback) { var status = /^1[3-9]\d{9}$/.test(value) if(value === '') { return callback(new Error('手机号为必填项')); } else if (!status) { return callback(new Error('手机号填写不正确')); } else { callback(); } } var validCode = function(rule,value,callback) { var status = /\d{6}/.test(value) if(value === '') { return callback(new Error('短信验证码为必填项')); } else if (!status) { return callback(new Error('验证码格式不正确')); } else { setTimeout(function() { if (!vm.codeStatus) { return callback(new Error('短信验证码不正确')); } else { callback(); } }, 500) } } var validEmail = function(rule,value,callback) { var status = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/.test(value) if (value === '') { return callback(new Error('邮箱为必填项')); } else { if (!status) { return callback(new Error('邮箱填写不正确')); } else { callback(); } } } var validCompany = function(rule,value,callback) { if (value === '') { return callback(new Error('公司名称为必填项')); } else { if (value.length < 2) { return callback(new Error('公司名称至少输入2个字')); } else { callback(); } } } var validComType = function(rule,value,callback) { if (value.length === 0) { return callback(new Error('公司类型为必填项')); } else { callback(); } } var validJob = function(rule,value,callback) { if(value === '') { return callback(new Error('职位为必填项')); return callback(); } else { if (value === '其他' && vm.form.otherJob === '') { return callback(); } else { callback(); } } } var validBranch = function(rule,value,callback) { if(value === '') { return callback(new Error('请选择部门')); } else { callback(); } } return { dialogTitle: '为给您匹配精准的推荐信息,请完善个人信息', jobData: jobData, // 职位数据 branchData: branchData, form: { oldPhone: '', // 带出来的手机号,用于判断是否需要短信验证码 name: '', // 姓名 phone: '', // 手机号 mail: '', // 邮箱 code: '', // 短信验证码 companyName: '', // 公司名称 companyType: [], // 公司类型 job: '', // 职位值 otherJob: '', //自定义职位 branch: '' }, codeText: '获取验证码', sendCodeBtn: false, countdown: 0, codeStatus: true, rules: { name: [ { required: true, validator: validName, trigger: 'blur' } ], phone: [ { required: true, validator: validPhone, trigger: 'blur' } ], mail: [ { required: true, validator: validEmail, trigger: 'blur' } ], code: [ { required: true, validator: validCode, message: '', trigger: 'blur' } ], companyName: [ { required: true, validator: validCompany, trigger: 'blur' } ], companyType: [ { required: true, validator: validComType, trigger: 'blur' } ], job: [ { required: true, validator: validJob, trigger: 'blur' } ], branch: [ { required: true, trigger: 'blur', validator: validBranch, message: '' } ], }, showSearchResult: false, companyList: [], showForm: false, // 显示表单填写弹框 showSuccess: false, // 显示提交成功弹框 showExport: false, isForce: false, // 是否强制 source: '', // 来源模块 interest: '', // 感兴趣内容 moduleShow: { name: true, phone: true, mail: true, code: false, companyName: true, companyType: true, job: true, branch: false } } }, computed: { showOtherJob: function() { return this.form.job == '其他' }, showCode: function () { return (this.form.phone !== this.form.oldPhone && this.form.phone.length === 11) || !this.form.oldPhone }, defaultSource: function() { // 默认提交成功不显示广告图和邮箱文案 如果是结构化数据则显示 var noEmailSource = ['structedData', 'pc_data_custom_export'] return noEmailSource.indexOf(this.source) === -1 }, showBranch: function () { // 切换到总裁或总经理之后 把之前选择的部门清空 if (this.form.job.indexOf('总裁') > -1 || this.form.job.indexOf('总经理') > -1) { this.form.branch = '' } var zc = this.form.job.indexOf('总裁') > -1 var zjl = this.form.job.indexOf('总经理') > -1 return !(zc || zjl) && this.form.job } }, mounted: function() { var that = this; $(document).on('click', function (e) { let dom = $('.company-name')[0]; if (dom) { // 如果点击的区域不在自定义dom范围 if (!dom.contains((e.target))) { that.showSearchResult = false } } }) // $(window).on('resize', this.changeTop) }, beforeDestroy: function() { $(document).off('click') }, methods: { getModules: function () { var source = this.source switch (source) { case 'pc_supermarket_Noresults_customization': case 'pc_market_ApplicationScenario': case 'pc_supermarket_details_customization': case 'pc_supermarket_details_buy': { this.hideModule(['mail']) break; } default: this.hideModule() break; } }, hideModule: function (keys) { if (!keys) return var hideType = keys for (var k in this.moduleShow) { if (hideType.indexOf(k) !== -1) { this.moduleShow[k] = false } } }, // changeTop: function () { // this.$nextTick(function () { // var dialogDom = $('#collectUserInfoDialog .dialog-container') // var diffHeight = window.innerHeight - dialogDom.height() - 240 // if (diffHeight < 0) { // dialogDom.css('margin-top', diffHeight.toString() + 'px') // } // }) // }, nameFocus:function(){ this.$refs['ruleForm'].clearValidate(['name']); }, phoneFocus:function(){ this.$refs['ruleForm'].clearValidate(['phone']); }, mailFocus:function(){ this.$refs['ruleForm'].clearValidate(['mail']); }, codeFocus: function() { this.$refs['ruleForm'].clearValidate(['code']); }, // 公司名称获取焦点时 companyFocus: function() { this.$refs['ruleForm'].clearValidate(['companyName']); this.getResult(this.form.companyName) }, otherFocus:function() { this.$refs['ruleForm'].clearValidate(['job','otherJob']); }, // 发送验证码 sendCode: function() { var status = /^1[3-9]\d{9}$/.test(this.form.phone) var _this = this if (!status) return $.ajax({ type:'POST', url:'/salesLeads/sendMsg', data: { phoneNum: _this.form.phone }, success:function (res) { if (res.data && res.data.success) { _this.sendCodeBtn = true _this.countdown = 60 _this.codeText = '重新获取' + _this.countdown + 's' var timeInt = setInterval(function() { _this.countdown-- _this.codeText = '重新获取' + _this.countdown + 's' if (_this.countdown <= 0) { _this.sendCodeBtn = false _this.codeText = '获取验证码' window.clearInterval(timeInt) } }, 1000) } else { _this.$message.error('短信验证码发送失败'); } } }) }, // 校验验证码 checkCode: function(val) { var _this = this if (val.length !== 6) return $.ajax({ type:'POST', url:'/salesLeads/checkCode', data: { code: _this.form.code, phoneNum: _this.form.phone }, success:function (res) { if (res.data && res.data.flag) { _this.$message.success('验证成功') _this.codeStatus = true } else { _this.codeStatus = false } } }) }, // 日志统计 logAjax: function(source) { $.ajax({ type:'POST', url:'/front/portraitClassify?source=' + source, success:function (res) { console.log(res) } }) }, // 是否留资 isNeedSubmit: function(source, callback, interest) { if (!loginflag) { openLoginDig() return } this.source = source this.interest = interest this.logAjax(source) var _this = this $.ajax({ type:'GET', url:'/salesLeads/retainedCapital', data: { source: source }, success:function (res) { // 判断当前信息否在其他页面留资 如果全部留资 直接弹窗提交成功 var checkKeys = [] var requireMail = ['structedData', 'pc_data_custom_export', 'pc_data_custom_data'] if (requireMail.indexOf(_this.source) > -1) { checkKeys = ['name', 'phone', 'company', 'mail', 'branch', 'position', 'companyType'] } else { checkKeys = ['name', 'phone', 'company', 'branch', 'position', 'companyType'] } var result = checkRequiredKeys(checkKeys, res.info) res.info.interest = interest _this.showForm = true // 当前头部背景图 _this.isSelfHeader() if (res.info) { echoRequiredValues(_this.form, res.info, ['name', 'phone', 'mail', 'branch']) // 原有赋值回显逻辑 _this.form.oldPhone = res.info.phone ? res.info.phone : '' _this.form.companyName = res.info.company ? res.info.company : '' _this.form.companyType = res.info.companyType ? res.info.companyType.split(',') : [] if (res.info.position) { if (jobJson.indexOf(res.info.position) == -1) { _this.form.job = '' _this.form.otherJob = '' } else { _this.form.job = res.info.position } } else { _this.form.job = '' } } // if (result) { // callback && callback() // _this.formAjax(_this.source, res.info) // } else if (res.data) { // _this.isForce = res.data.fource // if (res.data.retainedCapital) { // _this.showForm = true // // 当前头部背景图 // _this.isSelfHeader() // // _this.changeTop() // if (res.info) { // echoRequiredValues(_this.form, res.info, ['name', 'phone', 'mail', 'branch']) // // 原有赋值回显逻辑 // _this.form.oldPhone = res.info.phone ? res.info.phone : '' // _this.form.companyName = res.info.company ? res.info.company : '' // _this.form.companyType = res.info.companyType ? res.info.companyType.split(',') : [] // if (res.info.position) { // if (jobJson.indexOf(res.info.position) == -1) { // // _this.form.job = '其他' // // _this.form.otherJob = res.data.position.replace('其他/', '') // _this.form.job = '' // _this.form.otherJob = '' // } else { // _this.form.job = res.info.position // } // } else { // _this.form.job = '' // } // } // } else { // callback && callback() // // 缺陷出现场景为:在其他页面留过资,但没有邮箱信息(user表也没有存邮箱字段),当前source也已留过资(是否需要留资字段返回为false) // // 如出现改场景 则会一直提交(更新)不了留资信息, 引次此处也需要再次提交 // // _this.formAjax(_this.source, res.info) // } // } } }) }, // 自定义弹窗头部 isSelfHeader: function(){ var imgUrl = '/common-module/pc-dialog/image/structed-title.png' var custom_export = this.source.indexOf('custom_export') > -1 var custom_data = this.source.indexOf('custom_data') > -1 var api_interface = this.source.indexOf('api_interface') > -1 // 数据超市source var marketNoResult = this.source.indexOf('pc_supermarket_Noresults_customization') > -1 // 数据超市列表无数据-申请定制 var marketApplicationScenario = this.source.indexOf('pc_market_ApplicationScenario') > -1 // 数据市场落地页-大数据服务应用场景-立即咨询 var marketBuy = this.source.indexOf('pc_supermarket_details_buy') > -1 // 数据超市详情页-申请购买 var marketDetailCustom = this.source.indexOf('pc_supermarket_details_customization') > -1 // 数据超市详情页-申请定制 if (custom_export || custom_data || marketNoResult || marketDetailCustom) { imgUrl = '/common-module/pc-dialog/image/leave-title-custom.png' } else if (api_interface) { imgUrl = '/common-module/pc-dialog/image/leave-title-api.png' } else if (marketApplicationScenario) { imgUrl = '/common-module/pc-dialog/image/data-supermarket-contact.png' } else if (marketBuy) { imgUrl = '/common-module/pc-dialog/image/data-supermarket-buy.png' } this.getModules() this.$nextTick(function(){ $('#collectUserInfoDialog .dialog-header').css('background-image', 'url(' + imgUrl + ')') }) }, // 表单提交事件 submitForm: function(formName) { var _this = this this.$refs[formName].validate(function (valid) { if (valid) { _this.formAjax(_this.source) } else { console.log('error submit!!'); return false; } }); }, // 表单提交请求 formAjax: function(source, info) { var params = { source: source, name: this.form.name, phone: this.form.phone, mail: this.form.mail, company: this.form.companyName, // 公司名称 companyType: this.form.companyType.join(','), position: this.form.job == '其他' ? this.form.job + '/' + this.form.otherJob : this.form.job, code: this.form.code, agree: true, // 原来留资模块的同意协议字段,,,默认传一个true 方便后端处理 branch: this.form.branch.indexOf('总裁') > -1 || this.form.branch.indexOf('总经理') > -1 || !this.form.job ? '' : this.form.branch, interest: this.interest } if (info) { params = info params.source = source params.interest = info.interest // 感兴趣内容 } var _this = this $.ajax({ type:'POST', url: '/salesLeads/collectInfo', contentType: "application/json;charset=utf-8", data: JSON.stringify(params), success:function (res) { if (res.data) { _this.showForm = false _this.showSuccess = true } else { _this.$message.error(res.error_msg); } } }) }, // 手机号输入框input事件 inputPhone: function(val) { this.form.phone = val.replace(/[^\d]/g,'') }, // 企业名称联想 getResult:function(name) { // 名称为空或长度小于2不发请求 if (!name || name.length < 2) return var _this = this $.ajax({ type:'POST', url:'/jypay/user/company/association', data: { name: name, companyCount:10 }, heads : { 'content-type': 'application/x-www-form-urlencoded' }, success:function (res) { console.log(res) if (res.data && res.data.length > 0) { var result = [] res.data.map(function(item){ item = _this.brightKeyword(item) result.push(item) return result }) _this.companyList = result _this.showSearchResult = true } } }) }, searchCompany: debounce(function(val){ if(val === '') { this.showSearchResult = false} this.getResult(val) }, 600), // 选择联想出来的公司名称 selectCompany: function(item) { this.form.companyName = item.replace(/<.*?>/ig, '') this.showSearchResult = false }, // 关键词高亮 brightKeyword: function (val) { var name = this.form.companyName if (val.indexOf(name) !== -1) { return val.replace(name, "" + name + "") } else { return val } }, // 暂不提供 cancelForm: function() { this.form.name = '' this.form.phone = '' this.form.mail = '' this.form.companyName = '' this.form.job = '' this.form.otherJob = '' this.form.code = '' var needExportSource = ['structedData', 'pc_data_custom_export', 'pc_data_custom_data'] if (needExportSource.indexOf(this.source) > -1) { this.showForm = false this.showExport = true } else { this.showForm = false } this.showSearchResult=false }, // 数据导出 dataExport: function() { location.href = "/front/dataExport/toSieve" } } })