| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <template>
- <view class="content">
- <view class="logo">
- <img class="img" src="../../static/ceshi.jpg">
- </view>
- <button class="button" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
- <img class="img" src="../../static/weixin.svg">
- <span>微信一键登录</span>
- </button>
- </view>
- </template>
- <script setup>
- // import {
- // ref
- // } from 'vue'
- // const code = ref('')
- // // 获取code方法
- // const login = () => {
- // uni.login({
- // provider: 'weixin',
- // success: res => {
- // code.value = res.code
- // console.log(code.value);
- // // getData()
- // }
- // });
- // }
- // // 通过code获取openId 和 session_key
- // const getData = () => {
- // console.log(123);
- // uni.request({
- // url: 'https://api.weixin.qq.com/sns/jscode2session',
- // method: 'GET',
- // data: {
- // appid: 'xxx', //你的小程序的APPID
- // secret: 'xxx', //你的小程序的secret,
- // js_code: code.value, //wx.login 登录成功后的code
- // grant_type: 'authorization_code',
- // },
- // success: (res) => {
- // // this.openId = cts.data.openid //openid 用户唯一标识
- // // this.unionid = cts.data.unionid //unionid 开放平台唯一标识 当公众号和小程序同时登录过才会有
- // // this.session_key = cts.data.session_key //session_key 会话密钥
- // // console.log(this.openId, this.session_key)
- // console.log(res)
- // }
- // })
- // }
- // const getPhoneNumber = (e) => {
- // console.log(e);
- // }
- // login()
- </script>
- <style lang="scss" scoped>
- .content {
- width: 100vw;
- height: 100vh;
- overflow: hidden;
- .logo {
- margin: 300rpx auto 0;
- width: 150rpx;
- height: 150rpx;
- border-radius: 20rpx;
- background-color: skyblue;
- .img {
- width: 100%;
- height: 100%;
- border-radius: 20rpx;
- }
- }
- .button {
- display: flex;
- justify-content: center;
- align-items: center;
- margin: 150rpx auto 0;
- width: 600rpx;
- height: 100rpx;
- font-size: 32rpx;
- color: #fff;
- border-radius: 50rpx;
- background-color: #1E7DFB;
- .img {
- margin-right: 20rpx;
- width: 50rpx;
- height: 50rpx;
- color: #fff;
- }
- }
- }
- </style>
|