Commit 43206b59 by zhujunjie

修改路由跳转

parent 4ac24e66
......@@ -32,9 +32,9 @@
<template>
<div class="knowledge" @click="knowledge">知识库</div>
<div
class="knowledge"
v-loading="showSyncWanPanloading"
v-if="showSyncWanPan"
v-loading="showSyncWanPanloading"
class="knowledge"
@click="SyncWanPan"
>
刷新知识库
......@@ -63,7 +63,7 @@
id: userInfo.id,
username: userInfo.username,
avatarUrl: userInfo.avatarUrl,
isReal: userInfo.isReal,
isReal: userInfo.isReal
}"
:size="35"
:round="true"
......@@ -113,8 +113,8 @@ export default {
props: {
headImg: {
type: String,
default: "",
},
default: ""
}
},
data() {
return {
......@@ -129,7 +129,7 @@ export default {
imgurl: require("@/assets/logo.png"),
islogin: true,
hideHeader: false, // 不需要头部右侧部分
preurl: "/",
preurl: "/"
};
},
computed: {
......@@ -154,19 +154,17 @@ export default {
// console.log(res.data.result);
// })
if (!!this.$store.state.user) {
let users = this.$store.state.user.info.attributes;
if(!!users)
{
console.log(users,22)
if (this.$store.state.user) {
const users = this.$store.state.user.info.attributes;
if (users) {
console.log(users, 22);
if (users.username == "熊裕文") {
this.showSyncWanPan = true;
}
}
}
return this.$store.state.user.info.attributes || {};
},
}
},
watch: {
// 监听路由变化
......@@ -176,13 +174,13 @@ export default {
} else {
this.siteClose = false;
}
},
}
},
mounted() {
this.showSyncWanPan = false;
// 获取cookies拿到token
var token = this.getCookie("BailunToken");
//var token =
// var token =
// "Bearer%20eyJhbGciOiJSUzI1NiIsImtpZCI6IjQ1ZmMzZDYzYjRmNGM5YjAzMWVhNjQ0MzhhNTE1NmM3IiwidHlwIjoiSldUIn0.eyJuYmYiOjE2MTAxNzMxNTAsImV4cCI6MTYxMDIwOTE1MCwiaXNzIjoiaHR0cDovL2xvY2FsaG9zdDo1MDAxIiwiYXVkIjpbImh0dHA6Ly9sb2NhbGhvc3Q6NTAwMS9yZXNvdXJjZXMiLCJiYWlsdW5BcGkiXSwiY2xpZW50X2lkIjoiYmFpbHVuQ2xpZW50Iiwic3ViIjoi54aK6KOV5paHIiwiYXV0aF90aW1lIjoxNjEwMTczMTUwLCJpZHAiOiJsb2NhbCIsIlVzZXJJZCI6IjI5MjEyNzAiLCJXeFVzZXJJZCI6Inhpb25neXV3ZW4iLCJzdWNlc3NzIjoidHJ1ZSIsIkNvbXBhbnkiOiJ7XCJJZFwiOjEsXCJDb21wYW55Q29kZVwiOlwiYmFpbHVuXCIsXCJDb21wYW55TmFtZVwiOlwi5bm_5bee55m-5Lym5L6b5bqU6ZO-56eR5oqA5pyJ6ZmQ5YWs5Y-4XCJ9IiwiQWxsQ29tcGFueSI6IkZhbHNlIiwiVXNlckNvZGVOZXciOiJCTDE4ODQiLCJVc2VyQ29kZSI6IkJMNTU2NjkyMiIsIk9hVXNlcklkIjoiMzk4OCIsIkRlcGFydG1lbnQiOiJ7XCJEZXBhcnRtZW50SWRcIjoyNTYsXCJOYW1lXCI6XCLliIrnmbvlsI_nu4RcIixcIkNvZGVcIjpcIlwifSIsInNjb3BlIjpbIm9wZW5pZCIsInByb2ZpbGUiLCJiYWlsdW5BcGkiXSwiYW1yIjpbImN1c3RvbSJdfQ.LWd_QutKJiG_zgE8kW2om5I5SB-rEA-c4LHvDZ0CzMLDGNNq-n40WodpD6W3W0nncKSObmvAycGo4Ko5bboAdP4zJykpoHEqSZ2naOZGwpvq8YnE50Ce0Nw1QgLWm0sXdNK6AfxItT04MOqjmhGrZ3KkQsS6VujXFCxBq1Mt2aVjhAgZjH5MKNMrPBuFN2h1l-fDWsjDoJw7JBNQQOJ2PlXHTCXIKLN3GzLt7VTmUa1Up8UozfoXu2k5Vzl5tCrNgGIUAmgdvME_I_eE3M-Klmqa6Tb2XfSRGqkmc7fnbF79ni4YtvxgYhQHAl-v9BNJF3OtQKXnGtGSaUC8rMTxzg";
var token = token.replace("Bearer%20", "").replace("Bearer ", "");
......@@ -195,7 +193,7 @@ export default {
axios
.get(`http://discuz.bailuntec.com/api/login?useid=${wxUserid}`)
// .get(`http://discuz.bailuntec.com/api/login?useid=chenzekai`)
.then((res) => {
.then(res => {
if (res.data.data.relationships.users.data.id) {
localStorage.setItem(
"user_id",
......@@ -251,7 +249,7 @@ export default {
},
methods: {
// 获取cookie
getCookie: function (cname) {
getCookie: function(cname) {
const name = `${cname}=`;
const ca = document.cookie.split(";");
console.log("获取cookie,现在循环");
......@@ -269,7 +267,7 @@ export default {
this.showSyncWanPanloading = true;
axios
.get(`${config.WEI_PAN_URL}/weipan/ProcessWeiPanWorker`)
.then((res) => {
.then(res => {
if (res.data.statusCode == 200) {
this.$message.success(res.data.result);
} else {
......@@ -315,16 +313,12 @@ export default {
},
// 跳转首页
toIndex() {
if (this.$route.path === "/") {
window.location.href = "/";
} else {
this.$router.push("/");
}
this.$router.push("/category");
},
knowledge() {
this.$router.push(`/knowledge`);
},
},
}
}
};
</script>
<style lang="scss" scoped>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment