
1 changed files with 101 additions and 0 deletions
@ -0,0 +1,101 @@ |
|||||
|
<template> |
||||
|
<view class="container"> |
||||
|
<uni-load-more :status="status" :contentText="contentText" @clickLoadMore="loadMore"></uni-load-more> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
data() { |
||||
|
return { |
||||
|
status: "loading", |
||||
|
contentText: { |
||||
|
contentdown: "获取信息失败,点击重试", |
||||
|
contentrefresh: "获取信息中,请稍后", |
||||
|
contentnomore: "没有更多数据了" |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
onLoad() { |
||||
|
this.getWxCode() |
||||
|
}, |
||||
|
methods: { |
||||
|
loadMore(e) { |
||||
|
if ('more' === e.detail.status) { |
||||
|
// 重新获取 |
||||
|
this.getWxCode() |
||||
|
} |
||||
|
}, |
||||
|
getWxCode() { |
||||
|
|
||||
|
this.status = "loading" |
||||
|
let _this = this; |
||||
|
|
||||
|
wx.login({ |
||||
|
success: function(res) { |
||||
|
uni.request({ |
||||
|
// 组装请求地址 |
||||
|
url: getApp().globalData.wxSilentLoginURL + "?wxCode=" + res.code, |
||||
|
method: "GET", |
||||
|
header: { |
||||
|
'content-type': "application/x-www-form-urlencoded" |
||||
|
}, |
||||
|
data: { |
||||
|
"wxCode": res.code |
||||
|
}, |
||||
|
success: res => { |
||||
|
console.log('success', res); |
||||
|
if (res.statusCode == 200) { |
||||
|
if (!res.data.success) { |
||||
|
if (res.data.code == "110") { |
||||
|
// 需要绑定手机号 |
||||
|
uni.navigateTo({ |
||||
|
url: '/pages/index/BindPhone?openid=' + |
||||
|
res.data.data.wxMpOpenid |
||||
|
}) |
||||
|
} else { |
||||
|
_this.status = 'more' |
||||
|
} |
||||
|
} else { |
||||
|
// 成功后跳转主页 |
||||
|
getApp().globalData.sid = res.data.data.sid |
||||
|
uni.switchTab({ |
||||
|
url: '/pages/card/card' |
||||
|
}) |
||||
|
} |
||||
|
} else { |
||||
|
_this.status = 'more' |
||||
|
} |
||||
|
}, |
||||
|
fail: (err) => { |
||||
|
_this.status = 'more' |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
fail: function(res) { |
||||
|
_this.status = 'more' |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style> |
||||
|
.container { |
||||
|
width: 100%; |
||||
|
height: 90vh; |
||||
|
display: flex; |
||||
|
flex-direction: row; |
||||
|
align-items: center; |
||||
|
justify-content: center; |
||||
|
} |
||||
|
|
||||
|
uni-page-body, |
||||
|
page { |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
height: calc(100% + var(--window-bottom); ); |
||||
|
} |
||||
|
</style> |
Loading…
Reference in new issue