Commit cd40806f by 庄欣

f

parent 4a6c7ae9
var host = "http://127.0.0.1:8045"
function main() {
var dom = $("#app > div.container-lg.clearfix > div.container-sm.float-left.stock__main > div.stock-name");
var stock = dom.text();
//http://quote.eastmoney.com/sz002460.html?from=beta
if (stock !== "") {
var matches = stock.match(/\(\S*\)/);
if (matches.length <= 0) {
......@@ -17,8 +18,31 @@ function main() {
a.target = "_blank";
a.innerText = stock;
$(dom).html($(a));
getInfo(search, function(res) {
var dom2 = $("#app > div.container-lg.clearfix > div.container-sm.float-left.stock__main > div.stock-issues");
var box = document.createElement("div");
$(box).addClass("stock-issue");
box.innerText = res;
$(dom2).append($(box));
});
}
}
function getInfo(code, callback) {
var api = "/basic?code=" + code
if (code === "") {
alert("code error")
return
}
fetch(host + api).then(res=>{
return res.text();
}).then(res => {
var data = JSON.parse(res);
callback(data.data.market)
}).catch(e => {
console.error(e)
})
}
main();
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment