diff --git a/main.js b/main.js index 755bb99..a8cfb6b 100644 --- a/main.js +++ b/main.js @@ -1,7 +1,7 @@ import App from './App' import store from './store/' -const baseURL = 'http://81.69.47.31:7010' +const baseURL = 'http://localhost:7010' Vue.prototype.baseURL = baseURL; diff --git a/pages/userInfo/myCollection/myCollection.vue b/pages/userInfo/myCollection/myCollection.vue index 51c5bbc..979301d 100644 --- a/pages/userInfo/myCollection/myCollection.vue +++ b/pages/userInfo/myCollection/myCollection.vue @@ -1,6 +1,9 @@ @@ -9,28 +12,27 @@ export default { data() { return { - + myCollection:[] } }, onLoad() { this.getMyCollection(1) }, methods: { - - getMyCollection(userId){ + async getMyCollection(userId){ let data = { - + userId : userId + } + const res = await getCollectionList(data) + if(res.data.code === 200){ + this.myCollection = res.data.data + console.log(res) + }else{ + uni.showModal({ + content: '我的收藏加载失败!', + showCancel: false + }); } - const res = getCollectionList(data); - // if(res.data.code === 200){ - // //this.banner = res.data.data - // console.log('结果为:',res) - // }else{ - // uni.showModal({ - // content: '我的收藏加载失败!', - // showCancel: false - // }); - // } } } } diff --git a/utils/request.js b/utils/request.js index eddc004..db91d45 100644 --- a/utils/request.js +++ b/utils/request.js @@ -9,6 +9,7 @@ const service = axios.create({ timeout: 10000 }) + // request拦截器,在请求之前做一些处理 service.interceptors.request.use( config => { @@ -16,12 +17,12 @@ 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 - }) : - config.params = { ...config.params - }; + config.headers['Content-Type'] = 'application/json' + // config.method === 'post' ? + // config.data = qs.stringify({ ...config.data + // }) : + // config.params = { ...config.params + // }; console.log('请求拦截成功') console.log(config) return config;