MrShi
3 天以前 4fabfe4dbd2eb28d07a4350597d314958cc1c281
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<template>
    <view class="login">
        <view class="login_title">欢迎回来,{{userInfo.sysuser.username}}~</view>
        <view class="login_info">{{getWeek()}}</view>
        <view class="login_func" @click="jump">
            <image src="/static/images/home_i1mg_zulingxuzhi@2x.png" mode="widthFix"></image>
        </view>
        <view class="login_btn" @click="logout">退出登录</view>
    </view>
</template>
 
<script>
    import { mapState } from 'vuex'
    export default {
        computed: {
            ...mapState(['userInfo'])
        },
        data() {
            return {
                
            };
        },
        methods: {
            jump() {
                uni.navigateTo({
                    url: '/pages/operationList/operationList'
                })
            },
            getWeek() {
                let today = new Date();
                let dayOfWeek = today.getDay();
                let weekdays = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
                let weekdayName = weekdays[dayOfWeek];
                
                const date = new Date();
                const month = date.getMonth() + 1;
                const day = date.getDate();
                
                return month + '月' + day + '日' + ',' + weekdayName;
            },
            logout() {
                uni.showLoading({ title: '加载中' });
                this.$u.api.logout()
                    .then(res => {
                        if (res.code === 200) {
                            uni.hideLoading();
                            this.$store.commit('setUserInfo', res.data)
                            uni.navigateBack({ delta: 1 });
                        }
                    })
            }
        }
    }
</script>
 
<style lang="scss" scoped>
    .login {
        width: 100vw;
        height: 100vh;
        padding: 40rpx 30rpx;
        box-sizing: border-box;
        background: #ffffff;
        .login_title {
            font-weight: 600;
            font-size: 40rpx;
            color: #333333;
        }
        .login_info {
            font-weight: 400;
            font-size: 28rpx;
            color: #999999;
            margin-top: 16rpx;
        }
        .login_func {
            width: 100%;
            height: 182rpx;
            margin-top: 40rpx;
            image {
                width: 100%;
                height: 100%;
            }
        }
        .login_btn {
            width: 200rpx;
            height: 72rpx;
            line-height: 72rpx;
            text-align: center;
            border-radius: 36rpx;
            border: 1rpx solid #01B6AD;
            font-weight: 400;
            font-size: 28rpx;
            color: #01B6AD;
            position: fixed;
            bottom: calc(env(safe-area-inset-bottom) + 30rpx);
            left: 50%;
            transform: translate(-50%, 0);
        }
    }
</style>