文件
yjyf/yjyf-app/pages/message/message.vue
MiAn fafddceaf2 feat: 新增发票抬头、晒单、钱包日志等模型及后台管理功能
- 新增 invoice_title、showcase、wallet_log 模型及对应语言包
- 新增后台控制器、视图及搜索字段配置
- 修复服务类目删除保护逻辑
- 优化后台登录页面文案及样式
- 新增前端角色切换逻辑及页面拦截
- 新增 SVG 图标及样式变量
- 修复接口权限及下拉框默认值问题
2026-11-11 17:02:35 +08:00

73 行
1.9 KiB
Vue

<template>
<view class="page" v-if="ready">
<UserMessageView ref="msgRef" :role-type="isMasterRole ? 'master' : 'user'" />
<YjyfMasterTabBar :current="2" v-if="isMasterRole" />
<YjyfTabBar :current="2" @change="onUserTabChange" v-else />
</view>
</template>
<script setup>
import { ref } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
import UserMessageView from '@/components/user/UserMessageView.vue';
import YjyfTabBar from '@/components/YjyfTabBar.vue';
import YjyfMasterTabBar from '@/components/YjyfMasterTabBar.vue';
import { getRole, setRole } from '@/utils/role.js';
const isMasterRole = ref(false);
const ready = ref(false);
const msgRef = ref(null);
let initialShown = false;
function onUserTabChange(idx) {
setRole('user');
uni.reLaunch({ url: `/pages/index/index?tab=${idx}` });
}
onLoad((query) => {
const roleParam = query && query.role ? String(query.role) : '';
let fromMasterPage = false;
try {
const pages = getCurrentPages() || [];
if (pages.length > 1) {
const prevRoute = pages[pages.length - 2]?.route || '';
fromMasterPage = prevRoute.startsWith('pages/master/') && !prevRoute.startsWith('pages/master/apply');
}
} catch (e) {}
const shouldUseMaster = roleParam === 'master' || (!roleParam && fromMasterPage && getRole() === 'master');
if (!shouldUseMaster) {
// 非师傅端明确入口一律收敛至业主端单母页消息 Tab,杜绝误入师傅端
setRole('user');
uni.reLaunch({ url: '/pages/index/index?tab=2' });
return;
}
setRole('master');
isMasterRole.value = true;
ready.value = true;
});
onShow(() => {
if (!ready.value) return;
if (!initialShown) {
initialShown = true;
return;
}
if (msgRef.value?.load) {
msgRef.value.load();
}
});
</script>
<style lang="scss" scoped>
.page {
height: 100vh;
display: flex;
flex-direction: column;
overflow: hidden;
background: $yjyf-bg-page;
}
</style>