Commit 9fa68e3e by liimin

初始提交:销售助手移动端项目,包含 lime-sqlite 编译修复

0 parents
Showing 897 changed files with 5127 additions and 0 deletions
/unpackage
/.idea
/.vscode
/.DS_Store
/.hbuilderx
node_modules
assets/images/sprite.png
assets/css/sprite.scss
<script lang="uts">
// import { updateResolutionConfig } from "@/services/adapter/index.uts";
// #ifdef APP
import { applyScreenOrientationLock } from "@/utils/apply-orientation-lock.uts";
import ws from "@/ws";
// #endif
let firstBackTime = 0;
export default {
onLaunch () {
// #ifdef APP
const sys = uni.getSystemInfoSync();
console.log(`[App] 当前分辨率:${ sys.screenWidth } x ${ sys.screenHeight}`);
// globalStyle.pageOrientation=auto 允许旋转;手机在下方仍 lock 竖屏,Pad unlock FULL_SENSOR
applyScreenOrientationLock();
// #endif
console.log("App Launch");
// 启动时仅做分辨率配置,避免后台定时器/录音模拟导致对象被长时间持有
// updateResolutionConfig();
// 连接(自动登录)
// #ifdef APP
// ws.connect();
// #endif
},
onShow () {
console.log("App Show");
// #ifdef APP
// 与 onLaunch 一致:手机每次回到前台再锁竖屏(auto 下易被系统/框架改回可旋转)
applyScreenOrientationLock();
// #endif
},
onHide () {
console.log("App Hide");
},
// #ifdef APP-ANDROID
onLastPageBackPress () {
console.log("App LastPageBackPress");
if (firstBackTime == 0) {
uni.showToast({
title: "再按一次退出应用",
position: "bottom"
});
firstBackTime = Date.now();
setTimeout(() => {
firstBackTime = 0;
}, 2000);
} else if (Date.now() - firstBackTime < 2000) {
firstBackTime = Date.now();
uni.exit();
}
},
// #endif
onExit () {
console.log("App Exit");
}
};
</script>
<style lang="scss">
/* 引入自定义 CSS 工具类 */
@import url("./common.css");
/* I18n 布局适配:横竖屏 + 分辨率 */
@import "./services/adapter/styles/layout-adapt.scss";
/* 全局默认样式:App 端 view 不支持 font-size,基准字号用 var(--l-font-*) 落在 <text> 上 */
.layout-root {
height: 100%;
min-height: 0;
}
/* #ifdef H5 */
.layout-root {
font-size: 14px;
}
/* #endif */
/* #ifdef H5 */
svg {
display: initial;
}
/* H5 端统一 flex 默认行为,与 App 端保持一致 */
uni-app uni-page-body, uni-app uni-left-window .uni-left-window, uni-app uni-right-window .uni-right-window, uni-app uni-top-window .uni-top-window, uni-app uni-view, uni-app uni-match-media, uni-app uni-swiper, uni-app uni-swiper-item, uni-app uni-movable-area, uni-app uni-movable-view, uni-app uni-cover-view, uni-app uni-list-item, uni-app uni-navigator, uni-app uni-radio-group, uni-app uni-checkbox-group, uni-app uni-scroll-view, uni-app uni-list-view, uni-app uni-unicloud-db, uni-app uni-sticky-section, uni-app uni-sticky-header {
display: flex ;
flex-direction: row ;
}
/* #endif */
.safe-area-top {
margin-top: env(safe-area-inset-top);
}
.uni-tabbar {
// #ifdef H5
display: none;
// #endif
.uni-tabbar__icon {
margin-top: 0;
}
}
.uni-toast {
border-radius: 32rpx;
background-color: rgba(0, 0, 0, 0.8) !important;
}
/* 修复 uview-unix un-segmented 组件在 uni-app X 的样式问题 */
/* color 属性只能在 text、button、input、textarea 上使用 */
.un-segmented__item {
.un-segmented__item__text {
color: #1f2937;
}
}
.un-segmented__item--active {
.un-segmented__item__text {
color: #ffffff;
}
}
</style>
/**
* 精品/轻改 API(从 gl_tape/api/module/boutique.js 迁移)
*/
import http from "@/api/request/http.uts";
/** 轻改素材配置 */
export function getBoutiqueMaterialConfig(data: UTSJSONObject): Promise<any> {
return http.post({
"method": "dj.api.boutique.recepiton.material.merchant.detail",
"projectName": "boutique",
...data
} as UTSJSONObject);
}
/** 查询商户套餐推荐配置列表 */
export function getBoutiquePackageList(data: UTSJSONObject): Promise<any> {
return http.post({
"method": "dj.api.smartcarlife.receptionMaterialRecommendPackageConfig.getByMerchantId",
"projectName": "boutique",
...data
} as UTSJSONObject);
}
// 新历史订单列表
export function getOrderListPage(data: UTSJSONObject): Promise<any> {
return http.post({
'method': 'dj.pad.api.history.order.page',
'projectName': 'pad',
...data
} as UTSJSONObject)
}
\ No newline at end of file
/**
* 公共 API(从 gl_tape/api/module/common.js 迁移)
*/
import http from "@/api/request/http.uts";
/** 获取交付人员列表 */
export function getEmployeeListApi(data: UTSJSONObject): Promise<any> {
return http.post({
"method": "dj.api.smartcarlife.employee.getByMerchantId.new",
"projectName": "boutique",
"sceneList": [0],
...data
} as UTSJSONObject);
}
/** 获取门店主营车品牌 */
export function getMerchantCarBrandList(merchantIdList: Array<number | string>): Promise<any> {
return http.post({
method: "merchants.api.open.merchant.info",
projectName: "merchants",
merchantIdList,
merchantInfoSwitch: {
brandFlag: true
}
} as UTSJSONObject, false, "merchant");
}
/**
* 车型
*/
export function getCarBrandsListApi(data: UTSJSONObject): Promise<any> {
return http.post({
method: "scrm.api.carlife.common.getCarSeriesList",
...data
} as UTSJSONObject, false, "scrm");
}
/**
* 查询门店支付配置
*/
export function findPayInfo(data: UTSJSONObject): Promise<any> {
return http.post({
method: "dj.api.smartcarlife.recepiton.pay.findPayInfoConfigListByMerchantId",
projectName: "boutique",
...data
} as UTSJSONObject);
}
import http from '@/api/request/http.uts'
/**查询客户档案列表 */
export function getCustomerInfoListApi(data: UTSJSONObject): Promise<any> {
return http.post({
'method': 'dj.api.smartcarlife.customervisits.customerInfoList',
'projectName': 'boutique',
...data
} as UTSJSONObject)
}
export function getMaterialResponsePage(data: UTSJSONObject): Promise<any> {
return http.post({
'method': 'dj.api.smartcarlife.customervisits.getMaterialResponsePage',
'projectName': 'boutique',
...data
} as UTSJSONObject)
}
export function getMaterialDetail(data: UTSJSONObject): Promise<any> {
return http.post({
'method': 'dj.api.smartcarlife.customervisits.getMaterialById',
'projectName': 'boutique',
...data
} as UTSJSONObject)
}
// /**接待客户素材
// *
// */
// getMaterialResponsePage (data) {
// return http.post({
// method: 'dj.api.smartcarlife.customervisits.getMaterialResponsePage',
// projectName: 'boutique',
// ...data
// })
// },
// /**素材详情 查询素材详情 */
// getMaterialDetail (data) {
// return http.post({
// method: 'dj.api.smartcarlife.customervisits.getMaterialById',
// projectName: 'boutique',
// ...data
// })
// },
\ No newline at end of file
/**
* 环境配置(从 gl_tape 迁移)
* 0: ip 本地 1: dev 开发 2: test 测试 3: prod 生产 4: beta 预发布
*/
const TARGET_OPTIONS = ["ip", "dev", "test", "prod", "beta"];
const TARGET_INDEX = 2;
// 为兼容 UTS 的限制,这里不再使用复杂的类型约束,统一用 UTSJSONObject
type SecretKeyItem = UTSJSONObject;
type SecretKeyMap = UTSJSONObject;
type SignSecretKeyItem = UTSJSONObject;
const secretKeyMap: UTSJSONObject = {
ip: {},
dev: {
sso: {
appKey: "8b31ae1009ccb0f96130ca4bd90e3d89",
secret: "02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b"
}
},
test: {
sso: {
appKey: "8b31ae1009ccb0f96130ca4bd90e3d89",
secret: "02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b"
}
},
prod: {
sso: {
appKey: "8b31ae1009ccb0f96130ca4bd90e3d89",
secret: "02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b"
}
},
beta: {
sso: {
appKey: "8b31ae1009ccb0f96130ca4bd90e3d89",
secret: "02d60f17ae714872845d2aa9d3b087e109ccb0f96130ca4b"
}
}
};
const domainMap: UTSJSONObject = {
ip: "http://192.168.1.122:8292",
dev: "https://scrm.dev.glsx.com.cn",
test: "https://scrm.test.glsx.com.cn",
beta: "https://scrm.beta.glsx.com.cn",
prod: "https://scrm.glsx.com.cn"
};
const evaluationDomainMap: UTSJSONObject = {
ip: "http://192.168.1.221:5003",
dev: "http://gsc.dev.glsx.com.cn",
beta: "https://gsc.beta.glsx.com.cn",
test: "http://gsc.test.glsx.com.cn",
prod: "https://gsc.glsx.com.cn",
pet: "https://cdptest.glsx.com.cn"
};
const djDomainMap: UTSJSONObject = {
ip: "http://192.168.1.122:8292",
dev: "http://dj.dev.glsx.com.cn",
beta: "https://dj.beta.glsx.com.cn",
test: "https://dj.test.glsx.com.cn",
prod: "https://dj.glsx.com.cn",
pet: "https://cdptest.glsx.com.cn"
};
const merchantDomainMap: UTSJSONObject = {
ip: "http://rop-merchant.dev.glsx.com.cn",
dev: "http://rop-merchant.dev.glsx.com.cn",
beta: "https://rop-merchant.beta.glsx.com.cn",
test: "https://rop-merchant.test.glsx.com.cn",
prod: "https://commodity.glsx.com.cn",
pet: ""
};
const djSecretKeyMap: UTSJSONObject = {
ip: { appKey: "48e5e13229b82c1b4e6e8c96151f0637", secret: "c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b" },
dev: { appKey: "48e5e13229b82c1b4e6e8c96151f0637", secret: "c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b" },
test: { appKey: "48e5e13229b82c1b4e6e8c96151f0637", secret: "c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b" },
beta: { appKey: "48e5e13229b82c1b4e6e8c96151f0637", secret: "c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b" },
prod: { appKey: "d7ffc3346fc9a45bccaaa35300d59022", secret: "4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353" },
pet: { appKey: "d7ffc3346fc9a45bccaaa35300d59022", secret: "4bc07f8868374c49a4661d603377e3106fc9a45bccaaa353" }
};
const signSecretKeyMap: UTSJSONObject = {
ip: {
appKey: "App_PromoteBusiness",
secret: "c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b",
carBasrUrl: "http://qcdidicb.glsx.com.cn/router",
pdfUrl:
"https://jinrong-huidan-test.oss-cn-shenzhen.aliyuncs.com/testdev/8981c8ca-8b30-436e-bb17-82fb6a53a3c4%E4%BA%8C%E6%89%8B%E8%BD%A6%E8%BD%AC%E8%AE%A9%E5%8D%8F%E8%AE%AE.pdf"
},
dev: {
appKey: "App_PromoteBusiness",
secret: "c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b",
carBasrUrl: "http://qcdidicb.glsx.com.cn/router",
pdfUrl:
"https://jinrong-huidan-test.oss-cn-shenzhen.aliyuncs.com/testdev/8981c8ca-8b30-436e-bb17-82fb6a53a3c4%E4%BA%8C%E6%89%8B%E8%BD%A6%E8%BD%AC%E8%AE%A9%E5%8D%8F%E8%AE%AE.pdf"
},
test: {
appKey: "App_PromoteBusiness",
secret: "c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b",
carBasrUrl: "http://qcdidicb.glsx.com.cn/router",
pdfUrl:
"https://jinrong-huidan-test.oss-cn-shenzhen.aliyuncs.com/testdev/8981c8ca-8b30-436e-bb17-82fb6a53a3c4%E4%BA%8C%E6%89%8B%E8%BD%A6%E8%BD%AC%E8%AE%A9%E5%8D%8F%E8%AE%AE.pdf"
},
beta: {
appKey: "App_PromoteBusiness",
secret: "c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b",
carBasrUrl: "http://didicb.glsx.com.cn/router",
pdfUrl:
"https://dj-oss-fastdfs-release.oss-cn-shenzhen.aliyuncs.com/release/3b7558fa-8b73-48ce-af40-7b853b0ea7de%E4%BA%8C%E6%89%8B%E8%BD%A6%E8%BD%AC%E8%AE%A9%E5%8D%8F%E8%AE%AE.pdf?wework_cfm_code=MvGt9rGpf0SNZt3fX0sBRZyHAe4qyfG0tz%2BFurp9RbBYoiLzPGcBycaKYEJM76NISOqT4SHJWZi8VU6YBosMk4ZDmdsk7bDma%2FQOkR8GLN7rZHtT3dOTFpQSKB3yR45vv%2BxKpsogpxQr7pO%2BtIwK6JWcEobZT%2FYnTEzlDwnhdbAt2emEro5iNhhuIIqDJiTM9pmgchS7G%2F77HbSGCNpq7oI%3D"
},
prod: {
appKey: "App_PromoteBusiness",
secret: "c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b",
carBasrUrl: "http://didicb.glsx.com.cn/router",
pdfUrl:
"https://dj-oss-fastdfs-release.oss-cn-shenzhen.aliyuncs.com/release/3b7558fa-8b73-48ce-af40-7b853b0ea7de%E4%BA%8C%E6%89%8B%E8%BD%A6%E8%BD%AC%E8%AE%A9%E5%8D%8F%E8%AE%AE.pdf?wework_cfm_code=MvGt9rGpf0SNZt3fX0sBRZyHAe4qyfG0tz%2BFurp9RbBYoiLzPGcBycaKYEJM76NISOqT4SHJWZi8VU6YBosMk4ZDmdsk7bDma%2FQOkR8GLN7rZHtT3dOTFpQSKB3yR45vv%2BxKpsogpxQr7pO%2BtIwK6JWcEobZT%2FYnTEzlDwnhdbAt2emEro5iNhhuIIqDJiTM9pmgchS7G%2F77HbSGCNpq7oI%3D"
},
pet: {
appKey: "App_PromoteBusiness",
secret: "c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b",
carBasrUrl: "http://qcdidicb.glsx.com.cn/router",
pdfUrl:
"https://jinrong-huidan-test.oss-cn-shenzhen.aliyuncs.com/testdev/8981c8ca-8b30-436e-bb17-82fb6a53a3c4%E4%BA%8C%E6%89%8B%E8%BD%A6%E8%BD%AC%E8%AE%A9%E5%8D%8F%E8%AE%AE.pdf"
}
};
const PATH_ENUM = {
sso: "/rop-scrm-sso/",
shopmall: "/rop-scrm-shopmall/",
coupon: "/rop-scrm-coupon/",
carlife: "/rop-scrm-carlife/",
live: "/rop-scrm-live/",
equity: "/rop-scrm-equity/",
entmicro: "/rop-scrm-entmicro/",
wechat: "/rop-scrm-wechat/",
boutiquecoupon: "/rop-scrm-boutiquecoupon/",
material: "/rop-scrm-marketing/",
sop: "/rop-scrm-sop/",
customercollect: "/rop-scrm-bigdatautil/",
mindworkplate: "/rop-dj-smartcarlife/",
drac: "/rop-scrm-entmicro/",
busassistant: "/rop-scrm-busassistant/",
boutique: "/rop-dj-car-boutique/",
merchants: "/rop-merchants/",
pad: "/rop-dj-pad/",
clue: "/rop-scrm-clue/",
evaluation: "/gsc-vcp-pad-facade",
staffMiniprogram: "/rop-dj-staff-miniprogram/"
};
const rawTarget = TARGET_OPTIONS[TARGET_INDEX] as string | null;
const currentTarget = rawTarget != null ? rawTarget : "test";
function pickEnvObject(source: UTSJSONObject): UTSJSONObject {
const currentValue = source[currentTarget] as UTSJSONObject | null;
if (currentValue != null) {
return currentValue;
}
const fallbackValue = source["test"] as UTSJSONObject | null;
return fallbackValue != null ? fallbackValue : {} as UTSJSONObject;
}
function pickEnvString(source: UTSJSONObject): string {
const currentValue = source[currentTarget] as string | null;
if (currentValue != null) {
return currentValue;
}
const fallbackValue = source["test"] as string | null;
return fallbackValue != null ? fallbackValue : "";
}
export const secretKey: SecretKeyMap = pickEnvObject(secretKeyMap) as SecretKeyMap;
export const domain: string = pickEnvString(domainMap);
export const evaluationDomain: string = pickEnvString(evaluationDomainMap);
export const djDomain: string = pickEnvString(djDomainMap);
export const merchantDomain: string = pickEnvString(merchantDomainMap);
export const djSecretKey: SecretKeyItem = pickEnvObject(djSecretKeyMap) as SecretKeyItem;
export const signSecretKey: SignSecretKeyItem = pickEnvObject(signSecretKeyMap) as SignSecretKeyItem;
export const pathEnum: UTSJSONObject = PATH_ENUM;
export const pathEnumExport: UTSJSONObject = PATH_ENUM;
// env 仅用于区分当前环境标签,这里直接按 TARGET_INDEX 映射为字符串
export const env: string = TARGET_INDEX == 3 ? "production" : (TARGET_INDEX == 1 ? "develop" : "test");
export * as receiption from "./receiption.uts";
import http from "@/api/request/http.uts";
export async function getToken(params: UTSJSONObject): Promise<UTSJSONObject> {
const data: UTSJSONObject = {
projectName: "boutique",
...params
};
return http.fetch("dj.api.smartcarlife.recepiton.customer.oss.getToken", data, false, "dj");
}
export async function saveRecCustomer(params: UTSJSONObject): Promise<boolean> {
const data: UTSJSONObject = {
projectName: "boutique",
...params
};
console.log("[saveRecCustomer] request", data);
const res = await http.fetch("dj.api.smartcarlife.recepiton.customer.saveRecCustomer", data, false, "dj");
console.log("[saveRecCustomer] response", res);
return res as boolean;
}
export async function searchRecordingEndTime(params: UTSJSONObject): Promise<string> {
const data: UTSJSONObject = {
projectName: "boutique",
...params
};
const d = http.fetch("dj.api.smartcarlife.recepiton.customer.searchRecordingEndTime", data, false, "dj");
// console.log("🚀 ~ getToken ~ d:", d)
return d as Promise<string>;
}
export async function getMerchantPerformance(params: UTSJSONObject): Promise<any> {
const data: UTSJSONObject = {
projectName: 'boutique',
...params
}
return await http.fetch("dj.api.car.boutique.inspection.findMerchantPerformance", data, true, "dj")
}
/** 查询当前门店客户档案列表(预录列表) */
export async function getCustomerFileList(params: UTSJSONObject): Promise<any> {
const data: UTSJSONObject = {
projectName: 'boutique',
...params
}
return await http.fetch("dj.api.smartcarlife.customervisits.customerInfoPage", data, true, "dj")
}
/** 查询当前门店接待复盘列表(接待复盘列表) */
export async function getReceptionList(params: UTSJSONObject): Promise<any> {
const data: UTSJSONObject = {
projectName: 'boutique',
...params
}
return await http.fetch("dj.api.smartcarlife.reception.customer.page", data, true, "dj")
}
export async function findAllSence(params: UTSJSONObject): Promise<any> {
const data: UTSJSONObject = {
projectName: 'boutique',
...params
}
return await http.fetch("dj.api.smartcarlife.customervisits.findAllSence", data, true, "dj")
}
// 根据客户标签
export async function findCustomerTags(params: UTSJSONObject): Promise<any> {
const data: UTSJSONObject = {
projectName: 'boutique',
...params
}
return await http.fetch("dj.api.smartcarlife.customervisits.findSenceTag", data, true, "dj")
}
export async function saveVisitsInfo(params: UTSJSONObject): Promise<any> {
const data: UTSJSONObject = {
projectName: 'boutique',
...params
}
return await http.fetch("dj.api.smartcarlife.customervisits.saveVisitsInfo", data, true, "dj")
}
export async function updateVisitsInfo(params: UTSJSONObject): Promise<any> {
const data: UTSJSONObject = {
projectName: 'boutique',
...params
}
return await http.fetch("dj.api.smartcarlife.customervisits.updateVisitsInfo", data, true, "dj")
}
export async function findVisitsInfo(params: UTSJSONObject): Promise<any> {
const data: UTSJSONObject = {
projectName: 'boutique',
...params
}
return await http.fetch("dj.api.smartcarlife.customervisits.findVisitsInfo", data, true, "dj")
}
export async function findCheckResultByBatchId(params: UTSJSONObject): Promise<any> {
const data: UTSJSONObject = {
projectName: 'pad',
...params
}
return await http.fetch("dj.pad.api.reception.findCheckResultByBatchId", data, true, "dj")
}
export async function getShortUrl(params: UTSJSONObject): Promise<any> {
const data: UTSJSONObject = {
projectName: 'boutique',
...params
}
return await http.fetch("dj.api.car.boutique.inspection.batch.file.short.url", data, true, "dj")
}
export async function getAiagent(params: UTSJSONObject): Promise<any> {
const data: UTSJSONObject = {
projectName: 'pad',
...params
}
return await http.fetch("dj.pad.api.aiagent.get.special.agent", data, true, "dj")
}
// /**获取智能体 */
// getAiagent (data = {}) {
// return http.post({
// method: 'dj.pad.api.aiagent.get.special.agent',
// projectName: 'pad',
// ...data
// })
// }
// /**
// * 查询对话内容
// */
// findConversationDetailByBatchIdNew(data){
// return http.post({
// method: 'dj.pad.api.reception.findConversationDetailByBatchIdNew',
// projectName: 'pad',
// ...data
// })
// },
// /**查询质检列表|侧边栏 */
// findCheckResultByBatchId (data) {
// return http.post({
// method: 'dj.pad.api.reception.findCheckResultByBatchId',
// projectName: 'pad',
// ...data
// })
// },
// /**话术标签 */
// findRecordingTagByBatchId(data) {
// return http.post({
// method: 'dj.pad.api.reception.findRecordingTagByBatchId',
// projectName: 'pad',
// ...data
// })
// },
// getShortUrl(data){
// return http.post({
// method: 'dj.api.car.boutique.inspection.batch.file.short.url',
// projectName: 'boutique',
// ...data
// })
// },
/**
* 查询客户档案详情
*/
// findVisitsInfo (data) {
// return http.post({
// method: 'dj.api.smartcarlife.customervisits.findVisitsInfo',
// projectName: 'boutique',
// ...data
// })
// },
// findCustomerTags (data) {
// return http.post({
// method: 'dj.api.smartcarlife.customervisits.findSenceTag',
// projectName: 'boutique',
// ...data
// })
// },
// {
// "customerTag": "23,24,26,60",
// "merchantId": 44209510,
// "bussinessScene": 2,
// "ownerName": "林磊1122",
// "ownerPhone": "13001362233",
// "brandModel": "奥迪A3(进口)",
// "receptionScene": 6,
// "arrivalDate": "2026-03-30",
// "customerTagName": "40岁以上,已婚,企业高管及负责人,车架号较好的",
// "carModelId": 1145128,
// "carBrand": "奥迪(进口)",
// "carBrandId": 2128,
// "oneCarBrand": "奥迪",
// "oneCarBrandId": 2125
// }
// /*
// * 保存客户档案
// */
// saveVisitsInfo (data) {
// console.log("保存客户档案",data);
// return http.post({
// method: 'dj.api.smartcarlife.customervisits.saveVisitsInfo',
// projectName: 'boutique',
// ...data
// })
// },
// /**
// * 更新客户档案
// */
// updateVisitsInfo (data) {
// console.log("更新客户档案",data);
// return http.post({
// method: 'dj.api.smartcarlife.customervisits.updateVisitsInfo',
// projectName: 'boutique',
// ...data
// })
// },
/**ҵ������ */
// getMerchantPerformance(data){
// return http.post({
// method: 'dj.api.car.boutique.inspection.findMerchantPerformance',
// projectName: 'boutique',
// ...data
// })
// },
// 传参
// {
// "merchantIdList": 44218339,
// "sceneType": 1,
// "startDate": "2026-03-01",
// "endDate": "2026-03-31",
// "hmzxFlag": 3
// }
// /** 查询接待记录列表 */
// getReceptionList(data) {
// return http.post({
// method: 'dj.api.smartcarlife.reception.customer.page',
// projectName: 'boutique',
// ...data
// })
// {
// "merchantId": 44218339,
// "pageNum": 1,
// "pageSize": 10,
// "reviewFlag": 0, // 0=已复盘,1=未复盘
// "orderFinishFlag": 0,
// "bussinessType": 2
// }
/**查询当前门店客户档案列表 */
// getCustomerFileList (data) {
// return http.post({
// method: 'dj.api.smartcarlife.customervisits.customerInfoPage',
// projectName: 'boutique',
// ...data
// })
// },
// 预录列表传参
// {
// "pageNum": 1,
// "pageSize": 10,
// "receptionStatus": 1,
// "merchantId": 44218339,
// "bussinessScene": 2,
// "startTime": "2026-03-18 00:00:00",
// "endTime": "2026-03-18 23:59:59"
// }
// },
// /** 接待统计 */
// getReceptionStatistics(data) {
// return http.post({
// method: 'dj.api.smartcarlife.reception.customer.statistics',
// projectName: 'boutique',
// ...data
// })
// },
import { storage } from "../../utils/storage.uts";
import { djDomain, djSecretKey, domain, merchantDomain, pathEnum, secretKey } from "../env.uts";
import { sign } from "./sign.uts";
type HostType = "dj" | "ip" | "merchant" | "scrm";
const HOST = {
"scrm": domain,
"dj": djDomain,
"merchant": merchantDomain,
"ip": "http://192.168.1.125:8080"
} as UTSJSONObject;
/**
* HTTP 请求封装(从 gl_tape/api/request/http.js 迁移)
* - 统一处理 GET / POST
* - 自动注入 appKey / secret / sessionId 等并完成参数签名
* - 处理业务 code 及登录态失效跳转
*/
class Request {
/**
* 业务方法调用封装
* @param method ROP 接口方法名
* @param data 业务参数
* @param returnAll 是否返回完整响应体
* @param hostType 域名类型
*/
fetch(method: string, data: UTSJSONObject, returnAll: boolean = true, hostType: HostType | null = null): Promise<any> {
const payload: UTSJSONObject = {};
payload.method = method;
// 合并业务参数
for (const key in data) {
payload[key] = data[key];
}
return this.post(payload, returnAll, hostType, null);
}
get(params: UTSJSONObject, returnAll: boolean = false, hostType: HostType | null = null): Promise<any> {
return this.request("GET", params, returnAll, hostType, null);
}
post(params: UTSJSONObject, returnAll: boolean = false, hostType: HostType | null = null, timeout: null | number = null): Promise<any> {
return this.request("POST", params, returnAll, hostType, timeout);
}
/**
* 简单的原始 uni.request 封装
*/
uni_request(options: UTSJSONObject): Promise<any> {
const url = options.url as string;
const method = (options.method ?? "GET") as string;
const data = (options.data ?? ({} as UTSJSONObject)) as UTSJSONObject;
const header = (options.header ?? ({} as UTSJSONObject)) as UTSJSONObject;
const dataType = (options.dataType ?? "json") as string;
const responseType = (options.responseType ?? "text") as string;
return new Promise((resolve) => {
uni.request({
url,
data,
method,
header,
dataType,
responseType,
success: (response) => {
const resData = response.data;
resolve(resData != null ? resData : ({} as UTSJSONObject));
}
});
});
}
/**
* 组装 ROP 请求参数并完成签名
*/
private getData(params: UTSJSONObject, hostType: HostType): UTSJSONObject {
let projectName = (params.projectName ?? "") as string;
if (projectName == "") {
projectName = this.getRopProject(params.method as string);
} else {
// 使用后删除 projectName 字段(UTS 不支持 delete,改为置空)
params.projectName = null;
}
let appKey = "48e5e13229b82c1b4e6e8c96151f0637";
let secret = "c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b";
const projectSecret = secretKey[projectName] as null | UTSJSONObject;
if (projectSecret != null) {
appKey = projectSecret.appKey as string;
secret = projectSecret.secret as string;
}
if (hostType == "dj") {
const djKey = djSecretKey as UTSJSONObject;
appKey = djKey.appKey as string;
secret = djKey.secret as string;
}
const rawSessionId = storage.get("sessionId");
const sessionId = (rawSessionId != null && rawSessionId != "") ? `${rawSessionId}` : null;
let noSignAttr: string[] = [];
if (params.sessionId == null && sessionId != null && sessionId != "") {
params.sessionId = sessionId;
}
if (params.delSessionId != null) {
params.sessionId = null;
params.delSessionId = null;
}
if (params.noSignAttr != null) {
noSignAttr = params.noSignAttr as string[];
params.noSignAttr = null;
}
params.v = "1.0.0";
params.format = "json";
params.locale = "zh_CN";
params.source = "app";
params.appKey = appKey;
return sign(params, secret, noSignAttr);
}
/**
* 根据 method 解析出 rop 项目名
* @example sso.xxx.xxx => 第三个段作为项目名
*/
private getRopProject(method: string): string {
const parts = method.split(".");
if (parts.length >= 3) {
return parts[2];
}
return "";
}
private request(
requestMethod: "GET" | "POST",
params: UTSJSONObject,
returnAll: boolean,
hostType: HostType | null,
timeout: null | number
): Promise<any> {
const finalHostType: HostType = hostType != null ? hostType : "dj";
return new Promise((resolve, reject) => {
uni.getNetworkType({
success: (res) => {
if (res.networkType == "none") {
uni.hideLoading();
uni.showToast({
title: "网络异常",
icon: "none"
});
reject("网络异常");
}
}
});
const header = requestMethod === "POST"
? { "content-type": "application/x-www-form-urlencoded" }
: { "Cache-Control": "no-cache" };
let projectName = (params.projectName ?? "") as string;
if (projectName == "") {
projectName = this.getRopProject(params.method as string);
}
const path = pathEnum[projectName] ?? "";
const requestData = this.getData(params, finalHostType);
// Android 原生层对 data 类型敏感:传 string 可能触发 ClassCastException
// 改为传 UTSJSONObject(全 string 值),由框架序列化为 form-urlencoded
const formDataObj: UTSJSONObject = {};
for (const key in requestData) {
const val = requestData[key];
if (val != null) {
let valStr: string;
if (typeof val === "string") {
valStr = val;
} else if (typeof val === "number" || typeof val === "boolean") {
valStr = `${val}`;
} else {
valStr = JSON.stringify(val);
}
formDataObj[key] = valStr;
}
}
const hostUrl = HOST[finalHostType] as string;
const pathStr = (path != null && path != "") ? `${path}` : "";
const methodStr = (requestData.method != null && requestData.method != "") ? `${requestData.method}` : "";
uni.request({
url: `${hostUrl}${pathStr}router?method=${methodStr}`,
data: formDataObj,
method: requestMethod,
header,
dataType: "json",
responseType: "text",
timeout: timeout ?? 60_000,
success: (response) => {
const resData: any | null = response.data;
const statusCode = response.statusCode;
if (resData == null || statusCode != 200) {
uni.hideLoading();
let errMsg = "";
if (resData == null) {
errMsg = "获取数据失败,请重试。";
} else {
errMsg = "服务器暂时不可用,请稍后再次尝试。";
}
reject(errMsg);
return;
}
const dataObj = resData as UTSJSONObject;
const code = (dataObj.code ?? "") as any;
const message = (dataObj.message ?? "") as string;
if (returnAll) {
resolve(resData);
return;
}
if (code == 20 || code == 21) {
const pages = getCurrentPages();
const currentPage = pages[pages.length - 1];
uni.hideLoading();
if (currentPage.route != "pages/common/login/index") {
uni.reLaunch({
url: "/pages/common/login/index"
});
}
} else {
if (`${code}` == "0") {
const bizData: any | null = dataObj.data as any | null;
if (bizData != null) {
resolve(bizData);
} else {
resolve({} as UTSJSONObject);
}
} else {
uni.hideLoading();
uni.showToast({
title: message != "" ? message : "系统异常",
icon: "none"
});
}
}
},
fail: (error) => {
uni.hideLoading();
console.error(`${params.method} 接口异常:`, error);
uni.showToast({
title: JSON.stringify(error),
icon: "error"
});
reject(error);
},
complete: () => {
uni.stopPullDownRefresh();
}
});
});
}
}
const http = new Request();
export default http;
/**
* 简化版 qs.stringify(从 gl_tape/lib/qs.js 核心逻辑提取)
* 仅支持简单对象序列化,不处理复杂嵌套
*/
export type Encoder = (str: string) => string
export type Sorter = (a: any, b: any) => number
export type GenerateArrayPrefix = (prefix: string, key: string) => string
export type Formatter = (str: string) => string
export type SerializeDate = (date: Date) => string
export type Filter = (prefix: string, value: any) => any
export type StringifyOptions = {
allowDots?: boolean
encoder?: Encoder
encodeValuesOnly?: boolean
filter?: any // Function | Array<string>
formatter?: Formatter
generateArrayPrefix?: GenerateArrayPrefix
prefix?: string
serializeDate?: SerializeDate
skipNulls?: boolean
sort?: Sorter
strictNullHandling?: boolean
}
function defaultEncoder(str: string): string {
const res = encodeURIComponent(str);
return res ?? str;
}
function defaultGenerateArrayPrefix(p: string, k: string): string {
return `${p}[${k}]`;
}
function defaultFormatter(str: string): string {
return str;
}
function defaultSerializeDate(date: Date): string {
return date.toISOString();
}
function stringifyRecursive(
obj: any | null,
options: StringifyOptions
): string {
const prefix = options.prefix ?? "";
const encoder = options.encoder !== null ? options.encoder : (str: string): string => defaultEncoder(str);
const filter = options.filter;
const sort = options.sort;
const strictNullHandling = options.strictNullHandling ?? false;
const skipNulls = options.skipNulls ?? false;
const encodeValuesOnly = options.encodeValuesOnly ?? false;
const generateArrayPrefix = options.generateArrayPrefix !== null ? options.generateArrayPrefix : (p: string, k: string): string => defaultGenerateArrayPrefix(p, k);
const allowDots = options.allowDots ?? false;
const formatter = options.formatter !== null ? options.formatter : (str: string): string => defaultFormatter(str);
const serializeDate = options.serializeDate !== null ? options.serializeDate : (date: Date): string => defaultSerializeDate(date);
let processedObj: any | null = obj;
if (typeof filter === "function") {
const filterFn = filter as Filter;
// UTS requires parameter types to match exactly, but 'obj' is 'any | null'
// and Filter expects 'any'. Casting 'obj' to 'any' is safe here.
processedObj = filterFn(prefix, obj as any);
} else if (obj instanceof Date) {
processedObj = serializeDate(obj);
} else if (obj === null) {
if (strictNullHandling) {
return encoder(prefix);
}
processedObj = "";
}
if (typeof processedObj === "string" ||
typeof processedObj === "number" ||
typeof processedObj === "boolean") {
const keyValue = encodeValuesOnly ? prefix : encoder(prefix);
const valueStr = typeof processedObj === "string" ? processedObj as string : `${processedObj}`;
return `${formatter(keyValue)}=${formatter(encoder(valueStr))}`;
}
const values: string[] = [];
if (processedObj === null) {
return "";
}
let objKeys: string[] = [];
let targetObj: any | null = processedObj;
if (Array.isArray(filter)) {
objKeys = filter as string[];
// If filter is array, we still need to know how to access processedObj
// If processedObj is not array/map, we might need to convert it to be accessible
if (!Array.isArray(processedObj) && !(processedObj instanceof UTSJSONObject)) {
targetObj = new UTSJSONObject(processedObj);
}
} else {
// if (processedObj !== null) {
if (Array.isArray(processedObj)) {
const arr = processedObj as any[];
for (let i = 0; i < arr.length; i++) {
objKeys.push(`${i}`);
}
} else if (processedObj instanceof UTSJSONObject) {
const objMap = (processedObj as UTSJSONObject).toMap();
objMap.forEach((_, key) => {
objKeys.push(key);
});
} else {
const json = new UTSJSONObject(processedObj);
targetObj = json;
const objMap = json.toMap();
objMap.forEach((_, key) => {
objKeys.push(key);
});
}
if (sort !== null) {
objKeys = objKeys.sort(sort);
}
// }
}
for (const key of objKeys) {
let value: any | null = null;
if (Array.isArray(targetObj)) {
const idx = Number.parseInt(key);
if (!Number.isNaN(idx)) {
value = (targetObj as any[])[idx];
}
} else {
value = (targetObj as UTSJSONObject)[key];
}
if (skipNulls && value === null) {
continue;
}
const nextPrefix = Array.isArray(targetObj)
? (prefix !== "" ? generateArrayPrefix(prefix, key) : key)
: (prefix !== "" ? prefix + (allowDots ? `.${key}` : `[${key}]`) : key);
const newOptions: StringifyOptions = {
prefix: nextPrefix,
encoder,
filter,
sort,
strictNullHandling,
skipNulls,
encodeValuesOnly,
generateArrayPrefix,
allowDots,
serializeDate,
formatter
};
const result = stringifyRecursive(value, newOptions);
if (result !== "") {
values.push(result);
}
}
return values.join("&");
}
/**
* 将对象序列化为 query string
* @param obj 要序列化的对象
* @param options 配置选项
* @returns 序列化后的字符串,如 "key1=val1&key2=val2"
*/
export function stringify(
obj: UTSJSONObject,
options: StringifyOptions = {} as StringifyOptions
): string {
return stringifyRecursive(obj, options);
}
/**
* SHA1 算法(从 gl_tape/lib/sha1.js 迁移为 UTS)
* 字符串加密成 hex 字符串
*/
function encodeUTF8(s: string): number[] {
const r: number[] = [];
let i = 0;
while (i < s.length) {
const c = s.charCodeAt(i) as number;
if (c < 0x80) {
r.push(c);
} else if (c < 0x800) {
r.push(0xc0 + ((c >> 6) & 0x1f), 0x80 + (c & 0x3f));
} else {
const x = c ^ 0xd800;
if (x >> 10 == 0) {
const next = (s.charCodeAt(i + 1) as number) ^ 0xdc00;
const code = (x << 10) + next + 0x10000;
r.push(0xf0 + ((code >> 18) & 0x7), 0x80 + ((code >> 12) & 0x3f));
i++;
} else {
r.push(0xe0 + ((c >> 12) & 0xf));
}
r.push(0x80 + ((c >> 6) & 0x3f), 0x80 + (c & 0x3f));
}
i++;
}
return r;
}
export function sha1(s: string): string {
const data = new Uint8Array(encodeUTF8(s));
const l = ((data.length + 8) >>> 6 << 4) + 16;
const sBuf = new ArrayBuffer(l << 2);
const sView = new Uint8Array(sBuf);
sView.set(data);
const s32 = new Uint32Array(sBuf);
const t = new DataView(sBuf);
let i = 0;
while (i < l) {
s32[i] = t.getUint32(i << 2, false);
i++;
}
s32[data.length >> 2] |= 0x80 << (24 - (data.length & 3) * 8);
s32[l - 1] = data.length << 3;
const w: number[] = [];
// 预先初始化 w 数组为 80 个元素,避免 UTS 下标越界
let wInit = 0;
while (wInit < 80) {
w.push(0);
wInit++;
}
const k = [1518500249, 1859775393, -1894007588, -899497514];
let m0 = 1732584193;
let m1 = -271733879;
let m2 = 0;
let m3 = 0;
let m4 = -1009589776;
m2 = ~m0;
m3 = ~m1;
const rol = (n: number, c: number): number => (n << c) | (n >>> (32 - c));
const f0 = (): number => (m1 & m2) | (~m1 & m3);
const f1 = (): number => m1 ^ m2 ^ m3;
const f2 = (): number => (m1 & m2) | (m1 & m3) | (m2 & m3);
const f3 = (): number => m1 ^ m2 ^ m3;
i = 0;
while (i < s32.length) {
const o0 = m0;
const o1 = m1;
const o2 = m2;
const o3 = m3;
const o4 = m4;
let j = 0;
while (j < 80) {
const wj = j < 16 ? s32[i + j] : rol(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1);
w[j] = wj;
const f = j < 20 ? f0() : j < 40 ? f1() : j < 60 ? f2() : f3();
const kj = k[Math.floor(j / 20)];
const tVal = (rol(m0, 5) + f + m4 + wj + kj) | 0;
m4 = m3;
m3 = m2;
m2 = rol(m1, 30);
m1 = m0;
m0 = tVal;
j++;
}
m0 = (m0 + o0) | 0;
m1 = (m1 + o1) | 0;
m2 = (m2 + o2) | 0;
m3 = (m3 + o3) | 0;
m4 = (m4 + o4) | 0;
i += 16;
}
const outBuf = new ArrayBuffer(20);
const outView = new DataView(outBuf);
outView.setUint32(0, m0);
outView.setUint32(4, m1);
outView.setUint32(8, m2);
outView.setUint32(12, m3);
outView.setUint32(16, m4);
const bytes = new Uint8Array(outBuf);
let hex = "";
let hi = 0;
while (hi < bytes.length) {
const e = bytes[hi];
hex += (e < 16 ? "0" : "") + e.toString(16);
hi++;
}
return hex;
}
import { stringify as qsStringify, StringifyOptions } from "./qs.uts";
import { sha1 } from "./sha1.uts";
/**
* 参数签名方法(完全对齐 gl_tape/api/request/sign.js)
* - 先用 qs.stringify 序列化参数
* - split('&') 拆开后 decodeURIComponent 解码
* - 按 key 字典序排序
* - 拼接为 key + value 字符串,首尾加密钥后做 SHA1,再转大写
* - 最后把 sign 挂到原始参数对象上(保留原始类型)
*
* @param params 原始参数对象(会被修改,添加 sign 字段)
* @param secret 签名密钥
* @param noSignAttr 不参与签名的字段列表
*/
export function sign(params: UTSJSONObject, secret: string, noSignAttr: string[] = []): UTSJSONObject {
// 1. 用 qs.stringify 序列化(encodeValuesOnly: true)
const options = {
// arrayFormat: 'indices', // UTS qs implementation doesn't support arrayFormat yet, default is indices-like
allowDots: true,
encodeValuesOnly: true
} as StringifyOptions;
const objStr = qsStringify(params, options);
// 2. split('&') 拆开
const objVal = objStr.split("&");
// 3. 解码并重建对象(用于签名计算)
const realObj: UTSJSONObject = {};
for (const item of objVal) {
const idx = item.indexOf("=");
if (idx == -1) {
continue;
}
const key = item.slice(0, Math.max(0, idx));
const val = decodeURIComponent(item.slice(Math.max(0, idx + 1)));
realObj[key] = val;
}
// 4. 获取 key 列表并排序
const sortedKeys: string[] = [];
for (const key in realObj) {
if (key === "sign") {
continue;
}
sortedKeys.push(key);
}
sortedKeys.sort();
// 5. 归一化 value:null -> "",对象 -> JSON 字符串
for (const key of sortedKeys) {
let obj: any | null = realObj[key];
if (obj === null) {
obj = "";
} else if (typeof obj === "object") {
obj = JSON.stringify(obj);
}
realObj[key] = obj;
}
// 6. 组装待签名字符串(排除 noSignAttr 指定的字段)
const segments: string[] = [];
for (const key of sortedKeys) {
if (noSignAttr.indexOf(key) >= 0) {
continue;
}
const val = realObj[key];
segments.push(key + val);
}
// 7. 计算签名:secret + 拼接字符串 + secret
const signSrc = secret + segments.join("") + secret;
const signVal = sha1(signSrc).toUpperCase();
// 8. 把 sign 挂到 realObj 上,返回全字符串的对象(和老项目保持一致)
realObj.sign = signVal;
return realObj;
}
import { evaluationDomain, pathEnum, signSecretKey } from "../env.uts";
import { storage } from "../../utils/storage.uts";
type GscPostConfig = {
returnAll?: boolean;
timeout?: number;
duplicatePrevention?: boolean;
};
/**
* 二手车/评估等业务专用 HTTP 请求(迁移自 api/request/signHttp.js)
*
* - 基于旧项目的 `uni.signHttpConfig` 语义:
* - baseURL: evaluationDomain + pathEnum.evaluation
* - sessionId 自动注入到请求参数
* - 响应结构:{ code, data, msg? }
* - code == "0" 视为成功,code == "21" 触发重新登录
*
* 注意:这里未完全复刻 glsk-toolkit 的全部特性(如去重、事件钩子),
* 但对现有业务 `gscPost` 的调用方式是兼容的。
*/
export function gscPost(url: string, data: UTSJSONObject, config: GscPostConfig | null = null): Promise<any> {
const finalConfig: GscPostConfig = config ?? {};
return new Promise((resolve, reject) => {
uni.getNetworkType({
success: (res) => {
if (res.networkType == "none") {
uni.hideLoading();
uni.showToast({
title: "网络异常",
icon: "none"
});
reject("网络异常");
return;
}
const baseURL = `${evaluationDomain}${pathEnum["evaluation"]}`;
const fullUrl = `${baseURL}${url}`;
// 组装请求体,自动注入 sessionId
const payload = {} as UTSJSONObject;
const dataKeys = Object.keys(data as any) as string[];
for (let i = 0; i < dataKeys.length; i++) {
const key = dataKeys[i];
// @ts-ignore
payload[key] = (data as UTSJSONObject)[key];
}
// sessionId 自动注入
const sessionId = storage.get("sessionId") as string | null;
if (sessionId != null && sessionId != "" && payload["sessionId"] == null) {
payload["sessionId"] = sessionId;
}
// 简单的重复提交防护:可选地附加一次性请求标识(仅客户端语义)
if (finalConfig.duplicatePrevention == true) {
payload["__duplicateKey"] = `${Date.now()}_${Math.random()}`;
}
const timeout = finalConfig.timeout ?? 300000;
// 将 appId / appSecret 通过 header 传递给后端(近似旧项目 glsk-toolkit 行为)
const header = {
"content-type": "application/json",
"X-App-Id": signSecretKey.appKey,
"X-App-Secret": signSecretKey.secret
} as UTSJSONObject;
uni.request({
url: fullUrl,
data: payload,
method: "POST",
header,
dataType: "json",
responseType: "text",
timeout,
success: (response) => {
const resData: any = response.data;
const code = `${resData.code ?? ""}`;
const message = (resData.msg ?? resData.message ?? "") as string;
// 需要原始响应
if (finalConfig.returnAll == true) {
resolve(resData);
return;
}
// 登录态失效,参考旧项目 signHttpConfig.events.logout
if (code == "21") {
const pages = getCurrentPages();
const currentPage = pages[pages.length - 1];
uni.hideLoading();
if (currentPage.route != "pages/common/login/index") {
uni.reLaunch({
url: "/pages/common/login/index"
});
}
reject(resData);
return;
}
if (code == "0") {
resolve(resData.data);
} else {
const title = message != "" ? message : "业务异常";
uni.showToast({
title,
icon: "none"
});
reject(resData);
}
},
fail: (error) => {
let title = "业务异常";
// @ts-ignore
const errMsg = (error as any).errMsg as string | null;
if (errMsg == "request:fail") {
title = "网络异常";
} else if (errMsg != null && errMsg != "") {
title = errMsg;
}
uni.showToast({
title,
icon: "none"
});
reject(error);
}
});
}
});
});
}
// 登录相关接口封装,直接使用项目现成的 http.uts(已包含签名逻辑)
import http from '@/api/request/http.uts'
// 获取短信验证码:dj.api.smartcarlife.sms.get.code
export async function apiGetSmsCode(params: UTSJSONObject): Promise<UTSJSONObject> {
const data: UTSJSONObject = {
projectName: 'boutique',
...params
}
return await http.fetch('dj.api.smartcarlife.sms.get.code', data, true, 'dj')
}
// 手机验证码登录:dj.api.smartcarlife.sms.applogin
export async function apiSmsLogin(params: UTSJSONObject): Promise<UTSJSONObject> {
const data: UTSJSONObject = {
projectName: 'boutique',
source: 'MINIAPP',
productCode: 'PC00c2',
...params
}
return await http.fetch('dj.api.smartcarlife.sms.applogin', data, true, 'dj')
}
// 免登:dj.api.smartcarlife.sms.noSignIn.login
export async function apiAutoLogin(params: UTSJSONObject): Promise<UTSJSONObject> {
const data: UTSJSONObject = {
projectName: 'boutique',
...params
}
return await http.fetch('dj.api.smartcarlife.sms.noSignIn.login', data, true, 'dj')
}
// 获取账号列表:dj.api.smartcarlife.workWechat.listSelectAccount
export async function apiGetListSelectAccount(params: UTSJSONObject): Promise<UTSJSONObject> {
const data: UTSJSONObject = {
projectName: 'boutique',
...params
}
return await http.fetch('dj.api.smartcarlife.workWechat.listSelectAccount', data, true, 'dj')
}
// 选择账号登录:dj.api.smartcarlife.workWechat.selectAccountLogin
export async function apiSelectAccountLogin(params: UTSJSONObject): Promise<UTSJSONObject> {
const data: UTSJSONObject = {
projectName: 'boutique',
method: 'dj.api.smartcarlife.workWechat.selectAccountLogin',
...params
}
return await http.post(data, true, 'dj', null)
}
// 获取园区店下的4S店:dj.api.scenemerchantref.query4SRefByYqShopByLogin
export async function apiGetSceneMerchantRefStoreList(params: UTSJSONObject): Promise<any> {
console.log("🚀 ~ 取园区店下的4S店 ~ params:", params)
const data: UTSJSONObject = {
projectName: 'boutique',
method: 'dj.api.scenemerchantref.query4SRefByYqShopByLogin',
...params
}
console.log("🚀 ~ 取园区店下的4S店 ~ params:", data)
return await http.post(data, true, 'dj', null)
}
// 获取园区店开通的场景:dj.api.smartcarlife.select.openScene.info
export async function apiGetYqMerchantSceneConfigAPI(params: UTSJSONObject): Promise<any> {
const data: UTSJSONObject = {
projectName: 'boutique',
method: 'dj.api.smartcarlife.select.openScene.info',
...params
}
return await http.post(data, true, 'dj', null)
}
// 选择4S店和场景:dj.api.smartcarlife.selectMerchantScene
export async function apiSelectMerchantScene(params: UTSJSONObject): Promise<any> {
const data: UTSJSONObject = {
projectName: 'boutique',
method: 'dj.api.smartcarlife.selectMerchantScene',
...params
}
return await http.post(data, true, 'dj', null)
}
// 查询门店品牌:dj.api.smartcarlife.recepiton.findMerchantBrand
export async function apiGetMerchantBrand(params: UTSJSONObject): Promise<any> {
const data: UTSJSONObject = {
projectName: 'boutique',
method: 'dj.api.smartcarlife.recepiton.findMerchantBrand',
...params
}
return await http.post(data, true, 'dj', null)
}
/**
* 查询门店保险权益
*/
export function getMerchantInsuranceListApi(data: UTSJSONObject): Promise<any> {
return http.post({
'method': 'dj.api.smartcarlife.recepiton.findMerchantItem',
'projectName': 'boutique',
...data
} as UTSJSONObject)
}
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
This diff is collapsed. Click to expand it.
<template>
<view class="app-navbar-root">
<!-- fixed 时占位,避免内容顶到屏幕最上(总高 = 安全区 + 导航条) -->
<view
v-if="fixed && placeholder"
class="app-navbar-placeholder"
:style="placeholderStyle"
></view>
<view class="app-navbar-shell" :class="shellClass" :style="shellStyle">
<view
v-if="safeAreaInsetTop"
class="app-navbar-safe-top"
:style="safeTopStyle"
></view>
<view
class="app-navbar-bar"
:class="barBorderClass"
:style="barRowStyle"
>
<view
v-if="showBack"
class="app-navbar-left"
@tap="onLeftTap"
>
<uni-icons
:color="leftIconColor"
:size="leftIconSizeNum"
:type="leftIcon"
></uni-icons>
<text
v-if="leftText != ''"
class="app-navbar-left-text"
>{{ leftText }}</text>
</view>
<view v-else class="app-navbar-left-spacer"></view>
<view class="app-navbar-center">
<slot name="center">
<text
v-if="title != ''"
class="app-navbar-title"
>{{ title }}</text>
</slot>
</view>
<view class="app-navbar-right">
<slot name="right"></slot>
</view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { computed, onMounted, ref } from "vue"
import { calcWindowTopInsetPx } from "@/utils/safe-area.uts"
import { router } from "@/utils/router.uts"
type AppNavbarProps = {
title?: string
/** 是否显示左侧返回区(图标 ± 文案) */
showBack?: boolean
/** 为 true 时点击左侧默认 router.back()(与项目路由钩子一致) */
autoBack?: boolean
safeAreaInsetTop?: boolean
bgColor?: string
border?: boolean
fixed?: boolean
placeholder?: boolean
/** 导航条内容区高度(px),不含安全区 */
barHeight?: number
leftIcon?: string
leftIconColor?: string
leftIconSize?: number
leftText?: string
/** fixed 时壳层 z-index;不传默认 200(详情页全屏时可传 0 压低层级) */
zIndex?: number | null
}
const props = withDefaults(defineProps<AppNavbarProps>(), {
title: "",
showBack: true,
autoBack: true,
safeAreaInsetTop: true,
bgColor: "#ffffff",
border: false,
fixed: false,
placeholder: false,
barHeight: 48,
leftIcon: "left",
leftIconColor: "#000000",
leftIconSize: 20,
leftText: "",
zIndex: null
})
const emit = defineEmits<{
leftClick: []
}>()
const insetTopPx = ref(0)
function refreshInset(): void {
insetTopPx.value = calcWindowTopInsetPx(uni.getWindowInfo())
}
onMounted(() => {
refreshInset()
})
const barHeightPx = computed((): number => {
const h = props.barHeight
return h > 0 ? h : 48
})
const totalHeightPx = computed((): number => {
const safe = props.safeAreaInsetTop ? insetTopPx.value : 0
return safe + barHeightPx.value
})
const placeholderStyle = computed((): UTSJSONObject => {
return {
height: `${totalHeightPx.value}px`,
width: "100%"
} as UTSJSONObject
})
const shellClass = computed((): string => {
return props.fixed ? "app-navbar-shell--fixed" : ""
})
const shellStyle = computed((): UTSJSONObject => {
const style = {
backgroundColor: props.bgColor,
width: "100%"
} as UTSJSONObject
if (props.fixed) {
style["position"] = "fixed"
style["top"] = "0"
style["left"] = "0"
const zi = props.zIndex
style["zIndex"] = zi != null ? zi : 200
}
return style
})
const safeTopStyle = computed((): UTSJSONObject => {
return {
height: `${insetTopPx.value}px`,
width: "100%"
} as UTSJSONObject
})
const barRowStyle = computed((): UTSJSONObject => {
return {
height: `${barHeightPx.value}px`,
width: "100%"
} as UTSJSONObject
})
const barBorderClass = computed((): string => {
return props.border ? "app-navbar-bar--border" : ""
})
const leftIconSizeNum = computed((): number => {
const s = props.leftIconSize
return s > 0 ? s : 20
})
function onLeftTap(): void {
emit("leftClick")
if (props.autoBack) {
router.back(null)
}
}
</script>
<style>
.app-navbar-root {
width: 100%;
display: flex;
flex-direction: column;
}
.app-navbar-placeholder {
flex-shrink: 0;
}
.app-navbar-shell {
display: flex;
flex-direction: column;
flex-shrink: 0;
}
.app-navbar-shell--fixed {
width: 100%;
}
.app-navbar-safe-top {
flex-shrink: 0;
width: 100%;
}
.app-navbar-bar {
display: flex;
flex-direction: row;
flex-shrink: 0;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding-left: 4px;
padding-right: 8px;
}
.app-navbar-bar--border {
border-bottom-width: 1px;
border-bottom-style: solid;
border-bottom-color: #eeeeee;
}
.app-navbar-left {
width: 48px;
height: 100%;
display: flex;
flex-direction: row;
flex-shrink: 0;
align-items: center;
justify-content: center;
}
.app-navbar-left-text {
margin-left: 2px;
font-size: 15px;
color: #000000;
}
.app-navbar-left-spacer {
width: 48px;
flex-shrink: 0;
height: 100%;
}
.app-navbar-center {
flex: 1;
height: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
overflow: hidden;
padding-left: 8px;
padding-right: 8px;
}
.app-navbar-title {
font-size: 17px;
font-weight: 500;
color: #000000;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
width: 100%;
}
.app-navbar-right {
min-width: 48px;
height: 100%;
display: flex;
flex-direction: row;
flex-shrink: 0;
align-items: center;
justify-content: flex-end;
}
</style>
<template>
<un-popup :show="visible"
closeOnClickOverlay
:z-index="99"
:title="title"
:closeable="true"
@close="close">
<view class="popup-panel" :style="popupStyle">
<view class="popup-content">
<view v-for="(item, index) in list"
:key="index"
class="popup-item"
@tap="handleChoose(index)">
<view class="item-icon">
<text class="item-icon-text">{{ (item as UTSJSONObject).icon ?? '' }}</text>
</view>
<view class="item-text">
<text class="item-title">{{ (item as UTSJSONObject).title ?? '' }}</text>
<text class="item-describe">{{ (item as UTSJSONObject).describe ?? '' }}</text>
</view>
<view class="item-arrow">
<un-icon name="arrow-right" size="14" color="#8aa0bf"></un-icon>
</view>
</view>
</view>
</view>
</un-popup>
</template>
<script setup lang="uts">
import { computed, defineExpose, ref } from "vue";
const props = defineProps<{
list?: any[]
title?: string
/** 受控显示,父组件传 true 即打开 */
visible?: boolean
}>();
const emit = defineEmits<{
choose: [index: number]
"update:visible": [value: boolean]
}>();
const internalVisible = ref(false);
const popupStyle = computed((): UTSJSONObject => {
const info = uni.getWindowInfo();
const winW = info.windowWidth > 0 ? info.windowWidth : 375;
const sideGapPx = 32;
const maxPanelWidthPx = 700;
const widthByWindow = winW - sideGapPx;
const widthPx = Math.max(280, Math.min(maxPanelWidthPx, widthByWindow));
return {
width: `${widthPx}px`
} as UTSJSONObject;
});
const visible = computed((): boolean => {
if (props.visible != null) return props.visible === true;
return internalVisible.value;
});
function open(): void {
if (props.visible != null) {
emit("update:visible", true);
} else {
internalVisible.value = true;
}
}
function close(): void {
internalVisible.value = false;
emit("update:visible", false);
}
function handleChoose(index: number): void {
emit("choose", index);
close();
}
defineExpose({
open,
close
});
</script>
<style scoped lang="scss">
.popup-panel {
border-radius: 16px;
overflow: hidden;
background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
margin: 0 auto;
display: flex;
flex-direction: column;
align-items: stretch;
}
.popup-content {
padding: 12px;
box-sizing: border-box;
}
.popup-item {
display: flex;
flex-direction: row;
align-items: center;
padding: 12px 12px;
margin-bottom: 10px;
background: rgba(255, 255, 255, 0.96);
border-radius: 12px;
border: 1px solid #dbe6f7;
box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
}
.popup-item:last-child {
margin-bottom: 0;
}
.item-icon {
width: 40px;
height: 40px;
margin-right: 10px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
flex-shrink: 0;
background: #edf4ff;
border-radius: 10px;
}
.item-icon-text {
font-size: 21px;
line-height: 1;
text-align: center;
}
.item-text {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
}
.item-title {
font-weight: 600;
font-size: 14px;
color: #1e293b;
margin-bottom: 2px;
}
.item-describe {
font-size: 12px;
color: #8091aa;
white-space: pre-wrap;
}
.item-arrow {
margin-left: 8px;
width: 16px;
height: 16px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
</style>
<template>
<!-- 引用示例:<CustomEmpty type="contract" :icon="'/static/empty/icon-base-empty.png'" :title="'自定义文案'" :customStyle="{ backgroundColor: '#999999', width: '300rpx' }"/> -->
<view class="empty-wrapper" :style="wrapperStyle">
<!-- 图标插槽,支持完全自定义图标 -->
<slot name="icon">
<image
v-if="showIcon"
class="empty-icon"
:src="iconSrc"
mode="heightFix"
/>
</slot>
<!-- 文字与自定义内容插槽 -->
<slot>
<view class="empty-text">
<text v-if="showTitle" class="empty-title">{{ displayTitle }}</text>
<text v-if="showDescription" class="empty-desc">{{ props.description }}</text>
</view>
</slot>
</view>
</template>
<script setup lang="uts">
import { computed } from 'vue'
type EmptyTypeConfig = {
icon: string
title: string
}
/** 预设类型 key,扩展时在此类型和 PRESET_TYPES 中同步添加 */
type PresetTypesMap = {
base: EmptyTypeConfig
home: EmptyTypeConfig
common: EmptyTypeConfig
contract: EmptyTypeConfig
function: EmptyTypeConfig
}
const TYPE_ICON_BASE_PATH: string = '/static/empty/'
/** 预设类型配置,图标需放在 /static/empty/ 下 */
const PRESET_TYPES: PresetTypesMap = {
base: {
icon: 'icon-base-empty.png',
title: '暂无数据'
},
home: {
icon: 'icon-home-empty.png',
title: '暂无数据'
},
common: {
icon: 'icon-common-empty.png',
title: '暂无数据'
},
contract: {
icon: 'icon-contract-empty.png',
title: '请先选择合同,签约个人信息自动带出'
},
function: {
icon: 'icon-function-empty.png',
title: '请先选择合同,签约个人信息自动带出'
}
}
interface CustomEmptyProps {
/**
* 预设类型:base | home | common | contract | function,展示对应图标与默认文案;扩展时在 PRESET_TYPES 中增加配置即可
*/
type: string
/**
* 直接传入图标地址,优先级高于 type
*/
icon: string
/**
* 主标题文案,不传时使用当前类型的默认文案
*/
title: string
/**
* 副标题/描述文案
*/
description: string
/**
* 外层容器样式,支持字符串或对象,覆盖默认居中样式
*/
customStyle: any | null
}
const props = withDefaults(defineProps<CustomEmptyProps>(), {
type: 'base',
icon: '',
title: '',
description: '',
customStyle: null
})
const getPreset = (type: string): EmptyTypeConfig | null => {
if (type == 'base') return PRESET_TYPES.base
if (type == 'home') return PRESET_TYPES.home
if (type == 'common') return PRESET_TYPES.common
if (type == 'contract') return PRESET_TYPES.contract
if (type == 'function') return PRESET_TYPES.function
return null
}
const typeConfig = computed<EmptyTypeConfig | null>(() => {
return getPreset(props.type)
})
const iconSrc = computed<string>(() => {
if (props.icon != '') {
return props.icon
}
const config = typeConfig.value
if (config == null) {
return ''
}
return TYPE_ICON_BASE_PATH + config.icon
})
const displayTitle = computed<string>(() => {
if (props.title != '') {
return props.title
}
return typeConfig.value?.title ?? '暂无数据'
})
const wrapperStyle = computed<any>(() => {
return props.customStyle ?? {}
})
const showIcon = computed<boolean>(() => {
return iconSrc.value != ''
})
const showTitle = computed<boolean>(() => {
return displayTitle.value != ''
})
const showDescription = computed<boolean>(() => {
return props.description != ''
})
</script>
<style>
.empty-wrapper {
/* 默认宽高占满容器,居中显示,适配手机与 Pad */
width: 100%;
min-height: 300rpx;
padding: 40rpx 32rpx;
box-sizing: border-box;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.empty-icon {
height: 104px;
width: auto;
}
.empty-text {
display: flex;
flex-direction: column;
align-items: center;
font-size: 12px;
font-weight: 400;
}
.empty-title {
color: #999999;
}
.empty-desc {
color: #999999;
margin-top: 12rpx;
}
</style>
\ No newline at end of file
<template>
<view>
<un-popup :show="visible"
mode="bottom"
:round="20"
:z-index="dynamicZIndex"
@close="handlePopupClose">
<view class="popup-wrapper" :style="{ height: windowHeight * 0.6 + 'px' }">
<view class="popup-header">
<view class="icon-close-box" @click="handleHide">
<uni-icons color="#1A1A1A" :size="18" type="closeempty"></uni-icons>
</view>
<text class="popup-title">请选择{{ title }}</text>
</view>
<scroll-view class="select-box"
direction="vertical"
:show-scrollbar="false"
:bounces="false"
:scroll-with-animation="false"
:enable-back-to-top="false"
scroll-y>
<view v-if="employeeList.length === 0" style="padding: 40px 20px; text-align: center;">
<text style="color: #999; font-size: 14px;">暂无销售人员数据</text>
</view>
<view v-if="employeeList.length > 0" class="view-content">
<view v-for="(item, index) in employeeList" :key="index"
class="select-item"
:class="[{ 'is-active': (salesUuid as string) == (item as UTSJSONObject).uuid }]"
@click="handleSelect(item)">
<text class="select-item-text" :class="[{ 'is-active-text': (salesUuid as string) == (item as UTSJSONObject).uuid }]">{{ (item as UTSJSONObject).staffName }}</text>
</view>
</view>
</scroll-view>
</view>
</un-popup>
</view>
</template>
<script setup lang="uts">
import { ComponentPublicInstance, computed, ref, watch } from "vue";
import { getEmployeeListApi } from "@/api/common-api.uts";
// import { resolutionState } from "@/services/adapter/index.uts";
import { dispatch, state } from "@/store/index.uts";
import { storage } from "@/utils/storage.uts";
type Props = {
salesPropsUuid?: string
title?: string
}
type UserInfo = UTSJSONObject
const props = withDefaults(defineProps<Props>(), {
title: "销售",
salesPropsUuid: ""
});
const emit = defineEmits(["close", "select"]);
const visible = ref<boolean>(false);
const watchStatus = computed<boolean>(() => {
const status = state.user?.historyStatus;
if (status == null) {
return false;
} else if (status == 1) {
return true;
} else {
return false;
}
});
const updateView = ref<number>(Date.now());
const salesUuid = computed<string>(() => {
const val1 = state.user.customerInfo.salesUuid;
const val2 = props.salesPropsUuid;
return val1 !== null && val1 !== "" ? (val1 as string) : val2;
});
// 动态计算 z-index,确保始终在最上层(高于 ToolBox 的 10073)
const dynamicZIndex = computed<number>(() => {
return 10090;
});
const windowHeight = computed<number>(() => {
// const height = resolutionState.windowHeight;
return uni.getWindowInfo().windowHeight;
});
const employeeList = ref<Array<any>>([]);
watch(updateView, (newVal: number) => {
// 优先从 store 读取,避免 storage 序列化问题
const employeeListFromStore = state.user.employeeList;
employeeList.value = employeeListFromStore != null ? employeeListFromStore : [];
}, { immediate: true });
function close(): void {
visible.value = false;
}
watch(watchStatus, () => {
close();
}, { immediate: true });
function handleClose(): void {
emit("close");
}
function handlePopupClose(): void {
visible.value = false;
emit("close");
}
function handleHide(): void {
visible.value = false;
}
function open(): void {
// 先显示弹窗
visible.value = true;
// 如果已有数据,直接返回
if (employeeList.value.length > 0) {
return;
}
const userInfo: null | UserInfo = storage.get("userInfo") as null | UTSJSONObject;
if (userInfo == null) return;
const shopMerchantId = userInfo.shopMerchantId;
// 异步获取销售人员列表,不阻塞弹窗显示
getEmployeeListApi({ merchantId: shopMerchantId }).then((res: any) => {
const list = res as Array<any>;
dispatch("setEmployeeList", list);
const listToStore = list != null ? list : [];
storage.set("employeeList", listToStore, 0);
updateView.value = Date.now();
}).catch((error) => {
console.error('[Employee] getEmployeeListApi 失败:', error);
});
}
function handleSelect(item: any): void {
close();
emit("select", item);
}
defineExpose({ open, close });
</script>
<style scoped lang="scss">
.popup-wrapper {
background: #ffffff;
border-radius: 20px 20px 0 0;
display: flex;
flex-direction: column;
overflow: hidden;
}
.popup-header {
position: relative;
display: flex;
align-items: center;
justify-content: center;
height: 56px;
flex-shrink: 0;
border-bottom: 1px solid #f0f0f0;
}
.popup-title {
font-size: 18px;
font-weight: 600;
color: #292d33;
}
.icon-close-box {
position: absolute;
right: 16px;
top: 50%;
transform: translateY(-50%);
width: 32px;
height: 32px;
display: flex;
align-items: center;
justify-content: center;
}
.select-box {
flex: 1;
min-height: 0;
position: relative;
display: flex;
flex-direction: column;
}
.view-content {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
width: 100%;
padding: 16px 24px 24px;
box-sizing: border-box;
min-height: 0;
}
.select-item {
width: 48%; /* 预留间距,避免49%引起的意外换行 */
margin-bottom: 12px;
height: 44px; /* 加高触控面积,显得更大气 */
background-color: #f8f9fa; /* 低调的浅灰背景 */
border-radius: 8px; /* 圆角增加现代感 */
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
border: 1px solid transparent;
transition: background-color 0.2s ease, border-color 0.2s ease;
}
/* 悬浮反馈 */
.select-item:active {
background-color: #f1f3f5;
}
/* 选中状态 */
.is-active {
background-color: rgba(22, 119, 255, 0.05); /* 淡淡的主题色背景 */
border: 1px solid rgba(22, 119, 255, 0.3); /* 主题色描边 */
}
.select-item-text {
text-align: center;
color: #495057; /* 稳重的深灰色 */
font-size: 15px;
line-height: 20px;
font-weight: 500;
}
.is-active-text {
color: #1677FF; /* 选中时的文字色与边框呼应 */
font-weight: 600;
}
</style>
<template>
<view class="entrance-box">
<scroll-view class="entrance-list"
direction="vertical"
:show-scrollbar="false"
:bounces="false"
:scroll-with-animation="false"
scroll-y>
<view class="entrance-content">
<view v-for="(item, index) in entranceList"
:key="index"
:class="['entrance-item', compactMode ? 'entrance-item-compact' : '']"
hover-class="entrance-item-hover"
@click="handleClick(item)">
<!-- 图标容器 -->
<view class="entrance-icon-wrapper">
<un-icon class="entrance-icon"
:class="[compactMode ? 'entrance-icon-compact' : '']"
:name="getIconUrl(item.icon)"
:size="iconSize" />
</view>
<text :class="['entrance-name', compactMode ? 'entrance-name-compact' : '']">{{ item.label }}</text>
</view>
</view>
</scroll-view>
</view>
</template>
<script setup lang="uts">
import { computed } from "vue";
import { layoutService } from "@/services/LayoutService.uts";
type EntranceItem = {
color: string
icon: string
label: string
}
const props = defineProps<{
sceneType?: number
}>();
defineEmits(["entranceClick"]);
// 根据横竖屏动态计算图标尺寸
const iconSize = computed((): number => {
const isLandscape = !layoutService.isMode("portrait");
return isLandscape ? 56 : 52;
});
const entranceList = computed((): EntranceItem[] => {
const sceneType = props.sceneType ?? 1;
if (sceneType === 1) {
// 轻改场景:对应老项目 icon-daily-report / icon-create-order / icon-defeat-order / icon-order-management / icon-wage-appeal
return [
{ label: "驻店日报", icon: "daily-report", color: "#7c4dff" },
{ label: "新建工单", icon: "create-order", color: "#4673ff" },
{ label: "战败下单", icon: "defeat-order", color: "#ff4747" },
{ label: "工单列表", icon: "order-management", color: "#ff8c00" },
{ label: "工资申诉", icon: "wage-appeal", color: "#ffc107" }
];
}
if (sceneType === 0) {
// 权益场景:在轻改基础上增加“权益提单” icon-equity-order
return [
{ label: "驻店日报", icon: "daily-report", color: "#7c4dff" },
{ label: "新建工单", icon: "create-order", color: "#4673ff" },
{ label: "权益提单", icon: "equity-order", color: "#4caf50" },
{ label: "战败下单", icon: "defeat-order", color: "#ff4747" },
{ label: "工单列表", icon: "order-management", color: "#ff8c00" },
{ label: "工资申诉", icon: "wage-appeal", color: "#ffc107" }
];
}
// 其它场景兜底:先复用轻改配置
return [
{ label: "驻店日报", icon: "daily-report", color: "#7c4dff" },
{ label: "新建工单", icon: "create-order", color: "#4673ff" },
{ label: "战败下单", icon: "defeat-order", color: "#ff4747" },
{ label: "工单列表", icon: "order-management", color: "#ff8c00" },
{ label: "工资申诉", icon: "wage-appeal", color: "#ffc107" }
];
});
const compactMode = computed((): boolean => {
return entranceList.value.length >= 7;
});
function handleClick(_item: EntranceItem): void {
uni.showToast({ title: "敬请期待", icon: "none" });
}
function getIconUrl(icon: string): string {
// App 端需用相对路径,便于打包时基于当前文件解析并打入包内
if (icon === "daily-report") return "../static/images/boutique/tools/daily-report.png";
if (icon === "create-order") return "../static/images/boutique/tools/create-order.png";
if (icon === "equity-order") return "../static/images/boutique/tools/equity-order.png";
if (icon === "defeat-order") return "../static/images/boutique/tools/defeat-order.png";
if (icon === "order-management") return "../static/images/boutique/tools/order-management.png";
if (icon === "wage-appeal") return "../static/images/boutique/tools/wage-appeal.png";
return "../static/images/boutique/tools/daily-report.png";
}
</script>
<style scoped lang="scss">
.entrance-box {
width: 100%;
height: 100%;
overflow: hidden;
}
.entrance-list {
width: 100%;
height: 100%;
box-sizing: border-box;
padding: var(--l-spacing-lg);
padding-bottom: var(--l-spacing-2xl);
}
.entrance-content {
display: flex;
flex-wrap: wrap;
flex-direction: row;
justify-content: space-between;
align-content: flex-start;
gap: var(--entrance-item-gap);
min-height: 0;
}
.entrance-item {
width: 33.33%;
min-height: 90px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 2px;
border-radius: var(--l-radius-md);
background: rgba(255, 255, 255, 0.6);
transition-property: transform, background, box-shadow;
transition-duration: 0.3s;
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
cursor: pointer;
}
.entrance-item-hover {
transform: translateY(-4px);
background: rgba(255, 255, 255, 0.9);
box-shadow: 0 8px 24px rgba(102, 126, 234, 0.15);
}
.entrance-icon-wrapper {
width: var(--entrance-icon-size);
height: var(--entrance-icon-size);
border-radius: var(--l-radius-md);
background-color: var(--bg-icon);
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
transition: all 0.3s ease;
margin-bottom: var(--l-spacing-sm);
}
.entrance-icon {
width: 36px;
height: 36px;
}
.entrance-name {
font-size: var(--l-font-xs);
color: #4a4a4a;
font-weight: 500;
text-align: center;
letter-spacing: 0.3px;
line-height: 1.4;
}
.entrance-item-compact {
width: 33.33%;
min-height: 100px;
padding: var(--l-spacing-md);
}
.entrance-icon-compact {
width: 32px;
height: 32px;
}
.entrance-name-compact {
font-size: 11px;
margin-top: 2px;
}
</style>
<template>
<view class="main-tab-shell-root">
<view class="main-tab-shell-body main-tab-shell-body-landscape">
<HomeFrameTabbarLandscape :user-name="userName"
:current-tab-index="currentTabIndex"
:scene-type-list="sceneTypeList"
:show-scene-popup="showScenePopup"
:show-setting="showSetting"
@tab-change="onTabChange"
@scene-popup-visible="onScenePopupVisible"
@setting-visible="onSettingVisible"
@scene-change="onSceneChange"
@setting="onSetting"
@choose-scene="onChooseScene"
@jump-person-center="jumpPersonCenter" />
<view class="main-tab-shell-slot main-tab-shell-slot-landscape">
<slot :user-info="slotUserInfo"></slot>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { computed, inject, type Ref } from "vue";
import HomeFrameTabbarLandscape from "./TabbarLandscape.uvue";
import type { HomeFrameTabbarSource } from "./tabbarShared.uts";
import { SCENE_SHELL_USER_INFO_INJECT_KEY, useHomeFrameTabbar } from "./tabbarShared.uts";
import { storage } from "@/utils/storage.uts";
type MainTabShellSlotProps = {
userInfo: UTSJSONObject
};
type MainTabShellSlots = {
default(props: MainTabShellSlotProps): any
};
defineSlots<MainTabShellSlots>();
const props = defineProps<{
activeTabIndex: number
}>();
const shellUserInfoRef = inject(SCENE_SHELL_USER_INFO_INJECT_KEY, null) as Ref<UTSJSONObject> | null;
const tabbarSource: HomeFrameTabbarSource = {
getTabIndex: (): number => props.activeTabIndex,
getUserInfo: (): null | UTSJSONObject => {
const r = shellUserInfoRef;
if (r != null) {
return r.value as UTSJSONObject;
}
return storage.get("userInfo") as null | UTSJSONObject;
}
};
const _tabbar = useHomeFrameTabbar(tabbarSource);
const userName = _tabbar.userName;
const currentTabIndex = _tabbar.currentTabIndex;
const sceneTypeList = _tabbar.sceneTypeList;
const showScenePopup = _tabbar.showScenePopup;
const showSetting = _tabbar.showSetting;
const onTabChange = _tabbar.onTabChange;
const onScenePopupVisible = _tabbar.onScenePopupVisible;
const onSettingVisible = _tabbar.onSettingVisible;
const onSceneChange = _tabbar.onSceneChange;
const onSetting = _tabbar.onSetting;
const onChooseScene = _tabbar.onChooseScene;
const jumpPersonCenter = _tabbar.jumpPersonCenter;
const slotUserInfo = computed((): UTSJSONObject => {
const r = shellUserInfoRef;
if (r != null) {
return r.value as UTSJSONObject;
}
const raw = storage.get("userInfo");
return raw != null ? raw as UTSJSONObject : ({} as UTSJSONObject);
});
</script>
<style scoped lang="scss">
.main-tab-shell-root {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
min-height: 0;
min-width: 0;
}
.main-tab-shell-body-landscape {
flex: 1;
display: flex;
flex-direction: row;
width: 100%;
height: 100%;
min-height: 0;
min-width: 0;
overflow: hidden;
}
.main-tab-shell-slot-landscape {
flex: 1 1 0%;
min-width: 0;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
}
</style>
<template>
<view class="main-tab-shell-root">
<view class="main-tab-shell-body main-tab-shell-body-portrait">
<view class="main-tab-shell-slot main-tab-shell-slot-portrait">
<slot :user-info="slotUserInfo"></slot>
</view>
<HomeFrameTabbarPortrait :current-tab-index="currentTabIndex"
:scene-type-list="sceneTypeList"
:show-scene-popup="showScenePopup"
:show-setting="showSetting"
@tab-change="onTabChange"
@scene-popup-visible="onScenePopupVisible"
@setting-visible="onSettingVisible"
@choose-scene="onChooseScene" />
</view>
</view>
</template>
<script setup lang="uts">
import { computed, inject, type Ref } from "vue";
import HomeFrameTabbarPortrait from "./TabbarPortrait.uvue";
import type { HomeFrameTabbarSource } from "./tabbarShared.uts";
import { SCENE_SHELL_USER_INFO_INJECT_KEY, useHomeFrameTabbar } from "./tabbarShared.uts";
import { storage } from "@/utils/storage.uts";
type MainTabShellSlotProps = {
userInfo: UTSJSONObject
};
type MainTabShellSlots = {
default(props: MainTabShellSlotProps): any
};
defineSlots<MainTabShellSlots>();
const props = defineProps<{
activeTabIndex: number
}>();
const shellUserInfoRef = inject(SCENE_SHELL_USER_INFO_INJECT_KEY, null) as Ref<UTSJSONObject> | null;
const tabbarSource: HomeFrameTabbarSource = {
getTabIndex: (): number => props.activeTabIndex,
getUserInfo: (): null | UTSJSONObject => {
const r = shellUserInfoRef;
if (r != null) {
return r.value as UTSJSONObject;
}
return storage.get("userInfo") as null | UTSJSONObject;
}
};
const _tabbar = useHomeFrameTabbar(tabbarSource);
const currentTabIndex = _tabbar.currentTabIndex;
const sceneTypeList = _tabbar.sceneTypeList;
const showScenePopup = _tabbar.showScenePopup;
const showSetting = _tabbar.showSetting;
const onTabChange = _tabbar.onTabChange;
const onScenePopupVisible = _tabbar.onScenePopupVisible;
const onSettingVisible = _tabbar.onSettingVisible;
const onChooseScene = _tabbar.onChooseScene;
const slotUserInfo = computed((): UTSJSONObject => {
const r = shellUserInfoRef;
if (r != null) {
return r.value as UTSJSONObject;
}
const raw = storage.get("userInfo");
return raw != null ? raw as UTSJSONObject : ({} as UTSJSONObject);
});
</script>
<style scoped lang="scss">
.main-tab-shell-root {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
min-height: 0;
min-width: 0;
}
.main-tab-shell-body-portrait {
flex: 1;
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
min-height: 0;
min-width: 0;
overflow: hidden;
}
.main-tab-shell-slot-portrait {
flex: 1 1 0%;
min-height: 0;
min-width: 0;
display: flex;
flex-direction: column;
overflow: hidden;
}
</style>
<template>
<scroll-view class="message-index" scroll-y="true">
<view class="message-placeholder">
<view class="placeholder-item">
<text class="placeholder-date">2026-01-16</text>
<view class="placeholder-row">
<view class="placeholder-icon"></view>
<text class="placeholder-title">活动中心</text>
<text class="placeholder-time">17:47</text>
</view>
</view>
<view class="placeholder-item">
<text class="placeholder-date">2026-01-13</text>
<view class="placeholder-row">
<view class="placeholder-icon"></view>
<text class="placeholder-title">企业通知</text>
<text class="placeholder-time">16:11</text>
</view>
</view>
<text class="coming-soon">敬请期待</text>
</view>
</scroll-view>
</template>
<script setup lang="uts">
</script>
<style scoped lang="scss">
.message-index {
width: 100%;
height: 100%;
}
.message-placeholder {
padding: var(--l-spacing-md);
display: flex;
flex-direction: column;
}
.placeholder-item {
display: flex;
flex-direction: column;
margin-bottom: var(--l-spacing-md);
padding-bottom: var(--l-spacing-md);
border-bottom: 1px solid #eee;
}
.placeholder-date {
font-size: var(--l-font-xs);
color: #999;
margin-bottom: var(--l-spacing-xs);
}
.placeholder-row {
display: flex;
flex-direction: row;
align-items: center;
}
.placeholder-icon {
width: var(--l-font-2xl);
height: var(--l-font-2xl);
background-color: #4673ff;
border-radius: var(--l-radius-lg);
margin-right: var(--l-spacing-xs);
}
.placeholder-title {
flex: 1;
font-size: var(--l-font-sm);
color: #333;
}
.placeholder-time {
font-size: var(--l-font-xs);
color: #999;
}
.coming-soon {
font-size: var(--l-font-sm);
color: #999;
text-align: center;
margin-top: var(--l-spacing-lg);
}
</style>
<template>
<view v-if="!loadComplete" class="intro-swiper-loading">
<BannerSkeleton />
</view>
<view v-else-if="modules.length > 0" class="intro-swiper-custom-wrap fade-in">
<view class="intro-swiper-custom-content">
<view class="intro-hero-head">
<view class="intro-hero-title-wrap">
<text class="intro-hero-eyebrow">{{ eyebrow }}</text>
<text class="intro-hero-title">{{ heroTitle }}</text>
</view>
<view class="intro-hero-indicator-pill">
<text class="intro-hero-indicator-text">{{ currentSwiperIndex + 1 }}/{{ modules.length }}</text>
</view>
</view>
<view class="intro-swiper-stack">
<un-swiper
class="intro-swiper"
:list="swiperList"
:autoplay="modules.length > 1"
:circular="modules.length > 1"
:indicator="false"
@change="(e: any) => onSwiperChangeFromEvent(e)"
@click="(idx: any) => onSlideTapFromEvent(idx)"
></un-swiper>
<view v-if="hasDotsOverlay" class="intro-swiper-overlay">
<view class="intro-swiper-dots">
<view v-for="(_, i) in modules"
:key="i"
class="intro-dot"
:class="[{ active: i == currentSwiperIndex }]" />
</view>
</view>
</view>
</view>
</view>
<view v-else class="intro-swiper-empty fade-in">
<view class="intro-empty-card">
<text class="intro-empty-title">{{ emptyTitle }}</text>
<text class="intro-empty-text">{{ emptyText }}</text>
</view>
</view>
</template>
<script setup lang="uts">
import { computed, ref, watch } from "vue";
import BannerSkeleton from "@/components/Skeleton/BannerSkeleton.uvue";
import type { UnSwiperItem } from "@/uni_modules/uview-unix";
const props = defineProps<{
loadComplete: boolean
swiperList: UnSwiperItem[]
modules: any[]
eyebrow: string
emptyTitle: string
emptyText: string
// swiperHeight: number
}>();
const emit = defineEmits<{
swiperChange: [index: number]
slideTap: [index: number]
}>();
const currentSwiperIndex = ref<number>(0);
watch((): number => props.modules.length, (_len: number) => {
currentSwiperIndex.value = 0;
});
function moduleTitleAt(item: any): string {
if (item == null) {
return "";
}
const obj = item as UTSJSONObject;
const value =
(obj.detailTitle as null | string)
?? (obj.materialTitle as null | string)
?? (obj.shortTitle as null | string)
?? (obj.materialName as null | string)
?? (obj.title as null | string)
?? (obj.name as null | string)
?? "";
return value;
}
const heroTitle = computed((): string => {
const list = props.modules;
if (list.length == 0) {
return "";
}
const idx = currentSwiperIndex.value;
if (idx < 0 || idx >= list.length) {
return "";
}
return moduleTitleAt(list[idx]);
});
const hasDotsOverlay = computed((): boolean => {
const list = props.modules;
const idx = currentSwiperIndex.value;
return list.length > 0 && idx >= 0 && idx < list.length;
});
function parseSwiperEventIndex(e: number | UniSwiperChangeEvent | null): number {
if (e == null) {
return 0;
}
if (typeof e === "number") {
return e as number;
}
return e.detail.current;
}
function onSwiperChange(e: number | UniSwiperChangeEvent): void {
const idx = parseSwiperEventIndex(e);
currentSwiperIndex.value = idx;
emit("swiperChange", idx);
}
function onSlideTap(index: number): void {
emit("slideTap", index);
}
/** 模板里必须写成函数调用;事件类型用 any 收口再收窄 */
function onSwiperChangeFromEvent(e: any): void {
onSwiperChange(e as number | UniSwiperChangeEvent);
}
function onSlideTapFromEvent(idx: any): void {
const n = typeof idx === "number" ? (idx as number) : 0;
onSlideTap(n);
}
</script>
<style scoped lang="scss">
.intro-swiper-loading {
width: 100%;
height: 100%;
padding: 12px;
box-sizing: border-box;
}
.intro-swiper-custom-wrap {
width: 100%;
height: 100%;
position: relative;
padding: 0;
box-sizing: border-box;
}
.intro-swiper-custom-content {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
border-radius: 0;
background: rgba(255, 255, 255, 0.86);
box-shadow: 0 12px 32px rgba(15, 23, 42, 0.10);
overflow: hidden;
}
.intro-hero-head {
width: 100%;
height: 40px;
padding: 0 10px;
box-sizing: border-box;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
border-bottom: 1px solid rgba(226, 236, 248, 0.8);
background-color: var(--bg-header);
}
.intro-hero-title-wrap {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
}
.intro-hero-eyebrow {
font-size: 10px;
color: #8ea0ba;
line-height: 12px;
}
.intro-hero-title {
margin-top: 0;
font-size: 14px;
font-weight: 700;
color: #1e293b;
line-height: 18px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
.intro-hero-indicator-pill {
height: 22px;
min-width: 44px;
padding: 0 8px;
border-radius: 13px;
background: #e9f1ff;
border: 1px solid #cfe0f8;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
box-sizing: border-box;
}
.intro-hero-indicator-text {
font-size: 11px;
font-weight: 600;
color: #2a5ecf;
}
.intro-swiper-stack {
flex: 1;
width: 100%;
min-height: 0;
position: relative;
padding: 0;
box-sizing: border-box;
}
.intro-swiper {
width: 100%;
height: 100%;
border-radius: 10px;
overflow: hidden;
box-shadow: 0 8px 18px rgba(15, 23, 42, 0.10);
}
.intro-swiper-overlay {
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
z-index: 10;
pointer-events: none;
display: flex;
flex-direction: column;
justify-content: flex-end;
background-color: rgba(30, 58, 138, 0.3);
border-radius: 10px;
}
.intro-swiper-dots {
position: absolute;
left: 0;
right: 0;
bottom: 2px;
display: flex;
flex-direction: row;
justify-content: center;
padding: 0;
}
.intro-dot {
width: 5px;
height: 5px;
border-radius: 3px;
background: rgba(255, 255, 255, 0.42);
margin: 0 3px;
transition: all 0.3s ease;
}
.intro-dot.active {
width: 14px;
background: rgba(255, 255, 255, 0.95);
}
.intro-swiper-empty {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
box-sizing: border-box;
}
.intro-empty-card {
margin: auto;
width: 70%;
min-height: 118px;
border-radius: 18px;
background: rgba(255, 255, 255, 0.86);
box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
border: 1px solid #e3ecf8;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.intro-empty-title {
font-size: 16px;
font-weight: 600;
color: #1e293b;
margin-bottom: 6px;
}
.intro-empty-text {
font-size: 13px;
color: #94a3b8;
}
</style>
<template>
<!-- 物理 tab 三页共用:横/竖两套壳 + 默认槽;方向由 updateOrientation + useOrientation 驱动 -->
<MainTabShellPortrait v-if="shellIsPortrait"
:active-tab-index="props.activeTabIndex">
<template #default="{ userInfo: u }">
<slot :user-info="u"></slot>
</template>
</MainTabShellPortrait>
<MainTabShellLandscape v-else
:active-tab-index="props.activeTabIndex">
<template #default="{ userInfo: u }">
<slot :user-info="u"></slot>
</template>
</MainTabShellLandscape>
</template>
<script setup lang="uts">
import { computed, defineExpose, onMounted, onResize, provide, ref, type Ref } from "vue";
import { updateOrientation, useOrientation } from "@/services/adapter/hooks/index.uts";
import { requestRecordPermission } from "@/utils/permission.uts";
import { storage } from "@/utils/storage.uts";
import { hideNativeTabBar } from "@/utils/tabBarShell.uts";
import MainTabShellLandscape from "./MainTabShellLandscape.uvue";
import MainTabShellPortrait from "./MainTabShellPortrait.uvue";
import { SCENE_SHELL_USER_INFO_INJECT_KEY } from "./tabbarShared.uts";
type SceneShellSlotProps = {
userInfo: UTSJSONObject
};
type SceneShellSlots = {
default(props: SceneShellSlotProps): any
};
defineSlots<SceneShellSlots>();
const props = defineProps<{
/** 当前 tab 页下标:0 首页、1 接待、2 我的(与 un-tabbar 高亮一致) */
activeTabIndex: number
}>();
updateOrientation();
const orientationHook = useOrientation();
const shellIsPortrait = computed((): boolean => {
const ip = orientationHook.isPortrait as Ref<boolean>;
return ip.value == true;
});
onMounted((): void => {
// await requestRecordPermission();
hideNativeTabBar();
updateOrientation();
});
onResize((_res: any): void => {
updateOrientation();
});
const userInfo = ref<UTSJSONObject>({});
provide(SCENE_SHELL_USER_INFO_INJECT_KEY, userInfo);
function updateApp(): void {
const info = storage.get("userInfo");
if (info != null) {
userInfo.value = info as UTSJSONObject;
}
}
onShow(() => {
hideNativeTabBar();
});
defineExpose({
updateApp
});
</script>
<template>
<HomeFrameTabbarLandscape v-if="!isPortraitMode"
:user-name="userName"
:current-tab-index="currentTabIndex"
:scene-type-list="sceneTypeList"
:show-scene-popup="showScenePopup"
:show-setting="showSetting"
@tab-change="onTabChange"
@scene-popup-visible="onScenePopupVisible"
@setting-visible="onSettingVisible"
@scene-change="onSceneChange"
@setting="onSetting"
@choose-scene="onChooseScene"
@jump-person-center="jumpPersonCenter" />
<HomeFrameTabbarPortrait v-else
:current-tab-index="currentTabIndex"
:scene-type-list="sceneTypeList"
:show-scene-popup="showScenePopup"
:show-setting="showSetting"
@tab-change="onTabChange"
@scene-popup-visible="onScenePopupVisible"
@setting-visible="onSettingVisible"
@choose-scene="onChooseScene" />
</template>
<script setup lang="uts">
import { computed, type Ref } from "vue";
import { useOrientation } from "@/services/adapter/hooks/index.uts";
import HomeFrameTabbarLandscape from "./TabbarLandscape.uvue";
import HomeFrameTabbarPortrait from "./TabbarPortrait.uvue";
import type { HomeFrameTabbarSource } from "./tabbarShared.uts";
import { useHomeFrameTabbar } from "./tabbarShared.uts";
const props = defineProps<{
tabIndex?: number
userInfo?: null | UTSJSONObject
}>();
const orientationHook = useOrientation();
const isPortraitMode = computed((): boolean => {
const ip = orientationHook.isPortrait as Ref<boolean>;
return ip.value == true;
});
const tabbarSource: HomeFrameTabbarSource = {
getTabIndex: (): number => props.tabIndex != null ? (props.tabIndex as number) : 0,
getUserInfo: (): null | UTSJSONObject => props.userInfo as null | UTSJSONObject
};
const _tabbar = useHomeFrameTabbar(tabbarSource);
const currentTabIndex = _tabbar.currentTabIndex;
const sceneTypeList = _tabbar.sceneTypeList;
const userName = _tabbar.userName;
const showScenePopup = _tabbar.showScenePopup;
const showSetting = _tabbar.showSetting;
const onTabChange = _tabbar.onTabChange;
const onScenePopupVisible = _tabbar.onScenePopupVisible;
const onSettingVisible = _tabbar.onSettingVisible;
const onSceneChange = _tabbar.onSceneChange;
const onSetting = _tabbar.onSetting;
const onChooseScene = _tabbar.onChooseScene;
const jumpPersonCenter = _tabbar.jumpPersonCenter;
</script>
<template>
<view class="home-tabbar home-tabbar-landscape">
<!-- <image class="home-tabbar-bg-img"
mode="aspectFill"
src="/static/images/home/left-bg.png" /> -->
<view class="hf-landscape-column">
<view class="user-box user-box-clickable hf-landscape-user"
@click="emit('jumpPersonCenter')">
<view class="hf-landscape-profile">
<un-avatar :text="avatarText"
shape="circle"
size="42"
bgColor="#2f6af7"
color="#ffffff"
fontSize="20" />
<text class="hf-landscape-name">{{ userName }}</text>
</view>
</view>
</view>
<view class="landscape-tabbar-wrap">
<view class="landscape-un-tabbar landscape-vertical-tabs">
<view v-for="(item, index) in tabs"
:key="index"
class="landscape-vertical-tabs__item"
:class="index === currentTabIndex ? 'landscape-vertical-tabs__item--active' : ''"
@click="onTabItemClick(index)">
<view class="landscape-vertical-tabs__inner">
<image class="landscape-vertical-tabs__icon"
mode="aspectFit"
:src="index === currentTabIndex ? item.iconSrcActive : item.iconSrcInactive" />
<text class="landscape-vertical-tabs__label">{{ item.label }}</text>
</view>
</view>
</view>
</view>
<view class="home-tabbar-footer flex-col hf-landscape-footer">
<view class="hf-landscape-footer-btn"
@tap="emit('sceneChange')">
<image class="hf-landscape-footer-icon"
mode="aspectFit"
src="/static/images/home/scene-change.png" />
</view>
<view class="hf-landscape-footer-btn hf-landscape-footer-btn--after"
@tap="emit('setting')">
<image class="hf-landscape-footer-icon"
mode="aspectFit"
src="/static/images/home/setting.png" />
</view>
</view>
<CenterPopup :list="sceneTypeList"
title="选择场景"
:visible="showScenePopup"
@choose="emit('chooseScene', $event)"
@update:visible="emit('scenePopupVisible', $event)" />
<SettingBox :visible="showSetting"
@update:visible="emit('settingVisible', $event)" />
</view>
</template>
<script setup lang="uts">
import { computed } from "vue";
import CenterPopup from "@/components/CenterPopup.uvue";
import SettingBox from "@/pages/person/SettingBox.uvue";
import { HOME_FRAME_TABS } from "./tabbarShared.uts";
const props = defineProps<{
userName: string
currentTabIndex: number
sceneTypeList: UTSJSONObject[]
showScenePopup: boolean
showSetting: boolean
}>();
const emit = defineEmits<{
tabChange: [name: string | number]
scenePopupVisible: [v: boolean]
settingVisible: [v: boolean]
sceneChange: []
setting: []
chooseScene: [index: number]
jumpPersonCenter: []
}>();
const tabs = HOME_FRAME_TABS;
/** 与 MyCenterMain 一致:姓名首字,空则「我」 */
const avatarText = computed((): string => {
const n = props.userName;
if (n == null || n === "") {
return "我";
}
const s = n as string;
if (s.length <= 0) {
return "我";
}
return s.substring(0, 1);
});
function onTabItemClick(index: number): void {
emit("tabChange", index);
}
</script>
<style scoped lang="scss">
@import "./styles/common.scss";
/* 顶部用户区:仅内容高度,不把中间 Tab 区挤没 */
.hf-landscape-column {
flex-shrink: 0;
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
box-sizing: border-box;
padding: 14px 10px 0;
position: relative;
z-index: 1;
}
/* 横屏侧栏:用户区 / Tab / 底按钮同一竖直中轴 */
.hf-landscape-user {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
box-sizing: border-box;
padding-top: 0;
flex-shrink: 0;
}
.hf-landscape-profile {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
}
/* 与 MyCenterMain .name 一致;与 Tab 文案同宽便于视觉对齐 */
.hf-landscape-name {
margin-top: 10px;
font-size: 14px;
font-weight: 600;
color: #1a2433;
line-height: 24px;
text-align: center;
width: 100%;
max-width: 104px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.hf-landscape-footer {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
box-sizing: border-box;
flex-shrink: 0;
padding-left: 10px;
padding-right: 10px;
}
.hf-landscape-footer-btn {
width: 44px;
height: 44px;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
.hf-landscape-footer-btn--after {
margin-top: 12px;
}
.hf-landscape-footer-icon {
width: 40px;
height: 40px;
flex-shrink: 0;
}
/* 横屏侧栏 Tab:占满中间 landscape-tabbar-wrap,条目在剩余高度内垂直居中 */
.landscape-vertical-tabs {
flex: 1;
min-height: 0;
width: 100%;
padding-left: var(--tabbar-padding, 16px);
padding-right: var(--tabbar-padding, 16px);
padding-top: 8px;
padding-bottom: 8px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
box-sizing: border-box;
}
.landscape-vertical-tabs__item {
width: 100%;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
padding: 18px 0;
box-sizing: border-box;
}
.landscape-vertical-tabs__item + .landscape-vertical-tabs__item {
margin-top: 10px;
}
.landscape-vertical-tabs__inner {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.landscape-vertical-tabs__icon {
width: var(--tabbar-icon-size, 28px);
height: var(--tabbar-icon-size, 28px);
flex-shrink: 0;
}
.landscape-vertical-tabs__label {
margin-top: 6px;
font-size: 12px;
color: #8a98b5;
text-align: center;
width: 100%;
max-width: 104px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.landscape-vertical-tabs__item--active .landscape-vertical-tabs__label {
color: #3773f8;
font-weight: 500;
}
</style>
<template>
<view class="home-tabbar home-tabbar-portrait home-tabbar-portrait-pad">
<un-tabbar :model-value="currentTabIndex"
class="portrait-un-tabbar"
:fixed="true"
:placeholder="false"
:safe-area-inset-bottom="true"
active-color="#3773f8"
inactive-color="#8a98b5"
bg-color="#ffffff"
@change="emit('tabChange', ($event as string | number))">
<un-tabbar-item v-for="(item, index) in tabs"
:key="index"
:name="index"
:text="item.label">
<template #icon="{ active }">
<image v-if="active === true"
class="tabbar-icon-img"
mode="aspectFit"
:src="item.iconSrcActive" />
<image v-else
class="tabbar-icon-img"
mode="aspectFit"
:src="item.iconSrcInactive" />
</template>
</un-tabbar-item>
</un-tabbar>
<CenterPopup :list="sceneTypeList"
title="选择场景"
:visible="showScenePopup"
@choose="emit('chooseScene', $event)"
@update:visible="emit('scenePopupVisible', $event)" />
<SettingBox :visible="showSetting"
@update:visible="emit('settingVisible', $event)" />
</view>
</template>
<script setup lang="uts">
import CenterPopup from "@/components/CenterPopup.uvue";
import SettingBox from "@/pages/person/SettingBox.uvue";
import { HOME_FRAME_TABS } from "./tabbarShared.uts";
defineProps<{
currentTabIndex: number
sceneTypeList: UTSJSONObject[]
showScenePopup: boolean
showSetting: boolean
}>();
const emit = defineEmits<{
tabChange: [name: string | number]
scenePopupVisible: [v: boolean]
settingVisible: [v: boolean]
chooseScene: [index: number]
}>();
const tabs = HOME_FRAME_TABS;
</script>
<style scoped lang="scss">
@import "./styles/common.scss";
/* 与 layout-root 注入的 index.vars.uts 中 --tabbar-icon-size 一致;横屏侧栏见 TabbarLandscape .landscape-vertical-tabs__icon */
.tabbar-icon-img {
width: var(--tabbar-icon-size, 24px);
height: var(--tabbar-icon-size, 24px);
}
</style>
<template>
<view class="home-frame-container scene-shell-root hf-embed-in-tab-slot"
>
<!-- 主导航 Tabbar 由 SceneShell 横/竖壳承担;此处仅内容区 -->
<view class="home-content hf-content-without-tabbar">
<view class="right-side">
<!-- 仅「场景首页」:接待中心 / 我的 为独立路由页(见 HomeFrameTabbar) -->
<!-- 三卡片布局:轻改 / 权益等使用 swiperCustom -->
<view v-if="useCardLayout" class="app-content-box right-content show-content-box">
<view v-if="resolvedShowStartReception"
class="start"
hover-class="start-hover"
@click="onStartClick">
<view class="start-inner">
<view class="start-icon-wrap">
<un-icon name="play-right-fill" size="14" color="#1677ff"></un-icon>
</view>
<text class="start-text">开始接待</text>
</view>
</view>
<view class="right-content-box flex-row">
<view class="content-left">
<view class="module-box box-class">
<view class="common-title">
<text class="title-text">产品介绍</text>
</view>
<view class="content-box">
<ProductIntroSwiper v-if="useCardLayout"
:load-complete="resolvedIntroLoadComplete"
:swiper-list="resolvedIntroSwiperList"
:modules="resolvedIntroModules"
:eyebrow="resolvedIntroEyebrow"
:empty-title="resolvedIntroEmptyTitle"
:empty-text="resolvedIntroEmptyText"
@swiper-change="onIntroSwiperChange"
@slide-tap="onIntroSlideTap" />
<view v-else class="swiper-placeholder">
<text class="placeholder-text">敬请期待</text>
</view>
</view>
</view>
<view class="tool-box box-class">
<view class="common-title">
<text class="title-text">{{ resolvedToolBoxTitle }}</text>
</view>
<view class="content-box">
<Entrance :scene-type="sceneType" />
</view>
</view>
</view>
<view class="content-right box-class">
<view class="common-title">
<text class="title-text">服务中心</text>
</view>
<view class="content-box">
<HomeFrameMessageIndex class="message-box" />
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { computed, defineExpose, ref } from "vue";
import type { UnSwiperItem } from "@/uni_modules/uview-unix";
import Entrance from "@/components/Entrance.uvue";
// import { cssClassRef, useResolutionConfig } from "@/services/adapter";
import { layoutService } from "@/services/LayoutService.uts";
import { requestRecordPermission } from "@/utils/permission.uts";
import { storage } from "@/utils/storage.uts";
import HomeFrameMessageIndex from "./MessageIndex.uvue";
import ProductIntroSwiper from "./ProductIntroSwiper.uvue";
import { recordService } from "@/services/recorder/index.uts";
const props = withDefaults(defineProps<{
showFooter?: boolean
swiperCustom?: boolean
/** 产品介绍区:与 swiperCustom 配套,由页面传入列表与文案 */
introLoadComplete?: boolean
introSwiperList?: UnSwiperItem[]
introModules?: any[]
introEyebrow?: string
introEmptyTitle?: string
introEmptyText?: string
// introSwiperHeight?: number | null
/** 是否显示「开始接待」按钮;未传或为 true 时显示 */
showStartReception?: boolean
/** 展业工具区块标题,默认「展业工具」 */
toolBoxTitle?: string
/**
* 嵌入 `pages/index/index` 的 SceneShell 槽内:与外层壳叠加时作为 flex 子项占满剩余区域。
* 独立整页使用 HomeFrame 时不要传(默认 false)。
*/
embedInTabSlot?: boolean
}>(), {
showStartReception: true,
embedInTabSlot: false,
});
const tabSlotEmbedClass = computed((): string => {
return props.embedInTabSlot === true ? "hf-embed-in-tab-slot" : "";
});
const emit = defineEmits<{
start: []
introSwiperChange: [index: number]
introSlideTap: [index: number]
}>();
const resolvedShowStartReception = computed((): boolean => {
return props.showStartReception !== false;
});
const resolvedToolBoxTitle = computed((): string => {
const t = props.toolBoxTitle;
if (t != null && t !== "") {
return t as string;
}
return "展业工具";
});
const useCardLayout = computed((): boolean => {
return props.swiperCustom === true;
});
const resolvedIntroLoadComplete = computed((): boolean => {
return props.introLoadComplete === true;
});
const resolvedIntroSwiperList = computed((): UnSwiperItem[] => {
const list = props.introSwiperList;
return list != null ? list : ([] as UnSwiperItem[]);
});
const resolvedIntroModules = computed((): any[] => {
const m = props.introModules;
return m != null ? m : [];
});
const resolvedIntroEyebrow = computed((): string => {
const t = props.introEyebrow;
return t != null && t !== "" ? (t as string) : "权益中心";
});
const resolvedIntroEmptyTitle = computed((): string => {
const t = props.introEmptyTitle;
return t != null && t !== "" ? (t as string) : "权益配置中";
});
const resolvedIntroEmptyText = computed((): string => {
const t = props.introEmptyText;
return t != null && t !== "" ? (t as string) : "敬请期待";
});
// const resolvedIntroSwiperHeight = computed((): number => {
// const h = props.introSwiperHeight;
// if (h != null) {
// return h as number;
// }
// // 轮播图高度 = module-box 高度 - 标题栏高度(48px) - 头部高度(40px)
// // 从 CSS 变量中获取 module-box-height
// const isLandscape = !layoutService.isMode("portrait");
// const resolution = layoutService.getResolutionBucket();
// // 根据不同分辨率返回对应的高度
// if (isLandscape) {
// if (resolution == "1174x768") return 266; // 360 - 54 - 40
// if (resolution == "1024x768") return 348; // 440 - 52 - 40
// if (resolution == "816x393") return 116; // 200 - 44 - 40
// return 352; // 默认横屏 440 - 48 - 40
// } else {
// if (resolution == "768x1174") return 556; // 650 - 54 - 40
// if (resolution == "414x896") return 366; // 450 - 44 - 40
// if (resolution == "393x816") return 318; // 400 - 42 - 40
// return 332; // 默认竖屏 420 - 48 - 40
// }
// });
function onIntroSwiperChange(index: number): void {
emit("introSwiperChange", index);
}
function onIntroSlideTap(index: number): void {
emit("introSlideTap", index);
}
// useResolutionConfig();
// const adapterClass = computed((): string => {
// const cls = cssClassRef.value;
// console.log('[HomeFrame] adapterClass:', cls);
// return cls != null ? (cls as string) : "";
// });
// const modeClass = computed((): string => {
// const modeRef = layoutService.getCurrentMode();
// const m = modeRef.value;
// return m == "portrait" ? "mode-portrait" : "mode-landscape";
// });
// const resolutionClass = computed((): string => {
// const bucket = layoutService.getResolutionBucket();
// return `res-${bucket}`;
// });
// // 动态样式 - 根据分辨率返回不同的样式(使用 CSS 变量)
// const dynamicModuleBoxStyle = computed((): any => {
// return {};
// });
// const dynamicToolBoxStyle = computed((): any => {
// return {};
// });
const userInfo = ref<UTSJSONObject>({});
const sceneType = ref<number>(1);
function updateApp(): void {
const info = storage.get("userInfo");
if (info != null) {
userInfo.value = info as UTSJSONObject;
const st = userInfo.value.sceneType as null | number;
sceneType.value = st != null ? st : 1;
}
}
function onStartClick(): void {
emit("start");
}
onLoad((options) => {
requestRecordPermission();
});
defineExpose({
updateApp
});
</script>
<style scoped lang="scss">
@import "./styles/common.scss";
</style>
<template>
<!--
层级(仅 index 物理 tab 页):
1) SceneShell:横/竖两套 MainTabShell + 槽,见 SceneShell.uvue
2) HomeMainTab:按 userInfo.sceneType 切换下方三选一子树
3) *HomePanel:各场景业务 + 内层 HomeFrame(三卡片区,embedInTabSlot 与壳分工)
-->
<view class="hf-home-main-tab">
<view v-if="resolvedSceneType === 1"
class="hf-home-main-inner">
<BoutiqueHomePanel :logic="logic" />
</view>
<view v-else-if="resolvedSceneType === 0"
class="hf-home-main-inner">
<EquityHomePanel />
</view>
<view v-else-if="resolvedSceneType === 7"
class="hf-home-main-inner">
<UsedCarHomePanel />
</view>
<view v-else
class="hf-home-main-fallback">
<text class="hf-fallback-text">暂不支持当前场景</text>
</view>
</view>
</template>
<script setup lang="uts">
import { computed } from "vue";
import BoutiqueHomePanel from "@/pages/boutique/components/BoutiqueHomePanel.uvue";
import EquityHomePanel from "@/pages/equity/components/EquityHomePanel.uvue";
import UsedCarHomePanel from "@/pages/usedCar/components/UsedCarHomePanel.uvue";
import type { BoutiqueLogic } from "@/pages/boutique/useBoutiqueLogic.uts";
import { storage } from "@/utils/storage.uts";
const props = defineProps<{
logic: BoutiqueLogic
/** SceneShell 同步的 userInfo;switchTab 回首页时随 updateApp 更新,避免子组件 onShow 不触发导致场景不刷新 */
userInfo?: null | UTSJSONObject
}>();
const logic = props.logic;
function sceneTypeFromStorage(): number {
const raw = storage.get("userInfo");
if (raw == null) {
return 1;
}
const st = (raw as UTSJSONObject).sceneType as null | number;
return st != null ? st : 1;
}
const resolvedSceneType = computed((): number => {
const u = props.userInfo;
if (u != null) {
const st = (u as UTSJSONObject).sceneType as null | number;
if (st != null) {
return st as number;
}
}
return sceneTypeFromStorage();
});
</script>
<style scoped lang="scss">
.hf-home-main-tab {
flex: 1;
width: 100%;
height: 100%;
min-height: 0;
min-width: 0;
display: flex;
flex-direction: column;
}
.hf-home-main-inner {
flex: 1;
width: 100%;
min-height: 0;
min-width: 0;
display: flex;
flex-direction: column;
}
.hf-home-main-fallback {
flex: 1;
width: 100%;
min-height: 0;
min-width: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 24px;
}
.hf-fallback-text {
font-size: 15px;
color: #666;
text-align: center;
}
</style>
<template>
<view class="home-frame-container scene-shell-root">
<view class="my-center-wrap">
<MyCenterMain :user-info="resolvedUserInfo" />
</view>
</view>
</template>
<script setup lang="uts">
import { computed } from "vue";
// import { cssClassRef, useResolutionConfig } from "@/services/adapter";
import { layoutService } from "@/services/LayoutService.uts";
import MyCenterMain from "@/pages/person/MyCenterMain.uvue";
const props = defineProps<{
userInfo?: null | UTSJSONObject
}>();
// useResolutionConfig();
// const adapterClass = computed((): string => {
// const cls = cssClassRef.value;
// return cls != null ? (cls as string) : "";
// });
// const modeClass = computed((): string => {
// const modeRef = layoutService.getCurrentMode();
// const m = modeRef.value;
// return m == "portrait" ? "mode-portrait" : "mode-landscape";
// });
// TODO
const resolutionClass = computed((): string => {
const bucket = layoutService.getResolutionBucket();
return `res-${bucket}`;
});
const resolvedUserInfo = computed((): UTSJSONObject => {
const u = props.userInfo;
return u != null ? u : ({} as UTSJSONObject);
});
</script>
<style scoped lang="scss">
@import "../styles/common.scss";
.my-center-wrap {
flex: 1;
width: 100%;
height: 100%;
min-height: 0;
display: flex;
flex-direction: column;
}
</style>
<template>
<view class="hf-reception-stack">
<ReceptionCenterMain />
</view>
</template>
<script setup lang="uts">
import ReceptionCenterMain from "@/pages/receptionCenter/center.uvue";
</script>
<style scoped lang="scss">
.hf-reception-stack {
flex: 1;
width: 100%;
height: 100%;
min-height: 0;
display: flex;
flex-direction: column;
}
</style>
# HomeFrame 响应式样式配置
## 🎨 企业级设计系统
HomeFrame 采用现代化的企业级设计语言,融合以下核心设计理念:
### 设计原则
- **视觉层次**:通过阴影、渐变、圆角建立清晰的层级关系
- **微交互**:悬停效果、过渡动画提升用户体验
- **响应式适配**:横竖屏自动切换,多分辨率精确适配
- **一致性**:统一的设计令牌(Design Tokens)确保视觉一致性
### 核心特性
✨ **玻璃态卡片** - `backdrop-filter: blur(10px)` 营造现代感
🌈 **渐变色彩** - 企业级渐变色方案(primary/secondary/success)
💫 **流畅动画** - cubic-bezier 缓动函数实现自然过渡
📐 **精确间距** - 8px 网格系统保证布局规整
🎯 **响应式图标** - Entrance 组件图标尺寸随屏幕自适应
---
## 架构说明
HomeFrame 组件采用 **CSS 变量 + layout-root** 的响应式方案,无需手动处理横竖屏切换。
### 核心原理
1. **配置文件** - `index.vars.uts` 定义所有响应式变量
2. **自动注入** - `layout-root` 组件根据屏幕状态自动应用对应的 CSS 变量
3. **样式引用** - SCSS 中使用 `var(--xxx)` 引用变量,自动响应变化
## 配置文件结构
```typescript
// styles/index.vars.uts
export default {
common: {
// 所有场景通用
"--common-title-height": "48px",
// 设计系统变量
"--l-spacing-sm": "8px",
"--l-radius-lg": "16px",
"--l-shadow-md": "0 4px 16px rgba(0, 0, 0, 0.08)",
"--l-bg-card": "rgba(255, 255, 255, 0.85)",
"--l-gradient-primary": "linear-gradient(135deg, #667eea 0%, #764ba2 100%)",
},
portrait: {
// 竖屏专用
"--module-box-height": "auto",
"--tool-box-min-height": "280px",
"--entrance-icon-size": "52px",
},
landscape: {
// 横屏专用
"--module-box-height": "320px",
"--tool-box-height": "280px",
"--entrance-icon-size": "56px",
},
resolutions: {
// 精确分辨率适配(优先级最高)
"landscape-1024x768": {
"--module-box-height": "360px",
"--entrance-icon-size": "60px",
},
},
};
```
## 使用方式
### 1. 在组件中导入配置
```typescript
import pageVars from "./styles/index.vars";
```
### 2. 在 SCSS 中使用 CSS 变量
```scss
.module-box {
height: var(--module-box-height);
min-height: var(--tool-box-min-height);
}
```
### 3. 无需任何 JavaScript 逻辑
❌ **不需要**:
- 监听屏幕旋转事件
- 手动计算样式
- 条件判断横竖屏
- 动态绑定 `:style`
✅ **只需要**:
- 定义 CSS 变量
- 在 SCSS 中引用
## 变量命名规范
HomeFrame 布局相关变量简洁命名,间距和字体保留 `l-` 前缀:
### 基础变量
| 变量名 | 说明 | 示例值 |
| -------------------------- | ------------------------ | ---------------- |
| `--module-box-height` | 产品介绍模块高度 | `320px` / `auto` |
| `--tool-box-height` | 展业工具模块高度(横屏) | `280px` |
| `--tool-box-min-height` | 展业工具最小高度(竖屏) | `280px` |
| `--tool-box-margin-bottom` | 展业工具底部间距 | `16px` / `0` |
| `--common-title-height` | 通用标题高度 | `48px` |
| `--tabbar-height` | TabBar 高度 | `60px` / `540px` |
| `--tabbar-icon-size` | TabBar 图标大小 | `24px` / `28px` |
| `--tabbar-width` | TabBar 宽度(横屏) | `120px` |
| `--tabbar-padding` | TabBar 内边距(横屏) | `16px` |
| `--entrance-icon-size` | Entrance 图标尺寸 | `52px` / `56px` |
| `--entrance-item-gap` | Entrance 项目间距 | `20px` / `24px` |
### 设计系统变量
| 变量名 | 说明 | 示例值 |
| ---------------- | ---------------------------------- | --------------------------- |
| `--l-spacing-*` | 间距变量 (xs/sm/md/lg/xl/2xl/3xl) | `4px` ~ `32px` |
| `--l-font-*` | 字体变量 (xs/sm/md/lg) | `12px` ~ `18px` |
| `--l-radius-*` | 圆角变量 (sm/md/lg/xl) | `8px` ~ `20px` |
| `--l-shadow-*` | 阴影变量 (sm/md/lg) | 多层次阴影 |
| `--l-bg-card` | 卡片背景色 | `rgba(255, 255, 255, 0.85)` |
| `--l-gradient-*` | 渐变色 (primary/secondary/success) | 企业级渐变 |
## 配置层级与优先级
```
resolutions[方向-分辨率] > portrait/landscape > common
(最高) (中) (最低)
```
**合并规则**:后合并的配置覆盖前面的同名属性
## 调试方法
1. 打开控制台,查看 `[useScreenVars]` 日志
2. 确认当前应用的 CSS 变量值
3. 旋转屏幕,观察变量是否自动更新
## 注意事项
⚠️ **重要**:
- 变量名必须与 `index.vars.uts` 中定义的完全一致
- 分辨率 key 格式:`{方向}-{宽}x{高}`,如 `portrait-393x816`
- UTS 对象属性间必须用逗号分隔
- 不要在组件中使用 `:style` 动态绑定,让 CSS 变量自动生效
## 扩展新分辨率
在 `resolutions` 中添加新的配置即可:
```typescript
resolutions: {
// 新增 iPad Pro 横屏
'landscape-1366x1024': {
'--module-box-height': '400px',
'--tool-box-height': '320px',
}
}
```
系统会自动识别并应用,无需修改其他代码。
// HomeFrame 响应式样式配置 - 横竖屏与分辨率适配
export default {
common: {
// 通用标题高度
'--common-title-height': '48px',
// 间距变量
'--l-spacing-xs': '4px',
'--l-spacing-sm': '8px',
'--l-spacing-md': '12px',
'--l-spacing-lg': '16px',
'--l-spacing-xl': '20px',
'--l-spacing-2xl': '24px',
'--l-spacing-3xl': '32px',
// 字体大小
'--l-font-xs': '12px',
'--l-font-sm': '14px',
'--l-font-md': '16px',
'--l-font-lg': '18px',
// 圆角
'--l-radius-sm': '8px',
'--l-radius-md': '12px',
'--l-radius-lg': '16px',
'--l-radius-xl': '20px',
// 阴影
'--l-shadow-sm': '0 2px 8px rgba(0, 0, 0, 0.04)',
'--l-shadow-md': '0 4px 16px rgba(0, 0, 0, 0.08)',
'--l-shadow-lg': '0 8px 24px rgba(0, 0, 0, 0.12)',
// 背景色
'--l-bg-card': 'rgba(255, 255, 255, 0.85)',
'--l-bg-card-hover': 'rgba(255, 255, 255, 0.95)',
// 渐变色
'--l-gradient-primary': 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
'--l-gradient-secondary': 'linear-gradient(135deg, #f093fb 0%, #f5576c 100%)',
'--l-gradient-success': 'linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)',
},
portrait: {
// 竖屏布局 - 产品介绍占 60%
// 可用高度 = 屏幕高度 - 状态栏(44px) - 标题栏(48px) - TabBar(60px) ≈ 屏幕高度 - 152px
'--module-box-height': '288px',
'--tool-box-min-height': '200px',
'--tool-box-margin-bottom': 'var(--l-spacing-lg)',
// Entrance 图标尺寸(竖屏)
'--entrance-icon-size': '52px',
'--entrance-item-gap': 'var(--l-spacing-xl)',
// TabBar 相关(竖屏底部)
'--tabbar-height': '70px',
'--tabbar-icon-size': '34px',
},
landscape: {
// 横屏布局 - 产品介绍占 65%
// 可用高度 = 屏幕高度 - 状态栏(44px) - 标题栏(48px) ≈ 屏幕高度 - 92px (TabBar在左侧,不影响高度)
'--module-box-height': '288px',
'--tool-box-height': '200px',
'--tool-box-min-height': 'auto',
'--tool-box-margin-bottom': '0',
// Entrance 图标尺寸(横屏)
'--entrance-icon-size': '56px',
'--entrance-item-gap': 'var(--l-spacing-2xl)',
// TabBar 相关(横屏左侧)
'--tabbar-width': '120px',
'--tabbar-height': '540px',
'--tabbar-padding': '16px',
'--tabbar-icon-size': '28px',
// TabBar 相关(竖屏底部)
'--tabbar-height': '70px',
'--tabbar-icon-size': '34px',
},
resolutions: {
// 大屏平板横屏 (1174x768) - 产品介绍占 65%
// 可用高度 = 768 - 44(状态栏) - 54(标题) ≈ 670px
'landscape-1174x768': {
'--module-box-height': '360px',
'--tool-box-height': '280px',
'--common-title-height': '54px',
'--entrance-icon-size': '64px',
'--entrance-item-gap': 'var(--l-spacing-3xl)',
'--tabbar-height': '70px',
'--tabbar-icon-size': '46px',
},
// 小屏 Pad 横屏 (816x393) - 产品介绍占 65%
// 可用高度 = 393 - 44(状态栏) - 44(标题) ≈ 305px
'landscape-816x393': {
'--module-box-height': '200px',
'--tool-box-height': '90px',
'--common-title-height': '44px',
'--entrance-icon-size': '52px',
'--tabbar-height': '70px',
'--tabbar-icon-size': '34px',
},
// iPhone 14 Pro 竖屏 (393x816) - 产品介绍占 60%
// 可用高度 = 816 - 44(状态栏) - 42(标题) - 60(TabBar) ≈ 670px
'portrait-393x816': {
'--module-box-height': '288px',
'--tool-box-min-height': '200px',
'--common-title-height': '42px',
'--tabbar-height': '70px',
'--tabbar-icon-size': '34px',
},
// 大屏平板竖屏 (768x1174) - 产品介绍占 65%
// 可用高度 = 1174 - 44(状态栏) - 54(标题) - 70(TabBar) ≈ 1006px
'portrait-768x1174': {
'--module-box-height': '500px',
'--tool-box-min-height': '200px',
'--common-title-height': '54px',
'--entrance-icon-size': '64px',
'--entrance-item-gap': 'var(--l-spacing-3xl)',
'--tabbar-height': '100px',
'--tabbar-icon-size': '36px',
},
}
}
import { computed, ref } from "vue";
import { storage } from "@/utils/storage.uts";
import { notifyUserSceneTypeChanged } from "@/utils/userSceneEvents.uts";
import { hideNativeTabBar } from "@/utils/tabBarShell.uts";
export type HomeFrameTabbarSource = {
getTabIndex: () => number
getUserInfo: () => null | UTSJSONObject
}
/** SceneShell `provide`:`Ref<UTSJSONObject>`;MainTabShell `inject`,与插槽同源 */
export const SCENE_SHELL_USER_INFO_INJECT_KEY = "homeFrame.sceneShellUserInfo"
export type TabItem = {
label: string;
icon: string;
name: string;
/** 模板内仅用路径字段,避免 UTS 在 slot 中调用 import 的函数 */
iconSrcActive: string;
iconSrcInactive: string;
};
export type SceneTypeItem = { describe: string; icon: string; title: string; }
export const HOME_FRAME_TABS: TabItem[] = [
{
label: "首页",
icon: "home",
name: "HomeSlot",
iconSrcActive: "/static/images/tabbar/home-active.png",
iconSrcInactive: "/static/images/tabbar/home.png"
},
{
label: "接待中心",
icon: "record",
name: "ReceptionCenter",
iconSrcActive: "/static/images/tabbar/record-active.png",
iconSrcInactive: "/static/images/tabbar/record.png"
},
{
label: "我的",
icon: "my",
name: "MyCenter",
iconSrcActive: "/static/images/tabbar/study-active.png",
iconSrcInactive: "/static/images/tabbar/study.png"
},
];
export function getSceneTypeItem(sceneId: number): null | SceneTypeItem {
if (sceneId == 1) return { title: "轻改", describe: "太阳膜升级转化", icon: "轻" };
if (sceneId == 0) return { title: "会员权益/升级", describe: "权益延保", icon: "权" };
if (sceneId == 7) return { title: "二手车", describe: "二手车业务", icon: "二" };
return null;
}
export function getTabIconSrc(icon: string, active: boolean): string {
if (icon === "home") {
return active ? "/static/images/tabbar/home-active.png" : "/static/images/tabbar/home.png";
}
if (icon === "record") {
return active ? "/static/images/tabbar/record-active.png" : "/static/images/tabbar/record.png";
}
if (icon === "study") {
return active ? "/static/images/tabbar/study-active.png" : "/static/images/tabbar/study.png";
}
if (icon === "my") {
return active ? "/static/images/tabbar/study-active.png" : "/static/images/tabbar/study.png";
}
return "/static/images/tabbar/home.png";
}
function reLaunchPage(pagesJsonPath: string): void {
const trimmed = pagesJsonPath.startsWith("/") ? pagesJsonPath.substring(1) : pagesJsonPath;
const withSlash = "/" + trimmed;
uni.reLaunch({
url: withSlash,
fail: (_err: any) => {
uni.reLaunch({ url: trimmed });
}
});
}
function switchTabPage(pagesJsonPath: string): void {
const trimmed = pagesJsonPath.startsWith("/") ? pagesJsonPath.substring(1) : pagesJsonPath;
const url = "/" + trimmed;
uni.switchTab({
url,
success: () => {
hideNativeTabBar();
},
fail: (_err: any) => {
reLaunchPage(trimmed);
}
});
}
export function useHomeFrameTabbar(source: HomeFrameTabbarSource) {
const showScenePopup = ref(false);
const showSetting = ref(false);
const currentTabIndex = computed((): number => {
return source.getTabIndex();
});
const sceneTypeList = computed((): UTSJSONObject[] => {
const info = source.getUserInfo();
let openArr: number[] = [1, 0, 7];
if (info != null) {
const arr = (info as UTSJSONObject).openSceneArr as null | number[];
if (arr != null && arr.length > 0) {
openArr = arr;
}
}
const result: UTSJSONObject[] = [];
const valid = [1, 0, 7];
for (const element of openArr) {
const e = element as number;
if (valid.indexOf(e) >= 0) {
const item = getSceneTypeItem(e);
if (item != null) {
result.push({ title: item.title, describe: item.describe, icon: item.icon } as UTSJSONObject);
}
}
}
if (result.length === 0) {
result.push(
{ title: "轻改", describe: "太阳膜升级转化", icon: "轻" } as UTSJSONObject,
{ title: "会员权益/升级", describe: "权益延保", icon: "权" } as UTSJSONObject,
{ title: "二手车", describe: "二手车业务", icon: "二" } as UTSJSONObject
);
}
return result;
});
const sceneTypeIdList = computed((): number[] => {
const info = source.getUserInfo();
let openArr: number[] = [1, 0, 7];
if (info != null) {
const arr = (info as UTSJSONObject).openSceneArr as null | number[];
if (arr != null && arr.length > 0) {
openArr = arr;
}
}
const valid = [1, 0, 7];
const result: number[] = [];
for (const element of openArr) {
const e = element as number;
if (valid.indexOf(e) >= 0) {
result.push(e);
}
}
if (result.length === 0) {
return [1, 0, 7];
}
return result;
});
const userName = computed((): string => {
const info = source.getUserInfo();
if (info == null) {
return "";
}
const obj = info as UTSJSONObject;
const raw = obj.name ?? obj.staffName ?? obj.merchantName;
if (raw == null) {
return "";
}
const s = `${raw}`;
return s !== "" ? s : "";
});
const navigateToTab = (index: number): void => {
const cur = source.getTabIndex();
if (index == cur) {
return;
}
if (index == 0) {
switchTabPage("pages/index/index");
return;
}
if (index == 1) {
switchTabPage("pages/receptionCenter/center");
return;
}
if (index == 2) {
switchTabPage("pages/person/myCenter");
return;
}
};
const onTabChange = (name: string | number): void => {
const idx = name as number;
navigateToTab(idx);
};
const onScenePopupVisible = (v: boolean): void => {
showScenePopup.value = v;
};
const onSettingVisible = (v: boolean): void => {
showSetting.value = v;
};
const onSceneChange = (): void => {
showScenePopup.value = true;
};
const onSetting = (): void => {
showSetting.value = true;
};
const onChooseScene = (index: number): void => {
const ids = sceneTypeIdList.value;
if (index < 0 || index >= ids.length) {
return;
}
const sceneType = ids[index];
const raw = storage.get("userInfo");
if (raw == null) {
return;
}
const info = raw as UTSJSONObject;
const current = info.sceneType as null | number;
if (current != null && current == sceneType) {
return;
}
info.sceneType = sceneType;
uni.showLoading({ title: "切换中", mask: true });
storage.set("userInfo", info, 0);
notifyUserSceneTypeChanged(sceneType);
uni.switchTab({
url: "/pages/index/index",
success: () => {
hideNativeTabBar();
},
complete: () => {
uni.hideLoading();
},
fail: (_err: any) => {
uni.hideLoading();
reLaunchPage("pages/index/index");
}
});
};
const jumpPersonCenter = (): void => {
uni.navigateTo({ url: "/pages/person/attendance" });
};
return {
showScenePopup,
showSetting,
currentTabIndex,
sceneTypeList,
sceneTypeIdList,
userName,
onTabChange,
onScenePopupVisible,
onSettingVisible,
onSceneChange,
onSetting,
onChooseScene,
jumpPersonCenter
};
}
<template>
<un-page class="layout-root layout-column-shell">
<slot />
</un-page>
</template>
<script setup lang="uts">
// import { resolutionState } from "@/services/adapter/index.uts";
// 在这里统一调用初始化,确保任何使用 Layout 的页面都能获得正确的配置
// useResolutionConfig();
</script>
<style>
.layout-column-shell {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
}
</style>
<template>
<un-page class="layout-root" :style="styleObject">
<slot></slot>
</un-page>
</template>
<script setup lang="uts">
import { computed, onMounted, onUnmounted, type Ref, ref } from 'vue'
// import { useLayout } from '@/composables/useLayout'
// import { cssClassRef, updateResolutionConfig, useResolutionConfig } from '@/services/adapter'
import { updateOrientation, useScreenVars } from '@/services/adapter/hooks/index.uts'
// import { layoutService } from '@/services/LayoutService.uts'
// import pageVars from '@/pages/common/accountItems/index.vars'
const props = defineProps<{
pageVars?: UTSJSONObject | null
}>()
// const layout = useLayout()
// const rawCssVars = (layout as UTSJSONObject)['cssVars'] as Ref<UTSJSONObject> | null
// onResize(() => {
// console.log('layout-------onResize',1112321321321321)
// updateOrientation()
// })
// const styleObj = computed((): UTSJSONObject => {
// const r = rawCssVars
// if (r == null) return {}
// const v = r.value
// return v != null ? v : {}
// })
// // useResolutionConfig()
// const LAYOUT_ROOT_POLL_MS = 350
// let layoutRootPollId: number | null = null
// let lastLayoutW = 0
// let lastLayoutH = 0
// function syncLayoutRootResolution(): void {
// const info = uni.getWindowInfo()
// let w = info.windowWidth
// let h = info.windowHeight
// if (w == 0 && info.screenWidth > 0) {
// w = info.screenWidth
// if (info.screenHeight > 0) {
// h = info.screenHeight
// }
// }
// if (w == 0 || h == 0) {
// return
// }
// if (w == lastLayoutW && h == lastLayoutH) {
// return
// }
// lastLayoutW = w
// lastLayoutH = h
// layoutService.refreshScreenInfo()
// updateResolutionConfig()
// }
const screenVarsHook = useScreenVars(props.pageVars ?? null)
const styleObject = computed((): Any => {
const sv = screenVarsHook.screenVars as Ref<UTSJSONObject>
return sv.value as Any
})
// const adapterClass = computed((): string => {
// const cls = cssClassRef.value
// return cls != null ? (cls as string) : ''
// })
// const modeClass = computed((): string => {
// const modeRef = layoutService.getCurrentMode()
// const m = modeRef.value
// return m == 'portrait' ? 'mode-portrait' : 'mode-landscape'
// })
// const resolutionClass = computed((): string => {
// const bucket = layoutService.getResolutionBucket()
// return `res-${bucket}`
// })
onMounted(() => {
// syncLayoutRootResolution()
// layoutRootPollId = setInterval(syncLayoutRootResolution, LAYOUT_ROOT_POLL_MS)
})
onUnmounted(() => {
// const tid = layoutRootPollId
// if (tid != null) {
// clearInterval(tid)
// layoutRootPollId = null
// }
})
</script>
<style>
.layout-root {
width: 100%;
height: 100%;
padding: 0;
padding-top: var(--status-bar-height);
}
</style>
<template>
<un-popup :mode="position"
:show="visible"
:z-index="zIndex"
@close="handlePopupClose"
>
<view class="tips-wrapper"
:class="[{'radius': position === 'center'}]"
:style="popupStyle">
<view class="tips-content">
<view class="icon-close-box flex"
@click="handleHide">
<uni-icons class="icon-close"
color="#1A1A1A"
:size="18"
type="closeempty">
</uni-icons>
</view>
<view class="tips-title">
<template v-if="back">
<view class="icon-back"
:style="{ display: 'flex', alignItems: 'center', justifyContent: 'center' }"
@click="handleBack">
<un-icon name="arrow-left" size="20"></un-icon>
</view>
</template>
<text class="tips-title-text">{{ title }}</text>
</view>
<text v-if="content"
class="tips-text">
{{ content }}
</text>
<slot>
</slot>
</view>
<view v-if="isFooter"
class="tips-footer">
<view v-if="showCancelBtn"
class="tips-btn close"
@click="cancel">
<text class="tips-btn-text tips-btn-text-close">{{ cancelBtnText }}</text>
</view>
<view class="tips-btn preview"
@click="confirm">
<text class="tips-btn-text tips-btn-text-preview">{{ confirmBtnText }}</text>
</view>
</view>
<template v-else>
<slot name="footer">
</slot>
</template>
</view>
</un-popup>
</template>
<script setup lang="uts">
const props = defineProps({
isAutoClose: {
type: Boolean,
default: true
},
position: {
type: String,
default: "center"
},
popupW: Number,
popupH: {
type: Number,
default: 372
},
isFooter: {
type: Boolean,
default: true
},
title: {
type: String,
default: "提示"
},
content: {
type: String,
default: ""
},
confirmBtnText: {
type: String,
default: "确定"
},
cancelBtnText: {
type: String,
default: "取消"
},
maxHeight: Number,
maxWidth: Number,
back: Boolean,
showCancelBtn: {
type: Boolean,
default: true
},
zIndex: {
type: Number,
default: 10_075
}
});
const emit = defineEmits(["close",
"cancel",
"confirm"]);
const visible = ref<boolean>(false);
const popupRef= ref(null);
const popupStyle = computed(() => {
const hasExplicitW = props.popupW != null && props.popupW > 0;
const isCenter = props.position === "center";
const style: UTSJSONObject = {
minHeight: props.popupH != null && props.popupH > 0 ? `${props.popupH}px` : "100%",
maxHeight: props.maxHeight != null && props.maxHeight > 0 ? `${props.maxHeight}px` : "100%"
};
if (hasExplicitW) {
let wPx = props.popupW as number;
if (isCenter) {
const info = uni.getWindowInfo();
const winW = info.windowWidth > 0 ? info.windowWidth : 375;
const capPx = Math.floor(winW * 0.85);
wPx = wPx < capPx ? wPx : capPx;
style.alignSelf = "center";
}
if (props.maxWidth != null && props.maxWidth > 0) {
wPx = wPx < props.maxWidth ? wPx : props.maxWidth;
}
style.width = `${wPx}px`;
} else if (isCenter) {
const info = uni.getWindowInfo();
const winW = info.windowWidth > 0 ? info.windowWidth : 375;
const capPx = Math.floor(winW * 0.85);
const maxCap = props.maxWidth != null && props.maxWidth > 0 ? props.maxWidth : 360;
const wPx = capPx < maxCap ? capPx : maxCap;
style.width = `${wPx}px`;
style.alignSelf = "center";
} else {
style.width = "100%";
if (props.maxWidth != null && props.maxWidth > 0) {
style.maxWidth = `${props.maxWidth}px`;
}
}
return style;
});
function close(): void {
if (props.isAutoClose) {
visible.value = false;
}
emit("close");
}
function hide(): void {
visible.value = false;
}
function handleBack(): void {
emit("close");
}
function open(): void {
visible.value = true;
}
function cancel(): void {
if (props.isAutoClose) {
visible.value = false;
}
emit("cancel");
}
function confirm(): void {
if (props.isAutoClose) {
visible.value = false;
}
emit("confirm");
}
function handlePopupClose(): void {
visible.value = false;
emit("close");
}
// 处理关闭按钮点击(不触发事件,只隐藏)
function handleHide(): void {
hide();
}
defineExpose({ open, close, hide });
</script>
<style scoped lang="scss">
.tips-wrapper {
background: #ffffff;
border-radius: 10px;
height: 100%;
min-height: 0;
overflow: hidden;
display: flex;
flex-direction: column;
box-sizing: border-box;
.tips-content {
width: 100%;
padding: 24px;
box-sizing: border-box;
flex: 1;
min-height: 0;
position: relative;
display: flex;
flex-direction: column;
.icon-close-box {
position: absolute;
right: 0;
top: 0;
width: 60px;
height: 60px;
justify-content: center;
z-index: 2;
align-items: center;
}
.tips-title {
position: relative;
width: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
.icon-back {
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
}
}
}
.tips-text {
font-size: 15px;
color: #5a5e66;
letter-spacing: 0.5px;
line-height: 20px;
text-align: center;
margin-top: 24px;
}
.tips-footer {
display: flex;
align-items: center;
justify-content: space-between;
padding: 16px 24px 24px;
flex-shrink: 0;
border-top: 1px solid #f1f3f5;
flex-direction: row;
}
.tips-btn {
flex: 1;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
height: 44px;
border-radius: 8px;
}
.tips-btn.close {
background-color: #f1f5f9;
margin-right: 12px;
}
.tips-btn.preview {
background-color: #3b82f6;
}
}
.tips-title-text {
font-weight: 700;
font-size: 18px;
color: #1e293b;
text-align: center;
}
.tips-btn-text {
text-align: center;
font-size: 16px;
font-weight: 700;
}
.tips-btn-text-close {
color: #64748b;
}
.tips-btn-text-preview {
color: #ffffff;
}
.radius{
border-radius: 10px;
}
</style>
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
No preview for this file type
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
No preview for this file type
No preview for this file type
No preview for this file type
This diff could not be displayed because it is too large.
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!