Browse Source

Merge pull request '修改首页加载流程,确保Js数据加载在页面准备之后。' (#2363) from zouap into V20220630

Reviewed-on: https://git.openi.org.cn/OpenI/aiforge/pulls/2363
Reviewed-by: zhoupzh <zhoupzh@pcl.ac.cn>
tags/v1.22.6.2^2
zhoupzh 3 years ago
parent
commit
18fbfc90a3
1 changed files with 23 additions and 16 deletions
  1. +23
    -16
      public/home/home.js

+ 23
- 16
public/home/home.js View File

@@ -74,28 +74,30 @@ var swiperOrg = new Swiper(".homeorg-list", {
},
});

var output = document.getElementById("newmessage");
var url = "ws://" + document.location.host + "/action/notification";
if(document.location.host == "git.openi.org.cn" || document.URL.startsWith("https")){
url = "wss://" + document.location.host + "/action/notification"
}
var socket = new WebSocket(url);

socket.onopen = function () {
messageQueue = [];
console.log("message has connected.");
};

var maxSize = 20;
var html =document.documentElement;
var lang = html.attributes["lang"]
var isZh = true;
if(lang != null && lang.nodeValue =="en-US" ){
isZh=false;
}else{
}

socket.onmessage = function (e) {
document.onreadystatechange = function () {
queryRecommendData();

var output = document.getElementById("newmessage");
var url = "ws://" + document.location.host + "/action/notification";
if(document.location.host == "git.openi.org.cn" || document.URL.startsWith("https")){
url = "wss://" + document.location.host + "/action/notification"
}
var socket = new WebSocket(url);
socket.onopen = function () {
messageQueue = [];
console.log("message has connected.");
};

socket.onmessage = function (e) {
var data =JSON.parse(e.data)
var html = "";
if (data != null){
@@ -176,7 +178,10 @@ socket.onmessage = function (e) {
output.innerHTML = html;
swiperNewMessage.updateSlides();
swiperNewMessage.updateProgress();
};
};
}



function getTaskLink(record){
var re = getRepoLink(record);
@@ -437,7 +442,9 @@ function getAction(opType,isZh){
}
}

queryRecommendData();




function queryRecommendData(){
$.ajax({


Loading…
Cancel
Save