resume_check

Boss|more...

当前为 2021-02-08 提交的版本,查看 最新版本

// ==UserScript==
// @name         resume_check
// @namespace    http://tampermonkey.net/
// @version      0.9
// @description  Boss|more...
// @author       Lonely
// @match        https://www.zhipin.com/web/boss/*
// @match        https://www.baidu.com
// @require      https://cdn.jsdelivr.net/npm/vue/dist/vue.js
// @grant        GM_xmlhttpRequest
// ==/UserScript==

(function () {
    'use strict';

    (function () {
        // 做一个div套着,后续直接innerHTML一把嗦
        var div = document.createElement('div')
        div.id='script_ele_box'

        div.innerHTML = `
                        <div id="resume_app" @click='match' v-show='is_show()' style='height: 80px; width: 150px;
                         background-color: #43CD80; border-radius: 10px; top: 10%; left: 90%;
                          position: fixed;z-index: 999999'>
                            <p> <h3> {{ message }}</h3></p>
                            <p class='timer'>{{ update_area }}秒前更新</p>
                            <p class='preview'><a href='#' target='_blank'></a></p>
                        </div>
                        `
        document.body.appendChild(div);
    })()

    var app = new Vue({
        el: '#resume_app',
        data: {
            message: '点击匹配',
            update_area: 0,
            intervalId: null,
            start_time: ''
        },
        methods: {
            is_show: function () {
                return document.location.href === 'https://www.zhipin.com/web/boss/index'

            },
            // 定时器
            dateRefresh: function () {
                if (this.intervalId != null) return

                this.intervalId = setInterval(() => {
                    this.update_area += 1
                }, 1000);
            },
            // 停止定时器
            clear: function () {
                clearInterval(this.intervalId); //清除计时器
                this.intervalId = null; //设置为null
            },
            extract_experience: function () {
                // 提取经历部分的HTML代码
                if (document.location.href === 'https://www.zhipin.com/web/boss/index' && document.querySelector('.resume-detail')) {
                    return document.querySelector('.resume-detail').outerHTML
                }
                return null
            },
            match: function () {
                var experience_html = this.extract_experience()
                if (!experience_html) {
                    alert('请在简历页面点击匹配')
                    return
                }
                var self = this
                GM_xmlhttpRequest({
                    method: "POST",
                    url: "http://192.168.1.224:8888/api/v1/resume/parse_html_exp",
                    data: 'data=' + encodeURIComponent(experience_html),
                    headers: {
                        'accept': 'application/json',
                        'Content-Type': 'application/x-www-form-urlencoded',
                    },
                    onload: function (e) {
                        var python_response = JSON.parse(e.response)
                        var _a = document.querySelector('.preview > a')
                        self.update_area = 0
                        if (python_response.data.score > 80) {
                            self.message = `${python_response.data.name}:${python_response.data.score}分`
                            _a.href = python_response.data.file_path
                            _a.text = '预览'
                        } else {
                            _a.href = '#'
                            _a.text = ''
                            self.message = `${python_response.data.name}:${python_response.data.score}分`
                        }
                    }
                })
            }
        },
        created: function () {
            this.dateRefresh();
        },
        destroyed() {
            // 在页面销毁后,清除计时器
            this.clear();
        }
    })

})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址