Browse Source

1.0.0:调试我的收藏

feature-1.0
chengkun 4 years ago
parent
commit
84b8bf57dd
  1. 2
      main.js
  2. 14
      pages/userInfo/myCollection/myCollection.vue
  3. 3
      utils/request.js

2
main.js

@ -1,7 +1,7 @@
import App from './App' import App from './App'
import store from './store/' import store from './store/'
const baseURL = 'http://localhost:7010' const baseURL = 'http://81.69.47.31:7010'
Vue.prototype.baseURL = baseURL; Vue.prototype.baseURL = baseURL;

14
pages/userInfo/myCollection/myCollection.vue

@ -1,6 +1,6 @@
<template> <template>
<view> <view>
<text>这是我的收藏</text> <text @click="getMyCollection()">这是我的收藏</text>
</view> </view>
</template> </template>
@ -13,17 +13,17 @@
} }
}, },
onLoad() { onLoad() {
this.getMyCollection(JSON.stringify(1)) //this.getMyCollection()
}, },
methods: { methods: {
getMyCollection(userId){ getMyCollection(){
const data = { let data = {
"userId" : userId "userId" : 1
} }
const res = getCollectionList(JSON.stringify(data)) const res = getCollectionList(data)
if(res.data.code === 200){ if(res.data.code === 200){
//this.banner = res.data.data //this.banner = res.data.data
console.log(res) console.log('结果为:',res)
}else{ }else{
uni.showModal({ uni.showModal({
content: '我的收藏加载失败!', content: '我的收藏加载失败!',

3
utils/request.js

@ -16,6 +16,9 @@ service.interceptors.request.use(
// // 给请求头添加user-token // // 给请求头添加user-token
// config.headers["user-token"] = store.state.token; // config.headers["user-token"] = store.state.token;
// } // }
config.headers = {
'Content-Type': 'application/json'
}
config.method === 'post' ? config.method === 'post' ?
config.data = qs.stringify({ ...config.data config.data = qs.stringify({ ...config.data
}) : }) :

Loading…
Cancel
Save