fix: 首页刷新、空状态提示、异常上报提示信息

This commit is contained in:
yangzhe 2025-05-06 09:34:17 +08:00
parent 151d801dc8
commit 977970c42e
4 changed files with 56 additions and 32 deletions

View File

@ -54,6 +54,11 @@
</view> </view>
</view> </view>
</view> </view>
<view class="empty-box" v-else>
<u-empty text="暂无内容" mode="list"></u-empty>
</view>
<!-- <button @click="successShow = true">刷卡成功</button> --> <!-- <button @click="successShow = true">刷卡成功</button> -->
<!-- <button @click="nfcResFn(false)">刷卡失败</button> --> <!-- <button @click="nfcResFn(false)">刷卡失败</button> -->
<!-- nfc刷卡成功弹窗 --> <!-- nfc刷卡成功弹窗 -->
@ -385,6 +390,9 @@ page {
} }
} }
} }
.empty-box{
margin-top: 100rpx;
}
.arealist { .arealist {
display: flex; display: flex;
flex-direction: column; flex-direction: column;

View File

@ -1,8 +1,8 @@
<template> <template>
<view class="content"> <view class="content">
<view v-if="false" style="display:flex"> <view v-if="false" style="display: flex">
<u-button type="error" @click="testFn">调试录入卡片</u-button> <u-button type="error" @click="testFn">调试录入卡片</u-button>
</view> </view>
<daySelect @dateChange="onDateChange" /> <daySelect @dateChange="onDateChange" />
<view v-if="isToday" class="task-info"> <view v-if="isToday" class="task-info">
<view class="title">今日任务</view> <view class="title">今日任务</view>
@ -109,7 +109,7 @@
<script> <script>
import { GetPlanByDate, TodayCompletion } from "@/api/apiList"; import { GetPlanByDate, TodayCompletion } from "@/api/apiList";
import { useRouter } from "@/utils/utils.js"; import { useRouter, formatDate } from "@/utils/utils.js";
import daySelect from "@/components/daySelect/index.vue"; import daySelect from "@/components/daySelect/index.vue";
export default { export default {
@ -132,41 +132,45 @@ export default {
}, },
mounted() { mounted() {
console.log("%c%s", "color:red", "mounted--"); // console.log("%c%s", "color:red", "mounted--");
this.getPlanByDate(); // this.getPlanByDate();
},
onShow() {
this.onDateChange({ date: formatDate(new Date()), isToday: true });
}, },
methods: { methods: {
testFn(){ testFn() {
let u = navigator.userAgent; let u = navigator.userAgent;
let isAndroid = let isAndroid = u.indexOf("Android") > -1 || u.indexOf("Adr") > -1; //android
u.indexOf("Android") > -1 || u.indexOf("Adr") > -1; //android // let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios
// let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios try {
try { if (isAndroid && AndroidJs) {
if (isAndroid && AndroidJs) { console.log("%c%s", "color:red", "安卓--调用方法");
console.log("%c%s", "color:red", "安卓--调用方法"); const reqRow = {
const reqRow = { name: "input",
name: "input", data: "",
data: "", };
}; AndroidJs.func(JSON.stringify(reqRow)); //
AndroidJs.func(JSON.stringify(reqRow)); // } else {
} else { console.log("%c%s", "color:red", "苹果--调用方法");
console.log("%c%s", "color:red", "苹果--调用方法"); const reqRow = {
const reqRow = { name: "back-iphone",
name: "back-iphone", data: "",
data: "", };
}; window.webkit.messageHandlers.func.postMessage(
window.webkit.messageHandlers.func.postMessage( JSON.stringify(reqRow)
JSON.stringify(reqRow) ); // ios
); // ios
}
} catch (e) {
console.log(e, "e-----判断安卓苹果类型出错");
} }
} catch (e) {
console.log(e, "e-----判断安卓苹果类型出错");
}
}, },
onDateChange({ date, isToday }) { onDateChange({ date, isToday }) {
this.isToday = isToday; this.isToday = isToday;
this.currentDate = date; this.currentDate = date;
this.getPlanByDate(); this.getPlanByDate();
if (isToday) { if (isToday) {

View File

@ -285,7 +285,7 @@ export default {
const queryParams = encodeURIComponent(JSON.stringify(this.params)); const queryParams = encodeURIComponent(JSON.stringify(this.params));
uni.showModal({ uni.showModal({
title: "提示", title: "提示",
content: "任务已完成,快去上传图片吧", content: "清扫工作已完成,上传图片记录",
confirmText: "去上传图片", confirmText: "去上传图片",
showCancel: false, showCancel: false,
success: function (res) { success: function (res) {

View File

@ -514,3 +514,15 @@ export function minutesToTime(minutes) {
const formattedMins = String(mins).padStart(2, '0'); const formattedMins = String(mins).padStart(2, '0');
return `${formattedHours}:${formattedMins}`; return `${formattedHours}:${formattedMins}`;
} }
/**
* 格式化日期
* @param {Date} date 日期
* @returns {string} 格式化后的日期
*/
export function formatDate(date) {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0');
const day = String(date.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
}