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

166 lines
3.3 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">
<u-icon :customStyle="{paddingTop:20+'rpx'}" :name="baseListItem.iconName" :size="42" color="#304ffe"></u-icon>
<text class="grid-text">{{baseListItem.name}}</text>
</u-grid-item>
</u-grid>
<view style="display: flex;flex-direction: row;" class="home-button">
<!-- <u-button type="primary" @click="reset" color="#3d4b70" :plain="true" style="margin-right: 5px;">重置</u-button> -->
<u-button type="primary" @click="goCamera" color="#3d4b70">隐患随手拍</u-button>
</view>
</view>
</view>
</template>
<script>
import {
getMenu
} from '../../services/apply'
export default {
data() {
return {
baseList: [
{
name: "新增用户",
iconName: "man-add"
},
// {
// name: "风险区域明细",
// iconName: "man-add"
// },
// {
// name: "区域风险四色图",
// iconName: "man-add"
// },
// {
// name: "区域隐患数量",
// iconName: "man-add"
// },
]
}
},
onShow() {
},
onLoad() {
this.getCaidan()
},
onNavigationBarButtonTap(e) {
let url = 'http://47.122.43.22:9100/'
uni.navigateTo({
url: '/pages/webview/webview?url=' + url
})
},
methods: {
click(name) {
this.baseList.map((item, index) => {
if (index == name) {
if (item.name == '新增用户') {
uni.navigateTo({
url: '/pages/apply/index'
})
}
}
})
},
goCamera() {
uni.navigateTo({
url: '/pages/camera/index'
})
},
getCaidan() {
let pages = getCurrentPages()
let currentPage = pages[pages.length - 1]
let options = currentPage.options
let company = ''
console.log(options, 'options')
if (options.Company == 'DCJD') {
company = 'DCJD'
} else if (options.Company == 'GXBB') {
company = 'GXBB'
} else if (options.Company == 'LYYL') {
company = 'LYYL'
} else if (options.Company == 'LYXT') {
company = 'LYXT'
} else {
company = 'XLK'
}
const json = {
Company: company,
Post: '搬运工',
Type: 1
}
getMenu(json).then((res) => {
console.log('成功', res);
this.baseList = res.data
}).catch((err) => {
console.error('失败', err);
})
}
}
}
</script>
<style>
.content {
background-color: #f4f7ff;
width: 100%;
/* #ifndef APP-PLUS */
height: calc(100vh - 44px - 50px); // 非APP平台下生效
/* #endif */
/* #ifdef APP-PLUS */
height: calc(100vh); // APP平台下生效
/* #endif */
}
.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;
}
.home-button {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
padding: 10px 36px;
box-sizing: border-box;
background: #f4f7ff;
z-index: 999;
}
.home-button .u-button {
height: 50px;
}
.grid-text {
font-size: 14px;
color: #000;
font-weight: bold;
padding: 10rpx 0 20rpx 0rpx;
/* #ifndef APP-PLUS */
box-sizing: border-box;
/* #endif */
}
</style>