Commit 7b5f1cf6 authored by zhangjianguo's avatar zhangjianguo

Merge branch 'master' of http://gitlab.oytour.com/viitto/mallapp

parents ad059e61 8ea9ef00
...@@ -19,23 +19,15 @@ export default { ...@@ -19,23 +19,15 @@ export default {
}; };
}, },
created() { created() {
this.pageinfo = uni.getStorageSync("basedata") this.pageinfo = uni.getStorageSync('basedata') ? uni.getStorageSync('basedata').auth_page : {};
? uni.getStorageSync("basedata").auth_page
: {};
let x = this.pageinfo.hotspot; let x = this.pageinfo.hotspot;
let y = this.pageinfo.hotspot_cancel; let y = this.pageinfo.hotspot_cancel;
this.sureStyle = `height:${x.height}rpx;width:${x.width}rpx;left:${x.left}rpx;top:${x.top}rpx;`; 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;`; this.cancelStyle = `height:${y.height}rpx;width:${y.width}rpx;left:${y.left}rpx;top:${y.top}rpx;`;
}, },
methods: { methods: {
getUserInfo(e) { getUserInfo(e) {
// if(e.mp.detail.userInfo){ var that = this;
// // TODO 实现用户登录
// uni.setStorageSync("userinfo", e.mp.detail.userInfo);
// this.$emit('changeuserinfo');
// }
var that=this;
uni.getProvider({ uni.getProvider({
service: 'oauth', service: 'oauth',
success: function(res) { success: function(res) {
...@@ -43,33 +35,21 @@ export default { ...@@ -43,33 +35,21 @@ export default {
uni.login({ uni.login({
provider: 'weixin', provider: 'weixin',
success: res => { success: res => {
that.authorization = res.code;
uni.getUserInfo({ uni.getUserInfo({
provider: 'weixin', provider: 'weixin',
success: info => { success: info => {
//这里请求接口 //这里请求接口
var OpenId='ow_7I5XC1-RGwwk8QANBmWKYKmOc' let obj = {
console.log(res, '请求222'); Source: 1,
console.log(info,'info'); OpenId: '',
that.request2( Name: info.userInfo.nickName,
{ Photo: info.userInfo.avatarUrl,
url: '/api/AppletLogin/Login', Moblie: '',
data: { SuperiorId: 0,
Source:1, code: res.code
OpenId:OpenId, };
Name:'^O^ 做个好梦^O^', that.getCode(obj);
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');
}
}
);
}, },
fail: () => { fail: () => {
uni.showToast({ title: '微信登录授权失败', icon: 'none' }); uni.showToast({ title: '微信登录授权失败', icon: 'none' });
...@@ -90,7 +70,55 @@ export default { ...@@ -90,7 +70,55 @@ export default {
}); });
}, },
close() { 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 { ...@@ -22,7 +22,7 @@ export default {
}; };
}, },
created() { created() {
this.u = uni.getStorageSync("userinfo"); this.u = uni.getStorageSync("mall_UserInfo");
if (!this.u) { if (!this.u) {
this.u = { this.u = {
nickName: "未登录", nickName: "未登录",
...@@ -33,7 +33,7 @@ export default { ...@@ -33,7 +33,7 @@ export default {
}, },
methods: { methods: {
reloadUserinfo() { reloadUserinfo() {
this.u = uni.getStorageSync("userinfo"); this.u = uni.getStorageSync("mall_UserInfo");
this.showAuth=false this.showAuth=false
} }
} }
......
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
@confirm="confirm" @confirm="confirm"
></u-modal> ></u-modal>
<u-toast ref="uToast" /> <u-toast ref="uToast" />
<!-- <auth v-if="showAuth" @changeuserinfo="reloadUserinfo"></auth> --> <auth v-if="showAuth" @changeuserinfo="reloadUserinfo"></auth>
</view> </view>
</template> </template>
...@@ -111,7 +111,7 @@ export default { ...@@ -111,7 +111,7 @@ export default {
}); });
}, },
onLoad() { onLoad() {
this.u = wx.getStorageSync("userinfo"); this.u = wx.getStorageSync("mall_UserInfo");
if (!this.u) { if (!this.u) {
this.u = { this.u = {
nickName: "未登录", nickName: "未登录",
...@@ -142,7 +142,8 @@ export default { ...@@ -142,7 +142,8 @@ export default {
); );
}, },
reloadUserinfo() { reloadUserinfo() {
this.u = uni.getStorageSync("userinfo"); this.init();
this.u = uni.getStorageSync("mall_UserInfo");
this.showAuth = false; this.showAuth = false;
}, },
isdefault(item) { isdefault(item) {
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
</view> </view>
<!-- <auth v-if="showAuth" @changeuserinfo="reloadUserinfo"></auth> --> <auth v-if="showAuth" @changeuserinfo="reloadUserinfo"></auth>
<view class="loading" v-if="load"> <view class="loading" v-if="load">
<u-loading mode="flower" size="48"></u-loading> <u-loading mode="flower" size="48"></u-loading>
<Text style='color: #fff;margin-top: 10rpx;'>加载中...</Text> <Text style='color: #fff;margin-top: 10rpx;'>加载中...</Text>
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
}); });
}, },
onLoad(){ onLoad(){
this.u = uni.getStorageSync("userinfo"); this.u = uni.getStorageSync("mall_UserInfo");
if (!this.u) { if (!this.u) {
this.u = { this.u = {
nickName: "未登录", nickName: "未登录",
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
}, },
methods: { methods: {
reloadUserinfo() { reloadUserinfo() {
this.u = uni.getStorageSync("userinfo"); this.u = uni.getStorageSync("mall_UserInfo");
this.showAuth=false this.showAuth=false
}, },
balancedata(){ balancedata(){
......
...@@ -128,7 +128,7 @@ ...@@ -128,7 +128,7 @@
}); });
}, },
onLoad(){ onLoad(){
this.u = uni.getStorageSync("userinfo"); this.u = uni.getStorageSync("mall_UserInfo");
if (!this.u) { if (!this.u) {
this.u = { this.u = {
nickName: "未登录", nickName: "未登录",
...@@ -191,7 +191,7 @@ ...@@ -191,7 +191,7 @@
}, },
reloadUserinfo() { reloadUserinfo() {
this.u = uni.getStorageSync("userinfo"); this.u = uni.getStorageSync("mall_UserInfo");
this.showAuth=false this.showAuth=false
}, },
clickHandler(cx) { clickHandler(cx) {
......
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
</scroll-view> </scroll-view>
</view> </view>
<!-- <auth v-if="showAuth" @changeuserinfo="reloadUserinfo"></auth> --> <auth v-if="showAuth" @changeuserinfo="reloadUserinfo"></auth>
<view class="loading" v-show="loading"> <view class="loading" v-show="loading">
<u-loading mode="flower" size="48"></u-loading> <u-loading mode="flower" size="48"></u-loading>
<Text style='color: #fff;margin-top: 10rpx;'>加载中...</Text> <Text style='color: #fff;margin-top: 10rpx;'>加载中...</Text>
...@@ -202,7 +202,7 @@ ...@@ -202,7 +202,7 @@
}); });
}, },
onLoad(){ onLoad(){
this.u = uni.getStorageSync("userinfo"); this.u = uni.getStorageSync("mall_UserInfo");
if (!this.u) { if (!this.u) {
this.u = { this.u = {
nickName: "未登录", nickName: "未登录",
...@@ -249,7 +249,7 @@ ...@@ -249,7 +249,7 @@
} }
}, },
reloadUserinfo() { reloadUserinfo() {
this.u = uni.getStorageSync("userinfo"); this.u = uni.getStorageSync("mall_UserInfo");
this.showAuth=false this.showAuth=false
}, },
change(index) { change(index) {
......
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
</view> </view>
<!-- <auth v-if="showAuth" @changeuserinfo="reloadUserinfo"></auth> --> <auth v-if="showAuth" @changeuserinfo="reloadUserinfo"></auth>
</view> </view>
</template> </template>
...@@ -110,6 +110,7 @@ ...@@ -110,6 +110,7 @@
sharemenus:{}, sharemenus:{},
orderdata:{}, orderdata:{},
bg_img:'', bg_img:'',
showAuth:false
} }
}, },
created(){ created(){
...@@ -142,7 +143,7 @@ ...@@ -142,7 +143,7 @@
}); });
}, },
onLoad(){ onLoad(){
this.u = uni.getStorageSync("userinfo"); this.u = uni.getStorageSync("mall_UserInfo");
if (!this.u) { if (!this.u) {
this.u = { this.u = {
nickName: "未登录", nickName: "未登录",
...@@ -153,7 +154,7 @@ ...@@ -153,7 +154,7 @@
}, },
methods: { methods: {
reloadUserinfo() { reloadUserinfo() {
this.u = uni.getStorageSync("userinfo"); this.u = uni.getStorageSync("mall_UserInfo");
this.showAuth=false this.showAuth=false
}, },
init(){ init(){
......
...@@ -92,9 +92,7 @@ ...@@ -92,9 +92,7 @@
<Text style="margin-top: 10rpx;">{{ meueData.user_center.copyright.description }}</Text> <Text style="margin-top: 10rpx;">{{ meueData.user_center.copyright.description }}</Text>
</view> </view>
</view> </view>
<!-- v-if="showAuth" --> <auth v-if="showAuth" @changeuserinfo="reloadUserinfo" @gbAuth="gbAuth"></auth>
<auth v-if="showAuth" @changeuserinfo="reloadUserinfo"></auth>
<tabbars></tabbars> <tabbars></tabbars>
</view> </view>
</template> </template>
...@@ -159,6 +157,9 @@ export default { ...@@ -159,6 +157,9 @@ export default {
}); });
this.userinfo(); this.userinfo();
}, },
onShow() {
this.userinfo();
},
methods: { methods: {
goHome() { goHome() {
uni.redirectTo({ url: '/pages/index/main' }); uni.redirectTo({ url: '/pages/index/main' });
...@@ -193,6 +194,10 @@ export default { ...@@ -193,6 +194,10 @@ export default {
if ((name&&name.nickname=='')||!name|| !name.nickname) { if ((name&&name.nickname=='')||!name|| !name.nickname) {
this.showAuth = true; 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