修复了一些小bug

This commit is contained in:
clay
2022-09-29 15:40:10 +08:00
parent 1eb9631127
commit ae08b72bc2
11 changed files with 149 additions and 77 deletions

View File

@@ -7,6 +7,7 @@
let vm = null
import {info} from "@/api";
export function setThis(that) {
vm = that
}
@@ -14,6 +15,7 @@ export function setThis(that) {
export function getParentNode(id) {
try {
let menuList = JSON.parse(sessionStorage.getItem("menu"));
console.log(menuList,"menuList")
for (let menu of menuList) {
for (let child of menu.children) {
if (id == child.encodeId) {
@@ -66,40 +68,42 @@ export function setLanguage() {
}
export function toArticle(news,width) {
console.log(width,"width")
export function toArticle(news, width) {
console.log(width, "width")
info(news.id).then(res => {
let info = null
try {
info = getParentNode(res.data.encodeId)
info = getParentNode(res.data.encodeId)
console.log(info)
}catch (e){}
if (info == null){
} catch (e) {
}
if (info == null) {
return
}
if (info.three == null) {
if (width) {
vm.$router.push("/pc/" + info.second.encodeId + "?id=" + news.id +"&type=" + info.second.type+ "&lang=" + sessionStorage.getItem("lang"));
vm.$router.push("/pc/" + info.second.encodeId + "?id=" + news.id + "&type=" + info.second.type + "&lang=" + sessionStorage.getItem("lang"));
} else {
vm.$router.push("/mobile/" + info.second.encodeId + "?id=" + news.id +"&type=" + info.second.type+ "&lang=" + sessionStorage.getItem("lang"));
vm.$router.push("/mobile/" + info.second.encodeId + "?id=" + news.id + "&type=" + info.second.type + "&lang=" + sessionStorage.getItem("lang"));
}
} else {
if (width) {
vm.$router.push("/pc/" + info.second.encodeId + "/" + info.three.encodeId + "&id=" + news.id +"?type=" + info.second.type+ "&lang=" + sessionStorage.getItem("lang"));
vm.$router.push("/pc/" + info.second.encodeId + "/" + info.three.encodeId + "&id=" + news.id + "?type=" + info.second.type + "&lang=" + sessionStorage.getItem("lang"));
} else {
vm.$router.push("/mobile/" + info.second.encodeId + "/" + info.three.encodeId + "&id=" + news.id +"?type=" + info.second.type+ "&lang=" + sessionStorage.getItem("lang"));
vm.$router.push("/mobile/" + info.second.encodeId + "/" + info.three.encodeId + "&id=" + news.id + "?type=" + info.second.type + "&lang=" + sessionStorage.getItem("lang"));
}
}
})
}
export function lookMoreComment(item,width) {
export function lookMoreComment(item, width) {
info(item.id).then(res => {
let info = null
try {
info = getParentNode(res.data.encodeId)
}catch (e){}
if (info == null){
info = getParentNode(res.data.encodeId)
} catch (e) {
}
if (info == null) {
return
}
if (info.three == null) {
@@ -119,6 +123,32 @@ export function lookMoreComment(item,width) {
}
export function lookMoreFixedComment(id, width) {
let info = null
try {
info = getParentNode(id)
console.log(info)
} catch (e) {
}
if (info == null) {
return
}
if (info.three == null) {
if (width) {
vm.$router.push("/pc/" + info.second.encodeId + "?type=" + info.second.type + "&lang=" + sessionStorage.getItem("lang"));
} else {
vm.$router.push("/mobile/" + info.second.encodeId + "?type=" + info.second.type + "&lang=" + sessionStorage.getItem("lang"));
}
} else {
if (width) {
vm.$router.push("/pc/" + info.second.encodeId + "/" + info.three.encodeId + "?type=" + info.second.type + "&lang=" + sessionStorage.getItem("lang"));
} else {
vm.$router.push("/mobile/" + info.second.encodeId + "/" + info.three.encodeId + "?type=" + info.second.type + "&lang=" + sessionStorage.getItem("lang"));
}
}
}