Browse Source

Merge branch 'master' of https://gitee.com/pennyJoly/bnyer-cloud-tiktok

 Conflicts:
	pages/userInfo/myCollection/myCollection.vue
	utils/request.js
feature-1.0
chengkun 4 years ago
parent
commit
95ea52e10f
  1. 2
      main.js
  2. 30
      pages/userInfo/myCollection/myCollection.vue
  3. 13
      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://81.69.47.31:7010' const baseURL = 'http://localhost:7010'
Vue.prototype.baseURL = baseURL; Vue.prototype.baseURL = baseURL;

30
pages/userInfo/myCollection/myCollection.vue

@ -1,6 +1,9 @@
<template> <template>
<view> <view>
<text>这是我的收藏</text> <text>这是我的收藏</text>
<view v-for="(item,index) in myCollection" :key="index">
<image :src="item.imgUrl"></image>
</view>
</view> </view>
</template> </template>
@ -9,28 +12,27 @@
export default { export default {
data() { data() {
return { return {
myCollection:[]
} }
}, },
onLoad() { onLoad() {
this.getMyCollection(1) this.getMyCollection(1)
}, },
methods: { methods: {
async getMyCollection(userId){
getMyCollection(userId){
let data = { 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
// });
// }
} }
} }
} }

13
utils/request.js

@ -9,6 +9,7 @@ const service = axios.create({
timeout: 10000 timeout: 10000
}) })
// request拦截器,在请求之前做一些处理 // request拦截器,在请求之前做一些处理
service.interceptors.request.use( service.interceptors.request.use(
config => { config => {
@ -16,12 +17,12 @@ 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.headers['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) console.log(config)
return config; return config;

Loading…
Cancel
Save