Browse Source

对接个人中心接口

master
邓平艺 4 years ago
parent
commit
fe1f13eea9
  1. 10
      pages/shop/seckillList.vue
  2. 49
      pages/user/my/center.vue
  3. 2
      pages/user/my/editname.vue
  4. 14
      pages/user/my/setting.vue

10
pages/shop/seckillList.vue

@ -34,10 +34,16 @@
} }
}, },
onLoad(){ onLoad(){
this.getSeckillList();
}, },
methods: { methods: {
getSeckillList(){
this.$http.get({
api: 'api/seckill/all'
}).then(res => {
console.log("----", res);
})
}
} }
} }
</script> </script>

49
pages/user/my/center.vue

@ -23,15 +23,15 @@
</view> </view>
<view class="lf-flex lf-row-between center-tag"> <view class="lf-flex lf-row-between center-tag">
<view class="lf-row-center lf-flex-column" @click="$url('/pages/point/detail/detail')"> <view class="lf-row-center lf-flex-column" @click="$url('/pages/point/detail/detail')">
<view class="lf-font-36 lf-color-white">0</view>
<view class="lf-font-36 lf-color-white">{{centerInfo.point || 0}}</view>
<view class="lf-font-24 lf-color-white">积分</view> <view class="lf-font-24 lf-color-white">积分</view>
</view> </view>
<view class="lf-row-center lf-flex-column" @click="$url('/pages/recharge/balance/balance')"> <view class="lf-row-center lf-flex-column" @click="$url('/pages/recharge/balance/balance')">
<view class="lf-font-36 lf-color-white">0.00</view>
<view class="lf-font-36 lf-color-white">{{centerInfo.balance || 0}}</view>
<view class="lf-font-24 lf-color-white">余额()</view> <view class="lf-font-24 lf-color-white">余额()</view>
</view> </view>
<view class="lf-row-center lf-flex-column" @click="$url('/pages/coupon/index/index')"> <view class="lf-row-center lf-flex-column" @click="$url('/pages/coupon/index/index')">
<view class="lf-font-36 lf-color-white">0</view>
<view class="lf-font-36 lf-color-white">{{centerInfo.coupon || 0}}</view>
<view class="lf-font-24 lf-color-white">优惠券</view> <view class="lf-font-24 lf-color-white">优惠券</view>
</view> </view>
</view> </view>
@ -152,14 +152,10 @@
}], }],
userInfo: {mobile_replace: '正在获取'}, // userInfo: {mobile_replace: '正在获取'}, //
token: '', // token token: '', // token
code: ''
code: '',
centerInfo: {}
} }
}, },
onShow(){
var userInfo = this.$cookieStorage.get('user_info');
console.log("userInfo", userInfo);
this.userInfo = userInfo || {};
},
onLoad(){ onLoad(){
var token = this.$cookieStorage.get('user_token'); var token = this.$cookieStorage.get('user_token');
this.token = token; this.token = token;
@ -178,7 +174,8 @@
} }
// #endif // #endif
} }
// this.getUserInfo();
this.getMeInfo();
this.getUcenter();
}, },
// //
onPageScroll(event){ onPageScroll(event){
@ -189,16 +186,38 @@
} }
}, },
methods: { methods: {
//
getUserInfo(){
//
getMeInfo(){
this.$http.get({
api: 'api/me',
header: {
Authorization: this.token
}
}).then(res => {
console.log("---", res);
this.userInfo = res.data.data;
})
},
//
getUcenter(){
this.$http.get({
api: 'api/users/ucenter',
header: {
Authorization: this.token
}
}).then(res => {
console.log("getUcenter", res);
this.centerInfo = res.data.data;
})
},
//
getUpdateUserInfo(){
this.$http.get({ this.$http.get({
api: 'api/user', api: 'api/user',
header: { header: {
Authorization: this.token Authorization: this.token
} }
}).then(res => { }).then(res => {
console.log("1111", res)
this.userInfo = res.data;
this.$cookieStorage.set('user_info', res.data); this.$cookieStorage.set('user_info', res.data);
}) })
}, },
@ -259,7 +278,7 @@
res = res.data; res = res.data;
if (res.status) { if (res.status) {
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
this.getUserInfo();
this.getUpdateUserInfo();
// #endif // #endif
uni.hideLoading(); uni.hideLoading();
} else { } else {

2
pages/user/my/editname.vue

@ -7,7 +7,7 @@
<view class="lf-p-l-32 lf-p-r-32"> <view class="lf-p-l-32 lf-p-r-32">
<view class="set-tag lf-border-bottom"> <view class="set-tag lf-border-bottom">
<view class="lf-font-28 lf-color-black"> <view class="lf-font-28 lf-color-black">
<input type="text" placeholder="182****5380" />
<input type="text" placeholder="输入新的昵称" />
</view> </view>
<view class="lf-flex"> <view class="lf-flex">
<text class="lf-iconfont icon-cuo lf-font-24 lf-m-l-10 lf-color-777"></text> <text class="lf-iconfont icon-cuo lf-font-24 lf-m-l-10 lf-color-777"></text>

14
pages/user/my/setting.vue

@ -7,7 +7,7 @@
昵称 昵称
</view> </view>
<view class="lf-flex"> <view class="lf-flex">
<view class="lf-font-28 lf-color-555">182****5380</view><text class="lf-iconfont icon-xiangyou lf-font-24 lf-m-l-10 lf-color-777"></text>
<view class="lf-font-28 lf-color-555">{{ userInfo.mobile_replace }}</view><text class="lf-iconfont icon-xiangyou lf-font-24 lf-m-l-10 lf-color-777"></text>
</view> </view>
</view> </view>
</view> </view>
@ -18,7 +18,8 @@
</view> </view>
<view class="lf-flex"> <view class="lf-flex">
<view class="lf-row-center"> <view class="lf-row-center">
<image src="https://hainan.lanzulive.com/storage/images/v2-deb89623e0ee2a2dad34bcded6dfd1ed_1440w.png" mode="aspectFill" class="set-img"></image>
<image :src="userInfo.avatar" mode="aspectFill" class="set-img" v-if="userInfo.avatar"></image>
<image src="../../../static/images/empty.png" mode="aspectFill" class="set-img" v-else></image>
</view> </view>
<text class="lf-iconfont icon-xiangyou lf-font-24 lf-m-l-10 lf-color-777"></text> <text class="lf-iconfont icon-xiangyou lf-font-24 lf-m-l-10 lf-color-777"></text>
</view> </view>
@ -93,6 +94,15 @@
<script> <script>
export default { export default {
data(){
return {
userInfo: {}
}
},
onLoad(){
var userInfo = this.$cookieStorage.get('user_info');
this.userInfo = userInfo || {};
},
methods: { methods: {
signOut(){ signOut(){
this.$msg('敬请期待') this.$msg('敬请期待')

Loading…
Cancel
Save