123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- <template>
- <view class="body">
- <view class="con">
- <view class="ImgCon">
- <view>
- <image style="width: 20vw; height: 20vw; border-radius: 50%;" src="../../static/logo.jpg" mode="">
- </image>
- </view>
- <view>
- <p style="font-size: 1.15rem; color: grey; margin-top: 6vw;"> 持之以恒,信守承诺 </p>
- <p style="font-size: 0.75rem; color: grey; margin-top: 3vw;"> PERSEVERE AND KEEP PROMISE </p>
- </view>
- </view>
- <view style="margin-top: 5vh;">
- <button
- style="border-radius:60rpx; width:80vw; height: 80rpx; font-size: 4vw; line-height: 80rpx; padding-right: 10vw;"
- type="primary" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber"
- hover-class="btn-hover">一键登录</button>
- </view>
- <!-- <view @click="avatar">123123</view> -->
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- data: {
- code: '',
- }
- }
- },
- onLoad() {
- let that = this
- uni.login({
- provider: 'weixin',
- success(res) {
- that.data.code = res.code;
- console.log(res.code)
- }
- })
- that.getappid()
- },
- methods: {
- //获取appId
- getappid() {
- let that = this
- const res = uni.getAccountInfoSync()
- that.data.appid = res.miniProgram.appId
- },
- getPhoneNumber(e) {
- console.log(e)
- let that = this
- that.$api.loginApi(that.data, res => {
- if (res.code == 0) {
- if (res.data.bind == 0) {
- that.$api.loginBind({
- encryptedData: e.detail.encryptedData,
- iv: e.detail.iv,
- openid: res.data.openid
- }, res => {
- if (res.code == 0) {
- that.$db.set('tel',res.data.tel)
- that.$db.set('token', res.data.token)
- uni.navigateBack({
- delta:1
- })
- }
- })
- } else {
- that.$db.set('name',res.data.name)
- that.$db.set('tel',res.data.tel)
- that.$db.set('token', res.data.token)
- uni.navigateBack({
- delta:1
- })
- }
- }
- })
- }
- }
- }
- </script>
- <style scoped lang="scss">
- .body {
- width: 100vw;
- height: 99vh;
- box-sizing: border-box;
- padding: 0 2vw;
- .con {
- width: 100vw;
- height: 40vh;
- .ImgCon {
- width: 100vw;
- height: 40vh;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- }
- }
- }
- </style>
|