1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <template>
- <view class="content">
- <u-button type="success" open-type="getUserInfo" @click="loginIn">微信一键登录</u-button>
- </view>
- </template>
- <script>
- import {code2Session} from "@/api/login.js"
- export default {
- components: {
- },
- data() {
- return {
-
- }
- },
- onShow () {
-
- },
- onLoad(option) {
-
- },
- methods: {
- loginIn () {
- let _this = this
- // uni.login({
- // provider: provider,
- // success(result) {
- // console.log(result)
- // if (result.code) {
- // code2Session({
- // code: result.code
- // }).then(res => {
- // if (res.status === '200') {
- // _this.$u.vuex('vuex_openid',res.data)
- // uni.navigateTo({
- // url: '/pages/index/index'
- // })
- // };
- // });
- // }
- // }
- // });
- uni.login({
- provider: 'weixin',
- success: function (loginRes) {
- console.log(loginRes); // 返回code
- uni.navigateTo({
- url: '/pages/index/index'
- })
- }
- })
- },
- }
- }
- </script>
- <style>
- .content{
- padding: 0;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- </style>
|