You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
1.7 KiB
Vue

<template>
<view class="main">
<image src="@/static/image/logo.png" mode="scaleToFill" class="logo" />
<button
class="btn"
v-if="isShow"
open-type="getPhoneNumber"
@getphonenumber="getPhoneNumber"
>点击登录</button>
<button class="btn" v-if="isLogoutShow" @click="login"></button>
</view>
</template>
<script>
export default {
data() {
return {
code: "",
openId: "",
isShow: false,
isLogoutShow: false
};
},
methods: {
async getPhoneNumber(e) {
if (e.detail.errMsg == "getPhoneNumber:ok") {
// 用户允许或去手机号
let res = await this.$api.user.loginToken({
wxPhoneCode: e.detail.code,
openid: this.openId
});
if (res.status == 0) {
uni.setStorageSync("token", res.data.token);
// uni.redirectTo({
// url: "../home/index"
// });
}
} else {
this.$common.msgToast("请不要拒绝哟~重新点击登录");
}
}
}
};
</script>
<style lang="scss" scoped>
page {
background: url("@/static/image/login-bg.png") no-repeat;
background-size: 100% 100%;
background-attachment: fixed;
height: 100vh;
}
.main {
height: 100%;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
.logo {
width: 237rpx;
height: 390rpx;
}
.btn {
background: transparent;
width: 200rpx;
position: fixed;
bottom: 15%;
color: red;
left: 50%;
transform: translateX(-50%);
font-size: 30rpx;
transition: all 1s;
animation: jump 1s ease-in-out infinite alternate;
}
@keyframes jump {
from {
bottom: 16%;
}
to {
bottom: 15%;
}
}
}
</style>