解决登录显示、首页显示bug

This commit is contained in:
2026-05-19 11:06:46 +08:00
parent 2f7e097e6c
commit 00a859c551
181 changed files with 55329 additions and 998 deletions

View File

@@ -0,0 +1,123 @@
<template>
<ServicePageScaffold title="设置" fallback-url="/pages/mall/delivery/profile/index">
<ServicePanel title="账号信息" subtitle="展示当前服务人员账号和档案状态。">
<text v-if="deliveryInfo != null" class="info-text">姓名:{{ deliveryInfo.name }}</text>
<text v-if="deliveryInfo != null" class="info-text">编号:{{ displayStaffNo() }}</text>
<text v-if="deliveryInfo != null" class="info-text">机构:{{ displayOrganizationName() }}</text>
<text v-if="deliveryInfo != null" class="info-text">在线状态:{{ deliveryInfo.onlineStatus }}</text>
<text v-if="deliveryInfo != null" class="info-text">资质状态:{{ deliveryInfo.certificateStatus }}</text>
</ServicePanel>
<ServicePanel title="提醒与权限" subtitle="预留定位权限、语音播报和消息提醒控制。">
<view class="setting-row">
<text class="setting-text">消息提醒</text>
<switch :checked="messageEnabled" color="#0f766e" @change="toggleMessage" />
</view>
<view class="setting-row">
<text class="setting-text">语音播报</text>
<switch :checked="voiceEnabled" color="#0f766e" @change="toggleVoice" />
</view>
<view class="setting-row">
<text class="setting-text">定位权限提示</text>
<text class="setting-hint">请确保 Android 和小程序侧授权开启</text>
</view>
</ServicePanel>
</ServicePageScaffold>
</template>
<script setup lang="uts">
import { ref } from 'vue'
import { onShow } from '@dcloudio/uni-app'
import ServicePageScaffold from '@/components/homeService/ServicePageScaffold.uvue'
import ServicePanel from '@/components/homeService/ServicePanel.uvue'
import type { DeliveryInfoType } from '@/types/delivery.uts'
import { getDeliveryProfile } from '@/services/deliveryService.uts'
import { requireDeliveryAuth } from '@/utils/deliveryAuth.uts'
const messageEnabled = ref(true)
const voiceEnabled = ref(false)
const deliveryInfo = ref<DeliveryInfoType | null>(null)
function displayOrganizationName(): string {
if (deliveryInfo.value == null) {
return ''
}
const organizationName = deliveryInfo.value.organizationName.trim()
if (organizationName != '') {
return organizationName
}
return '暂未绑定服务机构'
}
function displayStaffNo(): string {
if (deliveryInfo.value == null) {
return ''
}
const staffNo = deliveryInfo.value.staffNo.trim()
if (staffNo != '') {
return staffNo
}
return '待分配'
}
function restoreSettings() {
const msg = uni.getStorageSync('delivery_setting_message') as boolean | null
const voice = uni.getStorageSync('delivery_setting_voice') as boolean | null
messageEnabled.value = msg == null ? true : msg
voiceEnabled.value = voice == null ? false : voice
}
function toggleMessage(event: any) {
messageEnabled.value = event.detail.value === true
uni.setStorageSync('delivery_setting_message', messageEnabled.value)
}
function toggleVoice(event: any) {
voiceEnabled.value = event.detail.value === true
uni.setStorageSync('delivery_setting_voice', voiceEnabled.value)
}
async function loadData() {
const authResult = await requireDeliveryAuth({ redirectOnFail: true, toastOnFail: true })
if (!authResult.ok) {
return
}
restoreSettings()
deliveryInfo.value = await getDeliveryProfile()
}
onShow(() => {
loadData()
})
</script>
<style scoped>
.setting-row {
padding: 20rpx 0;
border-bottom: 1rpx solid #e6edf1;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
.info-text {
display: block;
margin-top: 12rpx;
font-size: 24rpx;
line-height: 36rpx;
color: #5e758c;
}
.setting-text {
font-size: 28rpx;
color: #16324f;
}
.setting-hint {
font-size: 24rpx;
line-height: 36rpx;
color: #5e758c;
text-align: right;
width: 60%;
}
</style>