;(function () { if (window.Basic_job) { return } window.Basic_job = function (id, listArr) { this.id = (id || '').replace('u', '') this.listArr = listArr this.resumeColumn = null this.pxid = getUrlQuery('pxid') this.formDialogId = 'resume-dialog-' + this.id this.init() } Basic_job.prototype = { init: function () { this.bind() }, bind: function () { var self = this if (Number(this.listArr.module_style) === 1) { $('#u' + this.id + ' .job-table-row').on('click', function (e) { self.onClickExpandIcon(e) }) } $('#u' + this.id + ' .btn-submit').on('click', function (e) { self.onClickSubmitBtn(e); }); }, bindDialog() { var self = this this.$dialog.find('.dialog_close').on('click', function () { self.$dialog.remove() }) this.$dialog.find('.form_submit').on('click', function () { if (jobForm.checkForm(self.form, self.formDialogId)) { self.submit() } }) this.$dialog.find('.validateCode_img').on('click', function () { var random = Math.random() $(this).attr('src', '/login-verify.html?width=121&height=44&app=mb&' + random + '') }) }, onClickExpandIcon(e) { var $icon = $(e.currentTarget).find('.fa'); if ($icon.hasClass('fa-angle-right')) { $icon.removeClass('fa-angle-right') $icon.addClass('fa-angle-down') $icon.parents('.el-table__row').next().show() } else { $icon.removeClass('fa-angle-down') $icon.addClass('fa-angle-right') $icon.parents('.el-table__row').next().hide() } }, onClickSubmitBtn(e) { var self = this var styleType = $(e.target).data('style') var jobId = $(e.target).data('id') var jobTitle = $(e.target).parents('.job-detail-wrapper').find('.job-title').html() if (this.isExpired(e)) { return myTip.showExpireTip() } var option = { styleType: styleType, jobId: jobId, jobTitle: jobTitle } if (this.resumeColumn) { this.showDialog(option) } else { self.getResumeData({ styleType: styleType }, function () { self.showDialog(option) }) } }, submit() { var self = this var data = {} this.form.fields.contentList.forEach(function (item) { data[item.name] = ($('#' + self.formDialogId).find('.input-' + item.name).val() || '').trim() }) data.verify = ($('#' + this.formDialogId).find('.validateCode_input').val() || '').trim() data.id = this.form.id $.ajax({ type: 'POST', url: '/?app=mb&m=contact&a=resume&pxid=' + this.pxid, data, success: function (res) { if (typeof res === 'string') { try { res = JSON.parse(res) } catch (e) { console.error('鑾峰彇鏁版嵁鏈夎') } } if (!res.isSuccess) { return myTip.showErrorTip(res.msg) } else { myTip.showSuccessTip('鎻愪氦鎴愬姛') setTimeout(function () { self.$dialog.remove() }, 3000) } } }) }, getResumeData(option, cb) { var self = this $.ajax({ type: "GET", url: '/?app=mb&m=contact&a=resumeColumn&pxid=' + this.pxid, success: function (res) { if (typeof res === 'string') { res = JSON.parse(res) } self.resumeColumn = res cb && cb() } }); }, showDialog(option) { var self = this option = option || {} var styleType = option.styleType var jobId = option.jobId var jobTitle = option.jobTitle var map = this.resumeColumn[Number(styleType) - 1] var textName = map.name || "濮撳悕" var textPhone = map.phone || '鎵嬫満鍙? var textEmail = map.email || '閭' var form = { id: jobId, fields: { contentList: [{ "title": textName, "name": "name", "placeholder": "璇疯緭鍏? + removeTrailingColon(textName), "require": true }, { "title": textPhone, "name": "phone", "placeholder": "璇疯緭鍏? + removeTrailingColon(textPhone), "require": true }, { "title": textEmail, "name": "email", "placeholder": "璇疯緭鍏? + removeTrailingColon(textEmail), "require": true }], "buttonName": "绔嬪嵆鎻愪氦", "popupName": jobTitle, } } Object.keys(map).forEach(function (key, index) { if (!map[key]) { return; } var excludeKeys = ['name', 'phone', 'email', 'img', 'title_first_1', 'title_first_2', 'title_first_3', 'title_first_4', 'title_first_5', 'title_first_6', 'title_first_7', 'title_first_8', 'title_second_1'] if (excludeKeys.indexOf(key) >= 0 || key.indexOf('title_') === 0) { return } form.fields.contentList.push({ "title": map[key], "name": key, "placeholder": "璇疯緭鍏? + removeTrailingColon(map[key]), }) }) this.form = form var $dialog = this.getDialogEl(jobTitle) var dom = $dialog dom.find('.my_form .form_content').empty() dom.css({display: 'block'}); dom.find('.loading_img').css({display: 'inline-block'}) dom.find('.form_warp').css({display: 'none'}) this.insertFormItem($dialog, form) this.insertVerifyCode($dialog) this.insertSublimeBtn($dialog) this.$dialog = $dialog $('.move_Frame').append($dialog) this.bindDialog() dom.find('.form_content').prepend('