1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <template>
- <view>
- <Nav title="我的" :isBack="false" />
- <view class="user">
- <u-icon name="https://b.yzcdn.cn/vant/icon-demo-1126.png" size="100rpx" style="margin-bottom: 40rpx;" />
- <view class="user-name">
- {{userName}}
- </view>
- </view>
- <view class="btn">
- <u-button type="warning" text="退出登录" @click="show=true" size="large"></u-button>
- </view>
- <view>
- <u-modal :show="show" title="提示" content='是否退出登录?' showCancelButton @confirm="loginOut"
- @cancel="show=false"></u-modal>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- //模态框
- show: false,
- };
- },
- computed: {
- userName() {
- return this.$store.getters.userName
- }
- },
- methods: {
- //退出登录
- loginOut() {
- this.$store.dispatch('user/logout').then(res => {
- if (res.data.code === 200) {
- uni.redirectTo({
- url: "/pages/login/index"
- })
- }
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .user {
- display: flex;
- flex-direction: column;
- align-items: center;
- padding-top: 300rpx;
- }
- .user-name {
- font-weight: bold;
- }
- .btn {
- position: absolute;
- bottom: 100rpx;
- left: 0;
- right: 0;
- padding:0 80rpx;
- }
-
- uni-button:after{
- border: none;
- }
- </style>
|