feat: 页面配置调整

This commit is contained in:
yangzhe 2025-04-09 13:44:35 +08:00
parent b7ea94963b
commit 8efffa4b94
7 changed files with 187 additions and 29 deletions

49
api/apiList.js Normal file
View File

@ -0,0 +1,49 @@
import request from "@/utils/request";
//使用说明
// export const getList = data => request.get('/api/list', data, false)
// 页面调用名 请求参数 请求类型 接口地址 loading是否显示
/*,this.$api.getList()
this.$api.getList(params).then(res => {
})
*/
/**
* 巡检保洁接口
*/
// 根据日期获取计划
export const GetPlanByDate = (data) =>
request.get("/api/App/GetPlanByDate", data);
// 今日完成情况
export const TodayCompletion = (data) =>
request.post("/api/App/TodayCompletion", data);
// 获取计划区域列表
export const GetPlanInfoAreaList = (data) =>
request.post("/api/App/GetPlanInfoAreaList", data);
// 获取已完成计划区域详情
export const GetPlanInfoAre = (data) =>
request.post("/api/App/GetPlanInfoAre", data);
// 获取计划列表
export const GetPlanList = (data) =>
request.get("/api/App/GetPlanList", data);
// 获取单位信息
export const GetCompanyInformation = (data) =>
request.get("/api/App/GetCompanyInformation", data);
// 上报nfc异常
export const ReportingNFCDanger = (data) =>
request.post("/api/App/ReportingNFCDanger", data);
// 上传图片
export const UploadFiles = (data) =>
request.post("/api/App/UploadFiles", data);
// 上传
export const UploadArea = (data) =>
request.post("/api/App/UploadArea", data);

View File

@ -2,7 +2,7 @@ let BASE_URL
//开发环境中
if (process.env.NODE_ENV === 'development') {
// 开发环境
BASE_URL = 'https://mock.apifox.cn/m1/3553664-0-default' //开发环境请求地址
BASE_URL = 'http://10.30.2.228:8556' //开发环境请求地址
} else {
// 生产环境
BASE_URL = 'https://mock.apifox.cn/m1/3553664-0-default' //生成环境请求地址

View File

@ -1,5 +1,7 @@
import App from './App'
import '@/utils/interceptor.js';//引入拦截
// 注释拦截
// import '@/utils/interceptor.js';//引入拦截
import Vue from 'vue'
import uView from '@/uni_modules/uview-ui'

View File

@ -57,6 +57,8 @@
</template>
<script>
import { GetPlanInfoAreaList } from "@/api/apiList";
export default {
data() {
return {
@ -91,14 +93,35 @@ export default {
value: 1,
},
],
paramsId: "",
};
},
created() {},
onLoad(options) {
this.paramsId = options.id;
},
created() {
this.getPlanInfoAreaList();
},
methods: {
changeTab(i) {
console.log(i);
this.selectIdx = i;
},
//
async getPlanInfoAreaList() {
const res = await GetPlanInfoAreaList({
id: this.paramsId,
// isCompleted: false,
});
if (res.succeed) {
console.log("res...", res);
}
},
},
};
</script>

View File

@ -1,11 +1,11 @@
<template>
<view class="content">
<daySelect @dateChange="onDateChange" />
<view v-show="isToday" class="task-info">
<view v-if="isToday" class="task-info">
<view class="title">今日任务</view>
<!-- 当日计划 点击跳转 -->
<view class="task-list">
<view class="task-item" @click="handleTaskClick">
<!-- <view class="task-item" >
<view class="name-state">
<view class="name">足球场休息室</view>
<u-tag text="已完成" type="success" border-color="transparent" />
@ -14,65 +14,97 @@
<view class="time">
<u-tag text="9:00~12:00" type="info" border-color="transparent" />
</view>
</view>
<view class="task-item">
</view> -->
<view
class="task-item"
v-for="item in planList"
:key="item.id"
@click="handleTaskClick(item)"
>
<view class="name-state">
<view class="name">足球场休息室</view>
<u-tag text="已完成" type="success" border-color="transparent" />
<view class="name">{{ item.name }}</view>
<u-tag
v-if="item.isCompleted == 0"
text="待保洁"
type="info"
border-color="transparent"
/>
<u-tag
v-else
text="已完成"
type="success"
border-color="transparent"
/>
</view>
<view class="time">
<u-tag text="9:00~12:00" type="info" border-color="transparent" />
<u-tag
:text="item.beginTime + '~' + item.endTime"
type="info"
border-color="transparent"
/>
</view>
</view>
</view>
</view>
<view v-show="isToday" class="area-schedule">
<view v-if="isToday" class="area-schedule">
<view class="finish">
<view class="point"></view>
<view class="title">已保洁区域</view>
<view class="count-rate">26 <view class="total">/50</view> </view>
<view class="count-rate">
{{ todayCompletion.completed }}
<view class="total">/{{ todayCompletion.total }}</view>
</view>
<u-line-progress
height="10"
class="schedule-line"
:show-percent="false"
active-color="#2979ff"
:percent="70"
:percent="(todayCompletion.completed / todayCompletion.total) * 100"
></u-line-progress>
</view>
<view class="unfinish">
<view class="point"></view>
<view class="title">已保洁区域</view>
<view class="count-rate">26 <view class="total">/50</view> </view>
<view class="title">待保洁区域</view>
<view class="count-rate">
{{ todayCompletion.notCompleted }}
<view class="total">/{{ todayCompletion.total }}</view>
</view>
<u-line-progress
height="10"
class="schedule-line"
:show-percent="false"
active-color="#FC873D"
:percent="70"
:percent="
(todayCompletion.notCompleted / todayCompletion.total) * 100
"
></u-line-progress>
</view>
</view>
<!-- 非当日计划 仅展示 -->
<view v-show="!isToday" class="cleaning-plan-box">
<view class="cleaning-plan">
<view v-if="!isToday" class="cleaning-plan-box">
<!-- <view class="cleaning-plan">
<view class="title">今日保洁计划名称</view>
<view class="time">
<view class="top">00:00:00</view>
<view class="bottom">23:59:00</view>
</view>
</view>
<view class="cleaning-plan">
<view class="title">今日保洁计划名称</view>
</view> -->
<view class="cleaning-plan" v-for="item in planList" :key="item.id">
<view class="title">{{ item.name }}</view>
<view class="time">
<view class="top">00:00:00</view>
<view class="bottom">23:59:00</view>
<view class="top">{{ item.beginTime }}</view>
<view class="bottom">{{ item.endTime }}</view>
</view>
</view>
</view>
</view>
</template>
<script>
import { GetPlanByDate, TodayCompletion } from "@/api/apiList";
import { useRouter } from "@/utils/utils.js";
import daySelect from "@/components/daySelect/index.vue";
@ -85,24 +117,63 @@ export default {
return {
isToday: true,
currentDate: "",
planList: [],
//
todayCompletion: {
total: 0,
completed: 0,
notCompleted: 0,
},
};
},
mounted() {
this.getPlanByDate();
},
methods: {
onDateChange({ date, isToday }) {
this.isToday = isToday;
this.currentDate = date;
this.getPlanByDate();
if (isToday) {
this.getTodayCompletion();
}
},
handleTaskClick() {
useRouter("/pages/index/cleanPlan", {}, "navigateTo");
handleTaskClick(item) {
console.log(item);
uni.navigateTo({
url: `/pages/index/cleanPlan?id=${item.id}`,
});
},
//
async getPlanByDate() {
this.planList = [];
const res = await GetPlanByDate({ Date: this.currentDate });
if (res.succeed) {
this.planList = res.data;
}
},
//
async getTodayCompletion() {
const res = await TodayCompletion();
if (res.succeed) {
this.todayCompletion = { ...res.data };
this.todayCompletion.total = res.data.completed + res.data.notCompleted;
}
},
},
};
</script>
<style lang="scss" scoped>
.content {
height: 100vh; //
// height: 100vh; //
overflow: hidden;
padding-bottom: 100rpx;
}
.task-info {
@ -128,6 +199,7 @@ export default {
display: flex;
justify-content: space-between;
.name {
padding-left: 6rpx;
position: relative;
}
.name::before {

View File

@ -16,7 +16,12 @@
/>
</view>
<u-calendar v-model="showCalendar" mode="range" :max-date="maxDate" @change="changeDate"></u-calendar>
<u-calendar
v-model="showCalendar"
mode="range"
:max-date="maxDate"
@change="changeDate"
></u-calendar>
</u-navbar>
<view
@ -90,6 +95,8 @@
</template>
<script>
import { GetPlanList } from "@/api/apiList";
export default {
data() {
return {
@ -111,8 +118,8 @@ export default {
},
changeDate(e) {
console.log('333',e);
console.log("333", e);
this.dateRange = e;
},
},

View File

@ -6,6 +6,11 @@ import {toast, clearStorageSync, getStorageSync, useRouter} from '@/utils/utils.
import systemConfig from '@/config/config.js';
const manager = new RequestManager()
// 先写死调接口
uni.setStorageSync('token', 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9zaWQiOiIwOGRkNzFiZC01N2MxLTQ1YmMtODBiYS0xMjkzYjU4MTViMmEiLCJ1bmlxdWVfbmFtZSI6IuS_nea0gSIsInJvbGUiOiJVc2VyIiwiaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvd3MvMjAwNS8wNS9pZGVudGl0eS9jbGFpbXMvbW9iaWxlcGhvbmUiOiIxODE3NDAxMDU2MiIsImdyb3Vwc2lkIjoiNGIyZDk2NjItYTc2OC0wOGYyLWEwYzgtNzYyYjhjNzZkYTJhIiwibmJmIjoxNzQ0MTc1MjA2LCJleHAiOjE3NDQxNzg4MDYsImlhdCI6MTc0NDE3NTIwNn0.1qDnEAJH-bJlEr1wbwjTfqLY9xAyJKzf6bmLP6svUNo')
const baseRequest = async (url, method, data = {}, loading = true) =>{
let requestId = manager.generateId(method, url, data)
if(!requestId) {