对接一键开门 修改首页引导页自适应样式

This commit is contained in:
zhouyanli
2026-05-19 17:52:57 +08:00
parent 5539e737d7
commit 99c36c0d83
9 changed files with 271 additions and 249 deletions

View File

@@ -100,14 +100,14 @@ onLoad((options) => {
repairId.value = options.projectId repairId.value = options.projectId
} }
// ✅ 监听返回选择的项目 // 监听返回选择的项目
uni.$on('selectRepairProject', (data) => { uni.$on('selectRepairProject', (data) => {
repairProject.value = `${data.category}-${data.project}` repairProject.value = `${data.category}-${data.project}`
repairId.value = data.projectId repairId.value = data.projectId
}) })
}) })
// ✅ 页面卸载时移除监听(必须加) // 页面卸载时移除监听
onUnload(() => { onUnload(() => {
uni.$off('selectRepairProject') uni.$off('selectRepairProject')
}) })
@@ -155,7 +155,7 @@ const uploadImages = async () => {
uploadedUrls.push(res.url || '') uploadedUrls.push(res.url || '')
} catch (err) { } catch (err) {
uni.showToast({ uni.showToast({
title:e.msg || '图片上传失败', title:err.msg || '图片上传失败',
icon:'error' icon:'error'
}) })
} }

View File

@@ -42,18 +42,10 @@ import { onLoad } from '@dcloudio/uni-app'
import {getRepairOrder} from '../../api/api.js' import {getRepairOrder} from '../../api/api.js'
// 分类列表 // 分类列表
const categoryList = ref([ const categoryList = ref([])
// { id: 1, name: '基础设施' },
// { id: 2, name: '电子设施' }
])
// 所有项目数据 // 所有项目数据
const projectList = ref([ const projectList = ref([])
// { id: 101, categoryId: 1, name: '路灯' },
// { id: 102, categoryId: 1, name: '楼层指示灯' },
// { id: 103, categoryId: 2, name: '应急出口灯' },
// { id: 104, categoryId: 1, name: '草坪灯' }
])
// 选中的分类 // 选中的分类
const activeCategory = ref(1) const activeCategory = ref(1)
@@ -91,7 +83,7 @@ const fetchProjectList = async () => {
activeCategory.value = categoryList.value[0]?.id || 1 activeCategory.value = categoryList.value[0]?.id || 1
} }
} catch (e) { } catch (e) {
uni.showToast({ title: '获取项目列表失败', icon: 'none' }) uni.showToast({ title: e.msg ||'获取项目列表失败', icon: 'none' })
} }
} }

View File

@@ -10,7 +10,7 @@
<!-- <uni-icons type="phone" size="24" color="#999"></uni-icons> --> <!-- <uni-icons type="phone" size="24" color="#999"></uni-icons> -->
<image <image
src="https://wuyeadmin.bugtc.com/images/login/phone.png" src="https://wuyeadmin.bugtc.com/images/login/phone.png"
mode="" mode="aspectFit"
style="height: 100%; width: 100%" style="height: 100%; width: 100%"
></image> ></image>
</view> </view>
@@ -31,7 +31,7 @@
<view class="input-icon"> <view class="input-icon">
<image <image
src="https://wuyeadmin.bugtc.com/images/login/code.png" src="https://wuyeadmin.bugtc.com/images/login/code.png"
mode="" mode="aspectFit"
style="height: 100%; width: 100%" style="height: 100%; width: 100%"
> >
</image> </image>
@@ -269,7 +269,6 @@ onUnmounted(() => {
/* 页面容器 */ /* 页面容器 */
.login-page { .login-page {
padding: 80rpx 40rpx 40rpx; padding: 80rpx 40rpx 40rpx;
/* background-color: #f8f9fa; */
min-height: 100vh; min-height: 100vh;
background: repeating-linear-gradient(to bottom, #e2f0ff, #f6faff); background: repeating-linear-gradient(to bottom, #e2f0ff, #f6faff);
} }

View File

@@ -45,7 +45,7 @@ const noticeList = ref([])
// 分页相关 // 分页相关
const pageNum = ref(1) // 当前页 const pageNum = ref(1) // 当前页
const pageSize = ref(5) // 每页条数 const pageSize = ref(10) // 每页条数
const total = ref(0) // 总条数 const total = ref(0) // 总条数
const loading = ref(false) // 加载状态 const loading = ref(false) // 加载状态
const noMore = ref(false) // 是否没有更多 const noMore = ref(false) // 是否没有更多

View File

@@ -1,7 +1,7 @@
<template> <template>
<!-- 页面主容器 --> <!-- 页面主容器 -->
<view class="door-open-page"> <view class="door-open-page">
<view class="status_bar"></view> <view class="status_bar" :style="{ height: statusBarHeight + 'px' }"></view>
<!-- 顶部标题栏 --> <!-- 顶部标题栏 -->
<view class="top-bar"> <view class="top-bar">
<uni-nav-bar left-icon="left" title="远程开门" backgroundColor ="none" :border="false" @clickLeft="narBack" /> <uni-nav-bar left-icon="left" title="远程开门" backgroundColor ="none" :border="false" @clickLeft="narBack" />
@@ -59,6 +59,7 @@ import { getOpenDoorList, switchOpenDoor } from '../../api/api.js'
// 响应式数据:选中的门索引、开门成功提示 // 响应式数据:选中的门索引、开门成功提示
const selectedDoor = ref(-1) // -1表示未选中 const selectedDoor = ref(-1) // -1表示未选中
const showSuccess = ref(false) const showSuccess = ref(false)
const statusBarHeight = ref(uni.getSystemInfoSync().statusBarHeight || 0)
// 门列表数据 // 门列表数据
const doorList = ref([]) const doorList = ref([])
@@ -130,8 +131,10 @@ const openDoor = () => {
box-sizing: border-box; box-sizing: border-box;
} }
.status_bar { .status_bar {
height: 32px; /* height: 32px; */
width: 100%; width: 100%;
/* height: var(--status-bar-height); */
flex-shrink: 0;
} }
/* 顶部标题 */ /* 顶部标题 */
.top-bar { .top-bar {

View File

@@ -1,6 +1,6 @@
<template> <template>
<view class="guide-page"> <view class="guide-page">
<view class="status_bar"></view> <view class="status-bar"></view>
<!-- 引导内容滑动容器 --> <!-- 引导内容滑动容器 -->
<swiper <swiper
class="guide-swiper" class="guide-swiper"
@@ -14,36 +14,39 @@
<swiper-item> <swiper-item>
<view class="guide-item"> <view class="guide-item">
<view class="guide-img"> <view class="guide-img">
<image src="https://wuyeadmin.bugtc.com/images/imgs/guide1.png" style="width: 100%;height: 100%;"></image> <image src="https://wuyeadmin.bugtc.com/images/imgs/guide1.png" mode="aspectFit" class="img-content"></image>
</view> </view>
<view style="height: 200rpx;width: 100%;"></view> <view class="guide-text">
<view class="guide-title">精准服务</view> <view class="guide-title">精准服务</view>
<view class="guide-subtitle">需求深度洞察,资源优化配置</view> <view class="guide-subtitle">需求深度洞察,资源优化配置</view>
</view> </view>
</view>
</swiper-item> </swiper-item>
<!-- 高效管理 --> <!-- 高效管理 -->
<swiper-item> <swiper-item>
<view class="guide-item"> <view class="guide-item">
<view class="guide-img"> <view class="guide-img">
<image src="https://wuyeadmin.bugtc.com/images/imgs/guide2.png" style="width: 100%;height: 100%;"></image> <image src="https://wuyeadmin.bugtc.com/images/imgs/guide2.png" mode="aspectFit" class="img-content"></image>
</view> </view>
<view style="height: 200rpx;width: 100%;"></view> <view class="guide-text">
<view class="guide-title">高效沟通</view> <view class="guide-title">高效沟通</view>
<view class="guide-subtitle">反馈即时响应,流程无缝衔接</view> <view class="guide-subtitle">反馈即时响应,流程无缝衔接</view>
</view> </view>
</view>
</swiper-item> </swiper-item>
<!--安全保障 --> <!--安全保障 -->
<swiper-item> <swiper-item>
<view class="guide-item"> <view class="guide-item">
<view class="guide-img"> <view class="guide-img">
<image src="https://wuyeadmin.bugtc.com/images/imgs/guide3.png" style="width: 100%;height: 100%;"></image> <image src="https://wuyeadmin.bugtc.com/images/imgs/guide3.png" mode="aspectFit" class="img-content"></image>
</view> </view>
<view style="height: 200rpx;width: 100%;"></view> <view class="guide-text">
<view class="guide-title">智能管理</view> <view class="guide-title">智能管理</view>
<view class="guide-subtitle">数据驱动决策,风险提前预警</view> <view class="guide-subtitle">数据驱动决策,风险提前预警</view>
</view> </view>
</view>
</swiper-item> </swiper-item>
</swiper> </swiper>
@@ -106,40 +109,61 @@ const handleBtnClick = () => {
.guide-page { .guide-page {
width: 100%; width: 100%;
height: 100vh; height: 100vh;
/* background-color: #f8f9ff; */
background: linear-gradient(to bottom, #E2F0FF, #F6FAFF); background: linear-gradient(to bottom, #E2F0FF, #F6FAFF);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: space-between;
padding: 120rpx 40rpx 80rpx;
box-sizing: border-box; box-sizing: border-box;
} }
.status_bar {
height: 140px; /* 状态栏 - 自适应设备状态栏高度 */
.status-bar {
height: var(--status-bar-height);
width: 100%; width: 100%;
flex-shrink: 0;
} }
/* 滑动容器 */ /* 滑动容器 */
.guide-swiper { .guide-swiper {
flex: 1; flex: 1;
width: 100%; width: 100%;
} }
/* 单个引导项 */ /* 单个引导项 - 全屏自适应 */
.guide-item { .guide-item {
width: 360px; width: 100%;
height: 480px; height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
padding: 0 60rpx;
box-sizing: border-box;
} }
/* 图片区域 - 自适应 */
.guide-img { .guide-img {
width: 77%; width: 80%;
height: 50%; max-width: 600rpx;
margin-bottom: 80rpx; flex: 1;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 40rpx;
}
.img-content {
width: 100%;
height: 100%;
max-height: 50vh;
}
/* 文字区域 */
.guide-text {
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 40rpx;
} }
/* 引导标题 */ /* 引导标题 */
@@ -161,7 +185,8 @@ const handleBtnClick = () => {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
margin-bottom: 60rpx; margin-bottom: 40rpx;
flex-shrink: 0;
} }
/* 单个进度点 */ /* 单个进度点 */
@@ -171,6 +196,7 @@ const handleBtnClick = () => {
border-radius: 8rpx; border-radius: 8rpx;
background-color: #ddd; background-color: #ddd;
margin: 0 8rpx; margin: 0 8rpx;
transition: all 0.3s ease;
} }
/* 激活的进度点 */ /* 激活的进度点 */
@@ -182,6 +208,9 @@ const handleBtnClick = () => {
/* 按钮容器 */ /* 按钮容器 */
.guide-btn-wrap { .guide-btn-wrap {
width: 80%; width: 80%;
max-width: 600rpx;
margin-bottom: 80rpx;
flex-shrink: 0;
} }
/* 引导按钮 */ /* 引导按钮 */
@@ -210,7 +239,7 @@ const handleBtnClick = () => {
border: none; border: none;
} }
/* 按钮禁用态 */ /* 按钮禁用态(可选) */
.guide-btn:disabled { .guide-btn:disabled {
background-color: #ccc; background-color: #ccc;
color: #fff; color: #fff;

View File

@@ -2,7 +2,7 @@
<view class="content-class"> <view class="content-class">
<view class="nar-top"> <view class="nar-top">
<!-- 这里是状态栏占位 --> <!-- 这里是状态栏占位 -->
<view class="status_bar"></view> <view class="status_bar" :style="{ height: statusBarHeight + 'px' }"></view>
<!-- 导航栏 --> <!-- 导航栏 -->
<view class="nav-bar"> <view class="nav-bar">
<text class="nav-title">首页</text> <text class="nav-title">首页</text>
@@ -134,6 +134,7 @@ const noticeText = ref('暂无公告')
const allCount = ref(0) // 全部巡检 const allCount = ref(0) // 全部巡检
const pendingCount = ref(0) //待巡检 const pendingCount = ref(0) //待巡检
const InspectedCount = ref(0) //已巡检 const InspectedCount = ref(0) //已巡检
const statusBarHeight = ref(uni.getSystemInfoSync().statusBarHeight || 0)
// =======方法======= // =======方法=======
@@ -214,7 +215,7 @@ const getInspectionData = () =>{
getTodayInspection().then(res =>{ getTodayInspection().then(res =>{
if(res.code === 200){ if(res.code === 200){
if(res.data){ if(res.data){
allCount.value = res.data.unfinishedPoints allCount.value = res.data.totalTasks
pendingCount.value = res.data.unfinishedTasks pendingCount.value = res.data.unfinishedTasks
InspectedCount.value = res.data.completedTasks InspectedCount.value = res.data.completedTasks
}else{ }else{
@@ -288,8 +289,8 @@ const clickItem = index => {
} }
.status_bar { .status_bar {
height: 46px;
width: 100%; width: 100%;
flex-shrink: 0;
} }
/* 导航栏 */ /* 导航栏 */
@@ -300,7 +301,7 @@ const clickItem = index => {
} }
.nav-title { .nav-title {
font-size: 14px; font-size: 32rpx;
font-weight: 400; font-weight: 400;
} }

View File

@@ -1,14 +1,12 @@
<template> <template>
<view class="contentStyle" style=""> <view class="contentStyle" style="">
<view class="status-bar"></view> <view class="status-bar" :style="{ height: statusBarHeight + 'px' }"></view>
<uni-nav-bar title="我的" backgroundColor="transparent" :border="false"> </uni-nav-bar> <uni-nav-bar title="我的" backgroundColor="transparent" :border="false"> </uni-nav-bar>
<scroll-view class="page" scroll-y> <scroll-view class="page" scroll-y>
<view class="topBox"> <view class="topBox">
<view class="name"> <view class="name">
<image :src="avatar" class="img" /> <image :src="avatar" class="img" />
<span <span style="padding: 5rpx 5rpx; display: flex; flex-direction: column; line-height: 60rpx">
style="padding: 5rpx 5rpx; display: flex; flex-direction: column; line-height: 60rpx"
>
<span style="font-size: 36rpx; font-weight: 600"> <span style="font-size: 36rpx; font-weight: 600">
{{ loginName }} {{ loginName }}
</span> </span>
@@ -21,20 +19,10 @@
<view class="contentBox"> <view class="contentBox">
<div class="page-container"> <div class="page-container">
<view class="list-container"> <view class="list-container">
<view <view class="list-item" v-for="(item, index) in list" :key="index" @click="onItemClick(item)">
class="list-item"
v-for="(item, index) in list"
:key="index"
@click="onItemClick(item)"
>
<image :src="item.icon" class="item-icon" /> <image :src="item.icon" class="item-icon" />
<view class="item-content"> <view class="item-content">
<text class="item-title">{{ item.title }}</text> <text class="item-title">{{ item.title }}</text>
<span class="item-desc" v-if="item.desc"
><span style="align-self: flex-end; font-size: 24rpx; vertical-align: baseline">{{
item.desc
}}</span></span
>
</view> </view>
<view class="item-arrow"></view> <view class="item-arrow"></view>
<!-- <image src="https://wuyeadmin.bugtc.com/images/propertyImgs/arrow-right.png" class="arrow-icon" /> --> <!-- <image src="https://wuyeadmin.bugtc.com/images/propertyImgs/arrow-right.png" class="arrow-icon" /> -->
@@ -46,24 +34,27 @@
</view> </view>
</template> </template>
<script setup> <script setup>
import { ref } from 'vue' import {
import { onShow } from '@dcloudio/uni-app' ref
import { getSettingInfo } from '../../api/api.js' } from 'vue'
import {
onShow
} from '@dcloudio/uni-app'
import {
getSettingInfo
} from '../../api/api.js'
const list = ref([ const list = ref([{
{
icon: 'https://wuyeadmin.bugtc.com/images/imgs/shangbao.png', icon: 'https://wuyeadmin.bugtc.com/images/imgs/shangbao.png',
title: '上报记录' title: '上报记录'
}, },
{ {
icon: 'https://wuyeadmin.bugtc.com/images/imgs/xunjian.png', icon: 'https://wuyeadmin.bugtc.com/images/imgs/xunjian.png',
title: '巡检记录' title: '巡检记录'
// desc: "您可以在这里添加家人、朋友、租客~"
}, },
{ {
icon: 'https://wuyeadmin.bugtc.com/images/imgs/xunjian.png', icon: 'https://wuyeadmin.bugtc.com/images/imgs/xunjian.png',
title: '仪表换新' title: '仪表换新'
// desc: "您可以在这里添加家人、朋友、租客~"
}, },
{ {
icon: 'https://wuyeadmin.bugtc.com/images/propertyImgs/setting.png', icon: 'https://wuyeadmin.bugtc.com/images/propertyImgs/setting.png',
@@ -73,6 +64,7 @@ const list = ref([
const loginName = ref('') const loginName = ref('')
const phoneNum = ref('') const phoneNum = ref('')
const avatar = ref('') const avatar = ref('')
const statusBarHeight = ref(uni.getSystemInfoSync().statusBarHeight || 0)
// 获取管家信息 // 获取管家信息
const fetchUserInfo = () => { const fetchUserInfo = () => {
@@ -85,7 +77,7 @@ const fetchUserInfo = () => {
}).catch(err => { }).catch(err => {
uni.showToast({ uni.showToast({
title: err.msg || '获取失败', title: err.msg || '获取失败',
icon: 'error' icon: 'none'
}) })
}) })
} }
@@ -174,9 +166,15 @@ const onItemClick = item => {
.contentBox { .contentBox {
position: relative; position: relative;
} }
.status-bar { .status-bar {
width: 100vw; width: 100vw;
height: 46px; // height: 46px;
height: var(--status-bar-height);
flex-shrink: 0;
}
::v-deep .uni-nav-bar-text{
font-size: 32rpx !important;
} }
.list-item { .list-item {