Browse Source

1.0.0:我的收藏同步

feature-1.0
chengkun 4 years ago
parent
commit
7e21b83ee5
  1. 1
      api/myCollection.js
  2. 2
      main.js
  3. 29
      pages/userInfo/myCollection/myCollection.vue
  4. 5
      utils/request.js

1
api/myCollection.js

@ -9,6 +9,5 @@ export function getCollectionList(data) {
url: `${serviceTitle}/img/mini/tiktok/listTiktokCollection`, url: `${serviceTitle}/img/mini/tiktok/listTiktokCollection`,
method: 'post', method: 'post',
data: data data: data
}) })
} }

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://81.69.47.31:7010' const baseURL = 'http://localhost:7010'
Vue.prototype.baseURL = baseURL; Vue.prototype.baseURL = baseURL;

29
pages/userInfo/myCollection/myCollection.vue

@ -1,6 +1,6 @@
<template> <template>
<view> <view>
<text @click="getMyCollection()">这是我的收藏</text> <text>这是我的收藏</text>
</view> </view>
</template> </template>
@ -13,23 +13,24 @@
} }
}, },
onLoad() { onLoad() {
//this.getMyCollection() this.getMyCollection(1)
}, },
methods: { methods: {
getMyCollection(){
getMyCollection(userId){
let data = { let data = {
"userId" : 1
}
const res = getCollectionList(data)
if(res.data.code === 200){
//this.banner = 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
// });
// }
} }
} }
} }

5
utils/request.js

@ -16,15 +16,14 @@ service.interceptors.request.use(
// // 给请求头添加user-token // // 给请求头添加user-token
// config.headers["user-token"] = store.state.token; // config.headers["user-token"] = store.state.token;
// } // }
config.headers = { config.headers['Content-Type'] = 'application/json';
'Content-Type': 'application/json'
}
config.method === 'post' ? config.method === 'post' ?
config.data = qs.stringify({ ...config.data config.data = qs.stringify({ ...config.data
}) : }) :
config.params = { ...config.params config.params = { ...config.params
}; };
console.log('请求拦截成功') console.log('请求拦截成功')
console.log(config)
return config; return config;
}, },
error => { error => {

Loading…
Cancel
Save