优化启动页
This commit is contained in:
@@ -18,6 +18,11 @@ onLaunch(() => {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
getPushCID()
|
getPushCID()
|
||||||
}, 2000)
|
}, 2000)
|
||||||
|
|
||||||
|
// 安全兜底:正常由首页/引导页 onReady 关闭启动屏;若异常未关闭,5 秒后强制关闭,避免卡在启动屏
|
||||||
|
setTimeout(() => {
|
||||||
|
plus.navigator.closeSplashscreen()
|
||||||
|
}, 5000)
|
||||||
// #endif
|
// #endif
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,5 @@ if (process.env.NODE_ENV === 'development') {
|
|||||||
} else {
|
} else {
|
||||||
baseUrl = 'https://wuyeapi.ckdzkj.com' // 生产环境
|
baseUrl = 'https://wuyeapi.ckdzkj.com' // 生产环境
|
||||||
// baseUrl = 'https://wuyeapi.bugtc.com' // 生产环境
|
// baseUrl = 'https://wuyeapi.bugtc.com' // 生产环境
|
||||||
// baseUrl = 'http://192.168.1.222:8080' // 生产环境
|
|
||||||
}
|
}
|
||||||
export default baseUrl;
|
export default baseUrl;
|
||||||
|
|||||||
@@ -2,17 +2,17 @@
|
|||||||
"name" : "花开管家",
|
"name" : "花开管家",
|
||||||
"appid" : "__UNI__5F224F3",
|
"appid" : "__UNI__5F224F3",
|
||||||
"description" : "智慧社区管家端,专为小区物业管理人员打造,支持多小区灵活切换管理。集成账号密码、手机号密码双重登录模式,内置忘记密码找回功能,保障账号安全。涵盖消息通知、日常巡检、故障报修、一键开门、工单流转、投诉处理等核心办公功能,物业人员可在线完成巡检打卡、问题上报、工单派发跟进、投诉对接处理等日常工作,同时支持查看个人上报记录、巡检历史,便捷修改账号信息与登录密码。高效简化社区物业办公流程,提升小区服务与管理效率,打造便捷智能的社区管理服务平台。",
|
"description" : "智慧社区管家端,专为小区物业管理人员打造,支持多小区灵活切换管理。集成账号密码、手机号密码双重登录模式,内置忘记密码找回功能,保障账号安全。涵盖消息通知、日常巡检、故障报修、一键开门、工单流转、投诉处理等核心办公功能,物业人员可在线完成巡检打卡、问题上报、工单派发跟进、投诉对接处理等日常工作,同时支持查看个人上报记录、巡检历史,便捷修改账号信息与登录密码。高效简化社区物业办公流程,提升小区服务与管理效率,打造便捷智能的社区管理服务平台。",
|
||||||
"versionName" : "1.0.6",
|
"versionName" : "1.0.7",
|
||||||
"versionCode" : 106,
|
"versionCode" : 107,
|
||||||
"transformPx" : false,
|
"transformPx" : false,
|
||||||
"app-plus" : {
|
"app-plus" : {
|
||||||
"usingComponents" : true,
|
"usingComponents" : true,
|
||||||
"nvueStyleCompiler" : "uni-app",
|
"nvueStyleCompiler" : "uni-app",
|
||||||
"compilerVersion" : 3,
|
"compilerVersion" : 3,
|
||||||
"splashscreen" : {
|
"splashscreen" : {
|
||||||
"alwaysShowBeforeRender" : false,
|
"alwaysShowBeforeRender" : true,
|
||||||
"waiting" : true,
|
"waiting" : true,
|
||||||
"autoclose" : true,
|
"autoclose" : false,
|
||||||
"delay" : 0,
|
"delay" : 0,
|
||||||
"useOriginalMsgbox" : true
|
"useOriginalMsgbox" : true
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -96,7 +96,7 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue'
|
import { ref, computed } from 'vue'
|
||||||
import { onLoad } from '@dcloudio/uni-app'
|
import { onLoad, onReady } from '@dcloudio/uni-app'
|
||||||
import { getLoginPassword } from '../../api/api.js'
|
import { getLoginPassword } from '../../api/api.js'
|
||||||
import { clearAccountStorage } from '../../api/request.js'
|
import { clearAccountStorage } from '../../api/request.js'
|
||||||
import PrivacyPopup from '@/components/privacy-popup/privacy-popup.vue'
|
import PrivacyPopup from '@/components/privacy-popup/privacy-popup.vue'
|
||||||
@@ -164,6 +164,13 @@ onLoad(() => {
|
|||||||
if (savedRemember) rememberPwd.value = savedRemember
|
if (savedRemember) rememberPwd.value = savedRemember
|
||||||
})
|
})
|
||||||
|
|
||||||
|
onReady(() => {
|
||||||
|
// 登录页渲染完成后关闭启动屏(登录过但未登录时直接进登录页)
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
plus.navigator.closeSplashscreen()
|
||||||
|
// #endif
|
||||||
|
})
|
||||||
|
|
||||||
// 登录逻辑
|
// 登录逻辑
|
||||||
const handleLogin = () => {
|
const handleLogin = () => {
|
||||||
if (!phoneNumber.value) {
|
if (!phoneNumber.value) {
|
||||||
|
|||||||
@@ -54,6 +54,7 @@
|
|||||||
const selectedItem = ref(null)
|
const selectedItem = ref(null)
|
||||||
const displayedCommunities = ref([])
|
const displayedCommunities = ref([])
|
||||||
const isLoading = ref(false)
|
const isLoading = ref(false)
|
||||||
|
const isConfirming = ref(false)
|
||||||
let searchTimeout = null
|
let searchTimeout = null
|
||||||
const defaultVillageId = ref('')
|
const defaultVillageId = ref('')
|
||||||
|
|
||||||
@@ -123,10 +124,13 @@
|
|||||||
|
|
||||||
// 确认选择
|
// 确认选择
|
||||||
const handleConfirm = () => {
|
const handleConfirm = () => {
|
||||||
|
// 防重复点击
|
||||||
|
if (isConfirming.value) return
|
||||||
if (!selectedItem.value) {
|
if (!selectedItem.value) {
|
||||||
uni.showToast({ title: '请先选择小区', icon: 'none', duration: 2000 })
|
uni.showToast({ title: '请先选择小区', icon: 'none', duration: 2000 })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
isConfirming.value = true
|
||||||
uni.showLoading({ title: '切换中...', mask: true })
|
uni.showLoading({ title: '切换中...', mask: true })
|
||||||
switchVillage({ villageId: selectedItem.value.id }).then((res) =>{
|
switchVillage({ villageId: selectedItem.value.id }).then((res) =>{
|
||||||
if(res.code === 200){
|
if(res.code === 200){
|
||||||
@@ -137,9 +141,12 @@
|
|||||||
uni.navigateBack()
|
uni.navigateBack()
|
||||||
}, 1500)
|
}, 1500)
|
||||||
}else{
|
}else{
|
||||||
|
isConfirming.value = false
|
||||||
|
uni.hideLoading()
|
||||||
uni.showToast({ title: res.msg || '切换失败', icon: 'none' })
|
uni.showToast({ title: res.msg || '切换失败', icon: 'none' })
|
||||||
}
|
}
|
||||||
}).catch((err)=>{
|
}).catch((err)=>{
|
||||||
|
isConfirming.value = false
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
uni.showToast({title:err.msg || '网络异常',icon:'none'})
|
uni.showToast({title:err.msg || '网络异常',icon:'none'})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
{
|
{
|
||||||
"pages": [{
|
"pages": [{
|
||||||
"path": "pages/guide/guide",
|
"path": "pages/index/index",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "引导页",
|
"navigationBarTitleText": "工作台",
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/index/index",
|
"path": "pages/guide/guide",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "工作台",
|
"navigationBarTitleText": "引导页",
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="guide-page" v-if="!token">
|
<view class="guide-page">
|
||||||
|
<template v-if="!token">
|
||||||
<view class="status-bar"></view>
|
<view class="status-bar"></view>
|
||||||
<!-- 引导内容滑动容器 -->
|
<!-- 引导内容滑动容器 -->
|
||||||
<swiper
|
<swiper
|
||||||
@@ -67,11 +68,13 @@
|
|||||||
{{ currentStep === 2 ? '立即体验' : '下一步' }}
|
{{ currentStep === 2 ? '立即体验' : '下一步' }}
|
||||||
</button>
|
</button>
|
||||||
</view>
|
</view>
|
||||||
|
</template>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
|
import { onReady } from '@dcloudio/uni-app';
|
||||||
|
|
||||||
// ========== 已登录直接进首页,跳过引导页 ==========
|
// ========== 已登录直接进首页,跳过引导页 ==========
|
||||||
const token = uni.getStorageSync('token');
|
const token = uni.getStorageSync('token');
|
||||||
@@ -81,6 +84,15 @@ if (token) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 引导页渲染完成后关闭启动屏(仅未登录;已登录由首页 onReady 关闭)
|
||||||
|
onReady(() => {
|
||||||
|
if (!token) {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
plus.navigator.closeSplashscreen()
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// ========== 响应式数据 ==========
|
// ========== 响应式数据 ==========
|
||||||
// 当前引导步骤(0/1/2)
|
// 当前引导步骤(0/1/2)
|
||||||
const currentStep = ref(0);
|
const currentStep = ref(0);
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="content-class">
|
<view class="content-class">
|
||||||
|
<template v-if="isLoggedIn">
|
||||||
<!-- 顶部渐变背景层 -->
|
<!-- 顶部渐变背景层 -->
|
||||||
<view class="bg-gradient"></view>
|
<view class="bg-gradient"></view>
|
||||||
|
|
||||||
<!-- 页面内容区 -->
|
<!-- 页面内容区 -->
|
||||||
<view class="page-content">
|
<view class="page-content">
|
||||||
<!-- 粘性顶部区域(状态栏 + 导航栏 + 小区选择) -->
|
|
||||||
<view class="sticky-header">
|
<view class="sticky-header">
|
||||||
<!-- 状态栏占位 -->
|
<!-- 状态栏占位 -->
|
||||||
<view class="status_bar" :style="{ height: statusBarHeight + 'px' }"></view>
|
<view class="status_bar" :style="{ height: statusBarHeight + 'px' }"></view>
|
||||||
@@ -118,12 +118,14 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
</template>
|
||||||
|
<view v-else class="launch-placeholder"></view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import { onLoad, onUnload, onShow } from '@dcloudio/uni-app'
|
import { onLoad, onUnload, onShow, onReady } from '@dcloudio/uni-app'
|
||||||
import {
|
import {
|
||||||
getCurrentVillage,
|
getCurrentVillage,
|
||||||
getTodayInspection,
|
getTodayInspection,
|
||||||
@@ -136,7 +138,10 @@ import { usePermStore } from '@/stores/usePermStore'
|
|||||||
|
|
||||||
const permStore = usePermStore()
|
const permStore = usePermStore()
|
||||||
|
|
||||||
// 首次加载标记:onLoad 和 onShow 在首次进入时都会触发,用此标记避免重复请求
|
// 登录状态:未登录时启动跳引导页
|
||||||
|
const isLoggedIn = ref(!!uni.getStorageSync('token'))
|
||||||
|
|
||||||
|
// 首次加载标记
|
||||||
const hasInit = ref(false)
|
const hasInit = ref(false)
|
||||||
|
|
||||||
// banner 缓存 key 和缓存时长(30分钟)
|
// banner 缓存 key 和缓存时长(30分钟)
|
||||||
@@ -302,7 +307,6 @@ const handleFunctionClick = item => {
|
|||||||
}
|
}
|
||||||
// 获取当前小区
|
// 获取当前小区
|
||||||
const currentVillageData = () => {
|
const currentVillageData = () => {
|
||||||
// 先重置,避免新账号无小区时仍显示旧账号的小区
|
|
||||||
currentCommunity.value = '请先绑定房屋'
|
currentCommunity.value = '请先绑定房屋'
|
||||||
getCurrentVillage()
|
getCurrentVillage()
|
||||||
.then(res => {
|
.then(res => {
|
||||||
@@ -313,7 +317,9 @@ const currentVillageData = () => {
|
|||||||
getNoticeData()
|
getNoticeData()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {})
|
.catch(() => {
|
||||||
|
currentCommunity.value = '请先绑定房屋'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
// 获取今日巡检数据
|
// 获取今日巡检数据
|
||||||
const getInspectionData = () => {
|
const getInspectionData = () => {
|
||||||
@@ -339,17 +345,16 @@ const getInspectionData = () => {
|
|||||||
}
|
}
|
||||||
// 获取消息通知
|
// 获取消息通知
|
||||||
const getNoticeData = () => {
|
const getNoticeData = () => {
|
||||||
getNewNoticeData()
|
getNewNoticeData().then(res => {
|
||||||
.then(res => {
|
const notice = res.code === 200 && res.data ? (res.data.notice || '') : '暂无公告'
|
||||||
if (res.code === 200 && res.data) {
|
// 仅在内容真正变化时才更新
|
||||||
noticeText.value = res.data.notice || ''
|
if (noticeText.value !== notice) {
|
||||||
} else {
|
noticeText.value = notice
|
||||||
noticeText.value = '暂无公告'
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {})
|
.catch(() => {})
|
||||||
}
|
}
|
||||||
// 获取bannar图(带缓存:30分钟内优先用缓存,请求成功后更新缓存)
|
// 获取bannar图
|
||||||
function getbannarData(forceRefresh = false) {
|
function getbannarData(forceRefresh = false) {
|
||||||
// 非强制刷新时,优先读缓存
|
// 非强制刷新时,优先读缓存
|
||||||
if (!forceRefresh) {
|
if (!forceRefresh) {
|
||||||
@@ -414,6 +419,7 @@ const slelctHomeData = data => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
|
if (!isLoggedIn.value) return
|
||||||
if (!hasInit.value) {
|
if (!hasInit.value) {
|
||||||
// 首次加载:onLoad 已触发过核心数据请求,这里只补 onLoad 没调的和需要每次都刷新的
|
// 首次加载:onLoad 已触发过核心数据请求,这里只补 onLoad 没调的和需要每次都刷新的
|
||||||
hasInit.value = true
|
hasInit.value = true
|
||||||
@@ -434,11 +440,33 @@ onShow(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
onLoad(() => {
|
onLoad(() => {
|
||||||
|
// 未登录:登录过→登录页;首次下载→引导页
|
||||||
|
if (!isLoggedIn.value) {
|
||||||
|
const hasShowGuide = uni.getStorageSync('hasShowGuide')
|
||||||
|
uni.hideTabBar({ animation: false })
|
||||||
|
uni.reLaunch({
|
||||||
|
url: hasShowGuide ? '/pageSubPack/loginSub/pwd-login' : '/pages/guide/guide',
|
||||||
|
animationType: 'none',
|
||||||
|
animationDuration: 0
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 已登录:确保 tabBar 显示(未登录启动时曾被 hideTabBar 隐藏,switchTab 不会自动恢复)
|
||||||
|
uni.showTabBar({ animation: false })
|
||||||
uni.$on('confirm', slelctHomeData)
|
uni.$on('confirm', slelctHomeData)
|
||||||
currentVillageData()
|
currentVillageData()
|
||||||
getInspectionData()
|
getInspectionData()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
onReady(() => {
|
||||||
|
// 已登录:首页即最终页,渲染完成后关闭启动屏(未登录由引导页 onReady 关闭)
|
||||||
|
if (isLoggedIn.value) {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
plus.navigator.closeSplashscreen()
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
onUnload(() => {
|
onUnload(() => {
|
||||||
uni.$off('confirm', slelctHomeData)
|
uni.$off('confirm', slelctHomeData)
|
||||||
})
|
})
|
||||||
@@ -465,6 +493,12 @@ onUnload(() => {
|
|||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 未登录启动占位:背景与引导页一致,过渡不闪烁 */
|
||||||
|
.launch-placeholder {
|
||||||
|
min-height: 100vh;
|
||||||
|
background: linear-gradient(to bottom, #e2f0ff, #f6faff);
|
||||||
|
}
|
||||||
|
|
||||||
/* 顶部渐变背景 - 增加高度确保覆盖粘性头部区域 */
|
/* 顶部渐变背景 - 增加高度确保覆盖粘性头部区域 */
|
||||||
.bg-gradient {
|
.bg-gradient {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|||||||
Reference in New Issue
Block a user