1. 账号体系与数据库解耦: - 师傅表 fa_master 解除对 fa_user.id 的外键依赖,升级为独立认证账号主表; - 新增师傅端独立支撑表:fa_master_security、fa_master_token、fa_master_wechat、fa_master_agreement_read; - 新增工单超时未接单自动关闭与原路退款配置(order_unaccepted_close_days)。 2. 服务端(Server): - 新增师傅端独立 API 控制器与认证库(MasterAuth, MasterBase, MasterMessage, MasterSecurity, MasterToken); - WxLogin 支持双小程序端(user/master)独立换取 session_key、openid 与 access_token; - 新增控制台调度命令 php think order:autoclose,支持订单超时自动关闭与售后退款闭环; - 修复 PHP 8.5 兼容性问题(Request.php 的 (bool) 强制转换); - 系统业务配置全面收敛至数据库 fa_config 及 site.php。 3. 小程序端: - yjyf-app(用户端):彻底剥离师傅端路由、组件及静态资源,增加隐私授权弹窗与评价模块; - yjyf-master-app(师傅端):全新独立微信小程序工程(wx140d90ceda786107),实现工作台、接单大厅、资质认证、工单协同与钱包提现完整闭环。
399 行
9.6 KiB
Vue
399 行
9.6 KiB
Vue
<template>
|
||
<view class="yjyf-navbar-wrapper">
|
||
<!-- 固定在顶部的导航条 -->
|
||
<view
|
||
class="yjyf-navbar"
|
||
:class="[
|
||
'theme-' + theme,
|
||
{ 'is-fixed': fixed, 'has-border': border && theme === 'white' }
|
||
]"
|
||
:style="navbarRootStyle"
|
||
>
|
||
<view class="nav-content" :style="{ height: navBarHeight + 'px' }">
|
||
<!-- 1. 绝对居中的标题容器(保障物理视口绝对正中心,不被两端挤压) -->
|
||
<view
|
||
class="nav-title-box"
|
||
:class="['align-' + titleAlign]"
|
||
:style="{
|
||
paddingLeft: (titleAlign === 'left' ? leftWidth : sideSafeWidth) + 'px',
|
||
paddingRight: (titleAlign === 'left' ? rightSpaceWidth : sideSafeWidth) + 'px'
|
||
}"
|
||
>
|
||
<slot>
|
||
<text class="nav-title" :class="'title-' + theme" :style="{ color: titleColor || defaultTitleColor }">{{ title }}</text>
|
||
</slot>
|
||
</view>
|
||
|
||
<!-- 2. 左侧操作区域:返回按钮 / 返回首页 / 自定义插槽 -->
|
||
<view class="nav-left" :style="{ minWidth: leftWidth + 'px' }">
|
||
<slot name="left">
|
||
<view class="back-btn clickable-hover" v-if="canBack" @tap="handleBack">
|
||
<image class="back-svg-icon" :src="theme === 'white' ? '/static/icons/back.svg' : '/static/icons/back-white.svg'" mode="aspectFit" />
|
||
<text class="back-text" v-if="backText" :class="'icon-' + theme">{{ backText }}</text>
|
||
</view>
|
||
<view class="home-btn clickable-hover" v-else-if="canHome" @tap="handleHome">
|
||
<image class="home-svg-icon" :src="theme === 'white' ? '/static/icons/home.svg' : '/static/icons/home-white.svg'" mode="aspectFit" />
|
||
</view>
|
||
</slot>
|
||
</view>
|
||
|
||
<!-- 3. 右侧胶囊安全避让占位 / 右侧自定义插槽 -->
|
||
<view
|
||
class="nav-right"
|
||
:style="{ minWidth: rightSpaceWidth + 'px', paddingRight: (rightSpaceWidth > 20 ? rightSpaceWidth : 12) + 'px' }"
|
||
>
|
||
<slot name="right"></slot>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 占位垫高块,防止页面内容被 fixed 导航栏遮挡 -->
|
||
<view
|
||
class="yjyf-navbar-placeholder"
|
||
:class="'placeholder-' + theme"
|
||
v-if="fixed && placeholder"
|
||
:style="{ height: totalNavHeight + 'px' }"
|
||
></view>
|
||
</view>
|
||
</template>
|
||
|
||
<script setup>
|
||
import { ref, computed, onMounted, nextTick } from 'vue';
|
||
import { getNavBarMetrics } from '@/utils/system.js';
|
||
|
||
const props = defineProps({
|
||
title: { type: String, default: '' },
|
||
theme: {
|
||
type: String,
|
||
default: 'orange', // 统一默认为品牌主题色 'orange'
|
||
validator: (v) => ['white', 'orange', 'transparent'].includes(v)
|
||
},
|
||
customBackground: { type: String, default: '' },
|
||
titleColor: { type: String, default: '' },
|
||
titleAlign: { type: String, default: 'center' }, // 'center' | 'left'
|
||
showBack: { type: Boolean, default: null }, // null表示智能自动判断:非Tab页默认显示,Tab页默认不显示
|
||
customBack: { type: Boolean, default: false }, // 是否由父组件完全接管返回事件(如多步表单回退上一步)
|
||
showHome: { type: Boolean, default: false },
|
||
backText: { type: String, default: '' },
|
||
fixed: { type: Boolean, default: true },
|
||
placeholder: { type: Boolean, default: true },
|
||
border: { type: Boolean, default: false }
|
||
});
|
||
|
||
const emit = defineEmits(['back', 'home']);
|
||
|
||
// 系统底栏 Tab 页面白名单(这些页面默认不显示返回按钮)
|
||
const TAB_ROUTES = [
|
||
'pages/index/index',
|
||
'pages/order/list',
|
||
'pages/message/message',
|
||
'pages/mine/mine'
|
||
];
|
||
|
||
// 安全区域与各尺寸响应式变量
|
||
const statusBarHeight = ref(20);
|
||
const navBarHeight = ref(44);
|
||
const rightSpaceWidth = ref(16);
|
||
const leftWidth = ref(50);
|
||
const currentRoute = ref('');
|
||
|
||
// 计算总高度
|
||
const totalNavHeight = computed(() => {
|
||
return statusBarHeight.value + navBarHeight.value;
|
||
});
|
||
|
||
// 根节点动态样式(仅在显式传入 customBackground 时附加,避免空 background 重置渐变尺寸)
|
||
const navbarRootStyle = computed(() => {
|
||
const style = {
|
||
paddingTop: statusBarHeight.value + 'px'
|
||
};
|
||
if (props.customBackground) {
|
||
style.background = props.customBackground;
|
||
}
|
||
return style;
|
||
});
|
||
|
||
// 对称避让安全距离(确保居中标题绝不偏心,两端完全对称)
|
||
const sideSafeWidth = computed(() => {
|
||
return Math.max(leftWidth.value, rightSpaceWidth.value);
|
||
});
|
||
|
||
// 标题默认颜色计算
|
||
const defaultTitleColor = computed(() => {
|
||
if (props.theme === 'orange' || props.theme === 'transparent') {
|
||
return '#FFFFFF';
|
||
}
|
||
return '#1F1F1F';
|
||
});
|
||
|
||
// 判断当前是否是底栏 Tab 页面
|
||
const isTabRoute = computed(() => {
|
||
if (!currentRoute.value) return false;
|
||
return TAB_ROUTES.some((route) => currentRoute.value.includes(route));
|
||
});
|
||
|
||
// 判断是否展示返回按钮
|
||
const canBack = computed(() => {
|
||
// 1. 外部显式指定优先级最高
|
||
if (props.showBack !== null && props.showBack !== undefined) {
|
||
return !!props.showBack;
|
||
}
|
||
// 2. 若是 Tab 页面,默认隐藏返回按钮
|
||
if (isTabRoute.value) {
|
||
return false;
|
||
}
|
||
// 3. 非 Tab 页面(二级/三级页面、下单页、详情页等),默认一律展示返回按钮
|
||
return true;
|
||
});
|
||
|
||
// 判断是否显示首页按钮
|
||
const canHome = computed(() => {
|
||
if (props.showHome && !canBack.value) {
|
||
return true;
|
||
}
|
||
return false;
|
||
});
|
||
|
||
// 获取当前路由路径
|
||
function updateCurrentRoute() {
|
||
try {
|
||
const pages = getCurrentPages();
|
||
if (pages && pages.length) {
|
||
const cur = pages[pages.length - 1];
|
||
currentRoute.value = cur.route || (cur.$page && cur.$page.route) || '';
|
||
}
|
||
} catch (e) {}
|
||
}
|
||
|
||
function initSystemInfo() {
|
||
updateCurrentRoute();
|
||
const metrics = getNavBarMetrics();
|
||
statusBarHeight.value = metrics.statusBarHeight;
|
||
navBarHeight.value = metrics.navBarHeight;
|
||
rightSpaceWidth.value = metrics.rightSpaceWidth;
|
||
leftWidth.value = metrics.leftWidth;
|
||
}
|
||
|
||
initSystemInfo();
|
||
onMounted(() => {
|
||
initSystemInfo();
|
||
nextTick(() => {
|
||
updateCurrentRoute();
|
||
});
|
||
});
|
||
|
||
function handleBack() {
|
||
emit('back');
|
||
if (props.customBack) return;
|
||
let pages = [];
|
||
try {
|
||
pages = getCurrentPages() || [];
|
||
} catch (e) {}
|
||
if (pages.length > 1) {
|
||
uni.navigateBack({
|
||
fail: () => {
|
||
uni.reLaunch({ url: '/pages/index/index' });
|
||
}
|
||
});
|
||
} else {
|
||
// 单层页面栈(如分享页、直接跳转页),智能兜底返回首页
|
||
uni.reLaunch({ url: '/pages/index/index' });
|
||
}
|
||
}
|
||
|
||
function handleHome() {
|
||
emit('home');
|
||
uni.reLaunch({ url: '/pages/index/index' });
|
||
}
|
||
</script>
|
||
|
||
<style scoped>
|
||
/* #ifdef MP-WEIXIN */
|
||
:host {
|
||
display: block;
|
||
width: 100%;
|
||
flex-shrink: 0;
|
||
}
|
||
/* #endif */
|
||
|
||
.yjyf-navbar-wrapper {
|
||
position: relative;
|
||
width: 100%;
|
||
z-index: 990;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.yjyf-navbar {
|
||
width: 100%;
|
||
box-sizing: border-box;
|
||
transition: background-color 0.2s ease;
|
||
}
|
||
|
||
.yjyf-navbar.is-fixed {
|
||
position: fixed;
|
||
top: 0;
|
||
left: 0;
|
||
right: 0;
|
||
z-index: 990;
|
||
}
|
||
|
||
/* 导航内容排版容器 */
|
||
.nav-content {
|
||
position: relative;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
width: 100%;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
/* 1. 绝对居中的标题容器(脱离两端挤压,保障永远物理居中) */
|
||
.nav-title-box {
|
||
position: absolute;
|
||
left: 0;
|
||
right: 0;
|
||
top: 0;
|
||
bottom: 0;
|
||
display: flex;
|
||
align-items: center;
|
||
box-sizing: border-box;
|
||
z-index: 1;
|
||
pointer-events: none;
|
||
}
|
||
|
||
.nav-title-box.align-center {
|
||
justify-content: center;
|
||
text-align: center;
|
||
}
|
||
|
||
.nav-title-box.align-left {
|
||
justify-content: flex-start;
|
||
text-align: left;
|
||
}
|
||
|
||
.nav-title {
|
||
font-size: 34rpx;
|
||
font-weight: 600;
|
||
line-height: 1.4;
|
||
max-width: 100%;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
pointer-events: auto;
|
||
letter-spacing: 0.5rpx;
|
||
}
|
||
|
||
/* 2. 左侧操作区域(返回 / 首页) */
|
||
.nav-left {
|
||
position: relative;
|
||
height: 100%;
|
||
display: flex;
|
||
align-items: center;
|
||
padding-left: 12rpx;
|
||
flex-shrink: 0;
|
||
box-sizing: border-box;
|
||
z-index: 2;
|
||
pointer-events: auto;
|
||
}
|
||
|
||
.back-btn, .home-btn {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
height: 64rpx;
|
||
min-width: 64rpx;
|
||
padding: 0 12rpx;
|
||
border-radius: 32rpx;
|
||
}
|
||
|
||
.back-icon {
|
||
font-size: 56rpx;
|
||
line-height: 1;
|
||
font-weight: 300;
|
||
margin-top: -6rpx;
|
||
}
|
||
|
||
.home-icon {
|
||
font-size: 40rpx;
|
||
line-height: 1;
|
||
}
|
||
|
||
.back-svg-icon, .home-svg-icon {
|
||
width: 36rpx;
|
||
height: 36rpx;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.back-text {
|
||
font-size: 26rpx;
|
||
margin-left: 4rpx;
|
||
}
|
||
|
||
/* 3. 右侧胶囊安全避让占位 */
|
||
.nav-right {
|
||
position: relative;
|
||
height: 100%;
|
||
flex-shrink: 0;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: flex-end;
|
||
padding-right: 12rpx;
|
||
box-sizing: border-box;
|
||
z-index: 2;
|
||
pointer-events: auto;
|
||
}
|
||
|
||
/* 主题体系 */
|
||
/* 1. 白底黑字主题 (white) */
|
||
.theme-white {
|
||
background: #FFFFFF;
|
||
}
|
||
.theme-white.has-border {
|
||
border-bottom: 1rpx solid #F0F0F2;
|
||
}
|
||
.icon-white {
|
||
color: #1F1F1F;
|
||
}
|
||
.title-white {
|
||
color: #1F1F1F;
|
||
}
|
||
|
||
/* 2. 橙金渐变主题 (orange) */
|
||
.theme-orange {
|
||
background-color: #F0710D;
|
||
background-image: linear-gradient(135deg, #FFA93F 0%, #F0710D 100%);
|
||
background-size: 100% 600rpx;
|
||
background-position: 0 0;
|
||
background-repeat: no-repeat;
|
||
}
|
||
.icon-orange {
|
||
color: #FFFFFF;
|
||
}
|
||
.title-orange {
|
||
color: #FFFFFF;
|
||
}
|
||
|
||
/* 3. 透明主题 (transparent) */
|
||
.theme-transparent {
|
||
background: transparent;
|
||
}
|
||
.icon-transparent {
|
||
color: #FFFFFF;
|
||
}
|
||
.title-transparent {
|
||
color: #FFFFFF;
|
||
}
|
||
|
||
/* 占位垫高块 */
|
||
.yjyf-navbar-placeholder {
|
||
width: 100%;
|
||
}
|
||
.placeholder-orange {
|
||
background-color: #F0710D;
|
||
background-image: linear-gradient(135deg, #FFA93F 0%, #F0710D 100%);
|
||
background-size: 100% 600rpx;
|
||
background-position: 0 0;
|
||
background-repeat: no-repeat;
|
||
}
|
||
</style>
|