|
|
@@ -34,33 +34,37 @@ function related_para_dlg_open(book, para) {
|
|
|
|
|
|
function related_para_dlg_render(para) {
|
|
|
let output = "";
|
|
|
- for (const iterator of para.book_list) {
|
|
|
- output += "<div>";
|
|
|
- if (para.curr_book_id == iterator.id) {
|
|
|
- output += "<b>" + iterator.title + "</b>";
|
|
|
- } else {
|
|
|
- //找到与这个书匹配的段落
|
|
|
- let paraList = new Array();
|
|
|
- for (const ipara of para.data) {
|
|
|
- if (ipara.bookid == iterator.id) {
|
|
|
- paraList.push(ipara);
|
|
|
+ if(Array.isArray(para.book_list)){
|
|
|
+ for (const iterator of para.book_list) {
|
|
|
+ output += "<div>";
|
|
|
+ if (para.curr_book_id == iterator.id) {
|
|
|
+ output += "<b>" + iterator.title + "</b>";
|
|
|
+ } else {
|
|
|
+ //找到与这个书匹配的段落
|
|
|
+ let paraList = new Array();
|
|
|
+ for (const ipara of para.data) {
|
|
|
+ if (ipara.bookid == iterator.id) {
|
|
|
+ paraList.push(ipara);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(paraList.length>0){
|
|
|
+ output +=
|
|
|
+ "<a href='../reader/?view=chapter&book=" +
|
|
|
+ paraList[0].book +
|
|
|
+ "&par=" +
|
|
|
+ paraList[0].para +
|
|
|
+ "' target='_blank'>" +
|
|
|
+ iterator.title +
|
|
|
+ "</a>";
|
|
|
}
|
|
|
}
|
|
|
- if(paraList.length>0){
|
|
|
- output +=
|
|
|
- "<a href='../reader/?view=chapter&book=" +
|
|
|
- paraList[0].book +
|
|
|
- "&par=" +
|
|
|
- paraList[0].para +
|
|
|
- "' target='_blank'>" +
|
|
|
- iterator.title +
|
|
|
- "</a>";
|
|
|
- }else{
|
|
|
- output += "no relation paragraph";
|
|
|
- }
|
|
|
- }
|
|
|
+ output += "</div>";
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ output += "no related paragraph";
|
|
|
output += "</div>";
|
|
|
}
|
|
|
|
|
|
+
|
|
|
return output;
|
|
|
}
|