阅读 177

骨干教师提升培训自动切课插件

骨干教师提升培就只有


服务器计时的视频,客户端只能老老实实观看,看完一个课程它不能自动切换,所以整个插件,让它一次完成所有视频观看任务


[Asm] 纯文本查看 复制代码

?

001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042
043
044
045
046
047
048
049
050
051
052
053
054
055
056
057
058
059
060
061
062
063
064
065
066
067
068
069
070
071
072
073
074
075
076
077
078
079
080
081
082
083
084
085
086
087
088
089
090
091
092
093
094
095
096
097
098
099
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
function getUrlParams(_key) {
    var _array = location.href.split("?");
    if (_array.length > 1) {
        _array = _array[1].split("&");
        for (var _i = 0; _i < _array.length; _i++) {
            var _v = _array[_i].split("=");
            if (_v.length > 1 && _key == _v[0]) {
                return _v[1];
            }
        }
    }
    return null;
}
//获取课程列表
function getCourseList() {
    $.ajax({
        url: "https://ipx-api.yanxiu.com/task-center/course/queryCourseList?pageIndex=1&pageSize=100&projectId=" + getUrlParams("projectId") + "&toolId=" + getUrlParams("toolId") + "&roleKey=100&examineSubstanceRole=MEMBER&segmentId=9999&subjectId=9999",
        type"GET",
        contentType: "application/json",
        headers: {
            "Accept""application/json, text/plain, */*",
            "Action-Type""json",
            "srxUserInfo": $.cookie("srxUserInfo"),
            "X-DT-accessToken": $.cookie("X-DT-accessToken")
        },
        success: function (data) {
            var _list = data.data.rows;
            for (var _i = 0; _i < _list.length; _i++) {
                var _o = _list[_i];
                console.log(_o.completeTime + "/" + _o.totalDuration);
                if (_o.completeTime <= _o.totalDuration) {
                    //window.sendMessage({ type"closeOtherTabs" });
                    window.sendMessage({ type"closeTabsFromKey", data: { keepKey: "list", closeKey: "detail?" } });
                    window.sendMessage({ type"reloadTime", data: { time: 300 } });
                    window.sendMessage({ type"createTab", data: { url: "https://ipx.yanxiu.com/grain/course/" + _o.id + "/detail?projectId=" + getUrlParams("projectId") + "&toolId=" + getUrlParams("toolId") + "&courseSourceId=" + _o.courseSourceId + "&role=100", selected: true } });
                    return;
                }
            }
        }
    });
}
function getCourseId() {
    var _str = location.href.replace("https://ipx.yanxiu.com/grain/course/""");
    _str = _str.substr(0, _str.indexOf("/"));
    return _str;
}
//给教授评星
function sendUserStar() {
    var _d = {};
    _d.userName = $(".login-name").text();
    _d.courseId = getCourseId();
    _d.toolId = getUrlParams("toolId");
    _d.courseSourceId = getUrlParams("courseSourceId");
    _d.rank = 5;
    $.ajax({
        url: "https://ipx-api.yanxiu.com/task-center/course/addUserCourseEvalution",
        type"POST",
        contentType: "application/json",
        data: JSON.stringify(_d),
        dataType: "json",
        headers: {
            "Action-Type""json",
            "srxUserInfo": $.cookie("srxUserInfo"),
            "X-DT-accessToken": $.cookie("X-DT-accessToken")
        },
        success: function (data) {
 
        }
    });
 
}
//获取用户信息
function getUserInfo() {
    var _userId;
    var _d = {};
    $.ajax({
        url: "https://ipx-api.yanxiu.com/train-project-center/user/getUserInfo",
        type"POST",
        contentType: "application/json",
        data: JSON.stringify(_d),
        dataType: "json",
        async: false,
        headers: {
            "Action-Type""json",
            "srxUserInfo": $.cookie("srxUserInfo"),
            "X-DT-accessToken": $.cookie("X-DT-accessToken")
        },
        success: function (data) {
            var _userName = data.data.userName;
            _userId = data.data.userId;
        }
    });
    return _userId;
}
//获取当前版块学习进度
function getCouresProgress() {
    var _d = { "examineSubstance""MEMBER""classId""""examineSubstanceRole""MEMBER""toolId": getUrlParams("toolId"), "userId": getUserInfo(), "examineType""tool""projectId": getUrlParams("projectId") };
    $.ajax({
        url: "https://ipx-api.yanxiu.com/task-center/examine/result/tool/query",
        type"POST",
        contentType: "application/json",
        data: JSON.stringify(_d),
        dataType: "json",
        headers: {
            "Action-Type""json",
            "srxUserInfo": $.cookie("srxUserInfo"),
            "X-DT-accessToken": $.cookie("X-DT-accessToken")
        },
        success: function (data) {
            console.log(JSON.stringify(data));
            if (Number(data.data.totalFinishScore) < Number(data.data.totalRequireScore)) {
                getCourseList();
            else {
                console.log("视频已经完成");
                window.sendMessage({ type"reloadHome", data: { homeKey: "workspace?projectId", homeUrl: "https://ipx.yanxiu.com/train/workspace?projectId=5962355032887484498&role=100" } });
            }
        }
    });
}
function getProgressById(_tid, _id) {
    var _out = { finish: true };
    $.ajax({
        url: "https://ipx-api.yanxiu.com/task-center/tool/user/packTools?bizId1=" + _tid + "&bizId2=" + _id + "&bizSource=yxb&userRole=MEMBER",
        type"POST",
        contentType: "application/json",
        data: "{}",
        dataType: "json",
        async: false,
        headers: {
            "Action-Type""json",
            "srxUserInfo": $.cookie("srxUserInfo"),
            "X-DT-accessToken": $.cookie("X-DT-accessToken")
        },
        success: function (data) {
            //console.log(data);
            var _o = data.data[0].toolExamines[0];
            if (Number(_o.userScore) < Number(_o.totalScore)) {
                _out.finish = false;
                _out.id = _o.id;
            }
        }
    });
    return _out;
}
//获取本次培训的所有项目
function getMainList() {
    console.log("获取课程目录");
    $.ajax({
        url: "https://ipx-api.yanxiu.com/train-project-center/projectPhase/personPage?trainProjectId=" + getUrlParams("projectId") + "&pageSize=10000&pageIndex=1",
        type"GET",
        contentType: "application/json",
        dataType: "json",
        headers: {
            "Action-Type""json",
            "srxUserInfo": $.cookie("srxUserInfo"),
            "X-DT-accessToken": $.cookie("X-DT-accessToken")
        },
        success: function (data) {
            //console.log(data);
            var _list = data.data.rows;
            for (var _i = 0; _i < _list.length; _i++) {
                var _out = getProgressById(_list[_i].trainProjectId, _list[_i].id);
                if (!_out.finish) {
                    var _url = "https://ipx.yanxiu.com/train/guide/course/list?projectId=" + _list[_i].trainProjectId + "&role=100&toolId=" + _out.id + "&stageId=" + _list[_i].id + "&barId=&examineSubstanceRole=MEMBER";
                    window.sendMessage({ type"createTab", data: { url: _url, selected: true } });
                    return;
                else {
                    console.log(_list[_i].phaseName + "  视频已经学习完成!");
                }
            }
            console.log("所有视频已经全部完成");
        }
    });
}
function autoClick() {
    //视频播放完成,出现重新播放时
    if ($(".replay").is(":visible")) {
        window.sendMessage({ type"reloadHome", data: { homeKey: "train/guide/course/list", homeUrl: "https://ipx.yanxiu.com/train/guide/course/list" } });
        return;
    }
    //给教授点击星星时
    if ($(".rate-item").length == 10) {
        $(".rate-item").eq(9).hover();
        $(".rate-item").eq(9).click();
        $(".ivu-btn.ivu-btn-primary").eq(0).click();
        return;
    }
    //出现点击继续计时的按钮时
    if ($(".alarmClock-wrapper").is(":visible")) {
        $(".alarmClock-wrapper").click();
    }
}
function init() {
    $.cookie = function (name, value, options) { if (typeof value != 'undefined') { options = options || {}; if (value === null) { value = ''; options.expires = -1 } var expires = ''if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { var date; if (typeof options.expires == 'number') { date = new Date(); date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)) } else { date = options.expires } expires = '; expires=' + date.toUTCString() } var path = options.path ? '; path=' + options.path : ''; var domain = options.domain ? '; domain=' + options.domain : ''; var secure = options.secure ? '; secure' ''; document.cookie = [name'=', encodeURIComponent(value), expires, path, domain, secure].join('') } else { var cookieValue = null; if (document.cookie && document.cookie != '') { var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { var cookie = $.trim(cookies[i]); if (cookie.substring(0, name.length + 1) == (name '=')) { cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); break } } } return cookieValue } };
    //课程主页
    if (location.href.indexOf("workspace?projectId") != -1) {
        getMainList();
        return;
    }
    //学习内容列表页
    if (location.href.indexOf("course/list") != -1) {
        getCouresProgress();
        return;
    }
    //具体视频学习页
    if (location.href.indexOf("detail?projectId") != -1) {
        //给教授点击星星
        sendUserStar();
        setInterval(autoClick, 1000);
        return;
    }
}
 
if (typeof $ == "undefined") {
    var s = document.createElement('script');
    s.onload = init;
    s.src = 'https://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js';
    document.getElementsByTagName('HEAD')[0].appendChild(s);
else {
    init();
}


文章分类
代码人生
版权声明:本站是系统测试站点,无实际运营。本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 XXXXXXo@163.com 举报,一经查实,本站将立刻删除。
相关推荐