|
@@ -6,7 +6,7 @@
|
|
|
</view>
|
|
</view>
|
|
|
<!--个人中心-->
|
|
<!--个人中心-->
|
|
|
<view v-if="current == 2">
|
|
<view v-if="current == 2">
|
|
|
- <mine-view :userData="userData"></mine-view>
|
|
|
|
|
|
|
+ <mine-view :activityId="activityId"></mine-view>
|
|
|
</view>
|
|
</view>
|
|
|
<view style="height: 100upx;"></view>
|
|
<view style="height: 100upx;"></view>
|
|
|
<view class="footer-fixed">
|
|
<view class="footer-fixed">
|
|
@@ -38,37 +38,34 @@
|
|
|
{image: '/static/swiper1.png'},
|
|
{image: '/static/swiper1.png'},
|
|
|
{image: '/static/swiper1.png'}
|
|
{image: '/static/swiper1.png'}
|
|
|
],
|
|
],
|
|
|
- userData: {},
|
|
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
onLoad(options) {
|
|
onLoad(options) {
|
|
|
this.activityId = options.activityId;
|
|
this.activityId = options.activityId;
|
|
|
-
|
|
|
|
|
|
|
+ this.authorization();
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
async authorization() {
|
|
async authorization() {
|
|
|
let params = getUrlParams(window.location.search);
|
|
let params = getUrlParams(window.location.search);
|
|
|
- let res = await this.$u.api.wxInfo.getUserInfo({userCode: params.code});
|
|
|
|
|
- this.userData = res.data;
|
|
|
|
|
- let params={
|
|
|
|
|
- nickName:res.data.nickname,
|
|
|
|
|
- avatar:res.data.headimgurl,
|
|
|
|
|
- gender:res.data.sex,
|
|
|
|
|
- openid:res.data.openid,
|
|
|
|
|
- unionid:res.data.unionid
|
|
|
|
|
- }
|
|
|
|
|
- this.$u.api.user.login(params).then(res=>{
|
|
|
|
|
- if (res.success) {
|
|
|
|
|
- uni.setStorageSync("userId",res.data.id)
|
|
|
|
|
- //登录成功
|
|
|
|
|
|
|
+ if (!this.$u.test.isEmpty(params.code)) {
|
|
|
|
|
+ let res = await this.$u.api.wxInfo.getUserInfo({userCode: params.code});
|
|
|
|
|
+ console.log("是否登录",res);
|
|
|
|
|
+ let datas = {
|
|
|
|
|
+ nickName: res.nickname,
|
|
|
|
|
+ avatar: res.headimgurl,
|
|
|
|
|
+ gender: res.sex,
|
|
|
|
|
+ openid: res.openid,
|
|
|
|
|
+ unionid: res.unionid
|
|
|
|
|
+ }
|
|
|
|
|
+ let result = await this.$u.api.user.login(datas);
|
|
|
|
|
+ console.log("登录后",result)
|
|
|
|
|
+ if (result.success) {
|
|
|
|
|
+ uni.setStorageSync("userId", res.data.id);
|
|
|
}
|
|
}
|
|
|
- })
|
|
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
change(index) {
|
|
change(index) {
|
|
|
this.current = index;
|
|
this.current = index;
|
|
|
- if (this.current == 2 && this.$u.test.isEmpty(uni.getStorageSync("userId"))) {
|
|
|
|
|
- this.authorization();
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|