qrcode-app/pages/index/index.vue
2024-07-24 14:45:27 +08:00

130 lines
2.5 KiB
Vue

<template>
<view class="content">
<view class="list">
<u-grid :border="false" @click="click" :col="2">
<u-grid-item v-for="(baseListItem,baseListIndex) in baseList" :key="baseListIndex" bgColor="#fff" @click="clicktwo">
<u-icon :customStyle="{paddingTop:20+'rpx'}" :name="baseListItem.name" :size="42" color="#304ffe"></u-icon>
<text class="grid-text">{{baseListItem.title}}</text>
</u-grid-item>
</u-grid>
</view>
</view>
</template>
<script>
import {getMenu} from '../../services/apply'
export default {
data() {
return {
baseList: [{
name: 'man-add',
title: '新员工信息录入'
},
{
name: 'warning',
title: '风险区域明细'
}, {
name: 'pushpin',
title: '区域风险四色图'
},
{
name: 'grid',
title: '区域隐患数量'
},
]
}
},
onShow() {
},
onLoad() {
this.getCaidan()
},
methods: {
click(name) {
console.log(name)
if (name == 0) {
uni.navigateTo({
url: '/pages/apply/index?company=XLK&post=1'
})
}
},
clicktwo(name) {
console.log(name, '2')
},
getCaidan() {
const json = {
Company: 'XLK',
Post: '搬运工',
Type: 1
}
getMenu(json).then((res) => {
console.log('成功', res);
}).catch((err) => {
console.error('失败', err);
})
}
// getMenu() {
// uni.request({
// url: 'http://47.122.43.22:3179/api/BI/H5Controller/GetMenu', //仅为示例,并非真实接口地址。
// data: {
// Company: 'XLK',
// Post:'搬运工',
// Type:1
// },
// header: {
// 'Content-Type': 'application/json;charset=UTF-8' //自定义请求头信息
// },
// success: res => {
// console.log(res)
// if (res.data.status !== 0) {
// return uni.showToast({
// title: "数据获取失败"
// })
// }
// this.data = res.data.messege
// }
// })
// }
}
}
</script>
<style>
.content {
background-color: #f4f7ff;
width: 100%;
height: 100vh;
}
.list {
padding: 20px;
}
.list .u-grid {
justify-content: space-between !important;
}
.list .u-grid-item {
padding: 20px 0px;
/* margin: 0px 0px 20px 0px; */
margin: 20px 10px;
width: 40% !important;
border-radius: 10px;
}
.grid-text {
font-size: 14px;
color: #000;
font-weight: bold;
padding: 10rpx 0 20rpx 0rpx;
/* #ifndef APP-PLUS */
box-sizing: border-box;
/* #endif */
}
</style>