|
@@ -12,52 +12,28 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
|
- // import {
|
|
|
|
|
- // ref
|
|
|
|
|
- // } from 'vue'
|
|
|
|
|
|
|
+ import {
|
|
|
|
|
+ ref
|
|
|
|
|
+ } from 'vue'
|
|
|
|
|
+ import {
|
|
|
|
|
+ myRequest
|
|
|
|
|
+ } from '../../util/api.js'
|
|
|
|
|
|
|
|
- // const code = ref('')
|
|
|
|
|
|
|
+ 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()
|
|
|
|
|
|
|
+ const getPhoneNumber = async (e) => {
|
|
|
|
|
+ console.log(e);
|
|
|
|
|
+ code.value = e.detail.code
|
|
|
|
|
+ if (code.value) {
|
|
|
|
|
+ const res = await myRequest({
|
|
|
|
|
+ url: "/wx/getPhone",
|
|
|
|
|
+ data: {
|
|
|
|
|
+ code: code.value
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ console.log(res);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|
|
@@ -71,7 +47,6 @@
|
|
|
width: 150rpx;
|
|
width: 150rpx;
|
|
|
height: 150rpx;
|
|
height: 150rpx;
|
|
|
border-radius: 20rpx;
|
|
border-radius: 20rpx;
|
|
|
- background-color: skyblue;
|
|
|
|
|
|
|
|
|
|
.img {
|
|
.img {
|
|
|
width: 100%;
|
|
width: 100%;
|