diff --git a/src/components/HeaderNav.vue b/src/components/HeaderNav.vue index 1c7b710..d1dce47 100755 --- a/src/components/HeaderNav.vue +++ b/src/components/HeaderNav.vue @@ -184,7 +184,8 @@ export default { // 获取用户信息 getUserInfoData() { - this.$http.post("/widget/getUser").then((res) => { + // this.$http.post("/widget/getUser").then((res) => { + this.$http.post("/api",).then((res) => { if (res.code != 200) return; this.userInfo = res.data; this.islogin = res.data.uid > 0 ? true : false; @@ -194,6 +195,7 @@ export default { }, getMenu() { + return this.$http.get("/widget", { type: "menu", }).then((res) => { diff --git a/src/utils/request.js b/src/utils/request.js index ed772ab..d246aa8 100755 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -11,16 +11,19 @@ axios.defaults.withCredentials = true axios.defaults.emulateJSON = true // baseURL = "https://offer.gter.net/api" baseURL = "https://forum.gter.net" -console.log("baseURL",baseURL); const service = axios.create({ baseURL, timeout: 5000 }) +// service.header.authorization = "qj2q1qk1on0curclipghjtv5ja1g9eq2" + // 2.请求拦截器 service.interceptors.request.use(config => { //发请求前做的一些处理,数据转化,配置请求头,设置token,设置loading等,根据需求去添加 //注意使用token的时候需要引入cookie方法或者用本地localStorage等方法,推荐js-cookie + // console.log(config, "config"); + config['headers']['authorization'] = "qj2q1qk1on0curclipghjtv5ja1g9eq2" return config }, error => { Promise.reject(error) diff --git a/src/views/index/allSections/AllSections.vue b/src/views/index/allSections/AllSections.vue index 128ca5e..813b251 100755 --- a/src/views/index/allSections/AllSections.vue +++ b/src/views/index/allSections/AllSections.vue @@ -7,7 +7,7 @@
-
+
{{ i.name }}
@@ -65,6 +65,8 @@ export default { this.$http.post("/api/home/allForum").then((res) => { if (res.code != 200) return; this.list = res.data + + console.log(this.list, "list"); }).catch(err => { this.$message.error(err.message) });