InspectionCleaning/pages/adminHome/index.vue

172 lines
4.7 KiB
Vue
Raw Normal View History

2025-04-15 10:07:11 +08:00
<template>
<view class="content">
2025-04-15 11:04:10 +08:00
<view class="bg-box">
2025-04-15 14:37:47 +08:00
<view class="homo-title">首页</view>
2025-04-24 15:03:07 +08:00
<image class="bg-logo" style="width: 200rpx; height: 170rpx" src="/static/adminImg/bg-logo.png"></image>
<image class="bg-hi" style="width: 130rpx; height: 50rpx" src="/static/adminImg/logo-hi.png"></image>
2025-04-15 11:04:10 +08:00
<view style="height: 150rpx"></view>
<view class="tip">欢迎使用,张三</view>
2025-04-15 14:37:47 +08:00
<view class="desc">欢迎使用巡检管理员端</view>
2025-04-15 11:04:10 +08:00
<view class="card">
<view class="card-item">
<view class="item-title">区域数量 </view>
2025-04-24 15:03:07 +08:00
<view class="item-totel">{{ form.areaCount }} </view>
<image class="card-img" style="width: 130rpx; height: 130rpx" src="/static/adminImg/card1.png"></image>
2025-04-15 11:04:10 +08:00
</view>
<view class="card-item">
<view class="item-title">子区域数量 </view>
2025-04-24 15:03:07 +08:00
<view class="item-totel">{{ form.regionCount }} </view>
<image class="card-img" style="width: 130rpx; height: 130rpx" src="/static/adminImg/card2.png"></image>
2025-04-15 11:04:10 +08:00
</view>
<view class="card-item">
<view class="item-title">已绑定子区域数 </view>
2025-04-24 15:03:07 +08:00
<view class="item-totel">{{ form.bindnfc }} </view>
<image class="card-img" style="width: 130rpx; height: 130rpx" src="/static/adminImg/card3.png"></image>
2025-04-15 11:04:10 +08:00
</view>
<view class="card-item">
<view class="item-title">未绑定子区域数 </view>
2025-04-24 15:03:07 +08:00
<view class="item-totel">{{ form.noBindnfc }} </view>
<image class="card-img" style="width: 130rpx; height: 130rpx" src="/static/adminImg/card4.png"></image>
2025-04-15 11:04:10 +08:00
</view>
</view>
2025-04-28 15:31:01 +08:00
<view v-if="false" style="display: flex">
2025-04-18 11:55:50 +08:00
<u-button type="error" @click="testFn">调试录入卡片</u-button>
</view>
2025-04-15 11:04:10 +08:00
</view>
2025-04-15 10:07:11 +08:00
<u-tabbar :list="vuex_tabbar"></u-tabbar>
</view>
</template>
<script>
2025-04-30 13:01:47 +08:00
import { GetHomeDataApi } from '@/api/apiAdmin'
2025-04-15 10:07:11 +08:00
export default {
data() {
return {
2025-04-24 15:03:07 +08:00
form: {
2025-04-30 13:01:47 +08:00
regionCount: 0,
areaCount: 0,
bindnfc: 0,
noBindnfc: 0
2025-04-24 15:03:07 +08:00
}
2025-04-30 13:01:47 +08:00
}
2025-04-15 10:07:11 +08:00
},
mounted() {
2025-04-30 13:01:47 +08:00
uni.hideLoading() // 关闭 Loading
2025-04-15 10:07:11 +08:00
},
2025-04-30 13:01:47 +08:00
onLoad() {},
2025-04-24 15:03:07 +08:00
onShow() {
this.getDataFn()
},
2025-04-18 11:55:50 +08:00
methods: {
2025-04-24 15:03:07 +08:00
async getDataFn() {
2025-04-30 13:01:47 +08:00
const res = await GetHomeDataApi()
console.log(res, '首页数据')
this.form = Object.assign(this.form, res.data)
2025-04-24 15:03:07 +08:00
},
2025-04-18 11:55:50 +08:00
testFn() {
2025-04-30 13:01:47 +08:00
let u = navigator.userAgent
let isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1 //android
2025-04-18 11:55:50 +08:00
// let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios
try {
if (isAndroid && AndroidJs) {
2025-04-30 13:01:47 +08:00
console.log('%c%s', 'color:red', '安卓--调用方法')
2025-04-18 11:55:50 +08:00
const reqRow = {
2025-04-30 13:01:47 +08:00
name: 'input',
data: ''
}
AndroidJs.func(JSON.stringify(reqRow)) // 给安卓传参
2025-04-18 11:55:50 +08:00
} else {
2025-04-30 13:01:47 +08:00
console.log('%c%s', 'color:red', '苹果--调用方法')
2025-04-18 11:55:50 +08:00
const reqRow = {
2025-04-30 13:01:47 +08:00
name: 'back-iphone',
data: ''
}
window.webkit.messageHandlers.func.postMessage(JSON.stringify(reqRow)) // 给ios 传参
2025-04-18 11:55:50 +08:00
}
} catch (e) {
2025-04-30 13:01:47 +08:00
console.log(e, 'e-----判断安卓苹果类型出错')
2025-04-18 11:55:50 +08:00
}
2025-04-30 13:01:47 +08:00
}
}
}
2025-04-15 10:07:11 +08:00
</script>
<style lang="scss" scoped>
.content {
2025-04-15 11:04:10 +08:00
height: calc(100vh - 100rpx); // 确保容器有明确高度
2025-04-15 10:07:11 +08:00
// background-color: skyblue;
2025-04-15 14:37:47 +08:00
2025-04-15 10:07:11 +08:00
overflow: hidden;
2025-04-24 15:03:07 +08:00
2025-04-15 11:04:10 +08:00
// padding-bottom: 100rpx;
.bg-box {
2025-04-15 14:37:47 +08:00
position: relative;
// background-color: #528dfe;
background: linear-gradient(to bottom, #3179fb, white);
height: 650rpx;
2025-04-24 15:03:07 +08:00
2025-04-15 14:37:47 +08:00
.homo-title {
color: white;
transform: translateY(30rpx);
font-size: 35rpx;
text-align: center;
}
2025-04-24 15:03:07 +08:00
2025-04-15 14:37:47 +08:00
.bg-logo {
position: absolute;
right: 50rpx;
top: 160rpx;
}
2025-04-24 15:03:07 +08:00
2025-04-15 14:37:47 +08:00
.bg-hi {
position: absolute;
left: 30rpx;
top: 200rpx;
}
2025-04-15 11:04:10 +08:00
.tip {
2025-04-15 14:37:47 +08:00
padding-left: 120rpx;
2025-04-15 11:04:10 +08:00
color: white;
font-size: 40rpx;
}
2025-04-24 15:03:07 +08:00
2025-04-15 11:04:10 +08:00
.desc {
margin-top: 20rpx;
padding-left: 30rpx;
2025-04-15 14:37:47 +08:00
color: #ffffff99;
2025-04-15 11:04:10 +08:00
}
2025-04-24 15:03:07 +08:00
2025-04-15 11:04:10 +08:00
.card {
2025-04-15 14:37:47 +08:00
// border: 1px solid red;
2025-04-15 11:04:10 +08:00
display: grid;
grid-template-columns: repeat(2, 1fr);
grid-template-rows: repeat(2, 1fr);
gap: 30rpx;
padding: 50rpx;
2025-04-24 15:03:07 +08:00
2025-04-15 11:04:10 +08:00
.card-item {
2025-04-15 14:37:47 +08:00
position: relative;
// border: 1px solid blue;
2025-04-15 11:04:10 +08:00
border-radius: 20rpx;
2025-04-15 14:37:47 +08:00
// background-color: red;
background: linear-gradient(to bottom, white, #e1e9ff);
height: 280rpx;
2025-04-15 11:04:10 +08:00
padding: 30rpx;
2025-04-24 15:03:07 +08:00
2025-04-15 11:04:10 +08:00
.item-title {
font-size: 30rpx;
}
2025-04-24 15:03:07 +08:00
2025-04-15 11:04:10 +08:00
.item-totel {
font-size: 50rpx;
}
2025-04-24 15:03:07 +08:00
2025-04-15 14:37:47 +08:00
.card-img {
position: absolute;
right: 20rpx;
bottom: 20rpx;
}
2025-04-15 11:04:10 +08:00
}
}
}
2025-04-15 10:07:11 +08:00
}
</style>