Commit 8ea9ef00 authored by zhengke's avatar zhengke

修改页面

parent b9439f0f
......@@ -19,23 +19,15 @@ export default {
};
},
created() {
this.pageinfo = uni.getStorageSync("basedata")
? uni.getStorageSync("basedata").auth_page
: {};
this.pageinfo = uni.getStorageSync('basedata') ? uni.getStorageSync('basedata').auth_page : {};
let x = this.pageinfo.hotspot;
let y = this.pageinfo.hotspot_cancel;
this.sureStyle = `height:${x.height}rpx;width:${x.width}rpx;left:${x.left}rpx;top:${x.top}rpx;`;
console.log(this.sureStyle, 'this.sureStyle');
this.cancelStyle = `height:${y.height}rpx;width:${y.width}rpx;left:${y.left}rpx;top:${y.top}rpx;`;
},
methods: {
getUserInfo(e) {
// if(e.mp.detail.userInfo){
// // TODO 实现用户登录
// uni.setStorageSync("userinfo", e.mp.detail.userInfo);
// this.$emit('changeuserinfo');
// }
var that=this;
var that = this;
uni.getProvider({
service: 'oauth',
success: function(res) {
......@@ -43,33 +35,21 @@ export default {
uni.login({
provider: 'weixin',
success: res => {
that.authorization = res.code;
uni.getUserInfo({
provider: 'weixin',
success: info => {
//这里请求接口
var OpenId='ow_7I5XC1-RGwwk8QANBmWKYKmOc'
console.log(res, '请求222');
console.log(info,'info');
that.request2(
{
url: '/api/AppletLogin/Login',
data: {
Source:1,
OpenId:OpenId,
Name:'^O^ 做个好梦^O^',
Photo:'https://wx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTLnsYM6ibJ4QzJqibNy4WudZy1HEhia3oIzXFhaGjUHZicDtNZeavGyxkP02ib2LVicpwDC4U7PZUZH6GuA/132',
Moblie:'',
SuperiorId:0
}
},
res => {
console.log(res, '登录了');
if(res.resultCode==1){
uni.setStorageSync("mall_UserInfo", res.data);
that.$emit('changeuserinfo');
}
}
);
let obj = {
Source: 1,
OpenId: '',
Name: info.userInfo.nickName,
Photo: info.userInfo.avatarUrl,
Moblie: '',
SuperiorId: 0,
code: res.code
};
that.getCode(obj);
},
fail: () => {
uni.showToast({ title: '微信登录授权失败', icon: 'none' });
......@@ -90,7 +70,55 @@ export default {
});
},
close() {
this.showDialog = false;
this.$emit('gbAuth');
},
//调用获取code
getCode(obj) {
var that = this;
uni.getUserInfo({
provider: 'weixin',
success: info => {
//这里请求接口
var OpenId = '';
that.request2(
{
url: '/api/mall/GetWeChatOpenId',
data: {
Code: obj.code
}
},
res => {
if (res.resultCode == 1) {
obj.OpenId = res.data;
that.getLogin(obj);
}
}
);
}
});
},
//登录
getLogin(obj) {
var that = this;
that.request2(
{
url: '/api/AppletLogin/Login',
data: {
Source: 1,
OpenId: obj.OpenId,
Name: obj.nickName,
Photo: obj.avatarUrl,
Moblie: '',
SuperiorId: 0
}
},
res => {
if (res.resultCode == 1) {
uni.setStorageSync('mall_UserInfo', res.data);
that.$emit('changeuserinfo');
}
}
);
}
}
};
......
......@@ -22,7 +22,7 @@ export default {
};
},
created() {
this.u = uni.getStorageSync("userinfo");
this.u = uni.getStorageSync("mall_UserInfo");
if (!this.u) {
this.u = {
nickName: "未登录",
......@@ -33,7 +33,7 @@ export default {
},
methods: {
reloadUserinfo() {
this.u = uni.getStorageSync("userinfo");
this.u = uni.getStorageSync("mall_UserInfo");
this.showAuth=false
}
}
......
......@@ -60,7 +60,7 @@
@confirm="confirm"
></u-modal>
<u-toast ref="uToast" />
<!-- <auth v-if="showAuth" @changeuserinfo="reloadUserinfo"></auth> -->
<auth v-if="showAuth" @changeuserinfo="reloadUserinfo"></auth>
</view>
</template>
......@@ -111,7 +111,7 @@ export default {
});
},
onLoad() {
this.u = wx.getStorageSync("userinfo");
this.u = wx.getStorageSync("mall_UserInfo");
if (!this.u) {
this.u = {
nickName: "未登录",
......@@ -142,7 +142,8 @@ export default {
);
},
reloadUserinfo() {
this.u = uni.getStorageSync("userinfo");
this.init();
this.u = uni.getStorageSync("mall_UserInfo");
this.showAuth = false;
},
isdefault(item) {
......
......@@ -46,7 +46,7 @@
</view>
<!-- <auth v-if="showAuth" @changeuserinfo="reloadUserinfo"></auth> -->
<auth v-if="showAuth" @changeuserinfo="reloadUserinfo"></auth>
<view class="loading" v-if="load">
<u-loading mode="flower" size="48"></u-loading>
<Text style='color: #fff;margin-top: 10rpx;'>加载中...</Text>
......@@ -90,7 +90,7 @@
});
},
onLoad(){
this.u = uni.getStorageSync("userinfo");
this.u = uni.getStorageSync("mall_UserInfo");
if (!this.u) {
this.u = {
nickName: "未登录",
......@@ -114,7 +114,7 @@
},
methods: {
reloadUserinfo() {
this.u = uni.getStorageSync("userinfo");
this.u = uni.getStorageSync("mall_UserInfo");
this.showAuth=false
},
balancedata(){
......
......@@ -103,7 +103,7 @@
});
},
onLoad(){
this.u = uni.getStorageSync("userinfo");
this.u = uni.getStorageSync("mall_UserInfo");
if (!this.u) {
this.u = {
nickName: "未登录",
......@@ -166,7 +166,7 @@
);
},
reloadUserinfo() {
this.u = uni.getStorageSync("userinfo");
this.u = uni.getStorageSync("mall_UserInfo");
this.showAuth=false
},
clickHandler(url) {
......
......@@ -72,7 +72,7 @@
</scroll-view>
</view>
<!-- <auth v-if="showAuth" @changeuserinfo="reloadUserinfo"></auth> -->
<auth v-if="showAuth" @changeuserinfo="reloadUserinfo"></auth>
<view class="loading" v-show="loading">
<u-loading mode="flower" size="48"></u-loading>
<Text style='color: #fff;margin-top: 10rpx;'>加载中...</Text>
......@@ -192,7 +192,7 @@
});
},
onLoad(){
this.u = uni.getStorageSync("userinfo");
this.u = uni.getStorageSync("mall_UserInfo");
if (!this.u) {
this.u = {
nickName: "未登录",
......@@ -270,7 +270,7 @@
}
},
reloadUserinfo() {
this.u = uni.getStorageSync("userinfo");
this.u = uni.getStorageSync("mall_UserInfo");
this.showAuth=false
},
change(index) {
......
......@@ -89,7 +89,7 @@
</view>
<!-- <auth v-if="showAuth" @changeuserinfo="reloadUserinfo"></auth> -->
<auth v-if="showAuth" @changeuserinfo="reloadUserinfo"></auth>
</view>
</template>
......@@ -110,6 +110,7 @@
sharemenus:{},
orderdata:{},
bg_img:'',
showAuth:false
}
},
created(){
......@@ -142,7 +143,7 @@
});
},
onLoad(){
this.u = uni.getStorageSync("userinfo");
this.u = uni.getStorageSync("mall_UserInfo");
if (!this.u) {
this.u = {
nickName: "未登录",
......@@ -153,7 +154,7 @@
},
methods: {
reloadUserinfo() {
this.u = uni.getStorageSync("userinfo");
this.u = uni.getStorageSync("mall_UserInfo");
this.showAuth=false
},
init(){
......
......@@ -92,9 +92,7 @@
<Text style="margin-top: 10rpx;">{{ meueData.user_center.copyright.description }}</Text>
</view>
</view>
<!-- v-if="showAuth" -->
<auth v-if="showAuth" @changeuserinfo="reloadUserinfo"></auth>
<auth v-if="showAuth" @changeuserinfo="reloadUserinfo" @gbAuth="gbAuth"></auth>
<tabbars></tabbars>
</view>
</template>
......@@ -159,6 +157,9 @@ export default {
});
this.userinfo();
},
onShow() {
this.userinfo();
},
methods: {
goHome() {
uni.redirectTo({ url: '/pages/index/main' });
......@@ -193,6 +194,10 @@ export default {
if ((name&&name.nickname=='')||!name|| !name.nickname) {
this.showAuth = true;
}
},
//关闭登录窗口
gbAuth(){
this.showAuth=false;
}
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment