1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <template>
- <view class="content">
- <view>
-
- <view>ddddddd{{showModal}}</view>
- <!-- <button open-type="getUserInfo">用户登录</button> -->
- <button v-if="showModal" open-type="getUserInfo" @click="wxlogion">请点击授权</button>
- </view>
- </view>
- </template>
- <script>
- import {
- mapMutations,mapState
- } from 'vuex';
- export default {
- data() {
- return {
- title: 'Hello',
- }
- },
- computed:{
- ...mapState([
- 'showModal'
- ]),
- },
- onLoad() {
-
- },
- methods: {
- ...mapMutations(['login','showDialog']),
- wxlogion() {
- let that = this;
- uni.getUserInfo({
- success(res) {
- that.login(res.userInfo);
- that.showDialog(false);
- },
- fail(res) {
- uni.showModal({
- title: 'shouquanshibai',
- })
- }
- })
-
- }
- },
- }
- </script>
- <style>
- .content {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- }
- .logo {
- height: 200upx;
- width: 200upx;
- margin-top: 200upx;
- margin-left: auto;
- margin-right: auto;
- margin-bottom: 50upx;
- }
- .text-area {
- display: flex;
- justify-content: center;
- }
- .title {
- font-size: 36upx;
- color: #8f8f94;
- }
- </style>
|