2025-05-14 15:14:12 +08:00
|
|
|
<template>
|
|
|
|
<view class="page">
|
2025-07-03 14:20:19 +08:00
|
|
|
<u-navbar :is-back="false" :title="tittxt" :border-bottom="false" :background="bgc" title-color='#fff' title-size='36' height='36' ></u-navbar>
|
2025-05-14 15:14:12 +08:00
|
|
|
<view class="imgbox">
|
|
|
|
<image src="https://api.ccttiot.com/smartmeter/img/static/uGfU2kTWiHxXEWrNAOuA" mode=""></image>
|
|
|
|
</view>
|
|
|
|
<button class="ceshi" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" >
|
|
|
|
授权登录
|
|
|
|
</button>
|
|
|
|
<view class="" v-if="maskflag" style="background-color: #010000;position: fixed;top: 0;left: 0;z-index: 998;width: 100%;height: 100vh;">
|
|
|
|
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
var xBlufi = require("@/components/blufi/xBlufi.js")
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
bgc: {
|
|
|
|
backgroundColor: "#010000",
|
|
|
|
},
|
|
|
|
tittxt:"登录",
|
|
|
|
chooseType:true,
|
|
|
|
usertype:'',
|
|
|
|
login:false,
|
|
|
|
checked:false,
|
|
|
|
maskflag:true,
|
|
|
|
q:''
|
|
|
|
}
|
|
|
|
},
|
|
|
|
onLoad(option) {
|
|
|
|
console.log(option.q);
|
|
|
|
if(option.q){
|
|
|
|
this.q = option.q
|
|
|
|
}
|
|
|
|
uni.showLoading({
|
|
|
|
title: '加载中...',
|
|
|
|
mask: true
|
|
|
|
})
|
|
|
|
this.$u.get(`/getInfo`).then(res => {
|
|
|
|
if (res.code == 200) {
|
|
|
|
xBlufi.notifyStartDiscoverBle({
|
|
|
|
'isStart': true
|
|
|
|
})
|
|
|
|
uni.hideLoading()
|
|
|
|
uni.reLaunch({
|
|
|
|
url:'/pages/myorder/index?q=' + this.q
|
|
|
|
})
|
|
|
|
}else if(res.code == 401){
|
|
|
|
xBlufi.initXBlufi(1)
|
|
|
|
xBlufi.notifyStartDiscoverBle({
|
|
|
|
'isStart': true
|
|
|
|
})
|
|
|
|
uni.hideLoading()
|
|
|
|
this.maskflag = false
|
|
|
|
}
|
|
|
|
})
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
getPhoneNumber(e) {
|
|
|
|
let that = this;
|
|
|
|
console.log("eeeeeeee", e);
|
|
|
|
const wxLoginAsync = () => {
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
wx.login({
|
|
|
|
success(res) {
|
|
|
|
if (res.code) {
|
|
|
|
console.log('登录!', res);
|
|
|
|
let data = {
|
|
|
|
loginCode: res.code,
|
|
|
|
mobileCode: e.detail.code,
|
|
|
|
appId:that.$store.state.appid
|
|
|
|
};
|
|
|
|
resolve(data);
|
|
|
|
} else {
|
|
|
|
reject(res.errMsg);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
fail(err) {
|
|
|
|
reject(err);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
wxLoginAsync()
|
|
|
|
.then(async (data) => {
|
|
|
|
this.$u.post("/wxLogin",data).then((res) => {
|
|
|
|
if (res.code == 200) {
|
|
|
|
console.log(res,'resres');
|
|
|
|
wx.setStorageSync('token', res.token);
|
|
|
|
that.ceshi()
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
})
|
|
|
|
.catch((err) => {
|
|
|
|
console.error(err);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
async ceshi() {
|
|
|
|
this.$u.get("/getInfo").then((res) => {
|
2025-07-03 14:20:19 +08:00
|
|
|
console.log('登录成功进行跳转页面');
|
2025-05-14 15:14:12 +08:00
|
|
|
uni.reLaunch({
|
|
|
|
url:'/pages/myorder/index?q=' + this.q
|
|
|
|
})
|
|
|
|
});
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" >
|
|
|
|
page{
|
|
|
|
// background: #010000;
|
|
|
|
}
|
|
|
|
.page {
|
|
|
|
position: relative; /* 添加相对定位 */
|
|
|
|
}
|
|
|
|
.zanbu{
|
|
|
|
font-weight: 600;
|
|
|
|
font-size: 36rpx;
|
|
|
|
color: #808080;
|
|
|
|
position: fixed;
|
|
|
|
bottom: 292rpx;
|
|
|
|
left: 50%;
|
|
|
|
transform: translateX(-50%);
|
|
|
|
background-color: transparent;
|
|
|
|
}
|
|
|
|
.ceshi{
|
|
|
|
width: 614rpx;
|
|
|
|
height: 108rpx;
|
|
|
|
border-radius: 54rpx 54rpx 54rpx 54rpx;
|
|
|
|
border: 2rpx solid #FF8998;
|
|
|
|
background-color: transparent;
|
|
|
|
font-weight: 600;
|
|
|
|
font-size: 36rpx;
|
|
|
|
color: #FF8998;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
position: fixed;
|
|
|
|
bottom: 398rpx;
|
|
|
|
left: 50%;
|
|
|
|
transform: translateX(-50%);
|
|
|
|
}
|
|
|
|
.imgbox {
|
|
|
|
width: 100%;
|
|
|
|
height: 100vh;
|
|
|
|
z-index: 0;
|
|
|
|
position: fixed;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
image {
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.button{
|
|
|
|
margin-top: 200rpx;
|
|
|
|
width: 586rpx;
|
|
|
|
height: 90rpx;
|
|
|
|
background: #4C97E7;
|
|
|
|
border-radius: 54rpx 54rpx 54rpx 54rpx;
|
|
|
|
font-weight: 500;
|
|
|
|
font-size: 40rpx;
|
|
|
|
color: #FFFFFF;
|
|
|
|
}
|
|
|
|
/deep/ .u-checkbox{
|
|
|
|
width: 40rpx !important;
|
|
|
|
}
|
|
|
|
.tip{
|
|
|
|
display: flex;
|
|
|
|
flex-wrap: nowrap;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
font-size: 24rpx;
|
|
|
|
color: #FFFFFF;
|
|
|
|
position: fixed;
|
|
|
|
left: 50%;
|
|
|
|
transform: translateX(-50%);
|
|
|
|
bottom: 204rpx;
|
|
|
|
z-index: 1;
|
|
|
|
width: 100%;
|
|
|
|
image{
|
|
|
|
width: 26rpx;
|
|
|
|
height: 26rpx;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
</style>
|