Merge branch 'master' of http://gitea.bugtc.com/zhouyanli/property-manager-side
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import request,{get,post} from "./request.js"
|
||||
import request,{get,post,upload} from "./request.js"
|
||||
|
||||
|
||||
// =======账号密码登录========
|
||||
@@ -65,8 +65,8 @@ export const addRepairList = (data) =>{
|
||||
return post('/manage/repair/order',data)
|
||||
}
|
||||
// 上传图片
|
||||
export const uploadFile = (filePath) => {
|
||||
return upload(filePath,'/resource/oss/upload');
|
||||
export const uploadFile = (filePath, fileName) => {
|
||||
return upload(filePath, '/api/butler/file/uploadImage', fileName);
|
||||
}
|
||||
|
||||
// 查询一键开门
|
||||
|
||||
@@ -81,20 +81,21 @@ export const put = (url, data) => request(url, data, 'PUT')
|
||||
// export const putMethod = (url, data) => request(url, data, 'PUT');
|
||||
|
||||
// 上传
|
||||
export const upload = (filePath, url) => {
|
||||
export const upload = (filePath, url, fileName) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.uploadFile({
|
||||
const uploadTask = uni.uploadFile({
|
||||
url: baseUrl + url,
|
||||
filePath: filePath,
|
||||
name: 'file',
|
||||
fileName: fileName,
|
||||
header: {
|
||||
Authorization: 'Bearer ' + (uni.getStorageSync('token') || ''),
|
||||
clientid: 'resident'
|
||||
clientid: 'butler'
|
||||
},
|
||||
success: res => {
|
||||
try {
|
||||
const data = JSON.parse(res.data)
|
||||
resolve(data.data || '') // 直接返回图片地址
|
||||
resolve(data.data || '')
|
||||
} catch (e) {
|
||||
resolve('')
|
||||
}
|
||||
|
||||
@@ -150,14 +150,15 @@ const uploadImages = async () => {
|
||||
continue
|
||||
}
|
||||
try {
|
||||
const res = await uploadFile(path)
|
||||
// 根据后端实际返回结构调整字段名
|
||||
uploadedUrls.push(res.url || '')
|
||||
// 从路径中提取文件名
|
||||
const fileName = path.substring(path.lastIndexOf('/') + 1)
|
||||
const res = await uploadFile(path, fileName)
|
||||
uploadedUrls.push(res?.url || '')
|
||||
} catch (err) {
|
||||
uni.showToast({
|
||||
title:err.msg || '图片上传失败',
|
||||
icon:'error'
|
||||
})
|
||||
uni.showToast({
|
||||
title: err.msg || '图片上传失败',
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
}
|
||||
return uploadedUrls
|
||||
|
||||
@@ -29,6 +29,15 @@
|
||||
|
||||
</view>
|
||||
|
||||
<!-- 记住密码 -->
|
||||
<view class="remember-wrap">
|
||||
<view class="remember-item" @click="toggleRemember">
|
||||
<uni-icons type="checkbox-filled" size="18" color="#4D5DFA" v-if="rememberPwd"></uni-icons>
|
||||
<uni-icons type="checkbox" size="18" color="#999" v-else></uni-icons>
|
||||
<text class="remember-text">记住密码</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 协议勾选 + 忘记密码 -->
|
||||
<view class="agreement-wrap">
|
||||
<view class="agreement-item">
|
||||
@@ -72,6 +81,7 @@
|
||||
const phoneNumber = ref('');
|
||||
const password = ref('');
|
||||
const agreeAgreement = ref(false); // 默认勾选
|
||||
const rememberPwd = ref(false);
|
||||
const placeholderStyle = ref('font-size:24rpx')
|
||||
// 控制点击变色
|
||||
// const isClicked = ref(false)
|
||||
@@ -87,6 +97,10 @@
|
||||
const toggleAgreement = () => {
|
||||
agreeAgreement.value = !agreeAgreement.value;
|
||||
};
|
||||
// 切换记住密码
|
||||
const toggleRemember = () => {
|
||||
rememberPwd.value = !rememberPwd.value;
|
||||
};
|
||||
// 跳转隐私协议
|
||||
const goToPrivacy = () => {
|
||||
|
||||
@@ -100,7 +114,14 @@
|
||||
const checkForm = () => {};
|
||||
|
||||
|
||||
onLoad(() => {});
|
||||
onLoad(() => {
|
||||
const savedPhone = uni.getStorageSync('rememberPhone');
|
||||
const savedPwd = uni.getStorageSync('rememberPassword');
|
||||
const savedRemember = uni.getStorageSync('rememberPwd');
|
||||
if (savedPhone) phoneNumber.value = savedPhone;
|
||||
if (savedPwd) password.value = savedPwd;
|
||||
if (savedRemember) rememberPwd.value = savedRemember;
|
||||
});
|
||||
|
||||
// 登录逻辑
|
||||
const handleLogin = () => {
|
||||
@@ -138,12 +159,21 @@
|
||||
if(res.code === 200){
|
||||
uni.setStorageSync('token', res.data.token);
|
||||
// 存用户ID
|
||||
if(res.data) {
|
||||
// 存当前绑定的小区ID,0 表示未绑定
|
||||
// const currentVillageId = res.data.currentVillageId || 0;
|
||||
// uni.setStorageSync('currentVillageId', currentVillageId);
|
||||
}
|
||||
// if(res.data) {
|
||||
// // 存当前绑定的小区ID,0 表示未绑定
|
||||
// // const currentVillageId = res.data.currentVillageId || 0;
|
||||
// // uni.setStorageSync('currentVillageId', currentVillageId);
|
||||
// }
|
||||
uni.hideLoading();
|
||||
if (rememberPwd.value) {
|
||||
uni.setStorageSync('rememberPhone', phoneNumber.value);
|
||||
uni.setStorageSync('rememberPassword', password.value);
|
||||
uni.setStorageSync('rememberPwd', true);
|
||||
} else {
|
||||
uni.removeStorageSync('rememberPhone');
|
||||
uni.removeStorageSync('rememberPassword');
|
||||
uni.removeStorageSync('rememberPwd');
|
||||
}
|
||||
uni.showToast({ title: '登录成功', icon: 'success' });
|
||||
setTimeout(() =>{
|
||||
uni.switchTab({
|
||||
@@ -228,11 +258,29 @@
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.remember-wrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin: 20rpx 0 0 0;
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
|
||||
.remember-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.remember-text {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
margin-left: 10rpx;
|
||||
}
|
||||
|
||||
.agreement-wrap {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin: 70rpx 0 28rpx 0;
|
||||
margin: 40rpx 0 28rpx 0;
|
||||
padding: 0 10rpx;
|
||||
}
|
||||
|
||||
|
||||
@@ -301,13 +301,10 @@ onReady(() => {
|
||||
.type-tabs {
|
||||
display: flex;
|
||||
/* background-color: #fff; */
|
||||
padding: 20rpx 0rpx;
|
||||
padding: 20rpx 40rpx;
|
||||
margin-top: 10rpx;
|
||||
justify-content: flex-start;
|
||||
margin: 0rpx 40rpx;
|
||||
}
|
||||
.type-tabs > .type-tab-item:not(:last-child) {
|
||||
margin-right: 20rpx;
|
||||
/* gap: 20rpx; */
|
||||
}
|
||||
|
||||
.type-tab-item {
|
||||
@@ -316,6 +313,7 @@ onReady(() => {
|
||||
color: #999;
|
||||
border: 2rpx solid #999;
|
||||
border-radius: 198rpx;
|
||||
margin: 0 16rpx 0 0;
|
||||
}
|
||||
|
||||
.type-tab-item.active {
|
||||
|
||||
@@ -192,7 +192,9 @@ const handleConfirm = () => {
|
||||
flex: 1;
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
height: 100%;
|
||||
/* height: 100%; */
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* 密码规则提示 */
|
||||
|
||||
@@ -210,7 +210,8 @@ const handleConfirm = () => {
|
||||
flex: 1;
|
||||
font-size: 32rpx;
|
||||
color: #333;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.verify-input {
|
||||
padding-right: 20rpx;
|
||||
|
||||
@@ -5,142 +5,148 @@
|
||||
|
||||
<!-- 页面内容区 -->
|
||||
<view class="page-content">
|
||||
<!-- 状态栏占位 -->
|
||||
<view class="status_bar" :style="{ height: statusBarHeight + 'px' }"></view>
|
||||
<!-- 导航栏 -->
|
||||
<view class="nav-bar">
|
||||
<text class="nav-title">首页</text>
|
||||
</view>
|
||||
<!-- 小区选择 -->
|
||||
<view class="header-container" @click="navigateToPage">
|
||||
<view class="location-area">
|
||||
<view class="location-icon">
|
||||
<image
|
||||
src="https://wuyeadmin.bugtc.com/images/imgs/adress.png"
|
||||
style="height: 100%; width: 100%"
|
||||
></image>
|
||||
</view>
|
||||
<view class="community-selector">
|
||||
<text class="community-name">{{ currentCommunity }}</text>
|
||||
<view class="community-icon">
|
||||
<!-- 粘性顶部区域(状态栏 + 导航栏 + 小区选择) -->
|
||||
<view class="sticky-header">
|
||||
<!-- 状态栏占位 -->
|
||||
<view class="status_bar" :style="{ height: statusBarHeight + 'px' }"></view>
|
||||
<!-- 导航栏 -->
|
||||
<view class="nav-bar">
|
||||
<text class="nav-title">首页</text>
|
||||
</view>
|
||||
<!-- 小区选择 -->
|
||||
<view class="header-container" @click="navigateToPage">
|
||||
<view class="location-area">
|
||||
<view class="location-icon">
|
||||
<image
|
||||
src="https://wuyeadmin.bugtc.com/images/imgs/三角形.png"
|
||||
src="https://wuyeadmin.bugtc.com/images/imgs/adress.png"
|
||||
style="height: 100%; width: 100%"
|
||||
></image>
|
||||
</view>
|
||||
<view class="community-selector">
|
||||
<text class="community-name">{{ currentCommunity }}</text>
|
||||
<view class="community-icon">
|
||||
<image
|
||||
src="https://wuyeadmin.bugtc.com/images/imgs/三角形.png"
|
||||
style="height: 100%; width: 100%"
|
||||
></image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- banner -->
|
||||
<view class="bannarClass">
|
||||
<uni-swiper-dot
|
||||
class="uni-swiper-dot-box"
|
||||
@clickItem="clickItem"
|
||||
:info="bannerList"
|
||||
:current="current"
|
||||
mode="round"
|
||||
>
|
||||
<swiper class="swiper-box" :current="current" @change="onSwiperChange" autoplay>
|
||||
<swiper-item v-for="(item, index) in bannerList" :key="index">
|
||||
<view class="swiper-item">
|
||||
<image :src="item.url" style="width: 100%; height: 100%"></image>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</uni-swiper-dot>
|
||||
</view>
|
||||
<!-- 可滚动内容区 -->
|
||||
<view class="scroll-content">
|
||||
<!-- banner -->
|
||||
<view class="bannarClass">
|
||||
<uni-swiper-dot
|
||||
class="uni-swiper-dot-box"
|
||||
@clickItem="clickItem"
|
||||
:info="bannerList"
|
||||
:current="current"
|
||||
mode="round"
|
||||
>
|
||||
<swiper class="swiper-box" :current="current" @change="onSwiperChange" autoplay>
|
||||
<swiper-item v-for="(item, index) in bannerList" :key="index">
|
||||
<view class="swiper-item">
|
||||
<image :src="item.url" style="width: 100%; height: 100%"></image>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</uni-swiper-dot>
|
||||
</view>
|
||||
|
||||
<!-- 巡检 -->
|
||||
<view class="inspectionClass">
|
||||
<!-- 消息通知栏 -->
|
||||
<view class="noticeClass">
|
||||
<view class="notice-left">
|
||||
<image
|
||||
src="https://wuyeadmin.bugtc.com/images/imgs/notice.png"
|
||||
class="notice-icon"
|
||||
></image>
|
||||
<view class="notice-line"></view>
|
||||
<!-- 巡检 -->
|
||||
<view class="inspectionClass">
|
||||
<!-- 消息通知栏 -->
|
||||
<view class="noticeClass">
|
||||
<view class="notice-left">
|
||||
<image
|
||||
src="https://wuyeadmin.bugtc.com/images/imgs/notice.png"
|
||||
class="notice-icon"
|
||||
></image>
|
||||
<view class="notice-line"></view>
|
||||
</view>
|
||||
<view class="notice-right" @click="getNoticeMore">
|
||||
<uni-notice-bar
|
||||
:text="noticeText"
|
||||
type="line"
|
||||
:showIcon="false"
|
||||
show-get-more
|
||||
scrollable
|
||||
color="#fff"
|
||||
background-color="transparent"
|
||||
moreColor="#fff"
|
||||
no-border
|
||||
>
|
||||
</uni-notice-bar>
|
||||
</view>
|
||||
</view>
|
||||
<view class="notice-right" @click="getNoticeMore">
|
||||
<uni-notice-bar
|
||||
:text="noticeText"
|
||||
type="line"
|
||||
:showIcon="false"
|
||||
show-get-more
|
||||
scrollable
|
||||
color="#fff"
|
||||
background-color="transparent"
|
||||
moreColor="#fff"
|
||||
no-border
|
||||
>
|
||||
</uni-notice-bar>
|
||||
|
||||
<!-- 巡检数据统计区 -->
|
||||
<view class="statistics-wrap">
|
||||
<view class="statistics-item" @click="goToInspectionRecord">
|
||||
<text class="num">{{ allCount }}</text>
|
||||
<text class="label">全部巡检</text>
|
||||
</view>
|
||||
<view class="statistics-item" @click="goToDaysInspection">
|
||||
<text class="num">{{ pendingCount }}</text>
|
||||
<text class="label">待巡检</text>
|
||||
</view>
|
||||
<view class="statistics-item">
|
||||
<text class="num">{{ InspectedCount }}</text>
|
||||
<text class="label">已巡检</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 巡检数据统计区 -->
|
||||
<view class="statistics-wrap">
|
||||
<view class="statistics-item" @click="goToInspectionRecord">
|
||||
<text class="num">{{ allCount }}</text>
|
||||
<text class="label">全部巡检</text>
|
||||
<!-- 网格布局功能 -->
|
||||
<view class="function-container">
|
||||
<!-- 第一行功能:故障上报、一键开门、工单大厅、我的工单 -->
|
||||
<view class="function-row">
|
||||
<view class="function-item" @click="goToReport">
|
||||
<image
|
||||
class="item-icon"
|
||||
src="https://wuyeadmin.bugtc.com/images/imgs/fault-report.png"
|
||||
mode="aspectFit"
|
||||
></image>
|
||||
<text class="item-text">故障上报</text>
|
||||
</view>
|
||||
<view class="function-item" @click="goToOneOpenDoor">
|
||||
<image
|
||||
class="item-icon"
|
||||
src="https://wuyeadmin.bugtc.com/images/imgs/open.png"
|
||||
mode="aspectFit"
|
||||
></image>
|
||||
<text class="item-text">一键开门</text>
|
||||
</view>
|
||||
<view class="function-item" @tap="goToTicketHall">
|
||||
<image
|
||||
class="item-icon"
|
||||
src="https://wuyeadmin.bugtc.com/images/imgs/work-order.png"
|
||||
mode="aspectFit"
|
||||
></image>
|
||||
<text class="item-text">工单大厅</text>
|
||||
</view>
|
||||
<view class="function-item" @tap="goToMyTicket">
|
||||
<image
|
||||
class="item-icon"
|
||||
src="https://wuyeadmin.bugtc.com/images/imgs/my-work.png"
|
||||
mode="aspectFit"
|
||||
></image>
|
||||
<text class="item-text">我的工单</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="statistics-item" @click="goToDaysInspection">
|
||||
<text class="num">{{ pendingCount }}</text>
|
||||
<text class="label">待巡检</text>
|
||||
</view>
|
||||
<view class="statistics-item">
|
||||
<text class="num">{{ InspectedCount }}</text>
|
||||
<text class="label">已巡检</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 网格布局功能 -->
|
||||
<view class="function-container">
|
||||
<!-- 第一行功能:故障上报、一键开门、工单大厅、我的工单 -->
|
||||
<view class="function-row">
|
||||
<view class="function-item" @click="goToReport">
|
||||
<image
|
||||
class="item-icon"
|
||||
src="https://wuyeadmin.bugtc.com/images/imgs/fault-report.png"
|
||||
mode="aspectFit"
|
||||
></image>
|
||||
<text class="item-text">故障上报</text>
|
||||
</view>
|
||||
<view class="function-item" @click="goToOneOpenDoor">
|
||||
<image
|
||||
class="item-icon"
|
||||
src="https://wuyeadmin.bugtc.com/images/imgs/open.png"
|
||||
mode="aspectFit"
|
||||
></image>
|
||||
<text class="item-text">一键开门</text>
|
||||
</view>
|
||||
<view class="function-item" @tap="goToTicketHall">
|
||||
<image
|
||||
class="item-icon"
|
||||
src="https://wuyeadmin.bugtc.com/images/imgs/work-order.png"
|
||||
mode="aspectFit"
|
||||
></image>
|
||||
<text class="item-text">工单大厅</text>
|
||||
</view>
|
||||
<view class="function-item" @tap="goToMyTicket">
|
||||
<image
|
||||
class="item-icon"
|
||||
src="https://wuyeadmin.bugtc.com/images/imgs/my-work.png"
|
||||
mode="aspectFit"
|
||||
></image>
|
||||
<text class="item-text">我的工单</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 第二行 -->
|
||||
<view class="function-row" style="margin-top: 2px">
|
||||
<view class="function-item" @tap="goToComplaint">
|
||||
<image
|
||||
class="item-icon"
|
||||
src="https://wuyeadmin.bugtc.com/images/imgs/complaint.png"
|
||||
mode="aspectFit"
|
||||
></image>
|
||||
<text class="item-text">投诉处理</text>
|
||||
<!-- 第二行 -->
|
||||
<view class="function-row" style="margin-top: 2px">
|
||||
<view class="function-item" @tap="goToComplaint">
|
||||
<image
|
||||
class="item-icon"
|
||||
src="https://wuyeadmin.bugtc.com/images/imgs/complaint.png"
|
||||
mode="aspectFit"
|
||||
></image>
|
||||
<text class="item-text">投诉处理</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -150,7 +156,7 @@
|
||||
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { onLoad, onUnload } from '@dcloudio/uni-app'
|
||||
import { onLoad, onUnload ,onShow} from '@dcloudio/uni-app'
|
||||
import {
|
||||
getCurrentVillage,
|
||||
getTodayInspection,
|
||||
@@ -297,13 +303,16 @@ const slelctHomeData = data => {
|
||||
getNoticeData()
|
||||
getInspectionData()
|
||||
}
|
||||
onShow(()=>{
|
||||
getbannarData()
|
||||
})
|
||||
|
||||
onLoad(() => {
|
||||
uni.$on('confirm', slelctHomeData)
|
||||
// 优先调用接口获取当前小区,失败时再读缓存
|
||||
currentVillageData()
|
||||
getInspectionData()
|
||||
getbannarData()
|
||||
// getbannarData()
|
||||
})
|
||||
|
||||
onUnload(() => {
|
||||
@@ -326,13 +335,13 @@ const onSwiperChange = e => {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* 顶部渐变背景 */
|
||||
/* 顶部渐变背景 - 增加高度确保覆盖粘性头部区域 */
|
||||
.bg-gradient {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 400rpx;
|
||||
height: 600rpx;
|
||||
background: repeating-linear-gradient(to right, #edf4fa, #c0e4fb);
|
||||
z-index: 0;
|
||||
}
|
||||
@@ -344,6 +353,19 @@ const onSwiperChange = e => {
|
||||
padding: 0 40rpx 40rpx;
|
||||
}
|
||||
|
||||
/* 粘性头部区域 - 滚动时固定在顶部 */
|
||||
.sticky-header {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
/* 与顶部渐变背景一致,保证滚动时视觉效果连贯 */
|
||||
background: repeating-linear-gradient(to right, #edf4fa, #c0e4fb);
|
||||
margin: 0 -40rpx; /* 抵消父容器内边距,使背景完全延伸 */
|
||||
padding: 0 40rpx;
|
||||
/* 可选:添加轻微阴影增强层次感 */
|
||||
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.02);
|
||||
}
|
||||
|
||||
.status_bar {
|
||||
width: 100%;
|
||||
}
|
||||
@@ -407,6 +429,12 @@ const onSwiperChange = e => {
|
||||
}
|
||||
}
|
||||
|
||||
/* 可滚动内容区域 */
|
||||
.scroll-content {
|
||||
/* 确保内部元素正常布局 */
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.bannarClass {
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user