This commit is contained in:
2025-08-19 14:35:12 +08:00
parent 3f2fa0a8a3
commit 7a91647105
30 changed files with 2282 additions and 1085 deletions

View File

@@ -1,409 +1,467 @@
<template>
<view class="home-container">
<!-- 顶部Banner区域包含所有顶部内容 -->
<view class="home-header">
<swiper class="banner-swiper" :current="current" @change="onBannerChange" :autoplay="true" :interval="3000" :circular="true">
<swiper-item v-for="(item, idx) in banners" :key="idx">
<image :src="item.img" class="banner-bg-img" mode="aspectFill" />
</swiper-item>
</swiper>
<!-- 自定义指示器 -->
<view class="banner-indicator">
<view v-for="(item, idx) in banners" :key="idx" :class="['banner-dot', current === idx ? 'active' : '']"></view>
</view>
<view class="home-top">
<image class="icon3" src="/static/ic_tq.png" />
<text class="weather">21-36</text>
<view class="search-bar">
<image src="/static/ic_search.png" class="search-icon-img" />
<input class="search-input" placeholder="搜索" />
</view>
<view class="top-icons">
<image class="icon1" src="/static/ic_scan.png" />
<image class="icon2" src="/static/ic_msg.png" />
</view>
</view>
</view>
<!-- 白色圆角虚线面板 -->
<view class="main-panel">
<!-- 九宫格功能区 -->
<view class="grid-area">
<view class="grid-item" v-for="(item, idx) in gridList" :key="idx">
<image :src="item.icon" class="grid-icon" />
<text class="grid-text">{{ item.text }}</text>
</view>
</view>
<!-- 滚动资讯条 -->
<view class="news-bar">
<text class="news-label">头条</text>
<scroll-view scroll-x class="news-scroll">
<text v-for="(item, idx) in newsList" :key="idx" class="news-item">{{ item }}</text>
</scroll-view>
<text class="news-arrow"></text>
</view>
<!-- 热门活动区 -->
<view class="hot-section">
<view class="hot-title-row">
<text class="hot-title">热门活动</text>
<text class="hot-more">全部热门活动 ></text>
</view>
<view class="hot-list">
<view class="hot-card" v-for="(item, idx) in hotList" :key="idx">
<image :src="item.img" class="hot-img" mode="aspectFill" />
<view class="hot-info">
<text class="hot-tag">#热门活动</text>
<text class="hot-desc">{{ item.title }}</text>
<view class="hot-meta">
<text class="hot-date">{{ item.date }}</text>
<text class="hot-status">进行中</text>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'Home',
data() {
return {
banners: [{
img: 'https://picsum.photos/750/300?random=1'
},
{
img: 'https://picsum.photos/750/300?random=2'
}
],
current: 0,
gridList: [{
icon: 'https://picsum.photos/80/80?random=3',
text: '报事报修'
},
{
icon: 'https://picsum.photos/80/80?random=4',
text: '停车缴费'
},
{
icon: 'https://picsum.photos/80/80?random=5',
text: '生活服务'
},
{
icon: 'https://picsum.photos/80/80?random=6',
text: '服务中心'
},
{
icon: 'https://picsum.photos/80/80?random=7',
text: '会议预约'
},
{
icon: 'https://picsum.photos/80/80?random=8',
text: '工单管理'
},
{
icon: 'https://picsum.photos/80/80?random=9',
text: '访客管理'
},
{
icon: 'https://picsum.photos/80/80?random=10',
text: '敬请期待'
}
],
newsList: [
'数智南川|最新资讯1',
'数智南川|最新资讯2',
'数智南川|最新资讯3'
],
hotList: [{
img: 'https://picsum.photos/700/280?random=13',
title: '世界骑行日 低碳出行 让城市更美好',
date: '2025-07-03'
},
{
img: 'https://picsum.photos/700/280?random=14',
title: '仲夏之夜低碳出行·绿色生活让城市更美好',
date: '2025-07-03'
}
]
}
},
methods: {
onBannerChange(e) {
this.current = e.detail.current;
}
}
}
</script>
<style scoped>
.home-container {
display: flex;
flex-direction: column;
height: 100vh;
background: #f8f8f8;
padding-bottom: 40rpx;
}
.home-header {
position: relative;
height: 446rpx;
width: 100vw;
margin-bottom: -40rpx;
flex-shrink: 0;
}
.banner-swiper {
width: 100vw;
height: 446rpx;
position: absolute;
left: 0;
top: 0;
z-index: 0;
}
.banner-bg-img {
width: 100vw;
height: 446rpx;
object-fit: cover;
}
.banner-indicator {
position: absolute;
left: 0;
bottom: 64rpx;
width: 100vw;
display: flex;
justify-content: center;
z-index: 2;
}
.banner-dot {
width: 14rpx;
height: 14rpx;
border-radius: 50%;
background: rgba(255,255,255,0.6);
margin: 0 8rpx;
transition: background 0.2s;
}
.banner-dot.active {
background: #3B7BFF;
}
.home-top {
position: relative;
z-index: 3;
display: flex;
align-items: center;
color: #fff;
padding: 80rpx 20rpx 0 20rpx;
}
.weather {
font-size: 24rpx;
margin-left: 10rpx;
margin-right: 16rpx;
}
.search-bar {
flex: 1;
display: flex;
align-items: center;
background: rgba(255, 255, 255, 0.3);
border-radius: 30rpx;
padding: 0 20rpx;
height: 56rpx;
margin-right: 16rpx;
}
.search-input::placeholder {
color: #f0f0f0;
}
.search-icon-img {
width: 28rpx;
height: 28rpx;
margin-right: 8rpx;
}
.search-input {
border: none;
background: transparent;
font-size: 26rpx;
flex: 1;
color: #fff;
}
.top-icons {
display: flex;
align-items: center;
}
.icon1 {
width: 33rpx;
height: 33rpx;
margin-left: 19rpx;
}
.icon2 {
width: 38rpx;
height: 38rpx;
margin-left: 23rpx;
}
.icon3 {
width: 40rpx;
height: 40rpx;
}
.main-panel {
flex: 1;
overflow-y: auto;
background: #fff;
border-radius: 20rpx;
position: relative;
z-index: 10;
padding: 20rpx;
}
.grid-area {
display: flex;
flex-wrap: wrap;
padding: 20rpx 0 10rpx 0;
}
.grid-item {
width: 20%;
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 20rpx;
}
.grid-icon {
width: 80rpx;
height: 80rpx;
margin-bottom: 8rpx;
}
.grid-text {
font-size: 24rpx;
color: #1D1D1D;
}
.news-bar {
display: flex;
align-items: center;
padding: 10rpx 0;
border-top: 1rpx solid #f5f5f5;
margin-top: 10rpx;
}
.news-label {
color: #FF6A00;
font-size: 28rpx;
font-weight: bold;
margin-right: 16rpx;
border: 1rpx solid #FF6A00;
border-radius: 4rpx;
padding: 2rpx 6rpx;
}
.news-scroll {
flex: 1;
white-space: nowrap;
}
.news-item {
display: inline-block;
margin-right: 30rpx;
color: #666;
font-size: 24rpx;
}
.news-arrow {
color: #999;
font-size: 32rpx;
}
.hot-section {
margin-top: 20rpx;
}
.hot-title-row {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20rpx;
}
.hot-title {
font-size: 32rpx;
font-weight: bold;
color: #222;
position: relative;
padding-left: 16rpx;
}
.hot-title::before {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 6rpx;
height: 30rpx;
background: #3B7BFF;
border-radius: 3rpx;
}
.hot-more {
font-size: 24rpx;
color: #999;
}
.hot-list {
display: flex;
flex-direction: column;
gap: 20rpx;
}
.hot-card {
background: #fff;
border-radius: 20rpx;
overflow: hidden;
display: flex;
flex-direction: column;
border: 1rpx solid #f0f0f0;
}
.hot-img {
width: 100%;
height: 280rpx;
object-fit: cover;
}
.hot-info {
padding: 16rpx 20rpx 20rpx 20rpx;
}
.hot-tag {
color: #3B7BFF;
font-size: 22rpx;
margin-bottom: 6rpx;
display: block;
}
.hot-desc {
font-size: 28rpx;
color: #222;
margin-bottom: 10rpx;
display: block;
font-weight: 500;
}
.hot-meta {
display: flex;
justify-content: space-between;
align-items: center;
}
.hot-date {
color: #999;
font-size: 22rpx;
}
.hot-status {
color: #fff;
background: #3B7BFF;
font-size: 22rpx;
border-radius: 8rpx;
padding: 4rpx 12rpx;
}
<template>
<view class="home-container">
<!-- 顶部Banner区域包含所有顶部内容 -->
<view class="home-header">
<swiper class="banner-swiper" :current="current" @change="onBannerChange" :autoplay="true" :interval="3000"
:circular="true">
<swiper-item v-for="(item, idx) in banners" :key="idx">
<image :src="item.img" class="banner-bg-img" mode="aspectFill" />
</swiper-item>
</swiper>
<!-- 自定义指示器 -->
<view class="banner-indicator">
<view v-for="(item, idx) in banners" :key="idx"
:class="['banner-dot', current === idx ? 'active' : '']"></view>
</view>
<view class="home-top">
<image class="icon3" src="/static/ic_tq.png" />
<text class="weather">21-36</text>
<view class="search-bar">
<image src="/static/ic_search.png" class="search-icon-img" />
<input class="search-input" placeholder="搜索" />
</view>
<view class="top-icons">
<image class="icon1" src="/static/ic_scan.png" @click="goToScan" />
<image class="icon2" src="/static/ic_msg.png" />
</view>
</view>
</view>
<!-- 白色圆角虚线面板 -->
<view class="main-panel">
<!-- 九宫格功能区 -->
<view class="grid-area">
<view class="grid-item" v-for="(item, idx) in gridList" :key="idx" @click="handleItemClick(item.url)">
<image :src="item.icon" class="grid-icon" />
<text class="grid-text">{{ item.text }}</text>
</view>
</view>
<!-- 滚动资讯条 -->
<view class="news-bar">
<text class="news-label">头条</text>
<scroll-view scroll-x class="news-scroll">
<text v-for="(item, idx) in newsList" :key="idx" class="news-item">{{ item }}</text>
</scroll-view>
<text class="news-arrow"></text>
</view>
<!-- 热门活动区 -->
<view class="hot-section">
<view class="hot-title-row">
<text class="hot-title">热门活动</text>
<text class="hot-more">全部热门活动 ></text>
</view>
<view class="hot-list">
<view class="hot-card" v-for="(item, idx) in hotList" :key="idx">
<image :src="item.img" class="hot-img" mode="aspectFill" />
<view class="hot-info">
<text class="hot-tag">#热门活动</text>
<text class="hot-desc">{{ item.title }}</text>
<view class="hot-meta">
<text class="hot-date">{{ item.date }}</text>
<text class="hot-status">进行中</text>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'Home',
data() {
return {
banners: [{
img: '/static/aaa_banner1.png'
}
// ,
// {
// img: 'https://picsum.photos/750/300?random=2'
// }
],
current: 0,
gridList: [{
icon: '/static/aaa_bsbx.png',
text: '报事报修',
url:'/pages/sys/user/myRepair/myRepair'
},
{
icon: '/static/aaa_tcjf.png',
text: '停车缴费',
url:'/pages/sys/user/myPayment/myPayment'
},
{
icon: '/static/aaa_shfw.png',
text: '生活服务'
},
{
icon: '/static/aaa_fwzx.png',
text: '服务中心',
url:'/pages/sys/user/serviceCenter/serviceCenter'
},
{
icon: '/static/aaa_hyyy.png',
text: '会议预约',
url:'/pages/sys/workbench/meet/meet'
},
{
icon: '/static/aaa_gdgl.png',
text: '工单管理',
url:'/pages/sys/workbench/order/order'
},
{
icon: '/static/aaa_fkgl.png',
text: '访客管理',
url:'/pages/sys/user/myVisitor/myVisitor'
},
{
icon: '/static/aaa_jqqd.png',
text: '敬请期待'
}
],
newsList: [
'数智南川|最新资讯1',
'数智南川|最新资讯2',
'数智南川|最新资讯3'
],
hotList: [{
img: '/static/aaa_hd1.png',
title: '世界骑行日 低碳出行 让城市更美好',
date: '2025-07-03'
},
{
img: '/static/aaa_hd2.png',
title: '仲夏之夜低碳出行·绿色生活让城市更美好',
date: '2025-07-03'
}
]
}
},
methods: {
onBannerChange(e) {
this.current = e.detail.current;
},
// 扫码功能
goToScan() {
uni.scanCode({
success: (res) => {
console.log('扫码成功', res);
uni.showModal({
title: '扫码结果',
content: res.result,
showCancel: true,
confirmText: '确定',
cancelText: '取消',
success: (modalRes) => {
if (modalRes.confirm) {
console.log('用户点击确定');
// 可以在这里处理扫码结果
}
}
});
},
fail: (err) => {
}
});
},
handleItemClick(url) {
uni.navigateTo({
url: url
});
}
}
}
</script>
<style scoped>
.home-container {
display: flex;
flex-direction: column;
height: 100vh;
background: #f8f8f8;
padding-bottom: 40rpx;
}
.home-header {
position: relative;
height: 446rpx;
width: 100vw;
margin-bottom: -40rpx;
flex-shrink: 0;
}
.banner-swiper {
width: 100vw;
height: 446rpx;
position: absolute;
left: 0;
top: 0;
z-index: 0;
}
.banner-bg-img {
width: 100vw;
height: 446rpx;
object-fit: cover;
}
.banner-indicator {
position: absolute;
left: 0;
bottom: 64rpx;
width: 100vw;
display: flex;
justify-content: center;
z-index: 2;
}
.banner-dot {
width: 14rpx;
height: 14rpx;
border-radius: 50%;
background: rgba(255, 255, 255, 0.6);
margin: 0 8rpx;
transition: background 0.2s;
}
.banner-dot.active {
background: #3B7BFF;
}
.home-top {
position: relative;
z-index: 3;
display: flex;
align-items: center;
color: #fff;
padding: 80rpx 20rpx 0 20rpx;
}
.weather {
font-size: 24rpx;
margin-left: 10rpx;
margin-right: 16rpx;
}
.search-bar {
flex: 1;
display: flex;
align-items: center;
background: rgba(255, 255, 255, 0.3);
border-radius: 30rpx;
padding: 0 20rpx;
height: 56rpx;
margin-right: 16rpx;
}
.search-input::placeholder {
color: #FFFFFF;
opacity: 1;
}
.search-icon-img {
width: 28rpx;
height: 28rpx;
margin-right: 8rpx;
}
.search-input {
border: none;
background: transparent;
font-size: 26rpx;
flex: 1;
color: #fff;
}
.top-icons {
display: flex;
align-items: center;
}
.icon1 {
width: 33rpx;
height: 33rpx;
margin-left: 19rpx;
}
.icon2 {
width: 38rpx;
height: 38rpx;
margin-left: 23rpx;
}
.icon3 {
width: 40rpx;
height: 40rpx;
}
.main-panel {
flex: 1;
overflow-y: auto;
background: #fff;
border-radius: 20rpx;
position: relative;
z-index: 10;
padding: 20rpx;
}
.grid-area {
display: flex;
flex-wrap: wrap;
padding: 20rpx 0 10rpx 0;
margin-top: 10rpx;
}
.grid-item {
width: 20%;
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 30rpx;
}
.grid-icon {
width: 50rpx;
height: 50rpx;
margin-bottom: 8rpx;
}
.grid-text {
font-size: 24rpx;
color: #1D1D1D;
}
.news-bar {
display: flex;
align-items: center;
padding: 10rpx 0;
border-top: 1rpx solid #f5f5f5;
margin-top: 10rpx;
}
.news-label {
color: #FF6A00;
font-size: 28rpx;
font-weight: bold;
margin-right: 16rpx;
border: 1rpx solid #FF6A00;
border-radius: 4rpx;
padding: 2rpx 6rpx;
}
.news-scroll {
flex: 1;
white-space: nowrap;
}
.news-item {
display: inline-block;
margin-right: 30rpx;
color: #666;
font-size: 24rpx;
}
.news-arrow {
color: #999;
font-size: 32rpx;
}
.hot-section {
margin-top: 20rpx;
}
.hot-title-row {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20rpx;
}
.hot-title {
font-size: 32rpx;
font-weight: bold;
color: #222;
position: relative;
padding-left: 16rpx;
}
.hot-title::before {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
width: 6rpx;
height: 30rpx;
background: #3B7BFF;
border-radius: 3rpx;
}
.hot-more {
font-size: 24rpx;
color: #999;
}
.hot-list {
display: flex;
flex-direction: column;
gap: 20rpx;
}
.hot-card {
background: #fff;
border-radius: 20rpx;
overflow: hidden;
display: flex;
flex-direction: column;
border: 1rpx solid #f0f0f0;
}
.hot-img {
width: 100%;
height: 280rpx;
object-fit: cover;
}
.hot-info {
padding: 16rpx 20rpx 20rpx 20rpx;
}
.hot-tag {
color: #3B7BFF;
font-size: 22rpx;
margin-bottom: 6rpx;
display: block;
}
.hot-desc {
font-size: 28rpx;
color: #222;
margin-bottom: 10rpx;
display: block;
font-weight: 500;
}
.hot-meta {
display: flex;
justify-content: space-between;
align-items: center;
}
.hot-date {
color: #999;
font-size: 22rpx;
}
.hot-status {
color: #fff;
background: #3B7BFF;
font-size: 22rpx;
border-radius: 8rpx;
padding: 4rpx 12rpx;
}
</style>

504
pages/sys/home/scan.vue Normal file
View File

@@ -0,0 +1,504 @@
<template>
<view class="scan-container">
<view class="scan-header">
<view class="back-btn" @click="goBack">
<u-icon name="arrow-left" color="#fff" size="20"></u-icon>
</view>
<text class="scan-title">扫码</text>
</view>
<!-- 扫码区域 -->
<view class="scan-content">
<view class="scan-area">
<!-- #ifdef APP-PLUS -->
<view class="scanner" id="scannerId"></view>
<!-- #endif -->
<!-- H5和小程序平台使用通用提示 -->
<!-- #ifndef APP-PLUS -->
<view class="scan-placeholder">
<text class="placeholder-text">点击下方按钮开始扫码</text>
</view>
<!-- #endif -->
<view class="scan-frame">
<view class="corner top-left"></view>
<view class="corner top-right"></view>
<view class="corner bottom-left"></view>
<view class="corner bottom-right"></view>
</view>
</view>
<text class="scan-tip">将二维码/条码放入框内即可自动扫描</text>
</view>
<view class="scan-footer">
<view class="album-btn" @click="selectFromAlbum">
<u-icon name="photo" color="#fff" size="24"></u-icon>
<text class="btn-text">相册</text>
</view>
<view class="scan-btn" @click="startScanCode">
<u-icon name="scan" color="#fff" size="24"></u-icon>
<text class="btn-text">扫码</text>
</view>
<view class="flashlight-btn" @click="toggleFlashlight">
<u-icon :name="flashlightOn ? 'light-fill' : 'light'" color="#fff" size="24"></u-icon>
<text class="btn-text">{{ flashlightOn ? '关闭' : '开启' }}手电筒</text>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'Scan',
data() {
return {
flashlightOn: false,
barcodeObj: null
}
},
methods: {
goBack() {
// 关闭手电筒
if (this.flashlightOn) {
// #ifdef APP-PLUS
plus.device.flashlight(false)
// #endif
}
uni.navigateBack()
},
// 从相册选择二维码
selectFromAlbum() {
// #ifdef APP-PLUS
plus.gallery.pick((e) => {
this.scanImage(e.files[0])
}, (e) => {
console.log('取消选择图片')
}, {
filter: 'none',
multiple: false,
maximum: 1,
system: false
})
// #endif
// H5和小程序平台使用uni.chooseImage
// #ifndef APP-PLUS
uni.chooseImage({
count: 1,
success: (res) => {
// 在H5和小程序平台相册选择后无法直接识别二维码
uni.showToast({
title: '请选择扫码功能直接扫描二维码',
icon: 'none'
})
}
})
// #endif
},
// 扫描图片中的二维码 (仅App)
scanImage(path) {
// #ifdef APP-PLUS
plus.barcode.scan(path, (type, code) => {
this.handleScanResult(type, code)
}, (error) => {
uni.showToast({
title: '未识别到二维码',
icon: 'none'
})
})
// #endif
},
// 打开/关闭手电筒 (仅App)
toggleFlashlight() {
// #ifdef APP-PLUS
this.flashlightOn = !this.flashlightOn
plus.device.flashlight(this.flashlightOn)
// #endif
// #ifndef APP-PLUS
uni.showToast({
title: '该功能仅在App中可用',
icon: 'none'
})
// #endif
},
// 处理扫码结果
handleScanResult(type, code) {
uni.showModal({
title: '扫码结果',
content: code,
showCancel: true,
confirmText: '确定',
cancelText: '取消',
success: (res) => {
if (res.confirm) {
console.log('用户点击确定')
// 可以在这里处理扫码结果,比如跳转页面
// uni.redirectTo({
// url: '/pages/somepage?code=' + code
// })
} else if (res.cancel) {
// 用户取消,继续扫码
// #ifdef APP-PLUS
this.startScan()
// #endif
}
}
})
},
// 开始扫码 (仅App)
startScan() {
// #ifdef APP-PLUS
if (this.barcodeObj) {
this.barcodeObj.start()
}
// #endif
},
// 停止扫码 (仅App)
stopScan() {
// #ifdef APP-PLUS
if (this.barcodeObj) {
this.barcodeObj.cancel()
}
// #endif
},
// 使用uni.scanCode进行扫码 (H5和小程序平台)
startScanCode() {
// #ifndef APP-PLUS
uni.scanCode({
success: (res) => {
this.handleScanResult(res.scanType, res.result)
},
fail: (err) => {
console.log('扫码失败', err)
uni.showToast({
title: '扫码失败,请重试',
icon: 'none'
})
}
})
// #endif
// #ifdef APP-PLUS
// App平台仍然使用原生扫码
this.startScan()
// #endif
},
// 初始化扫码功能 (仅App)
initScanner() {
// #ifdef APP-PLUS
const scanner = plus.barcode.Barcode
this.barcodeObj = new scanner('scannerId',
[scanner.QR, scanner.EAN13, scanner.EAN8, scanner.CODE128],
{
top: '0px',
left: '0px',
width: '100%',
height: '100%',
position: 'static'
}
)
// 设置扫码成功回调
this.barcodeObj.onmarked = (type, result) => {
let code = result
switch(type) {
case scanner.QR:
type = 'QR'
break
case scanner.EAN13:
type = 'EAN13'
break
case scanner.EAN8:
type = 'EAN8'
break
case scanner.CODE128:
type = 'CODE128'
break
default:
type = '其他'
break
}
this.handleScanResult(type, code)
}
// 开始扫码
this.barcodeObj.start()
// #endif
},
// 检查并请求摄像头权限 (仅App)
checkPermission() {
// #ifdef APP-PLUS
return new Promise((resolve, reject) => {
// 判断是否已经授权
plus.android.requestPermissions(['android.permission.CAMERA'],
(resultObj) => {
let result = 0;
for (var i = 0; i < resultObj.granted.length; i++) {
if (resultObj.granted[i] === 'android.permission.CAMERA') {
result = 1
}
}
for (var i = 0; i < resultObj.denied.length; i++) {
if (resultObj.denied[i] === 'android.permission.CAMERA') {
result = 0
}
}
for (var i = 0; i < resultObj.alwaysDenied.length; i++) {
if (resultObj.alwaysDenied[i] === 'android.permission.CAMERA') {
result = -1
}
}
if (result == 1) {
resolve(true)
} else {
resolve(false)
}
},
(error) => {
resolve(false)
}
);
})
// #endif
// #ifndef APP-PLUS
return Promise.resolve(true)
// #endif
}
},
onLoad() {
// #ifdef APP-PLUS
// 页面加载时检查权限并初始化扫码功能
this.checkPermission().then((authorized) => {
if (authorized) {
this.$nextTick(() => {
// 使用定时器确保DOM渲染完成后再初始化扫码组件
setTimeout(() => {
this.initScanner()
}, 100)
})
} else {
uni.showModal({
title: '权限申请',
content: '需要摄像头权限才能使用扫码功能,是否前往设置开启权限?',
success: (res) => {
if (res.confirm) {
// 跳转到系统设置页面
if (plus.os.name === 'Android') {
var Intent = plus.android.importClass("android.content.Intent");
var Settings = plus.android.importClass("android.provider.Settings");
var main = plus.android.runtimeMainActivity();
var intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
var uri = plus.android.invoke("android.net.Uri", "fromParts", "package", main.getPackageName(), null);
intent.setData(uri);
main.startActivity(intent);
} else {
plus.runtime.openURL("app-settings://");
}
} else {
uni.navigateBack()
}
}
})
}
})
// #endif
},
onUnload() {
// 页面卸载时关闭扫码和手电筒
this.stopScan()
if (this.flashlightOn) {
// #ifdef APP-PLUS
plus.device.flashlight(false)
// #endif
}
},
onHide() {
// 页面隐藏时停止扫码
this.stopScan()
},
onShow() {
// 页面显示时重新开始扫码
// #ifdef APP-PLUS
this.$nextTick(() => {
setTimeout(() => {
this.startScan()
}, 100)
})
// #endif
}
}
</script>
<style scoped>
.scan-container {
width: 100%;
height: 100vh;
background: #000;
position: relative;
}
.scan-header {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 80rpx;
padding: 60rpx 30rpx 30rpx;
display: flex;
align-items: center;
z-index: 100;
}
.back-btn {
width: 60rpx;
height: 60rpx;
border-radius: 50%;
background: rgba(0, 0, 0, 0.5);
display: flex;
align-items: center;
justify-content: center;
}
.scan-title {
flex: 1;
text-align: center;
color: #fff;
font-size: 36rpx;
margin-right: 60rpx;
}
.scan-content {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding-top: 120rpx;
box-sizing: border-box;
}
.scan-area {
width: 480rpx;
height: 480rpx;
position: relative;
overflow: hidden;
}
/* #ifdef APP-PLUS */
.scanner {
width: 480rpx;
height: 480rpx;
position: absolute;
top: 0;
left: 0;
z-index: 10;
background: transparent;
}
/* #endif */
.scan-placeholder {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
background: #333;
}
.placeholder-text {
color: #fff;
font-size: 28rpx;
text-align: center;
}
.scan-frame {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 20;
}
.corner {
position: absolute;
width: 40rpx;
height: 40rpx;
border: 4rpx solid #00ff00;
}
.top-left {
top: 0;
left: 0;
border-right: none;
border-bottom: none;
}
.top-right {
top: 0;
right: 0;
border-left: none;
border-bottom: none;
}
.bottom-left {
bottom: 0;
left: 0;
border-right: none;
border-top: none;
}
.bottom-right {
bottom: 0;
right: 0;
border-left: none;
border-top: none;
}
.scan-tip {
color: #fff;
font-size: 28rpx;
margin-top: 60rpx;
}
.scan-footer {
position: absolute;
bottom: 100rpx;
left: 0;
width: 100%;
display: flex;
justify-content: space-around;
z-index: 100;
}
.album-btn, .flashlight-btn, .scan-btn {
display: flex;
flex-direction: column;
align-items: center;
color: #fff;
}
.btn-text {
margin-top: 10rpx;
font-size: 24rpx;
color: #fff;
}
</style>

View File

@@ -26,7 +26,7 @@
<image v-if="!item.extra" class="mine-list-arrow" src="/static/ic_arrow_gray.webp" />
</view>
</view>
<button class="logout-btn">退出登录</button>
<button class="logout-btn" @click="logout">退出登录</button>
</view>
</view>
</template>
@@ -35,10 +35,10 @@
export default {
name: 'Mine',
data() {
return {
userInfo:{
nickname: '',
phone:''
return {
userInfo:{
nickname: '',
phone:''
},
list: [{
icon: '/static/ic_mine_info.png',
@@ -76,8 +76,8 @@
]
}
},
onLoad() {
this.userInfo.nickname =this.vuex_user.nickName
onLoad() {
this.userInfo.nickname =this.vuex_user.nickName
this.userInfo.phone = this.vuex_user.phonenumber
},
methods: {
@@ -111,6 +111,14 @@
url: '/pages/sys/user/myRecord/myRecord'
});
}
},
logout() {
// 清除用户信息并返回登录页
this.$u.vuex('vuex_user', {});
this.$u.vuex('vuex_token', '');
uni.redirectTo({
url: '/pages/sys/login/login'
});
}
}
}

View File

@@ -115,7 +115,6 @@
let images = [''];
let filePath = this.header.replace('file://', '');
images[0] = filePath;
console.log("t1", images)
const result = await uploadFiles({
files: images,
url: this.vuex_config.baseUrl + '/resource/oss/upload',
@@ -125,7 +124,6 @@
if (result.code == '200') {
data = result.data.url
console.log("t1", result.data.url)
}
this.form.facePictures = result.url

View File

@@ -16,19 +16,19 @@
<!-- 列表区 -->
<scroll-view scroll-y class="warn-list">
<view v-for="(item, idx) in list" :key="idx" class="warn-card" @click="goDetail(item)">
<view v-for="(item, idx) in list" :key="idx" class="warn-card" @click="goDetail2(item)">
<view class="warn-row">
<view class="warn-no">事件预警类型</view>
<view class="warn-no">{{item.smallTypeName}}</view>
<view class="warn-status">
紧急
{{item.levelName}}
</view>
</view>
<image class="warn-line-image" src="/static/ic_my_repair_03.png" />
<view class="warn-info">预警内容</view>
<view class="warn-info">预警位置</view>
<view class="warn-info">预警时间</view>
<view class="warn-info">预警设备</view>
<view class="warn-eval-wrap">
<view class="warn-info">预警内容{{ item.description }}</view>
<view class="warn-info">预警位置{{ item.deviceGroupName }}</view>
<view class="warn-info">预警时间{{ item.reportTime }}</view>
<view class="warn-info">预警设备{{ item.deviceName }}</view>
<view v-if="[20, 30, 31, 32].includes(item.state)" class="warn-eval-wrap" @click.stop="goDetail(item)">
<view class="warn-eval-btn">去处理</view>
</view>
</view>
@@ -57,6 +57,11 @@
return this.tabData[this.activeTab];
},
},
onShow() {
uni.$once('refreshData',s=> {
this.loadTabData(this.activeTab);
});
},
created() {
this.loadTabData(this.activeTab);
},
@@ -74,8 +79,10 @@
async loadTabData(idx) {
this.loading = true;
let params = {};
if(idx == 0){
params = {'status':0}
if (idx == 0) {
params = {
'states': [20, 30, 31, 32]
}
}
let res = await this.$u.api.getWarns(params);
if (res.code == "200") {
@@ -91,10 +98,16 @@
url: "/pages/sys/workbench/earlyWarning/warnDetail?item=" + itemStr,
});
},
goStatistics(){
goDetail2(item) {
const itemStr = encodeURIComponent(JSON.stringify(item));
uni.navigateTo({
url: "/pages/sys/workbench/earlyWarning/warnDetail?item=" + itemStr+"&pageType=detail",
});
},
goStatistics() {
uni.navigateTo({
url: "/pages/sys/workbench/earlyWarning/warnStatistics"
});
});
}
},
};
@@ -124,12 +137,14 @@
margin-left: 24rpx;
margin-right: 78rpx;
}
.warn-right-txt{
.warn-right-txt {
font-size: 24rpx;
color: #0090FF;
margin-right: 24rpx;
}
.warn-title{
.warn-title {
font-size: 36rpx;
color: #000;
margin-left: auto;
@@ -188,15 +203,15 @@
padding-top: 25rpx;
padding-bottom: 32rpx;
}
.warn-eval-wrap {
display: flex;
justify-content: center;
width: 100%;
margin-top: 20rpx;
}
.warn-eval-btn{
.warn-eval-btn {
width: 240rpx;
height: 60rpx;
text-align: center;

View File

@@ -1,338 +1,360 @@
<template>
<view class="page">
<!-- 预警信息卡片 -->
<view class="card">
<view class="card-header">预警信息</view>
<view class="card-content">
<view class="info-item" v-for="(item, index) in warnInfoList" :key="index">
<text class="label">{{ item.label }}</text>
<text class="value">{{ item.value || '-' }}</text>
</view>
</view>
</view>
<!-- 处理情况卡片 -->
<view class="card" style="margin-top: 30rpx;">
<view class="card-header">处理情况</view>
<view class="card-content">
<!-- 处理状态输入框 -->
<view class="form-item" @click="showStatusPopup = true">
<text class="form-label">处理状态</text>
<view class="select-input">{{ handleStatus || '请选择状态' }}</view>
</view>
<!-- 处理情况描述 -->
<view class="form-item">
<text class="form-label">处理情况描述</text>
<textarea class="textarea" placeholder="请输入描述" v-model="handleDesc" auto-height></textarea>
</view>
<!-- 上传照片 -->
<view >
<view class="add-warn-label">上传照片 <text class="add-warn-optional">(非必填最多三张)</text></view>
<u-upload :fileList="selectedImages" @delete="deletePic" name="upload" multiple maxCount="3"
width="180" height="180" :autoUpload="false"></u-upload>
</view>
</view>
</view>
<!-- 底部提交按钮 -->
<view class="btn-box">
<button class="submit-btn" @click="submit">去上报</button>
</view>
<!-- 底部状态选择弹窗 -->
<view v-if="showStatusPopup" class="popup-mask" @click.self="showStatusPopup = false">
<view class="popup">
<view class="popup-item" v-for="(status, i) in statusList" :key="i" @click="selectStatus(status)">
{{ status }}</view>
<view class="popup-cancel" @click="showStatusPopup = false">取消</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
warnInfo: {
code: "KJG-24124",
type: "越界侦测",
deviceName: "设备1111",
deviceLocation: "角落里",
level: "紧急",
warnTime: "2025-06-12 15:04:28",
sendTime: "2025-06-12 15:04:28",
desc: "这里是预警的描述内容,确保内容正常显示。"
},
handleStatus: '',
handleDesc: '',
fileList: [],
showStatusPopup: false,
statusList: ['未处理', '处理中', '已处理'],
selectedImages: [] // 存储已选图片
};
},
computed: {
warnInfoList() {
return [{
label: "预警编码",
value: this.warnInfo.code
},
{
label: "预警类型",
value: this.warnInfo.type
},
{
label: "设备名称",
value: this.warnInfo.deviceName
},
{
label: "设备位置",
value: this.warnInfo.deviceLocation
},
{
label: "预警级别",
value: this.warnInfo.level
},
{
label: "预警时间",
value: this.warnInfo.warnTime
},
{
label: "下发时间",
value: this.warnInfo.sendTime
},
{
label: "预警描述",
value: this.warnInfo.desc
}
];
}
},
methods: {
// 删除图片
deletePic(event) {
<template>
<view class="page">
<!-- 预警信息卡片 -->
<view class="card">
<view class="card-header">预警信息</view>
<view class="card-content">
<view class="info-item" v-for="(item, index) in warnInfoList" :key="index">
<text class="label">{{ item.label }}</text>
<text class="value">{{ item.value || '-' }}</text>
</view>
</view>
</view>
<!-- 处理情况卡片 详情情况卡片 -->
<view class="card" style="margin-top: 30rpx;">
<view class="card-header">
{{ pageType === 'handle' ? '处理情况' : '处理记录' }}
</view>
<view class="card-content">
<!-- =============== 处理情况模式 =============== -->
<view v-if="pageType === 'handle'">
<!-- 处理状态选择 (目前隐藏) -->
<view v-if="false" class="form-item" @click="showStatusPopup = true">
<text class="form-label">处理状态</text>
<view class="select-input">{{ handleStatus || '请选择状态' }}</view>
</view>
<!-- 处理情况描述 -->
<view class="form-item">
<text class="form-label">处理情况描述</text>
<textarea class="textarea" placeholder="请输入描述" v-model="handleDesc" auto-height></textarea>
</view>
<!-- 上传照片 -->
<view>
<view class="add-warn-label">上传照片 <text class="add-warn-optional">(非必填最多三张)</text></view>
<u-upload
:fileList="selectedImages"
@delete="deletePic"
@on-list-change="onListChange"
name="upload"
multiple
maxCount="3"
width="180"
height="180"
:autoUpload="false">
</u-upload>
</view>
</view>
<!-- =============== 详情情况模式 =============== -->
<view v-else>
<!-- 显示处理情况描述 -->
<view class="form-item">
<text class="form-label">处理情况描述</text>
<view class="value">{{ handleDesc || '-' }}</view>
</view>
<!-- 显示上传的图片 -->
<view v-if="realImages.length > 0">
<view class="add-warn-label">相关图片</view>
<view class="image-list">
<image
v-for="(img, idx) in realImages"
:key="idx"
:src="img"
mode="aspectFill"
class="preview-image"
@click="previewImage(idx)"
/>
</view>
</view>
</view>
</view>
</view>
<!-- 底部提交按钮 (仅处理情况模式显示) -->
<view class="btn-box" v-if="pageType === 'handle'">
<button class="submit-btn" @click="submit">去上报</button>
</view>
<!-- 底部状态选择弹窗 -->
<view v-if="showStatusPopup" class="popup-mask" @click.self="showStatusPopup = false">
<view class="popup">
<view class="popup-item" v-for="(status, i) in statusList" :key="i" @click="selectStatus(status)">
{{ status }}
</view>
<view class="popup-cancel" @click="showStatusPopup = false">取消</view>
</view>
</view>
</view>
</template>
<script>
import { uploadFiles } from '@/common/upload.js';
export default {
data() {
return {
pageType: 'handle', // handle = 处理情况, detail = 详情情况
warnInfo: {},
handleStatus: '',
handleDesc: '',
showStatusPopup: false,
statusList: ['未处理', '处理中', '已处理'],
selectedImages: [], // 存储已选图片
realImages: [], // 上传后的真实图片url
loading: false
};
},
onLoad(options) {
if (options.item) {
const item = JSON.parse(decodeURIComponent(options.item));
this.warnInfo = item;
}
if (options.pageType) {
this.pageType = options.pageType;
}
},
computed: {
warnInfoList() {
return [
{ label: "预警编码", value: this.warnInfo.id },
{ label: "预警类型", value: this.warnInfo.smallTypeName },
{ label: "设备名称", value: this.warnInfo.deviceName },
{ label: "设备位置", value: this.warnInfo.deviceGroupName },
{ label: "预警级别", value: this.warnInfo.levelName },
{ label: "预警时间", value: this.warnInfo.reportTime },
{ label: "下发时间", value: this.warnInfo.servBeginTime },
{ label: "预警描述", value: this.warnInfo.description }
];
}
},
methods: {
// 处理文件列表变化
onListChange(list) {
this.selectedImages = list;
},
// 删除图片
deletePic(event) {
if (event && typeof event.index === 'number') {
this.selectedImages.splice(event.index, 1);
},
selectStatus(status) {
this.handleStatus = status;
this.showStatusPopup = false;
},
async submit() {
if(this.selectedImages.length<=0){
this.realSubmit()
return
}
// 遍历selectedImages数组并处理图片路径
const images = this.selectedImages.map(item => item.path.replace('file://', ''));
const result = await uploadFiles({
files: images,
url: this.vuex_config.baseUrl + '/resource/oss/upload',
name: 'file',
vm: this // 关键:用于注入 token 等
});
if (result.code == '200') {
// 遍历result获取data.url加上,分割
const urls = result.map(item => item.data?.url || '').filter(url => url !== '');
this.repairInfo.orderImgUrl = urls.join(',');
this.realSubmit()
}
},
async realSubmit(){
let res = await this.$u.api.addOrder2(this.repairInfo);
if (res.code == '200') {
// 关闭页面前发送事件通知前页面刷新
uni.$emit('refreshData', '');
// 返回上一页
uni.navigateBack();
}
}
}
};
</script>
<style scoped>
.page {
padding: 30rpx;
background-color: #f5f5f5;
min-height: 100vh;
box-sizing: border-box;
}
.card {
background-color: #fff;
border-radius: 16rpx;
padding: 30rpx 30rpx 20rpx 30rpx;
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.06);
}
.card-header {
font-size: 32rpx;
font-weight: 700;
color: #333;
margin-bottom: 20rpx;
}
.card-content {
border-top: 1rpx solid #eee;
padding-top: 20rpx;
}
.info-item {
display: flex;
justify-content: space-between;
padding: 18rpx 0;
border-bottom: 1rpx solid #f0f0f0;
}
.label {
font-weight: 600;
color: #666;
font-size: 28rpx;
}
.value {
color: #333;
max-width: 70%;
font-size: 28rpx;
text-align: right;
word-break: break-word;
}
.form-item {
margin-bottom: 30rpx;
}
.form-label {
font-weight: 700;
font-size: 28rpx;
color: #333;
margin-bottom: 12rpx;
}
.select-input {
border: 1rpx solid #ccc;
border-radius: 12rpx;
height: 64rpx;
line-height: 64rpx;
padding: 0 20rpx;
font-size: 28rpx;
color: #999;
}
.textarea {
width: 100%;
min-height: 160rpx;
border: 1rpx solid #ccc;
border-radius: 12rpx;
padding: 10rpx 20rpx;
font-size: 28rpx;
resize: none;
box-sizing: border-box;
}
.image-list {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 20rpx;
}
.preview-image {
width: 140rpx;
height: 140rpx;
border-radius: 12rpx;
}
.upload-btn {
width: 140rpx;
height: 140rpx;
border-radius: 12rpx;
background: #eee;
font-size: 60rpx;
color: #999;
line-height: 140rpx;
text-align: center;
user-select: none;
border: none;
}
.btn-box {
margin-top: 40rpx;
text-align: center;
}
.submit-btn {
width: 100%;
background-color: #007aff;
color: white;
font-size: 32rpx;
height: 72rpx;
line-height: 72rpx;
border-radius: 36rpx;
border: none;
cursor: pointer;
}
.popup-mask {
position: fixed;
left: 0;
top: 0;
width: 100vw;
height: 100vh;
background: rgba(0, 0, 0, 0.4);
display: flex;
justify-content: center;
align-items: flex-end;
z-index: 9999;
}
.popup {
width: 100%;
background: #fff;
border-top-left-radius: 24rpx;
border-top-right-radius: 24rpx;
padding-bottom: 40rpx;
}
.popup-item {
font-size: 32rpx;
padding: 30rpx 0;
text-align: center;
border-bottom: 1rpx solid #eee;
color: #007aff;
}
.popup-item:last-child {
border-bottom: none;
}
.popup-cancel {
font-size: 32rpx;
color: #999;
text-align: center;
padding: 30rpx 0;
margin-top: 20rpx;
border-top: 1rpx solid #eee;
}
.add-warn-optional {
color: #888;
font-size: 24rpx;
font-weight: 400;
}
},
selectStatus(status) {
this.handleStatus = status;
this.showStatusPopup = false;
},
async submit() {
this.loading = true;
if (this.selectedImages.length <= 0) {
this.realSubmit()
return
}
const images = this.selectedImages
.map(item => item?.path?.replace('file://', '') || item?.url || null)
.filter(path => path !== null);
if (images.length === 0) {
this.realSubmit();
return;
}
const result = await uploadFiles({
files: images,
url: this.vuex_config.baseUrl + '/resource/oss/upload',
name: 'file',
vm: this
});
this.realImages = result.map(item => item.data?.url || '').filter(url => url !== '');
this.realSubmit();
},
async realSubmit() {
let params = {
alarmId: this.warnInfo.id,
remark: this.handleDesc,
attachments: this.realImages
}
let res = await this.$u.api.warnsProcess(params);
if (res.code == '200') {
uni.$emit('refreshData', '');
uni.navigateBack();
}
this.loading = false
},
// 查看大图
previewImage(index) {
uni.previewImage({
current: this.realImages[index],
urls: this.realImages
})
}
}
.add-warn-label {
font-size: 32rpx;
color: #000000;
font-weight: 500;
margin-bottom: 41rpx;
}
</style>
};
</script>
<style scoped>
/* 你的原有样式保持不变 */
.page {
padding: 30rpx;
background-color: #f5f5f5;
min-height: 100vh;
box-sizing: border-box;
}
.card {
background-color: #fff;
border-radius: 16rpx;
padding: 30rpx 30rpx 20rpx 30rpx;
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.06);
}
.card-header {
font-size: 32rpx;
font-weight: 700;
color: #333;
margin-bottom: 20rpx;
}
.card-content {
border-top: 1rpx solid #eee;
padding-top: 20rpx;
}
.info-item {
display: flex;
justify-content: space-between;
padding: 18rpx 0;
border-bottom: 1rpx solid #f0f0f0;
}
.label {
font-weight: 600;
color: #666;
font-size: 28rpx;
}
.value {
color: #333;
max-width: 70%;
font-size: 28rpx;
text-align: right;
word-break: break-word;
}
.form-item {
margin-bottom: 30rpx;
}
.form-label {
font-weight: 700;
font-size: 28rpx;
color: #333;
margin-bottom: 12rpx;
}
.select-input {
border: 1rpx solid #ccc;
border-radius: 12rpx;
height: 64rpx;
line-height: 64rpx;
padding: 0 20rpx;
font-size: 28rpx;
color: #999;
}
.textarea {
width: 100%;
min-height: 160rpx;
border: 1rpx solid #ccc;
border-radius: 12rpx;
padding: 10rpx 20rpx;
font-size: 28rpx;
resize: none;
box-sizing: border-box;
margin-top: 20rpx;
}
.image-list {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 20rpx;
}
.preview-image {
width: 140rpx;
height: 140rpx;
border-radius: 12rpx;
}
.upload-btn {
width: 140rpx;
height: 140rpx;
border-radius: 12rpx;
background: #eee;
font-size: 60rpx;
color: #999;
line-height: 140rpx;
text-align: center;
user-select: none;
border: none;
}
.btn-box {
margin-top: 40rpx;
text-align: center;
}
.submit-btn {
width: 100%;
background-color: #007aff;
color: white;
font-size: 32rpx;
height: 72rpx;
line-height: 72rpx;
border-radius: 36rpx;
border: none;
cursor: pointer;
}
.popup-mask {
position: fixed;
left: 0;
top: 0;
width: 100vw;
height: 100vh;
background: rgba(0, 0, 0, 0.4);
display: flex;
justify-content: center;
align-items: flex-end;
z-index: 9999;
}
.popup {
width: 100%;
background: #fff;
border-top-left-radius: 24rpx;
border-top-right-radius: 24rpx;
padding-bottom: 40rpx;
}
.popup-item {
font-size: 32rpx;
padding: 30rpx 0;
text-align: center;
border-bottom: 1rpx solid #eee;
color: #007aff;
}
.popup-item:last-child {
border-bottom: none;
}
.popup-cancel {
font-size: 32rpx;
color: #999;
text-align: center;
padding: 30rpx 0;
margin-top: 20rpx;
border-top: 1rpx solid #eee;
}
.add-warn-optional {
color: #888;
font-size: 24rpx;
font-weight: 400;
}
.add-warn-label {
font-size: 32rpx;
color: #000000;
font-weight: 500;
margin-bottom: 41rpx;
}
</style>

View File

@@ -0,0 +1,222 @@
<template>
<view class="ins-container">
<!-- tab栏 -->
<view class="ins-tabs">
<view v-for="(tab, idx) in tabs" :key="idx" :class="['ins-tab', {active: idx === activeTab}]"
@click="changeTab(idx)">
{{ tab }}
<view v-if="idx === activeTab" class="tab-underline"></view>
</view>
</view>
<!-- 列表区 -->
<view class="ins-list">
<view v-for="(item, idx) in list" :key="idx" class="ins-card" @click="goProcess(item)">
<view class="ins-row">
<view class="ins-no">保洁部日常巡检 {{ item.createTime.substring(0,11) }}</view>
<view class="ins-status" :class="getStatusColor(item.status)">
{{ getStatusLabel(item.status) }}
</view>
</view>
<image class="ins-line-image" src="/static/ic_my_repair_03.png" />
<view class="ins-info">巡检人{{ item.createTime }}</view>
<view class="ins-info">计划完成时间{{ item.typeName }}</view>
<view class="ins-info">实际完成时间{{ item.location }}</view>
<view class="ins-info">巡检进度{{ item.location }}</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
tabs: ['待进行', '处理中', '已完成'],
activeTab: 0,
tabData: [
[],
[],
[]
], // 每个tab的数据
tabLoaded: [false, false, false], // 每个tab是否已加载
loading: false
}
},
computed: {
list() {
return this.tabData[this.activeTab];
}
},
created() {
this.loadTabData(this.activeTab); // 初始化加载当前tab数据
},
methods: {
goBack() {
uni.navigateBack();
},
async changeTab(idx) {
this.activeTab = idx;
if (!this.tabLoaded[idx]) {
await this.loadTabData(idx);
}
},
async loadTabData(idx) {
this.loading = true;
// 模拟接口请求不同tab返回不同mock数据
let params = {}
let data = [];
let res = await this.$u.api.getInspection(params);
if (res.code == '200') {
data = res.rows
}
this.$set(this.tabData, idx, data);
this.$set(this.tabLoaded, idx, true);
this.loading = false;
},
goProcess(item) {
const detailItemStr = encodeURIComponent(JSON.stringify(item));
uni.navigateTo({
url: `/pages/sys/workbench/inspection/inspectionProcess?detailItem=${item}`
});
},
getStatusLabel(status) {
const statusMap = {
0: '待确认',
1: '已确认',
2: '已取消',
3: '已完成'
};
return statusMap[status] || '';
},
getStatusColor(status){
const statusMap = {
0: '待确认',
1: 'orange',
2: '已取消',
3: '已完成'
};
return statusMap[status] || '';
}
}
}
</script>
<style scoped>
.ins-container {
height: 100vh;
background: #f7f7f7;
display: flex;
flex-direction: column;
}
.ins-tabs {
display: flex;
align-items: center;
justify-content: space-around;
background: #fff;
height: 80rpx;
border-bottom: 1px solid #f0f0f0;
flex-shrink: 0;
/* 防止被压缩 */
}
.ins-tab {
flex: 1;
text-align: center;
font-size: 30rpx;
color: #888;
position: relative;
font-weight: 500;
padding: 0 0 10rpx 0;
/* tab点击事件 */
cursor: pointer;
}
.ins-tab.active {
color: #2186FF;
font-weight: bold;
}
.tab-underline {
width: 60rpx;
height: 6rpx;
background: #2186FF;
border-radius: 3rpx;
margin: 0 auto;
margin-top: 8rpx;
}
.ins-list {
margin: 25rpx 0 0 0;
padding: 0 35rpx;
flex: 1;
/* 占据所有剩余空间 */
overflow-y: auto;
/* 内容超出时,开启垂直滚动 */
padding-bottom: 200rpx;
/* 为底部按钮留出空间 */
}
.ins-card {
background: #fff;
border-radius: 16rpx;
margin-bottom: 24rpx;
padding: 20rpx 40rpx 70rpx 12rpx;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.03);
}
.ins-row {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 12rpx;
margin-top: 25rpx;
margin-left: 19rpx;
margin-right: 50rpx;
}
.ins-no {
font-size: 24rpx;
color: #0B0B0B;
font-weight: 500;
}
.ins-status {
font-size: 24rpx;
font-weight: 500;
}
.ins-line-image {
margin: left 29rpx;
margin-right: 39rpx;
height: 2rpx;
margin-bottom: 29rpx;
}
.ins-status.orange {
color: #F3AB44;
}
.ins-status.doing {
color: #00C9AA;
}
.ins-status.done {
color: #8A8A8A;
}
.ins-info {
font-size: 24rpx;
color: #888;
margin-bottom: 30rpx;
margin-left: 47rpx;
}
</style>

View File

@@ -0,0 +1,274 @@
<template>
<view class="page">
<view class="section-title">巡检点</view>
<!-- 时间轴列表 -->
<view class="timeline">
<view v-for="(item, idx) in taskList" :key="idx" class="node"
:class="[{ 'is-last': idx === taskList.length - 1 }]">
<!-- 左侧 + 竖线 -->
<view class="rail">
<view class="dot" :class="{
'dot-circle': item.dotShape === 'circle',
'dot-square': item.dotShape === 'square',
'dot-active': item.dotColor === 'blue'
}"></view>
</view>
<!-- 右侧内容 -->
<view class="card">
<!-- 标题块 + 操作区打包在一起方便宽度同步 -->
<view class="title-ops-wrapper">
<!-- 标题块 -->
<view v-if="item.headerStyle === 'solid'" class="title-solid">
{{ item.pointName }}{{ item.date }} {{ item.time }}
</view>
<view v-else class="title-dashed">
{{ item.pointName }}{{ item.date }} {{ item.time }}
</view>
<!-- 操作区宽度跟随标题块内部居中 -->
<view class="ops" v-if="item.status === '待巡检'">
<view class="btn-outline" @click="startTask(item)">立即巡检</view>
</view>
<view class="ops" v-else>
<view class="btn-disabled">完成巡检</view>
<view class="badge" :class="item.result === '正常' ? 'badge-success' : 'badge-warn'">
{{ item.result }}
</view>
</view>
</view>
</view>
</view>
</view>
<view class="footer-placeholder">巡检提醒</view>
</view>
</template>
<script>
export default {
data() {
return {
taskList: []
}
},
onLoad() {
this.getTaskListMock()
},
methods: {
// ---- 模拟接口数据(可替换成 uni.request----
getTaskListMock() {
this.taskList = [
{
pointName: 'A区花园',
date: '2025-07-16',
time: '09:00—10:00',
status: '待巡检',
headerStyle: 'solid',
result: '',
dotShape: 'circle',
dotColor: 'gray'
},
{
pointName: 'A区花园',
date: '2025-07-16',
time: '09:00—10:00',
status: '已完成',
headerStyle: 'dashed',
result: '正常',
dotShape: 'circle',
dotColor: 'blue'
},
{
pointName: 'A区花园',
date: '2025-07-16',
time: '09:00—10:00',
status: '待巡检',
headerStyle: 'solid',
result: '',
dotShape: 'square',
dotColor: 'gray'
},
{
pointName: 'A区花园',
date: '2025-07-16',
time: '09:00—10:00',
status: '已完成',
headerStyle: 'dashed',
result: '异常',
dotShape: 'square',
dotColor: 'blue'
}
]
},
startTask(item) {
uni.showToast({
title: `开始巡检:${item.pointName}`,
icon: 'none'
})
}
}
}
</script>
<style scoped>
/* 页面基础 */
.page {
background: #f7f8fa;
min-height: 100vh
}
.section-title {
font-size: 28rpx;
color: #333;
margin: 24rpx 24rpx 8rpx
}
/* 时间轴容器 */
.timeline {
position: relative;
padding: 16rpx 24rpx 40rpx 24rpx
}
/* 每个节点 */
.node {
position: relative;
padding-left: 72rpx;
margin-bottom: 32rpx
}
.node:last-child {
margin-bottom: 0
}
/* 左侧导轨与连线 */
.node::after {
content: "";
position: absolute;
left: 37rpx;
top: 35rpx;
bottom: -32rpx;
width: 2rpx;
background: #e8e9ee
}
.node.is-last::after {
display: none
}
/* 左栏(点的容器) */
.rail {
position: absolute;
left: 0;
top: 0;
width: 72rpx;
height: 100%;
display: flex;
justify-content: center
}
.dot {
width: 16rpx;
height: 16rpx;
margin-top: 20rpx;
background: #cfd3dc
}
.dot-circle {
border-radius: 50%
}
.dot-square {
border-radius: 4rpx
}
.dot-active {
background: #2f6aff
}
/* 右侧卡片 */
.card {
padding: 16rpx 20rpx;
}
/* 标题 + 操作区包裹(宽度由标题决定) */
.title-ops-wrapper {
display: inline-block;
}
/* 标题两种样式 */
.title-solid {
background: #2f6aff;
color: #fff;
border-radius: 12rpx;
padding: 12rpx 18rpx;
display: inline-block;
font-size: 26rpx
}
.title-dashed {
border-radius: 12rpx;
background: #fff;
padding: 12rpx 18rpx;
display: inline-block;
font-size: 26rpx;
color: #333
}
/* 操作区:宽度继承标题块,内部居中 */
.ops {
display: flex;
align-items: center;
justify-content: center;
margin-top: 20rpx;
}
.btn-outline {
border: 2rpx solid #2f6aff;
color: #2f6aff;
background: #fff;
padding: 12rpx 28rpx;
border-radius: 12rpx;
font-size: 26rpx
}
.btn-disabled {
background: #f2f3f5;
color: #a0a0a0;
padding: 12rpx 24rpx;
border-radius: 12rpx;
font-size: 26rpx
}
/* 结果徽标 */
.badge {
padding: 8rpx 18rpx;
border-radius: 22rpx;
font-size: 24rpx;
margin-left: 16rpx;
}
.badge-success {
color: #16a34a;
border: 2rpx solid #16a34a;
background: #fff
}
.badge-warn {
color: #f59e0b;
border: 2rpx solid #f59e0b;
background: #fff
}
/* 底部占位文字 */
.footer-placeholder {
text-align: center;
color: #e5e6eb;
font-size: 28rpx;
margin-top: 80rpx;
letter-spacing: 2rpx
}
</style>

View File

@@ -18,13 +18,13 @@
<!-- 工单状态按钮 -->
<view v-if="activeTab == 1" class="filter-btn" @click.stop="togglePopup('status')">
{{ !selectedFilters.status || selectedFilters.status === '全部' ? '工单状态' : selectedFilters.status }}
{{ !selectedFilters.status || selectedFilters.status.name === '全部' ? '工单状态' : selectedFilters.status.name }}
<image class="filter-img" src="/static/ic_down_arrow_g.png" />
<view v-if="activePopup === 'status'" class="dropdown">
<view class="dropdown-triangle"></view>
<view class="dropdown-list">
<view v-for="(item, index) in statusList" :key="index" class="dropdown-item"
@click.stop="selectFilter('status', item.name)">
@click.stop="selectFilter('status', item)">
{{ item.name }}
</view>
</view>
@@ -33,13 +33,13 @@
<!-- 处理人按钮 -->
<view class="filter-btn" @click.stop="togglePopup('handler')">
{{ !selectedFilters.handler || selectedFilters.handler === '全部' ? '处理人' : selectedFilters.handler }}
{{ !selectedFilters.handler || selectedFilters.handler.name === '全部' ? '处理人' : selectedFilters.handler.name }}
<image class="filter-img" src="/static/ic_down_arrow_g.png" />
<view v-if="activePopup === 'handler'" class="dropdown">
<view class="dropdown-triangle"></view>
<view class="dropdown-list">
<view v-for="(item, index) in handlerList" :key="index" class="dropdown-item"
@click.stop="selectFilter('handler', item.name)">
@click.stop="selectFilter('handler', item)">
{{ item.name }}
</view>
</view>
@@ -108,7 +108,11 @@
'orderTypeName': '全部'
}],
statusList: [],
handlerList: [],
handlerList: [
{
"name": '全部'
},
],
};
},
computed: {
@@ -116,7 +120,8 @@
return this.tabData[this.activeTab];
},
},
created() {
created() {
console.log("t1","!1111")
this.loadTabData(this.activeTab);
this.loadFilterData();
},
@@ -141,13 +146,23 @@
await this.loadTabData(idx);
}
},
async loadTabData(idx) {
async loadTabData(idx) {
this.loading = true;
let params = {};
if (this.selectedFilters.type && this.selectedFilters.type.id) {
params.type = this.selectedFilters.type.id
}
if(this.selectedFilters.status&&this.selectedFilters.status.id){
params.status = this.selectedFilters.status.id
}
if(this.selectedFilters.handler&&this.selectedFilters.handler.value){
params.handler = this.selectedFilters.handler.value
}
if(idx == 0){
params.status = "1,2"
}
let res = await this.$u.api.getOrderList(params);
let res = await this.$u.api.getOrderList2(params);
if (res.code == "200") {
this.$set(this.tabData, idx, res.rows);
}
@@ -203,63 +218,33 @@
let resType = await this.$u.api.getOrdersType();
if (resType.code === 200) {
this.typeList = [...this.typeList, ...resType.rows];
}
let handlers = await this.$u.api.getHandler();
if(handlers.code === 200){
this.handlerList = [...this.handlerList,...handlers.data]
}
this.statusList = [{
name: "全部"
},
{
name: "创建工单"
name: "创建工单",
id:"0"
},
{
name: "已接单"
name: "已接单",
id:"1,2"
},
{
name: "处理中"
name: "处理中",
id:"3"
},
{
name: "已完成"
name: "已完成",
id:"4"
},
];
// 处理人
try {
let resHandler = await this.$u.api.getHandlers();
if (resHandler.code === "200" && Array.isArray(resHandler.data)) {
this.handlerList = resHandler.data;
} else {
this.handlerList = [{
name: "全部"
},
{
name: "张三"
},
{
name: "李四"
},
{
name: "王五"
},
];
}
} catch {
this.handlerList = [{
name: "全部"
},
{
name: "张三"
},
{
name: "李四"
},
{
name: "王五"
},
];
}
},
},
};

View File

@@ -89,7 +89,6 @@
this.detail = item;
this.detail.orderImgUrl =
"https://picsum.photos/80/80?random=3,https://picsum.photos/80/80?random=3,https://picsum.photos/80/80?random=3";
console.log("t1", this.detail)
// 现在可以使用item对象了
// 进度映射
if (item.status == 0) {

View File

@@ -47,45 +47,52 @@
name: 'Workbench',
data() {
return {
commonApps: [{
icon: 'https://picsum.photos/80/80?random=3',
text: '审批'
},
{
icon: 'https://picsum.photos/80/80?random=3',
text: '假勤',
url:'/pages/sys/workbench/camera'
commonApps: [
// {
// icon: 'https://picsum.photos/80/80?random=3',
// text: '工作巡检',
// url:'/pages/sys/workbench/inspection/inspection'
// },
// {
// icon: 'https://picsum.photos/80/80?random=3',
// text: '假勤',
// url:'/pages/sys/workbench/camera'
},
// },
{
icon: 'https://picsum.photos/80/80?random=3',
icon: '/static/aaaa_gd.png',
text: '工单',
url:'/pages/sys/workbench/order/order'
},
{
icon: 'https://picsum.photos/80/80?random=3',
icon: '/static/aaaa_yjcl.png',
text: '预警处理',
url:'/pages/sys/workbench/earlyWarning/earlyWarning'
},
// {
// icon: 'https://picsum.photos/80/80?random=3',
// text: '保洁'
// },
{
icon: 'https://picsum.photos/80/80?random=3',
text: '保洁'
},
{
icon: 'https://picsum.photos/80/80?random=3',
icon: '/static/aaaa_jk.png',
text: '监控',
url:'/pages/sys/workbench/monitor/monitors'
},
{
icon: 'https://picsum.photos/80/80?random=3',
text: '会议',
url:'/pages/sys/workbench/meet/meet'
},
{
icon: 'https://picsum.photos/80/80?random=3',
text: '添加常用'
},
{
icon: '/static/aaaa_bsbx.png',
text: '报事报修',
url:'/pages/sys/user/myRepair/myRepair'
}
// {
// icon: 'https://picsum.photos/80/80?random=3',
// text: '会议',
// url:'/pages/sys/workbench/meet/meet'
// },
// {
// icon: 'https://picsum.photos/80/80?random=3',
// text: '添加常用'
// }
],
tabs: ['最近使用', 'OA 管理', '敏捷开发', '协同办公'],
activeTab: 0,