72 lines
1.1 KiB
Vue
72 lines
1.1 KiB
Vue
<template>
|
|
<view class="content">
|
|
<view class="text-area">
|
|
<text class="title">{{title}}</text>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import { getOpenId, getCurrentUser } from '@/api/pages/api.js'
|
|
export default {
|
|
data() {
|
|
return {
|
|
title: 'Hello'
|
|
}
|
|
},
|
|
onLoad() {
|
|
this.login()
|
|
},
|
|
methods: {
|
|
login() {
|
|
const _this = this
|
|
uni.login({
|
|
success(res) {
|
|
getOpenId(res.code).then(Res => {
|
|
if(Res.code == 200) {
|
|
_this.isWxBing(Res.msg, '1')
|
|
}
|
|
})
|
|
}
|
|
})
|
|
},
|
|
isWxBing(openid, cityCode) {
|
|
getCurrentUser(openid, cityCode).then(res => {
|
|
console.log(res);
|
|
if(!res.data) {
|
|
// 注册
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
.content {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.logo {
|
|
height: 200rpx;
|
|
width: 200rpx;
|
|
margin-top: 200rpx;
|
|
margin-left: auto;
|
|
margin-right: auto;
|
|
margin-bottom: 50rpx;
|
|
}
|
|
|
|
.text-area {
|
|
display: flex;
|
|
justify-content: center;
|
|
}
|
|
|
|
.title {
|
|
font-size: 36rpx;
|
|
color: #8f8f94;
|
|
}
|
|
</style>
|