适配链接管理插件1.4.0版本
detailed: 1.适配链接管理插件1.4.0版本,解决前台索引查询链接报错问题。 2.当爱发电接口超时未返回内容时,显示默认数据。
This commit is contained in:
parent
236e0d6547
commit
66417cb511
@ -379,10 +379,24 @@ let halo = {
|
||||
|
||||
function getPower() {
|
||||
const url = GLOBAL_CONFIG.source.power.url;
|
||||
let powerStar = document.getElementById("power-star")
|
||||
powerStar.href = GLOBAL_CONFIG.source.power.powerLink
|
||||
fetch(url)
|
||||
.then(res => res.json())
|
||||
.then(response => {
|
||||
// 检查响应状态码
|
||||
if (!response.ok) {
|
||||
// 如果响应状态码不是 200,抛出一个错误
|
||||
powerStar.innerHTML = `
|
||||
<div id="power-star-image" style="background-image: url('/themes/theme-hao/assets/images/afadian/afadian.webp')">
|
||||
</div>
|
||||
<div class="power-star-body">
|
||||
<div id="power-star-title">还没有人赞助~</div>
|
||||
<div id="power-star-desc">为爱发电,点击赞助</div>
|
||||
</div>`;
|
||||
}
|
||||
return response.json(); // 只有在状态码为 200 时才解析 JSON
|
||||
})
|
||||
.then(data => {
|
||||
console.log(data)
|
||||
if (200 === data["ec"]) {
|
||||
const values = data["data"]["list"];
|
||||
saveToLocal.set('power-data', JSON.stringify(values), 10 / (60 * 24))
|
||||
@ -390,8 +404,6 @@ let halo = {
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
let powerStar = document.getElementById("power-star")
|
||||
powerStar.href = GLOBAL_CONFIG.source.power.powerLink
|
||||
powerStar.innerHTML = `
|
||||
<div id="power-star-image" style="background-image: url('/themes/theme-hao/assets/images/afadian/afadian.webp')">
|
||||
</div>
|
||||
|
@ -115,7 +115,7 @@ var heo = {
|
||||
|
||||
function getLinks() {
|
||||
const fetchUrl =
|
||||
"/apis/api.plugin.halo.run/v1alpha1/plugins/PluginLinks/links?keyword=&sort=priority,asc"
|
||||
"/apis/api.plugin.halo.run/v1alpha1/plugins/PluginLinks/links?keyword="
|
||||
fetch(fetchUrl)
|
||||
.then(res => res.json())
|
||||
.then(json => {
|
||||
|
@ -51,5 +51,5 @@ spec:
|
||||
repo: https://gitea.uptoz.cn/UPToZ/halo-theme-hao
|
||||
settingName: "theme-hao-setting"
|
||||
configMapName: "theme-hao-configMap"
|
||||
version: "1.0.1-ce"
|
||||
version: "1.0.2-ce"
|
||||
require: ">=2.10.0"
|
||||
|
Loading…
Reference in New Issue
Block a user