192 lines
4.4 KiB
Vue
192 lines
4.4 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'
|
|
import config from '../../config/common'
|
|
import request from '../../utils/request.js'
|
|
export default {
|
|
data() {
|
|
return {
|
|
baseList: [
|
|
|
|
{
|
|
name: "新增用户",
|
|
iconName: "man-add"
|
|
},
|
|
// {
|
|
// name: "风险区域明细",
|
|
// iconName: "order"
|
|
// },
|
|
// {
|
|
// name: "区域风险四色图",
|
|
// iconName: "list-dot"
|
|
// },
|
|
// {
|
|
// name: "区域隐患数量",
|
|
// iconName: "info-circle"
|
|
// },
|
|
|
|
|
|
],
|
|
company: ''
|
|
}
|
|
},
|
|
onShow() {
|
|
const pages = getCurrentPages()
|
|
const currentPage = pages[pages.length - 1]
|
|
const Options = currentPage.options
|
|
uni.setStorageSync('Company', Options.Company?Options.Company:'XLK')
|
|
},
|
|
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?Company=${uni.getStorageSync('Company')}`
|
|
})
|
|
}
|
|
}
|
|
})
|
|
},
|
|
goCamera() {
|
|
// uni.chooseImage({
|
|
// count: 6, //默认9
|
|
// sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
|
// sourceType: ['camera'],
|
|
// success: (res) => {
|
|
// const url = config.serviceHost('/PF/File/UploadFile')
|
|
// request.upload(url, res.tempFilePaths).then((result) => {
|
|
// if (result.IsSuccessful) {
|
|
// // TODO: 目前只支持一张照片
|
|
// store.commit('updateImageLists', [{
|
|
// IMG_FILE_ID: result.Data.imgFileID,
|
|
// IMG_FILE_PATH: result.Data.imgFilePath
|
|
// }]);
|
|
// uni.showActionSheet({
|
|
// title: '选择上报类型',
|
|
// itemList: ['随手拍', '隐患上报'],
|
|
// success: (e) => {
|
|
// if (e.tapIndex === 0) {
|
|
// uni.navigateTo({
|
|
// url: '/pages/camera/index'
|
|
// })
|
|
// } else {
|
|
// uni.navigateTo({
|
|
// url: '/pages/apply/subPages/riskReport'
|
|
// })
|
|
// }
|
|
// }
|
|
// })
|
|
// }
|
|
// }).catch((error) => {
|
|
// console.log(error)
|
|
// });
|
|
// },
|
|
// complete: function(com) {
|
|
// console.log('choose image complete', com)
|
|
// }
|
|
// })
|
|
},
|
|
getCaidan() {
|
|
|
|
const json = {
|
|
Company: this.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 40px;
|
|
}
|
|
|
|
.list .u-grid {
|
|
justify-content: space-between !important;
|
|
}
|
|
|
|
.list .u-grid-item {
|
|
padding: 20px 0px;
|
|
/* margin: 0px 0px 20px 0px; */
|
|
margin: 10px 0px;
|
|
width: 47% !important;
|
|
border-radius: 10px;
|
|
box-shadow: 5px 5px 5px #ceccca;
|
|
}
|
|
|
|
.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> |