From c64091d9c02bf49588652e85811a0d174de59c06 Mon Sep 17 00:00:00 2001 From: XiaoMo Date: Mon, 3 Apr 2023 12:00:14 +0800 Subject: [PATCH] =?UTF-8?q?a1300399510@qq.com=20=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E4=BA=8E=202023/04/03=20-12:00:02?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/HeaderNav.vue | 4 +++- src/utils/request.js | 5 ++++- src/views/index/allSections/AllSections.vue | 4 +++- 3 files changed, 10 insertions(+), 3 deletions(-) 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) });