feat: 首页按钮刷新调整为下拉刷新

This commit is contained in:
gcd 2025-05-07 20:46:00 +08:00
parent e695479fbe
commit 159996ad1c
3 changed files with 17 additions and 79 deletions

View File

@ -5,7 +5,8 @@
"style" : "style" :
{ {
"navigationBarTitleText" : "接单大厅", "navigationBarTitleText" : "接单大厅",
"navigationStyle": "custom" "navigationBarBackgroundColor": "@backgroundColor",
"enablePullDownRefresh": true
} }
}, },
{ {
@ -41,49 +42,49 @@
}, },
{ {
"path" : "pages/order/select-time", "path" : "pages/order/select-time",
"style" : "style" :
{ {
"navigationBarTitleText" : "已和客户沟通" "navigationBarTitleText" : "已和客户沟通"
} }
}, },
{ {
"path" : "pages/order/arrived-on-site", "path" : "pages/order/arrived-on-site",
"style" : "style" :
{ {
"navigationBarTitleText" : "完成上门" "navigationBarTitleText" : "完成上门"
} }
}, },
{ {
"path" : "pages/order/complete-service", "path" : "pages/order/complete-service",
"style" : "style" :
{ {
"navigationBarTitleText" : "完成服务" "navigationBarTitleText" : "完成服务"
} }
}, },
{ {
"path" : "pages/order/report-order-exception", "path" : "pages/order/report-order-exception",
"style" : "style" :
{ {
"navigationBarTitleText" : "上报异常" "navigationBarTitleText" : "上报异常"
} }
}, },
{ {
"path" : "pages/order/worker-remark", "path" : "pages/order/worker-remark",
"style" : "style" :
{ {
"navigationBarTitleText" : "工单备注" "navigationBarTitleText" : "工单备注"
} }
}, },
{ {
"path" : "pages/user/user-agreement", "path" : "pages/user/user-agreement",
"style" : "style" :
{ {
"navigationBarTitleText" : "用户协议" "navigationBarTitleText" : "用户协议"
} }
}, },
{ {
"path" : "pages/user/privacy-policy", "path" : "pages/user/privacy-policy",
"style" : "style" :
{ {
"navigationBarTitleText" : "隐私协议" "navigationBarTitleText" : "隐私协议"
} }

View File

@ -1,22 +1,6 @@
<template name="skeleton"> <template name="skeleton">
<view class="sk-container"> <view class="sk-container">
<view class="ctr ctr data-v-1cf27b2a data-v-1cf27b2a"> <view class="ctr ctr data-v-1cf27b2a data-v-1cf27b2a">
<view class="fixed-top fixed-top data-v-1cf27b2a data-v-1cf27b2a">
<view is="components/me-top/me-top" class="data-v-1cf27b2a data-v-1cf27b2a">
<view class="me-top top--me-top data-v-e4d1a339 top--data-v-e4d1a339">
<view class="status-bar top--status-bar data-v-e4d1a339 top--data-v-e4d1a339" style="height:47px"></view>
<view class="capsule top--capsule flex-c top--flex-c data-v-e4d1a339 top--data-v-e4d1a339" style="height:40px">
<view class="icon-ctr top--icon-ctr flex-c top--flex-c data-v-e4d1a339 top--data-v-e4d1a339">
<image class="icon top--icon data-v-e4d1a339 top--data-v-e4d1a339 sk-image" mode="aspectFill"></image>
</view>
<text class="title top--title data-v-e4d1a339 top--data-v-e4d1a339 sk-transparent sk-text-14-2857-544 sk-text">接单大厅</text>
</view>
</view>
</view>
</view>
<view is="components/me-empty-space/me-empty-space" class="data-v-1cf27b2a data-v-1cf27b2a">
<view class="me-empty-space space--me-empty-space" style="height:87px"></view>
</view>
<view class="list list data-v-1cf27b2a data-v-1cf27b2a"> <view class="list list data-v-1cf27b2a data-v-1cf27b2a">
<view class="order-item order-item data-v-1cf27b2a data-v-1cf27b2a"> <view class="order-item order-item data-v-1cf27b2a data-v-1cf27b2a">
<view class="top top flex-sb flex-sb data-v-1cf27b2a data-v-1cf27b2a"> <view class="top top flex-sb flex-sb data-v-1cf27b2a data-v-1cf27b2a">

View File

@ -2,12 +2,6 @@
<IndexSkeleton v-if="data.is_show_skeleton"></IndexSkeleton> <IndexSkeleton v-if="data.is_show_skeleton"></IndexSkeleton>
<template v-else> <template v-else>
<view class="ctr"> <view class="ctr">
<view class="fixed-top">
<me-top title="接单大厅"></me-top>
</view>
<me-empty-space :height="listMarginTop"></me-empty-space>
<view class="list" v-if="data.list.length > 0"> <view class="list" v-if="data.list.length > 0">
<view class="order-item" v-for="(item, index) in data.list" :key="index"> <view class="order-item" v-for="(item, index) in data.list" :key="index">
<view class="top flex-sb" @click="toDetail(item.id)"> <view class="top flex-sb" @click="toDetail(item.id)">
@ -44,12 +38,6 @@
</view> </view>
</view> </view>
<me-empty v-else text="暂无数据"></me-empty> <me-empty v-else text="暂无数据"></me-empty>
<view class="refresh flex-c" @click="refreshStart()" hover-class="auto-mask-layer-radius100" hover-start-time="0" hover-stay-time="50">
<view class="icon flex-c" :style="{ transform: `rotate(${refresh.rotate_deg}deg)` }">
<me-icon type="icon-reset-left-line" color="#FFFFFF" size="60rpx"></me-icon>
</view>
</view>
<me-empty-space height="100"></me-empty-space> <me-empty-space height="100"></me-empty-space>
</view> </view>
</template> </template>
@ -57,16 +45,20 @@
</template> </template>
<script setup> <script setup>
import {onReachBottom, onShow} from '@dcloudio/uni-app' import {onReachBottom, onShow, onPullDownRefresh} from '@dcloudio/uni-app'
import {reactive, computed, inject} from 'vue' import {reactive} from 'vue'
import MeIcon from "../../components/me-icon/me-icon"; import MeIcon from "../../components/me-icon/me-icon";
import MeButton from "../../components/me-button/me-button"; import MeButton from "../../components/me-button/me-button";
import MeEmptySpace from "../../components/me-empty-space/me-empty-space"; import MeEmptySpace from "../../components/me-empty-space/me-empty-space";
import MeTop from "../../components/me-top/me-top";
import helpers from "../../utils/helpers"; import helpers from "../../utils/helpers";
import api from "../../api/api"; import api from "../../api/api";
import IndexSkeleton from "./index-skeleton"; import IndexSkeleton from "./index-skeleton";
onPullDownRefresh(() => {
data.page = 1
getList()
})
const acceptOrder = (index, id) => { const acceptOrder = (index, id) => {
uni.showModal({ uni.showModal({
title: '接单提示', title: '接单提示',
@ -113,10 +105,6 @@ const rejectOrder = (index, id) => {
}); });
} }
const listMarginTop = computed(() => {
return (inject('globalData').statusBarH + (inject('globalData').customBarH - inject('globalData').statusBarH)) * 2
})
const toDetail = (id) => { const toDetail = (id) => {
helpers.jumpToPage('order-info', `id=${id}`) helpers.jumpToPage('order-info', `id=${id}`)
} }
@ -151,45 +139,10 @@ const getList = () => {
data.is_show_skeleton = false data.is_show_skeleton = false
helpers.delayHideLoading() helpers.delayHideLoading()
}).catch(() => {}).finally(() => { }).catch(() => {}).finally(() => {
setTimeout(() => { uni.stopPullDownRefresh();
refreshComplete()
}, 500)
}) })
} }
const refresh = reactive({
interval: null,
rotate_deg: 0
})
const refreshStart = () => {
if (refresh.interval !== null) {
return
}
if (userLocation.lng === null || userLocation.lat === null) {
helpers.showToast('请授权位置权限')
return
}
refresh.interval = setInterval(() => {
refresh.rotate_deg -= 12;
}, 16);
data.page = 1
getList()
}
const refreshComplete = () => {
if (refresh.interval !== null) {
clearInterval(refresh.interval);
refresh.interval = null
uni.showToast({
title: '已刷新',
icon: "success"
})
}
}
const userLocation = reactive({ const userLocation = reactive({
lng: null, lng: null,
lat: null, lat: null,