李旭东
2023-11-23 9a1274defad7dcd011efa5b37e26ee7e129c6f69
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<template>
    <view class="home_index">
        <view class="home_header"></view>
        <view class="home_content">
            <view 
                class="home_content_item" 
                :style="{'height': height + 'px'}" 
                v-for="item in homeTabList" 
                :key="item.menuId"
                @click="navigatorTo(item)">
                <u-image :src="item.menuIcon" shape="circle" width="50px" height="50px"></u-image>
                <view class="item_text">
                    <span>{{item.menuName}}</span>
                </view>
            </view>
        </view>
        <view class="home_copyright">
            <span>版权所有©中铁十四局集团房桥有限公司</span>
        </view>
        <scan-code></scan-code>
    </view>
</template>
 
<script>
    import scanCode from '@/components/scan-code.vue';
    import img from '../../static/logo.png';
    export default { 
        components: {
            scanCode
        },
        data() {
            return {
                homeTabList: [],
                height: 0,
            }
        },
        onShow() {
            uni.$off('scancodedate');
        },
        onLoad() {
            // 获取设备窗口信息
            const deviceInfo =  uni.getWindowInfo();
            this.height = (deviceInfo.windowWidth / 3) - 32;
            const menuData = JSON.parse(uni.getStorageSync('menuData')) || [];
            this.homeTabList = menuData.map(item => {
                console.log(item.menuIcon);
                item.menuIcon = `https://szpipe.thhy-tj.com/${item.menuIcon}`
                return item;
            })
        },
        methods: {
            // 跳转页面
            navigatorTo(item) {
                if(item.menuUrl) {
                    uni.navigateTo({
                        url: '/' + item.menuUrl,
                        fail(err) {
                            console.log(err,'====')
                        }
                    })
                }
            }
        }
    }
</script>
 
<style scoped lang="scss">
.home_index {
    position: relative;
    width: 100vw;
    height: 100vh;
    background: #F6F6F6;
    
    .home_header {
        height: 16%;
        background: #1976FF;
        border-radius: 0 0 30% 30%;
    }
    
    .home_content {
        position: absolute;
        top: 8%;
        left: 50%;
        transform: translateX(-50%);
        display: flex;
        flex-wrap: wrap;
        width: calc(100% - 16px);
        height: auto;
        background: transparent;
        
        .home_content_item {
            margin: 8px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            width: calc((100% / 3) - 16px);
            background: #fff;
            border-radius: 6px;
            
            &:active {
                background-color: rgb(229, 232, 229);
            }
            
            .item_img {
                width: 50%;
                height: 50%;
                border-radius: 50%;
            }
            
            .item_text {
                font-weight: 600;
                text-align: center;
            }
        }
    }
    
    .home_copyright {
        position: absolute;
        bottom: 1%;
        left: 50%;
        transform: translateX(-50%);
        color: #333;
        font-size: 12px;
        text-align: center;
        white-space: nowrap;
    }
}
</style>