From 84b8bf57ddbe48a73906c634b1ff2fc8d6369935 Mon Sep 17 00:00:00 2001 From: chengkun <2500338766@qq.com> Date: Thu, 5 May 2022 16:37:08 +0800 Subject: [PATCH] =?UTF-8?q?1.0.0:=E8=B0=83=E8=AF=95=E6=88=91=E7=9A=84?= =?UTF-8?q?=E6=94=B6=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.js | 2 +- pages/userInfo/myCollection/myCollection.vue | 14 +++++++------- utils/request.js | 3 +++ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/main.js b/main.js index a8cfb6b..755bb99 100644 --- a/main.js +++ b/main.js @@ -1,7 +1,7 @@ import App from './App' import store from './store/' -const baseURL = 'http://localhost:7010' +const baseURL = 'http://81.69.47.31:7010' Vue.prototype.baseURL = baseURL; diff --git a/pages/userInfo/myCollection/myCollection.vue b/pages/userInfo/myCollection/myCollection.vue index b6f6fc8..cfe4dd0 100644 --- a/pages/userInfo/myCollection/myCollection.vue +++ b/pages/userInfo/myCollection/myCollection.vue @@ -1,6 +1,6 @@ @@ -13,17 +13,17 @@ } }, onLoad() { - this.getMyCollection(JSON.stringify(1)) + //this.getMyCollection() }, methods: { - getMyCollection(userId){ - const data = { - "userId" : userId + getMyCollection(){ + let data = { + "userId" : 1 } - const res = getCollectionList(JSON.stringify(data)) + const res = getCollectionList(data) if(res.data.code === 200){ //this.banner = res.data.data - console.log(res) + console.log('结果为:',res) }else{ uni.showModal({ content: '我的收藏加载失败!', diff --git a/utils/request.js b/utils/request.js index f29aabf..98aa9ed 100644 --- a/utils/request.js +++ b/utils/request.js @@ -16,6 +16,9 @@ service.interceptors.request.use( // // 给请求头添加user-token // config.headers["user-token"] = store.state.token; // } + config.headers = { + 'Content-Type': 'application/json' + } config.method === 'post' ? config.data = qs.stringify({ ...config.data }) :