This commit is contained in:
@@ -106,19 +106,87 @@ $(function () {
|
||||
$(".no-login").attr("style", "display:block");
|
||||
}
|
||||
};
|
||||
// 获取通用配置信息
|
||||
// 获取通用配置信息(先用系统 /console/v1/common,若有插件则再用插件数据覆盖部分字段)
|
||||
const getCommentInfo = () => {
|
||||
const handleSuccess = function (res) {
|
||||
sessionStorage.commentData = JSON.stringify(res.data);
|
||||
setCommData();
|
||||
};
|
||||
$.ajax({
|
||||
url: "/console/v1/common",
|
||||
method: "get",
|
||||
headers: {
|
||||
Authorization: "Bearer" + " " + localStorage.jwt,
|
||||
},
|
||||
success: handleSuccess,
|
||||
success: function (res) {
|
||||
if (!res || res.status !== 200 || !res.data) {
|
||||
return;
|
||||
}
|
||||
var baseData = res.data || {};
|
||||
|
||||
// 再尝试从主题配置插件读取额外配置,用于覆盖旧数据
|
||||
$.ajax({
|
||||
url: "/console/v1/theme/config",
|
||||
method: "get",
|
||||
headers: {
|
||||
Authorization: "Bearer" + " " + localStorage.jwt,
|
||||
},
|
||||
success: function (pluginRes) {
|
||||
if (pluginRes && pluginRes.status === 200 && pluginRes.data) {
|
||||
var cfg = pluginRes.data || {};
|
||||
|
||||
// 覆盖基础字段:企业信息 & ICP 等
|
||||
baseData.enterprise_name =
|
||||
cfg.enterprise_name || baseData.enterprise_name;
|
||||
baseData.enterprise_telephone =
|
||||
cfg.enterprise_telephone || baseData.enterprise_telephone;
|
||||
baseData.enterprise_mailbox =
|
||||
cfg.enterprise_mailbox || baseData.enterprise_mailbox;
|
||||
baseData.enterprise_qrcode =
|
||||
cfg.enterprise_qrcode || baseData.enterprise_qrcode;
|
||||
baseData.official_website_logo =
|
||||
cfg.official_website_logo || baseData.official_website_logo;
|
||||
baseData.icp_info = cfg.icp_info || baseData.icp_info;
|
||||
baseData.icp_info_link =
|
||||
cfg.icp_info_link || baseData.icp_info_link;
|
||||
baseData.public_security_network_preparation =
|
||||
cfg.public_security_network_preparation ||
|
||||
baseData.public_security_network_preparation;
|
||||
baseData.public_security_network_preparation_link =
|
||||
cfg.public_security_network_preparation_link ||
|
||||
baseData.public_security_network_preparation_link;
|
||||
baseData.telecom_appreciation =
|
||||
cfg.telecom_appreciation || baseData.telecom_appreciation;
|
||||
baseData.cloud_product_link =
|
||||
cfg.cloud_product_link || baseData.cloud_product_link;
|
||||
baseData.dcim_product_link =
|
||||
cfg.dcim_product_link || baseData.dcim_product_link;
|
||||
baseData.terms_service_url =
|
||||
cfg.terms_service_url || baseData.terms_service_url;
|
||||
baseData.terms_privacy_url =
|
||||
cfg.terms_privacy_url || baseData.terms_privacy_url;
|
||||
|
||||
// 数组字段:优先使用插件配置
|
||||
if (cfg.friendly_link) {
|
||||
baseData.friendly_link = cfg.friendly_link;
|
||||
}
|
||||
if (cfg.honor) {
|
||||
baseData.honor = cfg.honor;
|
||||
}
|
||||
if (cfg.partner) {
|
||||
baseData.partner = cfg.partner;
|
||||
}
|
||||
if (cfg.feedback_type) {
|
||||
baseData.feedback_type = cfg.feedback_type;
|
||||
}
|
||||
}
|
||||
|
||||
sessionStorage.commentData = JSON.stringify(baseData);
|
||||
setCommData();
|
||||
},
|
||||
error: function () {
|
||||
// 插件不可用则直接使用系统默认配置
|
||||
sessionStorage.commentData = JSON.stringify(baseData);
|
||||
setCommData();
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
};
|
||||
// 设置通用信息函数
|
||||
|
||||
38
js/about.js
38
js/about.js
@@ -20,19 +20,45 @@ $(function () {
|
||||
viewer.show();
|
||||
});
|
||||
|
||||
// 获取通用配置信息
|
||||
// 获取通用配置信息(关于页:用插件覆盖 honor/partner)
|
||||
function getCommentInfo() {
|
||||
const handleSuccess = function (res) {
|
||||
sessionStorage.commentData = JSON.stringify(res.data);
|
||||
setIndexData();
|
||||
};
|
||||
$.ajax({
|
||||
url: "/console/v1/common",
|
||||
method: "get",
|
||||
headers: {
|
||||
Authorization: "Bearer" + " " + localStorage.jwt,
|
||||
},
|
||||
success: handleSuccess,
|
||||
success: function (res) {
|
||||
if (!res || res.status !== 200 || !res.data) {
|
||||
return;
|
||||
}
|
||||
var baseData = res.data || {};
|
||||
|
||||
$.ajax({
|
||||
url: "/console/v1/theme/config",
|
||||
method: "get",
|
||||
headers: {
|
||||
Authorization: "Bearer" + " " + localStorage.jwt,
|
||||
},
|
||||
success: function (pluginRes) {
|
||||
if (pluginRes && pluginRes.status === 200 && pluginRes.data) {
|
||||
var cfg = pluginRes.data || {};
|
||||
if (cfg.honor) {
|
||||
baseData.honor = cfg.honor;
|
||||
}
|
||||
if (cfg.partner) {
|
||||
baseData.partner = cfg.partner;
|
||||
}
|
||||
}
|
||||
sessionStorage.commentData = JSON.stringify(baseData);
|
||||
setIndexData();
|
||||
},
|
||||
error: function () {
|
||||
sessionStorage.commentData = JSON.stringify(baseData);
|
||||
setIndexData();
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
// 获取首页数据
|
||||
|
||||
@@ -65,19 +65,42 @@ $(function () {
|
||||
input.attr("style", "border: 1px solid #E6EAED;");
|
||||
return true;
|
||||
}
|
||||
// 获取通用配置信息
|
||||
// 获取通用配置信息(反馈页:用插件覆盖 feedback_type)
|
||||
function getCommentInfo() {
|
||||
const handleSuccess = function (res) {
|
||||
sessionStorage.commentData = JSON.stringify(res.data);
|
||||
setIndexData();
|
||||
};
|
||||
$.ajax({
|
||||
url: "/console/v1/common",
|
||||
method: "get",
|
||||
headers: {
|
||||
Authorization: "Bearer" + " " + localStorage.jwt,
|
||||
},
|
||||
success: handleSuccess,
|
||||
success: function (res) {
|
||||
if (!res || res.status !== 200 || !res.data) {
|
||||
return;
|
||||
}
|
||||
var baseData = res.data || {};
|
||||
|
||||
$.ajax({
|
||||
url: "/console/v1/theme/config",
|
||||
method: "get",
|
||||
headers: {
|
||||
Authorization: "Bearer" + " " + localStorage.jwt,
|
||||
},
|
||||
success: function (pluginRes) {
|
||||
if (pluginRes && pluginRes.status === 200 && pluginRes.data) {
|
||||
var cfg = pluginRes.data || {};
|
||||
if (cfg.feedback_type) {
|
||||
baseData.feedback_type = cfg.feedback_type;
|
||||
}
|
||||
}
|
||||
sessionStorage.commentData = JSON.stringify(baseData);
|
||||
setIndexData();
|
||||
},
|
||||
error: function () {
|
||||
sessionStorage.commentData = JSON.stringify(baseData);
|
||||
setIndexData();
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
getCommentInfo();
|
||||
|
||||
49
js/index.js
49
js/index.js
@@ -128,23 +128,56 @@ $(function () {
|
||||
});
|
||||
}
|
||||
}
|
||||
// 获取通用配置信息
|
||||
// 获取通用配置信息(首页:先用 /console/v1/common,再用插件配置覆盖后渲染荣誉/合作伙伴)
|
||||
function getCommentInfo() {
|
||||
const handleSuccess = function (res) {
|
||||
sessionStorage.commentData = JSON.stringify(res.data);
|
||||
setIndexData();
|
||||
};
|
||||
$.ajax({
|
||||
url: "/console/v1/common",
|
||||
method: "get",
|
||||
headers: {
|
||||
Authorization: "Bearer" + " " + localStorage.jwt,
|
||||
},
|
||||
success: handleSuccess,
|
||||
success: function (res) {
|
||||
if (!res || res.status !== 200 || !res.data) {
|
||||
return;
|
||||
}
|
||||
var baseData = res.data || {};
|
||||
|
||||
$.ajax({
|
||||
url: "/console/v1/theme/config",
|
||||
method: "get",
|
||||
headers: {
|
||||
Authorization: "Bearer" + " " + localStorage.jwt,
|
||||
},
|
||||
success: function (pluginRes) {
|
||||
if (pluginRes && pluginRes.status === 200 && pluginRes.data) {
|
||||
var cfg = pluginRes.data || {};
|
||||
// 仅覆盖首页会用到的字段:honor/partner/banner/friendly_link 等
|
||||
if (cfg.honor) {
|
||||
baseData.honor = cfg.honor;
|
||||
}
|
||||
if (cfg.partner) {
|
||||
baseData.partner = cfg.partner;
|
||||
}
|
||||
if (cfg.banner) {
|
||||
baseData.banner = cfg.banner;
|
||||
}
|
||||
if (cfg.friendly_link) {
|
||||
baseData.friendly_link = cfg.friendly_link;
|
||||
}
|
||||
}
|
||||
sessionStorage.commentData = JSON.stringify(baseData);
|
||||
setIndexData();
|
||||
},
|
||||
error: function () {
|
||||
sessionStorage.commentData = JSON.stringify(baseData);
|
||||
setIndexData();
|
||||
},
|
||||
});
|
||||
},
|
||||
});
|
||||
}
|
||||
// 获取首页数据
|
||||
getCommentInfo();
|
||||
// 获取首页数据
|
||||
getCommentInfo();
|
||||
var viewer = new Viewer(document.getElementById("viewer"), {
|
||||
button: true,
|
||||
inline: false,
|
||||
|
||||
Reference in New Issue
Block a user