You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
105 lines
2.3 KiB
105 lines
2.3 KiB
<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 => {
|
|
if (res.statusCode == 200) {
|
|
if (!res.data.success) {
|
|
if (res.data.code == "110") {
|
|
// 需要绑定手机号
|
|
uni.reLaunch({
|
|
url: '/pages/index/BindPhone?openid=' +
|
|
res.data.data.wxMpOpenid
|
|
})
|
|
} else {
|
|
_this.status = 'more'
|
|
// _this.contentText.contentdown = res.data.msg+",点击重试"
|
|
}
|
|
} else {
|
|
// 成功后跳转主页
|
|
getApp().globalData.sid = res.data.data.sid
|
|
getApp().globalData.token = res.data.data.token
|
|
uni.setStorageSync("satoken",res.data.data.token)
|
|
console.log("人员sid", res.data.data.sid);
|
|
console.log("token", res.data.data.token);
|
|
uni.switchTab({
|
|
url: '/pages/home/cloudCard'
|
|
})
|
|
}
|
|
} 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>
|