1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <template>
- <view>
- <view style="text-align: center;margin: 100upx;font-size: 36upx;">欢迎回来</view>
- <view style="width: 50%;margin: 0 auto;">
- <button @click="wxlogion" open-type='getUserInfo'>
- 授权登录
- </button>
- </view>
-
- <!-- <van-dialog title="请登录"
- :show-cancel-button="ishow"
- :show="show"
- @cancel="cancelDialog" @confirm="confirmOrder"
- confirm-button-open-type="getUserInfo"
- confirm-button-color = "#323232"
- >
- </van-dialog> -->
- <!-- <button @click="wxlogion" open-type="getUserInfo">请点击授权</button> -->
- </view>
-
- </template>
- <script>
- import {
- mapMutations,mapState
- } from 'vuex'
- export default {
- props:{
- showdialog:{
- default: false,
- type: Boolean
- },
- ishow:{
- default: true,
- type: Boolean
- },
- },
- data() {
- return{
- show: false
- }
- },
-
- methods:{
- ...mapMutations(['login','showDialog']),
- wxlogion() {
- let that = this;
- uni.getUserInfo({
- success(res) {
- that.login(res.userInfo);
- that.showDialog(true); // 改变haslogion的值
- // that.$emit('confirmDiaolog');
- that.$msg("登录成功")
- uni.navigateBack()
- },
- fail(res) {
- //that.$emit('keepdialog'); // 订单我的保持登录
- that.showDialog(false);
- that.$msg("登录失败")
- }
- })
- }
- }
- }
- </script>
- <style>
- </style>
|