This commit is contained in:
李彪 2025-04-30 13:01:47 +08:00
parent b6c8c07cf0
commit 3c78631953
3 changed files with 128 additions and 170 deletions

View File

@ -37,57 +37,57 @@
</view>
</template>
<script>
import { GetHomeDataApi } from "@/api/apiAdmin";
import { GetHomeDataApi } from '@/api/apiAdmin'
export default {
data() {
return {
form: {
"regionCount": 0,
"areaCount": 0,
"bindnfc": 0,
"noBindnfc": 0
regionCount: 0,
areaCount: 0,
bindnfc: 0,
noBindnfc: 0
}
};
}
},
mounted() {
uni.hideLoading(); // Loading
uni.hideLoading() // Loading
},
onLoad() { },
onLoad() {},
onShow() {
this.getDataFn()
},
methods: {
async getDataFn() {
const res = await GetHomeDataApi();
console.log(res, "首页数据");
Object.assign(this.form, res.data);
const res = await GetHomeDataApi()
console.log(res, '首页数据')
this.form = Object.assign(this.form, res.data)
},
testFn() {
let u = navigator.userAgent;
let isAndroid = u.indexOf("Android") > -1 || u.indexOf("Adr") > -1; //android
let u = navigator.userAgent
let isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1 //android
// let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios
try {
if (isAndroid && AndroidJs) {
console.log("%c%s", "color:red", "安卓--调用方法");
console.log('%c%s', 'color:red', '安卓--调用方法')
const reqRow = {
name: "input",
data: "",
};
AndroidJs.func(JSON.stringify(reqRow)); //
name: 'input',
data: ''
}
AndroidJs.func(JSON.stringify(reqRow)) //
} else {
console.log("%c%s", "color:red", "苹果--调用方法");
console.log('%c%s', 'color:red', '苹果--调用方法')
const reqRow = {
name: "back-iphone",
data: "",
};
window.webkit.messageHandlers.func.postMessage(JSON.stringify(reqRow)); // ios
name: 'back-iphone',
data: ''
}
window.webkit.messageHandlers.func.postMessage(JSON.stringify(reqRow)) // ios
}
} catch (e) {
console.log(e, "e-----判断安卓苹果类型出错");
console.log(e, 'e-----判断安卓苹果类型出错')
}
},
},
};
}
}
}
</script>
<style lang="scss" scoped>
.content {

View File

@ -40,6 +40,7 @@
<u-empty v-if="!sonList.length" text="数据为空" mode="list"></u-empty>
</scroll-view>
</view>
<!-- 筛选的下拉 -->
<u-action-sheet :list="options" title="请选择" @click="changeFn" v-model:value="selectShow"></u-action-sheet>
<!-- 弹窗 -->

View File

@ -1,19 +1,9 @@
<template>
<view class="content">
<u-navbar
:is-back="false"
title=""
:background="{ backgroundColor: '#DFEEFD' }"
:border-bottom="false"
>
<u-navbar :is-back="false" title="" :background="{ backgroundColor: '#DFEEFD' }" :border-bottom="false">
<view class="slot-wrap">
<u-dropdown :title-size="42" active-color="#211D2F">
<u-dropdown-item
v-model="dropdownValue"
:title="dataInfo.planName"
:options="dropdownOptions"
@change="changeDropdown"
></u-dropdown-item>
<u-dropdown-item v-model="dropdownValue" :title="dataInfo.planName" :options="dropdownOptions" @change="changeDropdown"></u-dropdown-item>
</u-dropdown>
<view class="back-icon" @click="backFn">
<!-- <u-icon name="arrow-left" size="50rpx" color="#606266"></u-icon> -->
@ -33,27 +23,14 @@
</span>
</view>
<view class="tabs">
<view
@click="changeTab(i)"
class="tab-item"
v-for="(v, i) in selectTabs"
:key="i"
:class="{ select: selectIdx === i }"
>
<view @click="changeTab(i)" class="tab-item" v-for="(v, i) in selectTabs" :key="i" :class="{ select: selectIdx === i }">
{{ v.name }}
</view>
</view>
</view>
<view class="arealist" v-if="dataInfo.areas.length > 0">
<view
class="block-info"
v-for="item in dataInfo.areas"
:key="item.id"
@click="toItemPage(item)"
>
<view v-if="!item.isCompleted" class="schedule schedule-wait"
>待保洁</view
>
<view class="block-info" v-for="item in dataInfo.areas" :key="item.id" @click="toItemPage(item)">
<view v-if="!item.isCompleted" class="schedule schedule-wait">待保洁</view>
<view v-else class="schedule schedule-completed">已完成</view>
<view class="name">
@ -62,18 +39,13 @@
</view>
<view class="type">
<view class="value">区域类型</view>
<u-tag
:text="item.areaType"
class="tag"
border-color="transparent"
:type="
<u-tag :text="item.areaType" class="tag" border-color="transparent" :type="
item.areaType === '室外'
? 'success'
: item.areaType === '特殊'
? 'warning'
: 'primary'
"
/>
" />
<!-- 特殊先隐藏没有这个字段 -->
<!-- <u-tag text="特殊" border-color="transparent" type="warning" /> -->
</view>
@ -89,11 +61,7 @@
<view class="success-box">
<view class="box-content">
<view class="logo">
<image
style="width: 100%; height: 100%"
src="/static/images/msg-success.png"
alt=""
/>
<image style="width: 100%; height: 100%" src="/static/images/msg-success.png" alt="" />
</view>
<view class="content-title">刷卡成功</view>
<view class="btn-box">
@ -108,11 +76,7 @@
<view class="error-box">
<view class="box-content">
<view class="logo">
<image
style="width: 100%; height: 100%"
src="/static/images/msg-error.png"
alt=""
/>
<image style="width: 100%; height: 100%" src="/static/images/msg-error.png" alt="" />
</view>
<view class="content-title">
{{ errorMsg }}
@ -129,60 +93,56 @@
</template>
<script>
import {
GetPlanInfoAreaList,
GetTodayPlanList,
GetAwaitUploadAreaApi,
} from "@/api/apiList";
import { GetPlanInfoAreaList, GetTodayPlanList, GetAwaitUploadAreaApi } from '@/api/apiList'
import { minutesToTime } from "@/utils/utils";
import { minutesToTime } from '@/utils/utils'
export default {
data() {
return {
posIcon: require("@/static/images/pos-icon.png"),
posIcon: require('@/static/images/pos-icon.png'),
selectIdx: 0,
dropdownValue: "",
dropdownValue: '',
dropdownOptions: [
{
label: "保洁计划1",
value: 1,
label: '保洁计划1',
value: 1
},
{
label: "保洁计划2",
value: 2,
label: '保洁计划2',
value: 2
},
{
label: "保洁计划3",
value: 3,
label: '保洁计划3',
value: 3
},
{
label: "保洁计划4",
value: 4,
},
label: '保洁计划4',
value: 4
}
],
selectTabs: [
{
name: "全部",
value: 0,
name: '全部',
value: 0
},
{
name: "待保洁",
value: 1,
},
name: '待保洁',
value: 1
}
],
paramsId: "",
paramsId: '',
//
successShow: false,
//
errorShow: false,
errorMsg: "NFC卡异常或丢失可尝试重新刷卡或提交卡片异常信息",
errorMsg: 'NFC卡异常或丢失可尝试重新刷卡或提交卡片异常信息',
dataInfo: {
planName: "",
areas: [],
},
};
planName: '',
areas: []
}
}
},
computed: {
@ -197,14 +157,14 @@ export default {
onLoad(options) {
// this.paramsId = options.id;
this.dropdownValue = options.id;
window.nfcFn = this.nfcResFn;
this.dropdownValue = options.id
window.nfcFn = this.nfcResFn
// this.nfcResFn();
},
created() {
this.getTodayPlanList();
this.getPlanInfoAreaList();
this.getTodayPlanList()
this.getPlanInfoAreaList()
},
methods: {
@ -213,132 +173,129 @@ export default {
backFn() {
// console.log("%c%s", "color:red", "");
uni.navigateBack();
uni.navigateBack()
},
async nfcResFn(data) {
if (!data) {
return uni.showToast({ title: "未传入参数 initFn", icon: "none" });
return uni.showToast({ title: '未传入参数 initFn', icon: 'none' })
}
uni.showModal({
title: "开发调试查看nimei",
content: JSON.stringify(data) || "未传入参数 initFn",
showCancel: true,
success: function (res) {},
});
let cardID = data.cardID;
// uni.showModal({
// title: "nimei",
// content: JSON.stringify(data) || " initFn",
// showCancel: true,
// success: function (res) {},
// });
let cardID = data.cardID
// let nimei = data.nimei;
let nimei = data.uuid;
let nimei = data.uuid
const req = {
Nimei: nimei,
Nimei: nimei
// Nimei:'"78F04BC3E9A6DE4782C11A2346F39C68'
};
const res = await GetAwaitUploadAreaApi(req);
console.log(res, "res---");
}
const res = await GetAwaitUploadAreaApi(req)
console.log(res, 'res---')
//
if (!res.succeed) {
console.log("%c%s", "color:red", "刷卡失败");
console.log('%c%s', 'color:red', '刷卡失败')
//
this.errorMsg =
res.error || "NFC卡异常或丢失可尝试重新刷卡或提交卡片异常信息";
this.errorShow = true;
this.errorMsg = res.error || 'NFC卡异常或丢失可尝试重新刷卡或提交卡片异常信息'
this.errorShow = true
//
this.successShow = false;
return;
this.successShow = false
return
}
//
this.successShow = true;
this.successShow = true
//
this.errorShow = false;
return;
this.errorShow = false
return
if (data) {
console.log("%c%s", "color:red", "nfc刷卡成功");
this.successShow = true;
console.log('%c%s', 'color:red', 'nfc刷卡成功')
this.successShow = true
//
this.errorShow = false;
this.errorShow = false
} else {
console.log("%c%s", "color:red", "刷卡失败");
this.errorShow = true;
console.log('%c%s', 'color:red', '刷卡失败')
this.errorShow = true
//
this.successShow = false;
this.successShow = false
}
},
//
toUploadPage() {
console.log("%c%s", "color:red", "上传图片");
console.log('%c%s', 'color:red', '上传图片')
const params = {
planName: this.dataInfo.planName,
id: this.dataInfo.areas[this.dataInfo.areas.length - 1].id,
aeraNmae: this.dataInfo.areas[this.dataInfo.areas.length - 1].aeraNmae,
};
console.log(params);
aeraNmae: this.dataInfo.areas[this.dataInfo.areas.length - 1].aeraNmae
}
console.log(params)
//
this.successShow = false;
this.successShow = false
uni.navigateTo({
url:
"/pages/index/uploadPhoto?params=" +
encodeURIComponent(JSON.stringify(params)),
});
url: '/pages/index/uploadPhoto?params=' + encodeURIComponent(JSON.stringify(params))
})
},
//
exceptionReportFn() {
console.log("%c%s", "color:red", "异常上报");
console.log('%c%s', 'color:red', '异常上报')
//
this.errorShow = false;
this.errorShow = false
uni.navigateTo({
url: "/pages/index/list",
});
url: '/pages/index/list'
})
},
toItemPage(item) {
console.log("%c%s", "color:red", "跳转至详情页", item);
console.log('%c%s', 'color:red', '跳转至详情页', item)
const combinedData = {
...item, // item
planName: this.dataInfo.planName, // planName
};
planName: this.dataInfo.planName // planName
}
const params = encodeURIComponent(JSON.stringify(combinedData));
const params = encodeURIComponent(JSON.stringify(combinedData))
if (item.isCompleted) {
//
uni.navigateTo({
url: "/pages/index/cleanDetails?params=" + params,
});
return;
url: '/pages/index/cleanDetails?params=' + params
})
return
} else {
//
uni.navigateTo({
url: "/pages/index/list?params=" + params,
});
url: '/pages/index/list?params=' + params
})
}
},
openFn() {},
closeFn() {},
changeTab(i) {
this.selectIdx = i;
this.selectIdx = i
this.getPlanInfoAreaList();
this.getPlanInfoAreaList()
},
changeDropdown(e) {
this.dropdownValue = e;
this.dropdownValue = e
this.getPlanInfoAreaList();
this.getPlanInfoAreaList()
},
//
async getTodayPlanList() {
const res = await GetTodayPlanList();
const res = await GetTodayPlanList()
if (res.succeed) {
this.dropdownOptions = res.data.map((item) => ({
this.dropdownOptions = res.data.map(item => ({
label: item.name,
value: item.id,
}));
value: item.id
}))
}
},
@ -346,14 +303,14 @@ export default {
async getPlanInfoAreaList() {
const res = await GetPlanInfoAreaList({
id: this.dropdownValue,
isCompleted: this.selectIdx === 0 ? true : false,
});
isCompleted: this.selectIdx === 0 ? true : false
})
if (res.succeed) {
this.dataInfo = res.data;
this.dataInfo = res.data
}
},
},
};
}
}
}
</script>
<style lang="scss" scoped>
@ -395,7 +352,7 @@ page {
padding-top: 72rpx;
display: flex;
flex-direction: column;
background: url("@/static/images/plan-icon-bg2.png") no-repeat 95% 40%;
background: url('@/static/images/plan-icon-bg2.png') no-repeat 95% 40%;
background-size: 40%;
background-color: #dfeefd;
.name {