This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
$(function () {
|
||||
const setIndexData = () => {
|
||||
const commentObj = JSON.parse(sessionStorage.commentData);
|
||||
commentObj.feedback_type.forEach((item, index) => {
|
||||
const setIndexData = () => {
|
||||
const commentObj = window.__themeCommon
|
||||
? window.__themeCommon
|
||||
: (sessionStorage.commentData ? JSON.parse(sessionStorage.commentData) : {});
|
||||
const types = Array.isArray(commentObj.feedback_type)
|
||||
? commentObj.feedback_type
|
||||
: [];
|
||||
types.forEach((item, index) => {
|
||||
$("#radioBox").append(`
|
||||
<div class="radio">
|
||||
<input type="radio" name="radioId" id="ptionsRadios${index}" value=${item.id} />
|
||||
@@ -65,43 +70,6 @@ $(function () {
|
||||
input.attr("style", "border: 1px solid #E6EAED;");
|
||||
return true;
|
||||
}
|
||||
// 获取通用配置信息(反馈页:用插件覆盖 feedback_type)
|
||||
function getCommentInfo() {
|
||||
$.ajax({
|
||||
url: "/console/v1/common",
|
||||
method: "get",
|
||||
headers: {
|
||||
Authorization: "Bearer" + " " + localStorage.jwt,
|
||||
},
|
||||
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();
|
||||
// 反馈页直接使用服务端注入的反馈类型渲染单选项
|
||||
setIndexData();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user