Sfoglia il codice sorgente

feat: 结构化数据pc留资弹框封装

yangfeng 4 anni fa
parent
commit
6a1e96becc

+ 380 - 0
src/web/staticres/common-module/pc-dialog/css/leave-info-dialog.css

@@ -0,0 +1,380 @@
+.fl{
+  float: left;
+}
+.fr{
+  float: right;
+}
+/* 滚动条样式 */
+.user-data-dialog ::-webkit-scrollbar {
+  /*滚动条整体样式*/
+  width: 6px;
+  height: 1px;
+}
+.user-data-dialog ::-webkit-scrollbar-thumb {
+  /*滚动条里面小方块*/
+  border-radius: 10px;
+  background: #e0e0e0;
+}
+.user-data-dialog ::-webkit-scrollbar-track {
+  /*滚动条里面轨道*/
+  box-shadow: inset 0 0 5px #fff;
+  border-radius: 10px;
+  background: transparent;
+}
+#collectUserInfoDialog .mask{
+  position: fixed;
+  width: 100%;
+  height: 100%;
+  top: 0;
+  left: 0;
+  right: 0;
+  bottom: 0;
+  background: #000000;
+  opacity: 0.6;
+  z-index: 999;
+}
+#collectUserInfoDialog .dialog-container{
+  position: fixed;
+  left: 50%;
+  top: 50%;
+  width: 752px;
+  max-height: 680px;
+  margin: 0 auto;
+  /* padding: 32px; */
+  background: #fff;
+  border-radius: 8px;
+  transform: translate(-50%,-50%);
+  z-index: 1000;
+  box-sizing: border-box;
+  /* overflow-y: auto; */
+}
+#collectUserInfoDialog .dialog-header{
+  margin-top: -120px;
+  height: 253px;
+  color: #1D1D1D;
+  font-size: 18px;
+  line-height: 28px;
+  text-align: center;
+  background: url('/common-module/pc-dialog/image/structed-title.png?v={{Msg "seo" "version"}}') no-repeat top center;
+  background-size: 100% 253px;
+}
+#collectUserInfoDialog .dialog-content{
+  /* margin-top: 20px; */
+  padding: 0 32px 32px;
+}
+#collectUserInfoDialog .form-title{
+  font-size: 14px;
+  line-height: 22px;
+  color: #2CB7CA;
+}
+#collectUserInfoDialog .form-main{
+  margin: 10px 0 14px;
+}
+#collectUserInfoDialog .short-control{
+  width: calc(50% - 16px);
+}
+#collectUserInfoDialog .long-control{
+  width: 100%;
+}
+
+#collectUserInfoDialog .item-input{
+  width: calc(100% - 90px);
+}
+.code-input .el-input-group__append{
+  border: 0;
+  background-color: transparent;
+  padding: 0 0 0 14px;
+  cursor: pointer;
+  color: #2CB7CA;
+  text-align: center;
+}
+.code-input .el-button.is-disabled, 
+.code-input .el-button.is-disabled:focus, 
+.code-input .el-button.is-disabled:hover{
+  border: 0;
+  color: #C0C4CC;
+  background-color: transparent;
+}
+.code-input .el-input-group--append .el-input__inner{
+  border-top-right-radius: 4px;
+  border-bottom-right-radius: 4px;
+}
+#collectUserInfoDialog .company-result{
+  position: absolute;
+  width: calc(100% - 90px);
+  top: 38px;
+  left: 88px;
+  height: auto;
+  background-color: #fff;
+  border: 1px solid #2CB7CA;
+  z-index: 100;
+  border-radius: 4px;
+}
+#collectUserInfoDialog .company-list{
+  padding: 0 16px;
+  height: 30px;
+  line-height: 30px;
+  font-size: 14px;
+  color: #1D1D1D;
+  cursor: pointer;
+  text-overflow: ellipsis;
+  overflow: hidden;
+  white-space: nowrap;
+}
+#collectUserInfoDialog .company-list:hover{
+  background: #ECECEC;
+}
+#collectUserInfoDialog .short-input{
+  width: calc(50% - 90px);
+}
+#collectUserInfoDialog [data-short-input]{
+  /* width: calc(240px - 16px); */
+  /* height: 36px; */
+  /* box-sizing: border-box; */
+  /* border-radius: 4px; */
+}
+#collectUserInfoDialog [data-long-input]{
+  /* width: calc(600px - 16px); */
+  height: 36px;
+  border: 1px solid #E0E0E0;
+  box-sizing: border-box;
+  border-radius: 4px;
+}
+#collectUserInfoDialog .agree-service{
+  text-align: center;
+}
+#collectUserInfoDialog .agree-service .el-checkbox__label, 
+#collectUserInfoDialog .agree-service .el-checkbox__input.is-checked+.el-checkbox__label{
+  color: #686868;
+}
+#collectUserInfoDialog .dialog-footer{
+  padding-top: 20px;
+  text-align: center;
+}
+#collectUserInfoDialog .cancel-btn{
+  width: 132px;
+  height: 36px;
+  line-height: 36px;
+  padding: 0;
+  border-radius: 6px;
+}
+#collectUserInfoDialog .submit-btn{
+  width: 132px;
+  height: 36px;
+  padding: 0;
+  color: #fff;
+  line-height: 36px;
+  background: #2CB7CA;
+  border-radius: 6px;
+  border: 1px solid #2CB7CA;
+}
+#collectUserInfoDialog .submit-btn:hover{
+  color: #fff;
+  border-color: #2CB7CA;
+  background: #2CB7CA;
+}
+/* element-ui reset */
+#collectUserInfoDialog .company-type > .el-form-item__label,
+#collectUserInfoDialog .company-type > .el-form-item__content{
+  line-height: 22px;
+}
+.el-form-item{
+  margin-bottom: 14px;
+}
+.el-form-item__error{
+  padding: 0px 0 0 90px;
+  top: 98%;
+}
+.el-form-item__label{
+  width: 80px;
+  padding: 0;
+  margin-right: 8px;
+  color: #686868;
+  margin-bottom: 0!important;
+  font-weight: normal!important;
+}
+.el-cascader-panel{
+  min-width: 240px;
+}
+.el-cascader{
+  line-height: 36px;
+  border: 0;
+}
+#collectUserInfoDialog .el-input__inner{
+  height: 36px;
+  line-height: 36px;
+  border-radius: 4px;
+}
+.el-cascader-menu{
+  min-width: 0;
+}
+.el-cascader-node{
+  padding: 0 28px 0 6px;
+}
+.el-cascader-node__prefix{
+  display: none;
+}
+.el-cascader-menu:last-child{
+  flex: 1;
+}
+.el-cascader__dropdown{
+  border-color: #2CB7CA;
+}
+.el-select-dropdown{
+  border-color: #2CB7CA;
+}
+.el-popper[x-placement^=bottom]{
+  margin-top: 0;
+}
+.el-popper[x-placement^=bottom] .popper__arrow{
+  display: none;
+}
+.el-input.is-active .el-input__inner, 
+.el-input__inner:focus{
+  border-color: #2CB7CA;
+}
+.el-select .el-input.is-focus .el-input__inner,
+.el-select .el-input__inner:focus{
+  border-color: #2CB7CA;
+}
+.el-cascader .el-input .el-input__inner:focus, 
+.el-cascader .el-input.is-focus .el-input__inner {
+  border-color: #2CB7CA;
+}
+.el-checkbox__input.is-focus{
+  border-color: #2CB7CA;
+}
+.el-checkbox{
+  margin-right: 12px;
+}
+.el-checkbox__label{
+  padding-left: 3px;
+  color: #1D1D1D;
+}
+.el-checkbox__input.is-checked+.el-checkbox__label{
+  color: #1D1D1D;
+}
+.el-checkbox__input.is-checked .el-checkbox__inner, 
+.el-checkbox__input.is-indeterminate .el-checkbox__inner{
+  background-color: #2CB7CA;
+  border-color: #2CB7CA;
+}
+.el-checkbox__inner:hover{
+  border-color: #DCDFE6;
+}
+.el-cascader-node.in-active-path, .el-cascader-node.is-active, .el-cascader-node.is-selectable.in-checked-path,
+.el-select-dropdown__item.selected{
+  color: #2CB7CA;
+}
+.el-button:focus, .el-button:hover{
+  background: #FFF;
+  border: 1px solid #DCDFE6;
+  color: #606266;
+}
+.el-textarea__inner{
+  /* height: 36px; */
+  min-height: 36px!important;
+}
+
+
+#success-dialog .success-dialog-container{
+  position: fixed;
+  width: 380px;
+  top: 50%;
+  left: 50%;
+  padding: 20px;
+  transform: translateX(-50%) translateY(-50%);
+  background: #ffffff;
+  border-radius: 8px;
+  transition: all 2s linear;
+  z-index: 1038;
+}
+#success-dialog .success-title{
+  padding: 12px 0 20px;
+  color: #1d1d1d;
+  line-height: 28px;
+  font-size: 18px;
+  text-align: center;
+}
+#success-dialog .success-content{
+  text-align: center;
+  color: #686868;
+  line-height: 22px;
+  font-size: 14px;
+}
+#success-dialog .success-footer{
+  padding: 32px 0 12px;
+  text-align: center;
+}
+.mask {
+  position: fixed;
+  width: 100%;
+  height: 100%;
+  right: 0;
+  left: 0;
+  top: 0;
+  bottom: 0;
+  background: rgba(0, 0, 0, .5);
+  z-index: 1031;
+}
+
+#success-dialog .custom-btn{
+  display: inline-block;
+  width: 132px;
+  height: 36px;
+  line-height: 36px;
+  background: #2cb7ca;
+  border-radius: 6px;
+  text-align: center;
+  color: #fff;
+  font-size: 16px;
+  cursor: pointer;
+  border: 0;
+}
+#collect-dialog .custom-btn:disabled{
+  opacity: 0.5;
+  cursor:not-allowed;
+}
+.el-popper ul li{
+  float: none!important;
+}
+
+#export-dialog .export-dialog-container{
+  position: fixed;
+  width: 380px;
+  top: 50%;
+  left: 50%;
+  padding: 32px;
+  transform: translateX(-50%) translateY(-50%);
+  background: #ffffff;
+  border-radius: 8px;
+  transition: all 2s linear;
+  z-index: 1038;
+}
+#export-dialog .export-content{
+  text-align: justify;
+  color: #686868;
+  line-height: 22px;
+  font-size: 14px;
+}
+#export-dialog .export-footer{
+  padding: 32px 0 0;
+  text-align: center;
+}
+#export-dialog .custom-btn{
+  display: inline-block;
+  width: 132px;
+  height: 36px;
+  line-height: 36px;
+  background: #2cb7ca;
+  border-radius: 6px;
+  text-align: center;
+  color: #fff;
+  font-size: 16px;
+  cursor: pointer;
+  border: 0;
+}
+#export-dialog .custom-btn:disabled{
+  opacity: 0.5;
+  cursor:not-allowed;
+}

BIN
src/web/staticres/common-module/pc-dialog/image/structed-title.png


+ 539 - 0
src/web/staticres/common-module/pc-dialog/js/leave-info-dialog.js

@@ -0,0 +1,539 @@
+var temp = `
+  <div>
+    <div class="user-data-dialog" id="collectUserInfoDialog" v-if="showForm">
+      <div class="mask"></div>
+      <div class="dialog-container">
+        <div class="dialog-header"></div>
+        <div class="dialog-content">
+          <el-form class="user-form" :model="form" :rules="rules" ref="ruleForm">
+            <!-- 基本信息 -->
+            <div class="basic clearfix">
+              <div class="form-title">基本信息</div>
+              <div class="form-main clearfix">
+                <div class="short-control fl">
+                  <el-form-item label="姓名 :" prop="name">
+                    <el-input v-model.trim="form.name"  class="item-input" placeholder="请输入姓名" @focus="nameFocus" required>
+                    </el-input>
+                  </el-form-item>
+                </div>
+                <div class="short-control fr">
+                  <el-form-item label="邮箱 :" prop="mail">
+                    <el-input v-model.trim="form.mail"  class="item-input" placeholder="请输入邮箱" @focus="mailFocus"></el-input>
+                  </el-form-item>
+                </div>
+                <div class="short-control fl">
+                  <el-form-item label="手机号 :" prop="phone">
+                    <el-input v-model.trim="form.phone" maxlength="11" @input="inputPhone"  class="item-input" placeholder="请输入手机号" @focus="phoneFocus"></el-input>
+                  </el-form-item>
+                </div>
+                <div class="short-control fr" v-if="showCode">
+                  <el-form-item label="验证码 :" prop="code">
+                    <el-input v-model.trim="form.code" maxlength="6" @change="checkCode" class="item-input code-input" placeholder="请输入手机验证码" @focus="codeFocus">
+                      <el-button slot="append" :disabled="sendCodeBtn" @click="sendCode">@@codeText@@</el-button>
+                    </el-input>
+                  </el-form-item>
+                </div>
+              </div>
+            </div>
+            <div class="company clearfix">
+              <div class="form-title">公司信息</div>
+              <div class="form-main">
+                <div class="long-control" style="position: relative;">
+                  <el-form-item label="公司名称 :" prop="companyName">
+                    <el-input 
+                    v-model.trim="form.companyName" 
+                    data-long-input
+                    class="item-input company-name" 
+                    @focus="companyFocus"
+                    @input="searchCompany"
+                    placeholder="请输入公司名称">
+                    </el-input>
+                  </el-form-item>
+                  <div class="company-result" v-if="showSearchResult">
+                    <div class="company-list" v-for="item in companyList" :key="item" @click="selectCompany(item)" v-html="item"></div>
+                  </div>
+                </div>
+                <div class="long-control">
+                  <el-form-item label="职位 :" prop="job">
+                    <el-select v-model="form.job" placeholder="请选择职位"  class="item-input short-input" clearable>
+                      <el-option v-for="item in jobData" :key="item.value" :label="item.label" :value="item.value">
+                      </el-option>
+                    </el-select>
+                    <el-input 
+                    v-if="showOtherJob"
+                    v-model.trim="form.otherJob" 
+                    class="item-input short-input"
+                    @focus="otherFocus"
+                    placeholder="请输入职位名称">
+                    </el-input>
+                  </el-form-item>
+                </div>
+              </div>
+            </div>
+            <div class="dialog-footer">
+              <el-button class="cancel-btn" @click="cancelForm">暂不提供</el-button>
+              <el-button class="submit-btn" @click="submitForm('ruleForm')">提交</el-button>
+            </div>
+          </el-form>
+        </div>
+      </div>
+    </div>
+    <div id="success-dialog" style="display: none;" v-show="showSuccess">
+      <div class="mask"></div>
+      <div class="success-dialog-container">
+        <div class="success-title">提交成功</div>
+        <div class="success-content">我们的客户经理会在24小时内尽快与您联系。</div>
+        <div class="success-footer">
+          <button type="button" class="custom-btn go-know" @click="showSuccess = false">我知道了</button>
+        </div>
+      </div>
+    </div>
+    <div id="export-dialog" v-show="showExport">
+      <div class="mask"></div>
+      <div class="export-dialog-container">
+        <div class="export-title"></div>
+        <div class="export-content">您可以通过剑鱼标讯提供的全国招投标数据自助导出功能,指定关键词、发布时间、地区或行业等筛选条件,以Excel表格的形式打包下载,精准获取所需数据。</div>
+        <div class="export-footer">
+          <button type="button" class="custom-btn go-know" @click="dataExport">数据自动导出</button>
+        </div>
+      </div>
+    </div>
+  </div>
+  `
+var jobJson = [
+  '总裁/总经理/总监', 
+  '市场经理/主管',
+  '销售经理/主管',
+  '渠道经理/主管',
+  '投标经理/专员',
+  '采购经理/专员',
+  '数据分析师',
+  '招标师', 
+  '项目经理', 
+  '其他'
+]
+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 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[3456789]\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() {
+          console.log(vm.codeStatus, '111')
+          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 validJob = function(rule,value,callback) {
+      if(value === '') {
+        return callback(new Error('职位不能为空'));
+      } else {
+        if (value === '其他' && vm.form.otherJob === '') {
+          return callback(new Error('请输入职位'));
+        } else {
+          callback();
+        }
+      }
+    }
+    return {
+      dialogTitle: '为给您匹配精准的推荐信息,请完善个人信息',
+      jobData: jobData, // 职位数据
+      form: {
+        oldPhone: '', // 带出来的手机号,用于判断是否需要短信验证码
+        name: '', // 姓名
+        phone: '', // 手机号
+        mail: '', // 邮箱
+        code: '', // 短信验证码
+        companyName: '', // 公司名称
+        job: '', // 职位值
+        otherJob: '' //自定义职位
+      },
+      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'
+          }
+        ],
+        job: [
+          {
+            required: false,
+            validator: validJob
+          }
+        ]
+      },
+      showSearchResult: false,
+      companyList: [],
+      showForm: false,  // 显示表单填写弹框
+      showSuccess: false, // 显示提交成功弹框
+      showExport: false,
+      isForce: false, // 是否强制
+      source: '' // 来源模块
+    }
+  },
+  computed: {
+    showOtherJob: function() {
+      return this.form.job == '其他'
+    },
+    showCode: function () {
+      return this.form.phone !== this.form.oldPhone && this.form.phone.length === 11
+    }
+  },
+  mounted() {
+    var that = this;
+    $(document).on('click', function (e) {
+        let dom = $('.company-name')[0];
+        if (dom) {
+            // 如果点击的区域不在自定义dom范围
+            if (!dom.contains((e.target))) {
+              that.showSearchResult = false
+            }
+        } 
+    })
+  },
+  beforeDestroy() {
+    $(document).off('click')
+  },
+  methods: {
+    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[3456789]\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) {
+      console.log(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
+          }
+        }
+      })
+    },
+    // 是否留资
+    isNeedSubmit: function(source, callback, dom) {
+      this.source = source
+      var _this = this
+      $.ajax({
+        type:'POST',
+        url:'/salesLeads/retainedCapital',
+        data: {
+          source: source
+        },
+        success:function (res) {
+          if (res.data) {
+            if (res.data.retainedCapital) {
+              _this.showForm = true
+              _this.getOldInfo()
+            } else {
+              callback && callback()
+            }
+            _this.isForce = res.data.fource
+          }
+        }
+      })
+    },
+    // 表单提交事件
+    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) {
+      var params = {
+        source: source,
+        name: this.form.name,
+        phone: this.form.phone, 
+        mail: this.form.mail,
+        company: this.form.companyName, // 公司名称
+        position: this.form.job == '其他' ?  this.form.job + '/' + this.form.otherJob : this.form.job, 
+        code: this.form.code,
+        agree: true // 原来留资模块的同意协议字段,,,默认传一个true 方便后端处理
+      }
+      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,'')
+    },
+    // 查询表单回显信息
+    getOldInfo: function() {
+      var _this = this
+      $.ajax({
+        type:'POST',
+        url:'/salesLeads/echoInfo?t=' + Date.now(),
+        success:function (res) {
+          if (res.data) {
+            _this.form.oldPhone = res.data.phone ? res.data.phone : ''
+            _this.form.name = res.data.name ? res.data.name : ''
+            _this.form.phone = res.data.phone ? res.data.phone : ''
+            _this.form.mail = res.data.mail ? res.data.mail : ''
+            _this.form.companyName = res.data.company ? res.data.company : ''
+            if (res.data.position) {
+              if (res.data.position.indexOf('其他') > -1 || jobJson.indexOf(res.data.position.replace('其他/', '')) == -1) {
+                _this.form.job = '其他'
+                _this.form.otherJob = res.data.position.replace('其他/', '')
+              } else {
+                _this.form.job = res.data.position
+              }
+            } else {
+              _this.form.job = ''
+            }
+          }
+        }
+      })
+    },
+    // 企业名称联想
+    getResult:function(name) {
+      // 名称为空或长度小于2不发请求
+      if (!name || name.length < 2) return
+      var _this = this
+      $.ajax({
+        type:'POST',
+        url:'/jypay/user/company/association',
+        data: {
+          name: name
+        },
+        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, `<span style='color:#2ABED1;'>${name}</span>`)
+      } 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 = ''
+      if (this.source.indexOf('structed') > -1) {
+        this.showForm = false
+        this.showExport = true
+      } else {
+        this.showForm = false
+      }
+    },
+    // 数据导出
+    dataExport: function() {
+      location.href = "/front/dataExport/toSieve"
+    }
+  }
+})

+ 11 - 0
src/web/templates/structuredata/pc/index.html

@@ -14,6 +14,8 @@
 	<script type="text/javascript" src="{{Msg "seo" "cdn"}}/js/public-nav.js?v={{Msg "seo" "version"}}2"></script>
   <link rel="stylesheet" href="{{Msg "seo" "cdn"}}/structuredata/pc/css/reset_pc.css?v={{Msg "seo" "version"}}">
   <link rel="stylesheet" href="{{Msg "seo" "cdn"}}/structuredata/pc/css/stucturedPc.css?v={{Msg "seo" "version"}}1">
+  <link href="//cdn.jsdelivr.net/npm/element-ui@2.13.2/lib/theme-chalk/index.css" rel="stylesheet" />
+  <link href='{{Msg "seo" "cdn"}}/common-module/pc-dialog/css/leave-info-dialog.css?v={{Msg "seo" "version"}}' rel="stylesheet">
 	<script>
 		$(function(){
       $("#backTop").remove();
@@ -24,6 +26,8 @@
 </head>
 <body class="indexpage">
 {{include "/common/pchead.html"}}
+<!-- 用户留资 -->
+<div id="vue-collect-user-info"></div>
 <div class="maindata">
     <div class="consultPopup">
         <div class="consult_tel">
@@ -270,7 +274,14 @@
     </div>
 </div>
 {{include "/common/pcbottom.html"}}
+<script src="//cdn.jsdelivr.net/npm/vue@2.6.12/dist/vue.min.js"></script>
+<script src="//cdn.jsdelivr.net/npm/element-ui@2.13.2/lib/index.js"></script>
+<script src='{{Msg "seo" "cdn"}}/common-module/pc-dialog/js/leave-info-dialog.js?v={{Msg "seo" "version"}}'></script>
 <script>
+  // 调用留资组件方法 弹出弹框  改为点击触发 传入一个source
+    vm.isNeedSubmit('structedData',function(){
+      vm.showSuccess = true
+    })
     $(window).scroll(function() {
         //为了保证兼容性,这里取两个值,哪个有值取哪一个
         //scrollTop就是触发滚轮事件时滚轮的高度