Commit 3303c75c by 李伟康

Merge branch 'v1.0.0' of http://192.168.3.233:8090/app/sales-assist-mobile into v1.0.0

2 parents f81acbe7 c6a99b7e
...@@ -6,3 +6,5 @@ ...@@ -6,3 +6,5 @@
node_modules node_modules
assets/images/sprite.png assets/images/sprite.png
assets/css/sprite.scss assets/css/sprite.scss
.codex
/.qoder
...@@ -20,7 +20,7 @@ export default { ...@@ -20,7 +20,7 @@ export default {
// updateResolutionConfig(); // updateResolutionConfig();
// 连接(自动登录) // 连接(自动登录)
// #ifdef APP // #ifdef APP
ws.connect(); // ws.connect();
// #endif // #endif
}, },
onShow () { onShow () {
......
/**
* 新系统认证 API
* 鉴权方式: Bearer Token
*/
import { request } from "@/api/modules/http/http.uts";
/**
* 用户登录
* POST /api/auth/login
* @param data { account: string, password: string }
* @returns { token, userId, username, realName, phone, roleName, stores }
*/
export function login(data: UTSJSONObject): Promise<any> {
return request("/auth/login", data);
}
/**
* 展业素材 API
* GET /api/contents
*/
import { request } from "@/api/modules/http/http.uts";
/**
* 获取已发布的展业素材列表
* @param params { storeId?: number, pageNum?: number, pageSize?: number }
*/
export function getContents(params: UTSJSONObject = {} as UTSJSONObject): Promise<any> {
return request("/contents", params, "GET");
}
/**
* 新系统环境配置(仅包含新系统所需)
* 0: ip 本地 1: dev 开发 2: test 测试 3: prod 生产 4: beta 预发布
*/
const TARGET_OPTIONS = ["ip", "dev", "test", "prod", "beta"];
const TARGET_INDEX = 1;
function pickEnv(map: UTSJSONObject): string {
const target = TARGET_OPTIONS[TARGET_INDEX] ?? "dev";
const val = map[target];
if (val != null) return `${val}`;
const fallback = map["dev"];
return fallback != null ? `${fallback}` : "";
}
/** 新系统后端服务地址 */
const baseUrlMap: UTSJSONObject = {
ip: "http://192.168.1.122:8292",
dev: "http://yjy.dev.glsx.com.cn/sa",
test: "http://yjy.test.glsx.com.cn/sa",
beta: "http://yjy.beta.glsx.com.cn/sa",
prod: "http://yjy.glsx.com.cn/sa",
pet: "http://yjy.test.glsx.com.cn/sa"
};
export const baseUrl: string = pickEnv(baseUrlMap);
/**
* 新系统 HTTP 请求客户端
* - Base: baseUrl(env.uts 按环境选取)
* - 公共路径前缀: /api
* - 鉴权: Bearer Token(自动从 storage.sessionId 注入)
* - 数据格式: JSON
* - 401 自动跳转登录页
*/
import { baseUrl } from "./env.uts";
import { storage } from "@/utils/storage.uts";
/** 401 时清理会话并跳转登录页 */
function redirectLogin(reject: (e: any) => void): void {
storage.set("sessionId", "", 0);
storage.set("userInfo", {} as UTSJSONObject, 0);
uni.hideLoading();
const pages = getCurrentPages();
if (pages.length > 0) {
const currentPage = pages[pages.length - 1];
if (currentPage.route != "pages/common/login/index") {
uni.reLaunch({ url: "/pages/common/login/index" });
}
}
reject("登录已过期,请重新登录");
}
/**
* 新系统统一请求函数
* @param path 接口路径,自动拼接 `${baseUrl}/api` + path,如 `/auth/login`
* @param data 请求体(POST)或查询参数(GET)
* @param method HTTP 方法,默认 POST
* @returns 响应 data 字段(code===0 时)
*/
export function request(
path: string,
data: UTSJSONObject = {} as UTSJSONObject,
method: "GET" | "POST" = "POST"
): Promise<any> {
console.log("🚀 ~ request ~ data:", data)
return new Promise((resolve, reject) => {
uni.getNetworkType({
success: (netRes) => {
if (netRes.networkType == "none") {
uni.hideLoading();
uni.showToast({ title: "网络异常", icon: "none" });
reject("网络异常");
return;
}
// Bearer Token 鉴权
const token = storage.get("sessionId");
const header: UTSJSONObject = { "Content-Type": "application/json" };
if (token != null && `${token}` !== "") {
header.Authorization = `Bearer ${token}`;
}
const fullUrl = `${baseUrl}/api${path}`;
console.log("🚀 ~ request ~ fullUrl:", fullUrl)
uni.request({
url: fullUrl,
data,
method,
header,
dataType: "json",
timeout: 30_000,
success: (response) => {
const statusCode = response.statusCode;
const resData = response.data;
// HTTP 层错误
if (resData == null || statusCode < 200 || statusCode >= 300) {
uni.hideLoading();
// 401 → 登录过期
if (statusCode == 401) {
redirectLogin(reject);
return;
}
const errMsg = resData == null
? "获取数据失败,请重试"
: `服务器错误(${statusCode})`;
console.log("🚀 ~ request ~ errMsg:", errMsg)
uni.showToast({ title: errMsg, icon: "none" });
reject(errMsg);
return;
}
// 业务层解析
const obj = resData as UTSJSONObject;
const code = obj["code"];
// 兼容数字 0 和字符串 "0"
if (code !== 0 && `${code}` !== "0") {
const msg = obj["message"] != null ? `${obj["message"]}` : "请求失败";
uni.showToast({ title: msg, icon: "none" });
reject(msg);
return;
}
// code === 0,返回 data 字段
const payload = obj["data"];
resolve(payload != null ? (payload as any) : ({} as UTSJSONObject));
},
fail: (error) => {
console.log("🚀 ~ request ~ error:", error)
uni.hideLoading();
const msg = error != null && error.errMsg != null
? `${error.errMsg}`
: "网络请求失败";
uni.showToast({ title: msg, icon: "none" });
reject(msg);
}
});
},
fail: () => {
reject("获取网络状态失败");
}
});
});
}
/**
* 接待记录 API
* GET /api/receptions
*/
import { request } from "@/api/modules/http/http.uts";
/**
* 获取接待列表
* @param params { storeId?: number, status?: number, pageNum?: number }
*/
export function getReceptions(params: UTSJSONObject = {} as UTSJSONObject): Promise<any> {
return request("/receptions", params, "GET");
}
...@@ -179,13 +179,11 @@ class Request { ...@@ -179,13 +179,11 @@ class Request {
const dataObj = resData as UTSJSONObject; const dataObj = resData as UTSJSONObject;
// 须先于 returnAll 分支:saveRecCustomer / confirm 等均 returnAll=true,否则 401 永远不会走 restore // 须先于 returnAll 分支:saveRecCustomer / confirm 等均 returnAll=true,否则 401 永远不会走 restore
const code = dataObj.code; const code = dataObj.code;
// ✅ 已迁移到新系统登录,旧接口 401 不再尝试 restore/redirect,仅静默失败
if (`${code}` == "401") { if (`${code}` == "401") {
const currentSessionId = storage.get("sessionId") as string | null; const errMsg = "旧接口认证失败(已迁移至新系统)";
if (currentSessionId != null && currentSessionId != "") { uni.hideLoading();
this.restoreShukeLogin(resolve, reject, urlPath, requestBody, method, returnAll, `${currentSessionId}`); reject(errMsg);
} else {
this.redirectShukeToLogin(reject);
}
return; return;
} }
if (returnAll) { if (returnAll) {
......
export type CustomFormFieldType = "input" | "picker" | "textarea" | "radio" | "checkbox";
export type CustomFormOption = {
label: string
value: string
}
export type CustomFormItem = {
key: string
label: string
type: CustomFormFieldType
inputType?: string
placeholder?: string
required?: boolean
message?: string
full?: boolean
options?: CustomFormOption[]
}
<template>
<view class="module-entry-grid">
<view class="module-entry-grid__list">
<view v-for="(item, index) in entryItems"
:key="index"
class="module-entry-grid__item"
:class="getItemKey(item) == activeKey ? 'module-entry-grid__item--active' : ''"
@click="onEntryClick(getItemKey(item))">
<image class="module-entry-grid__icon"
mode="aspectFit"
:src="getItemIconSrc(item)" />
<text class="module-entry-grid__label">{{ getItemLabel(item) }}</text>
</view>
</view>
</view>
</template>
<script setup lang="uts">
import { computed } from "vue";
const props = defineProps<{
items: UTSJSONObject[]
activeKey: string
}>();
const emit = defineEmits<{
change: [key: string]
}>();
const entryItems = computed((): UTSJSONObject[] => {
return props.items;
});
function getItemKey(item: UTSJSONObject): string {
const value = item["key"];
return value != null ? `${value}` : "";
}
function getItemLabel(item: UTSJSONObject): string {
const value = item["label"];
return value != null ? `${value}` : "";
}
function getItemIconSrc(item: UTSJSONObject): string {
const key = getItemKey(item);
const fieldName = key == props.activeKey ? "activeIconSrc" : "iconSrc";
const value = item[fieldName];
return value != null ? `${value}` : "";
}
function onEntryClick(key: string): void {
if (key == props.activeKey) return;
emit("change", key);
}
</script>
<style scoped lang="scss">
.module-entry-grid {
width: 100%;
min-height: 40px;
height: 100%;
background-color: var(--module-entry-grid-bg, #ffffff);
border-radius: var(--module-entry-grid-radius, 8px);
box-sizing: border-box;
overflow: visible;
}
.module-entry-grid__list {
width: 100%;
min-height: 40px;
height: 100%;
display: flex;
flex-direction: var(--module-entry-grid-list-direction, row);
flex-wrap: var(--module-entry-grid-list-wrap, nowrap);
align-items: stretch;
align-content: flex-start;
box-sizing: border-box;
padding: var(--module-entry-grid-list-padding, 0px);
}
.module-entry-grid__item {
width: var(--module-entry-grid-item-width, 88px);
min-height: 40px;
height: var(--module-entry-grid-item-height, 40px);
flex-shrink: 0;
display: flex;
flex-direction: var(--module-entry-grid-item-direction, row);
align-items: center;
justify-content: center;
border-radius: var(--module-entry-grid-item-radius, 7px);
background-color: var(--module-entry-grid-item-bg, transparent);
box-sizing: border-box;
margin-right: var(--module-entry-grid-item-gap, 0px);
margin-bottom: var(--module-entry-grid-item-bottom-gap, 0px);
}
.module-entry-grid__item--active {
background-color: var(--module-entry-grid-item-active-bg, #f6f9ff);
}
.module-entry-grid__icon {
width: var(--module-entry-grid-icon-size, 16px);
height: var(--module-entry-grid-icon-size, 16px);
margin-right: var(--module-entry-grid-icon-margin-right, 4px);
margin-bottom: var(--module-entry-grid-icon-margin-bottom, 0px);
}
.module-entry-grid__label {
font-size: var(--module-entry-grid-label-size, 13px);
color: var(--module-entry-grid-label-color, #202939);
font-weight: 400;
}
.module-entry-grid__item--active .module-entry-grid__label {
color: var(--tasks-primary, #2f6af7);
font-weight: 600;
}
</style>
...@@ -36,10 +36,9 @@ ...@@ -36,10 +36,9 @@
<script setup lang="uts"> <script setup lang="uts">
import { type Ref, computed, onMounted, ref } from "vue"; import { type Ref, computed, onMounted, ref } from "vue";
import { getList } from "@/api/receiption.uts"; import { getReceptions } from "@/api/modules/receptions.uts";
import { useOrientation } from "@/services/adapter/hooks/index.uts"; import { useOrientation } from "@/services/adapter/hooks/index.uts";
import { getStr } from "@/pages/receptionCenter/types/reception-center-helpers.uts"; import { getStr } from "@/pages/receptionCenter/types/reception-center-helpers.uts";
import { formatReceptionDateTime, getReceptionResultBadgeBgClass } from "@/pages/receptionCenter/lists/reception-list-helpers.uts";
type ReceptionCardItem = { type ReceptionCardItem = {
customerName: string; customerName: string;
...@@ -67,16 +66,24 @@ const cardList = ref<ReceptionCardItem[]>([]); ...@@ -67,16 +66,24 @@ const cardList = ref<ReceptionCardItem[]>([]);
const loading = ref(true); const loading = ref(true);
function buildCardItem(row: UTSJSONObject): ReceptionCardItem { function buildCardItem(row: UTSJSONObject): ReceptionCardItem {
const result = getStr(row, 'result'); const status = row["status"];
const resultText = result != '' ? result : '进行中'; const statusName = getStr(row, 'statusName');
const carType = getStr(row, 'carType'); const resultText = statusName != '' ? statusName : '进行中';
const carTypeText = carType != '' ? carType : '未填写车型'; // 新接口:brand + carSeries 拼接
const brand = getStr(row, 'brand');
const series = getStr(row, 'carSeries');
let carTypeText = '';
if (brand != '') {
carTypeText = series != '' ? `${brand} ${series}` : brand;
} else {
carTypeText = '未填写车型';
}
return { return {
customerName: getStr(row, 'customerName'), customerName: getStr(row, 'customerName'),
resultText: resultText, resultText: resultText,
badgeBgClass: getReceptionResultBadgeBgClass(result), badgeBgClass: status == 1 ? 'rrl-badge--active' : 'rrl-badge--done',
carTypeText: carTypeText, carTypeText: carTypeText,
timeText: formatReceptionDateTime(row, 'start'), timeText: getStr(row, 'startTime'),
rawData: row rawData: row
} as ReceptionCardItem; } as ReceptionCardItem;
} }
...@@ -86,17 +93,29 @@ async function fetchRecentList(): Promise<void> { ...@@ -86,17 +93,29 @@ async function fetchRecentList(): Promise<void> {
try { try {
const params = { const params = {
pageNum: 1, pageNum: 1,
pageSize: props.limit, status: 1
orderFinishFlag: "1"
} as UTSJSONObject; } as UTSJSONObject;
const resp = await getList(params); const resp = await getReceptions(params);
const respObj = resp as UTSJSONObject; // 新接口 request() 已提取 data 层,返回直接是数组
const rows = (respObj.data as UTSJSONObject)?.rows as UTSJSONObject[] | null; let data: any[] = [];
const data = rows != null ? rows : ([] as UTSJSONObject[]); if (resp != null) {
if (Array.isArray(resp)) {
data = resp as any[];
} else {
// 兼容:如果返回的是对象,尝试取 list 字段
const obj = resp as UTSJSONObject;
const list = obj["list"];
if (list != null && Array.isArray(list)) {
data = list as any[];
}
}
}
const limit = props.limit;
const count = data.length < limit ? data.length : limit;
const items: ReceptionCardItem[] = []; const items: ReceptionCardItem[] = [];
let i = 0; let i = 0;
while (i < data.length) { while (i < count) {
items.push(buildCardItem(data[i])); items.push(buildCardItem(data[i] as UTSJSONObject));
i++; i++;
} }
cardList.value = items; cardList.value = items;
......
...@@ -54,6 +54,13 @@ export const HOME_FRAME_TABS: TabItem[] = [ ...@@ -54,6 +54,13 @@ export const HOME_FRAME_TABS: TabItem[] = [
iconSrcActive: "/static/images/tabbar/study-active.png", iconSrcActive: "/static/images/tabbar/study-active.png",
iconSrcInactive: "/static/images/tabbar/study.png" iconSrcInactive: "/static/images/tabbar/study.png"
}, },
{
label: "任务",
icon: "home",
name: "Tasks",
iconSrcActive: "/static/images/tabbar/home-active.png",
iconSrcInactive: "/static/images/tabbar/home.png"
},
]; ];
function reLaunchPage(pagesJsonPath: string): void { function reLaunchPage(pagesJsonPath: string): void {
...@@ -97,6 +104,10 @@ export function navigateToTab(index: number, currentTabIndex: number): void { ...@@ -97,6 +104,10 @@ export function navigateToTab(index: number, currentTabIndex: number): void {
switchTabPage("pages/person/myCenter"); switchTabPage("pages/person/myCenter");
return; return;
} }
if (index == 2) {
switchTabPage("pages/tasks/tasks");
return;
}
} }
export function useHomeFrameTabbar(source: HomeFrameTabbarSource) { export function useHomeFrameTabbar(source: HomeFrameTabbarSource) {
......
...@@ -39,6 +39,13 @@ ...@@ -39,6 +39,13 @@
"navigationBarTitleText": "首页" "navigationBarTitleText": "首页"
} }
}, },
{
"path": "pages/index/reception",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "客户接待"
}
},
{ {
"path": "pages/person/attendance", "path": "pages/person/attendance",
"style": { "style": {
...@@ -88,6 +95,13 @@ ...@@ -88,6 +95,13 @@
"navigationBarTitleText": "接待详情" "navigationBarTitleText": "接待详情"
} }
}, },
{
"path": "pages/tasks/tasks",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "任务"
}
},
{ {
"path": "pages/common/orderEntry/index", "path": "pages/common/orderEntry/index",
"style": { "style": {
...@@ -135,6 +149,12 @@ ...@@ -135,6 +149,12 @@
"selectedIconPath": "static/images/tabbar/home-active.png" "selectedIconPath": "static/images/tabbar/home-active.png"
}, },
{ {
"pagePath": "pages/tasks/tasks",
"text": "任务",
"iconPath": "static/images/tabbar/home.png",
"selectedIconPath": "static/images/tabbar/home-active.png"
},
{
"pagePath": "pages/person/myCenter", "pagePath": "pages/person/myCenter",
"text": "我的", "text": "我的",
"iconPath": "static/images/tabbar/study.png", "iconPath": "static/images/tabbar/study.png",
......
<template> <template>
<view class="content-left"> <view class="content-left">
<view class="module-box box-class"> <view class="module-box">
<!-- ✅ 性能优化:骨架屏 + 异步加载 --> <!-- ✅ 性能优化:骨架屏 + 异步加载 -->
<ProductIntroSkeleton v-if="!logic.loadComplete.value" /> <view v-if="!logic.loadComplete.value" class="module-item">
<view v-else class="content-box"> <view class="content-box">
<ProductIntroSwiper <ProductIntroSkeleton />
:load-complete="logic.loadComplete.value" </view>
:swiper-list="boutiqueIntroSwiperList" </view>
:modules="introModulesForHomeFrame" <view v-else class="module-item">
:eyebrow="boutiqueIntroEyebrowText" <view class="content-box">
empty-title="暂无数据" <ProductIntroGrid
:empty-text="boutiqueIntroEmptyText" :modules="introModulesForHomeFrame"
:show-switch-product="true" eyebrow="展业素材"
@slide-tap="onIntroSlideTap" empty-title="暂无数据"
@switch-product="onIntroSwitchProduct" /> :empty-text="boutiqueIntroEmptyText"
</view> @item-tap="onIntroSlideTap" />
</view> </view>
</view>
</view>
<view class="recent-list-wrapper"> <view class="recent-list-wrapper">
<RecentReceptionList /> <RecentReceptionList />
</view> </view>
<CenterPopup :list="padBusinessTypePopupItems"
title="请选择接待类型"
:visible="showPadBusinessTypePopup"
:selected-type-code="boutiquePadSelectedTypeCode"
@choose="onChoosePadBusinessType"
@update:visible="onPadBusinessTypePopupVisible" />
<PackageDetailPopup ref="packageRef" @close="closePackageDetail"> <PackageDetailPopup ref="packageRef" @close="closePackageDetail">
<view class="package-detail-box"> <view class="package-detail-box">
<view class="package-box"> <view class="package-box">
...@@ -55,14 +50,11 @@ ...@@ -55,14 +50,11 @@
import type { BoutiqueLogic } from "@/pages/boutique/useBoutiqueLogic.uts"; import type { BoutiqueLogic } from "@/pages/boutique/useBoutiqueLogic.uts";
import { useBoutiqueLogic } from "@/pages/boutique/useBoutiqueLogic.uts"; import { useBoutiqueLogic } from "@/pages/boutique/useBoutiqueLogic.uts";
import { ComponentPublicInstance, computed, nextTick, onShow, ref } from "vue"; import { ComponentPublicInstance, computed, onMounted, onShow, ref } from "vue";
import CenterPopup from "@/components/CenterPopup.uvue";
import PackageDetailPopup from "@/pages/boutique/components/PackageDetailPopup.uvue"; import PackageDetailPopup from "@/pages/boutique/components/PackageDetailPopup.uvue";
import ProductIntroSwiper from "@/components/ProductIntroSwiper.uvue"; import ProductIntroGrid from "@/components/ProductIntroGrid.uvue";
import ProductIntroSkeleton from "@/components/Skeleton/ProductIntroSkeleton.uvue"; import ProductIntroSkeleton from "@/components/Skeleton/ProductIntroSkeleton.uvue";
// ✅ 从 uview-unix 模块导入 UnSwiperItem 类型
import type { UnSwiperItem } from "@/uni_modules/uview-unix";
import RecentReceptionList from "@/components/RecentReceptionList.uvue"; import RecentReceptionList from "@/components/RecentReceptionList.uvue";
...@@ -73,14 +65,29 @@ const props = defineProps<{ ...@@ -73,14 +65,29 @@ const props = defineProps<{
const logic: BoutiqueLogic = (props.logic != null) ? props.logic : useBoutiqueLogic(); const logic: BoutiqueLogic = (props.logic != null) ? props.logic : useBoutiqueLogic();
/** 组件级 onShow:每次页面展示时刷新数据(initIfNeeded 有内部防重复守卫) */ /**
* 数据加载:onMounted 覆盖首次加载 + v-if 重建(横竖屏切换);
* onShow 覆盖用户从其他页面返回时的刷新场景。
*/
let _initialized = false; let _initialized = false;
onShow(() => { let _skipNextShow = false;
function _loadData(): void {
if (!_initialized) { if (!_initialized) {
_initialized = true; _initialized = true;
void logic.initIfNeeded(); void logic.initIfNeeded();
} }
void logic.getBoutiquePackageList(); void logic.getBoutiquePackageList();
}
onMounted(() => {
_loadData();
_skipNextShow = true; // onShow 紧随 onMounted 触发时去重,避免首次加载双请求
});
onShow(() => {
if (_skipNextShow) {
_skipNextShow = false;
return;
}
_loadData();
}); });
/** 模板里对嵌套 ComputedRef 的解包因端而异,用本地 computed 收口 */ /** 模板里对嵌套 ComputedRef 的解包因端而异,用本地 computed 收口 */
...@@ -88,54 +95,12 @@ const introModulesForHomeFrame = computed((): any[] => { ...@@ -88,54 +95,12 @@ const introModulesForHomeFrame = computed((): any[] => {
return logic.introCarouselItems.value; return logic.introCarouselItems.value;
}); });
function bannerUrlForItem(item: any): string {
const u = logic.getPkg(item, "bannerImg") as string;
if (u != null && u !== "") {
return u;
}
const m = logic.getPkg(item, "materialUrl") as string;
return m != null && m !== "" ? m : "";
}
const boutiqueIntroSwiperList = computed((): UnSwiperItem[] => {
const list = logic.introCarouselItems.value;
const out: UnSwiperItem[] = [];
for (let i = 0; i < list.length; i++) {
const url = bannerUrlForItem(list[i]);
// ✅ 使用 uview-unix 导出的 UnSwiperItem 类型
out.push({
url: url
} as UnSwiperItem);
}
return out;
});
const boutiqueIntroEmptyText = computed((): string => { const boutiqueIntroEmptyText = computed((): string => {
const t = logic.swiperNoDataObject["text"]; const t = logic.swiperNoDataObject["text"];
return t != null ? `${t}` : "暂无数据"; return t != null ? `${t}` : "暂无数据";
}); });
/** 产品介绍区 eyebrow:当前 Pad 业务类型名(切换后随 logic 更新) */
const boutiqueIntroEyebrowText = computed((): string => {
const n = logic.padSelectedTypeName.value;
if (n != null && n !== "") {
return n;
}
return "产品介绍";
});
const boutiquePadSelectedTypeCode = computed((): string => {
return logic.padSelectedTypeCode.value;
});
const padBusinessTypePopupItems = computed((): any[] => {
const list = logic.businessTypePopupList.value;
return list != null ? list : ([] as any[]);
});
const packageRef = ref(null); const packageRef = ref(null);
/** 切换产品:受控弹层(与 CenterPopup `visible` + `update:visible` 用法一致) */
const showPadBusinessTypePopup = ref<boolean>(false);
function callExposedMethod(comp: any, methodName: string): void { function callExposedMethod(comp: any, methodName: string): void {
if (comp == null) return; if (comp == null) return;
...@@ -155,24 +120,6 @@ function onIntroSlideTap(index: number): void { ...@@ -155,24 +120,6 @@ function onIntroSlideTap(index: number): void {
toDetail(index); toDetail(index);
} }
async function onIntroSwitchProduct(): Promise<void> {
const ok = await logic.preparePadBusinessTypePicker();
if (!ok) {
uni.showToast({ title: "暂无可选类型", icon: "none" });
return;
}
await nextTick();
showPadBusinessTypePopup.value = true;
}
function onPadBusinessTypePopupVisible(value: boolean): void {
showPadBusinessTypePopup.value = value;
}
async function onChoosePadBusinessType(index: number): Promise<void> {
await logic.applyPadBusinessTypeAtIndex(index);
}
function closePackageDetail(): void { function closePackageDetail(): void {
logic.chooseItem.value = {}; logic.chooseItem.value = {};
} }
...@@ -190,11 +137,24 @@ function closePackageDetail(): void { ...@@ -190,11 +137,24 @@ function closePackageDetail(): void {
.module-box { .module-box {
flex-shrink: 0; flex-shrink: 0;
height: var(--module-box-height, 420px); height: var(--module-box-height, 360px);
width: 100%;
overflow: hidden;
}
.module-box .module-item {
width: 100%;
height: 100%;
}
.module-box .content-box {
width: 100%;
height: 100%;
min-height: 0;
} }
.recent-list-wrapper { .recent-list-wrapper {
flex: 1; flex-shrink: 0;
min-height: 0; min-height: 0;
overflow: hidden; overflow: hidden;
margin-top: var(--l-spacing-sm, 8px); margin-top: var(--l-spacing-sm, 8px);
......
...@@ -102,9 +102,8 @@ ...@@ -102,9 +102,8 @@
<script setup lang="uts"> <script setup lang="uts">
import { onUnmounted, ref } from "vue"; import { onUnmounted, ref } from "vue";
import { apiShukeLoginInit, apiShukeStoreList } from "@/api/user-api.uts"; import { login as loginApi } from "@/api/modules/auth.uts";
import { switchTabSelectStoreWithStoresPayload } from "@/utils/shukeSelectStoreNav.uts"; import { switchTabSelectStoreWithStoresPayload } from "@/utils/shukeSelectStoreNav.uts";
import { encryptLoginPassword } from "@/utils/crypto.uts";
import { storage } from "@/utils/storage.uts"; import { storage } from "@/utils/storage.uts";
import pageVars from './styles/index.vars' import pageVars from './styles/index.vars'
import { toStr, toObj, isEmptyStr, isNotEmptyStr, type AnyArrOrNull, type AnyOrNull, type ObjOrNull } from "@/utils/common.uts"; import { toStr, toObj, isEmptyStr, isNotEmptyStr, type AnyArrOrNull, type AnyOrNull, type ObjOrNull } from "@/utils/common.uts";
...@@ -115,8 +114,8 @@ type UniApiFail = { ...@@ -115,8 +114,8 @@ type UniApiFail = {
errMsg: string; errMsg: string;
}; };
const username = ref<string>("陈玲"); const username = ref<string>("admin");
const password = ref<string>("550747"); const password = ref<string>("admin123");
const showPassword = ref<boolean>(false); const showPassword = ref<boolean>(false);
const noSignIn = ref<boolean>(true); const noSignIn = ref<boolean>(true);
const readingStatus = ref<boolean>(true); const readingStatus = ref<boolean>(true);
...@@ -229,7 +228,6 @@ const openUserAgreement = (): void => { ...@@ -229,7 +228,6 @@ const openUserAgreement = (): void => {
const doLogin = async (): Promise<void> => { const doLogin = async (): Promise<void> => {
const u = username.value.trim(); const u = username.value.trim();
const p = password.value.trim(); const p = password.value.trim();
const remember = noSignIn.value;
const agreed = readingStatus.value; const agreed = readingStatus.value;
try { try {
if (u === "") { if (u === "") {
...@@ -245,89 +243,96 @@ const doLogin = async (): Promise<void> => { ...@@ -245,89 +243,96 @@ const doLogin = async (): Promise<void> => {
throw new Error("请您阅读并同意《隐私协议》"); throw new Error("请您阅读并同意《隐私协议》");
} }
const enc = encryptLoginPassword(p);
if (enc == null || enc === "") {
throw new Error("密码加密失败,请重试");
}
// uni.showLoading({
// title: "加载中",
// mask: true
// });
isLogging.value = true; isLogging.value = true;
const loginInRes = await apiShukeLoginInit(toObj({ // ✅ 新系统登录:POST /api/auth/login
username: u, const loginData = await loginApi({
password: enc account: u,
})); password: p
} as UTSJSONObject);
if (loginInRes == null) { if (loginData == null) {
throw new Error("登录失败"); throw new Error("登录失败");
} }
const codeRaw = loginInRes["code"] as number | StrOrNull; const data = toObj(loginData);
const msgAny = loginInRes["msg"] != null ? loginInRes["msg"] : loginInRes["message"]; const token = toStr(data["token"]);
const msgStr = msgAny != null ? `${msgAny}` : ""; if (isEmptyStr(token)) {
throw new Error("登录失败:未获取到 token");
if (codeRaw != null && `${codeRaw}` === "500") {
throw new Error(msgStr !== "" ? msgStr : "登录失败");
}
const data = toObj(loginInRes["data"]);
if (data == null) {
throw new Error(msgStr !== "" ? msgStr : "登录失败");
} }
const accessToken = toStr(data["access_token"]); // ✅ 存储 sessionId(JWT token)
const spInfo = toObj(data["spInfo"]); storage.set("sessionId", token, 0);
const spCode = spInfo != null ? (toStr(spInfo["spCode"])) : null;
// ✅ 从 data.user 提取用户信息(实际响应结构)
if (isNotEmptyStr(accessToken)) { const userObj = toObj(data["user"]);
// ✅ 性能优化:异步存储,避免阻塞主线程 const userId = userObj["id"];
storage.set("sessionId", accessToken, 0); const usernameVal = toStr(userObj["username"]);
} const displayName = toStr(userObj["displayName"]);
const phone = toStr(userObj["phone"]);
const storeListRes = await apiShukeStoreList({ const accountNo = toStr(userObj["accountNo"]);
spCode: spCode != null ? spCode : "" const staffId = toStr(userObj["staffId"]);
} as UTSJSONObject); const tenantId = userObj["tenantId"];
const currentStoreId = toStr(userObj["currentStoreId"]);
if (storeListRes == null) {
throw new Error("获取门店列表失败"); const userInfo = {
} userId: userId,
const storeCodeRaw = storeListRes["code"] as number | StrOrNull; id: userId,
if (storeCodeRaw != null && `${storeCodeRaw}` === "500") { username: usernameVal,
const sm = storeListRes["msg"] != null ? `${storeListRes["msg"]}` : "获取门店列表失败"; accountNo: accountNo,
throw new Error(sm); displayName: displayName,
phone: phone,
staffId: staffId,
tenantId: tenantId,
currentStoreId: currentStoreId,
shopMerchantId: userId != null ? `${userId}` : "",
shopMerchantName: displayName
} as UTSJSONObject;
storage.set("userInfo", userInfo, 0);
// ✅ 解析门店列表(兼容 Array 与 JSON 字符串两种形态)
let stores: any[] | null = null;
const storesRaw = data["stores"];
if (storesRaw != null) {
if (Array.isArray(storesRaw)) {
stores = storesRaw as any[];
} else if (typeof storesRaw === "string") {
try {
const parsed = JSON.parse(storesRaw as string);
if (Array.isArray(parsed)) {
stores = parsed as any[];
}
} catch (_e) {}
}
} }
const storeData = toObj(storeListRes["data"]);
const stores = storeData != null ? (storeData["stores"] as AnyArrOrNull) : null;
if (stores == null || stores.length == 0) { if (stores == null || stores.length == 0) {
throw new Error("暂无门店信息,请联系管理员"); throw new Error("暂无门店信息,请联系管理员");
} }
const spCodeStr = spCode != null ? spCode : ""; // ✅ 存储门店列表(最多 20 个) TODO 后续正式环境要去掉这个截断
const loginPayload = { const storesToUse = stores.slice(0, 20);
username: u, storage.set("pendingShukeStores", storesToUse, 0);
password: enc,
spCode: spCodeStr, if (storesToUse.length == 1) {
noSignIn: remember // 单门店:直接保存门店信息并进入首页
} as UTSJSONObject; const store = storesToUse[0] as UTSJSONObject;
const storeId = toStr(store["storeId"]);
// ✅ 性能优化:异步批量存储,避免阻塞主线程 const storeName = toStr(store["storeName"]);
storage.setAsync("loginForm", loginPayload, 0); const storeCode = toStr(store["storeCode"]);
storage.setAsync("shukeLastConfirmForm", loginPayload, 0); storage.set("storeInfo", {
storage.setAsync("shukeSpCode", spCodeStr, 0); storeId: storeId,
storage.setAsync("pendingShukeStores", stores, 0); storeName: storeName,
storeCode: storeCode
// ✅ 性能优化:立即跳转,不使用 setTimeout } as UTSJSONObject, 0);
switchTabSelectStoreWithStoresPayload(stores); uni.switchTab({ url: "/pages/index/index" });
} else {
// 多门店:跳转选店页
switchTabSelectStoreWithStoresPayload(storesToUse);
}
} catch (error) { } catch (error) {
const msg = error != null ? `${error}` : "操作失败"; const msg = error != null ? `${error}` : "操作失败";
showError(msg); showError(msg);
// uni.hideLoading();
// isLogging.value = false;
} }
}; };
......
export default {
common: {
'--store-page-padding-x': '16px',
'--store-page-padding-y': '14px',
'--store-section-gap': '12px',
'--store-panel-radius': '18px',
'--store-panel-padding': '14px',
'--store-card-radius': '16px',
'--store-card-min-height': '92px',
'--store-title-size': '24px',
'--store-subtitle-size': '13px',
'--store-stat-width': '120px',
'--store-banner-layout': 'row',
},
portrait: {
'--store-page-padding-x': '14px',
'--store-page-padding-y': '12px',
'--store-banner-layout': 'column',
'--store-stat-width': '100%',
},
landscape: {
'--store-page-padding-x': '18px',
'--store-page-padding-y': '12px',
'--store-banner-layout': 'row',
'--store-stat-width': '132px',
},
resolutions: {
'portrait-393x816': {
'--store-page-padding-x': '12px',
'--store-page-padding-y': '10px',
'--store-panel-padding': '12px',
'--store-title-size': '22px'
},
'portrait-414x736': {
'--store-page-padding-x': '12px',
'--store-page-padding-y': '10px'
},
'landscape-816x393': {
'--store-page-padding-x': '10px',
'--store-page-padding-y': '8px',
'--store-panel-padding': '10px',
'--store-card-min-height': '82px',
'--store-stat-width': '112px'
},
'landscape-1024x640': {
'--store-stat-width': '120px'
},
'landscape-1174x768': {
'--store-page-padding-x': '20px',
'--store-stat-width': '140px'
}
}
}
...@@ -42,27 +42,21 @@ async function onStartClick(): Promise<void> { ...@@ -42,27 +42,21 @@ async function onStartClick(): Promise<void> {
return; return;
} }
// 2. 获取 typeCode:优先使用传入值,否则从 storage 读取 // // 2. 获取 typeCode:优先使用传入值,否则从 storage 读取
let typeCode = props.typeCode; // let typeCode = props.typeCode;
if (typeCode === "") { // if (typeCode === "") {
const typeItem = storage.get("typeItem") as UTSJSONObject | null; // const typeItem = storage.get("typeItem") as UTSJSONObject | null;
if (typeItem != null) { // if (typeItem != null) {
const tc = typeItem["typeCode"] as string | null; // const tc = typeItem["typeCode"] as string | null;
typeCode = tc != null ? tc : ""; // typeCode = tc != null ? tc : "";
} // }
} // }
// 3. 校验 typeCode
if (typeCode === "") {
uni.showToast({ title: "请先加载或选择产品类型", icon: "none" });
return;
}
// 4. 统一跳转接待详情页 // 3. 跳转接待页:有 typeCode 时加载当前产品素材,无 typeCode 时回退通用素材
const q = `typeCode=${encodeURIComponent(typeCode)}&type=edit`; // const q = typeCode !== "" ? `?typeCode=${encodeURIComponent(typeCode)}` : "";
uni.navigateTo({ url: `/pages/equity/detail/index?${q}` }); uni.navigateTo({ url: `/pages/index/reception` });
// 5. 通知外部 // 4. 通知外部
emit("start"); emit("start");
} }
</script> </script>
......
...@@ -25,14 +25,14 @@ import BoutiqueHomePanel from "@/pages/boutique/components/BoutiqueHomePanel.uvu ...@@ -25,14 +25,14 @@ import BoutiqueHomePanel from "@/pages/boutique/components/BoutiqueHomePanel.uvu
display: flex; display: flex;
flex-direction: column; flex-direction: column;
overflow: hidden; overflow: hidden;
padding: var(--content-tabbar-gap, 12px); // padding: var(--content-tabbar-gap, 12px);
} }
.right-content-box { .right-content-box {
flex: 1; flex: 1;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
margin-top: var(--l-spacing-md); // margin-top: var(--l-spacing-md);
overflow: hidden; overflow: hidden;
} }
</style> </style>
...@@ -39,7 +39,7 @@ export default { ...@@ -39,7 +39,7 @@ export default {
portrait: { portrait: {
// 竖屏布局 - 产品介绍占 60% // 竖屏布局 - 产品介绍占 60%
// 可用高度 = 屏幕高度 - 状态栏(44px) - 标题栏(48px) - TabBar(60px) ≈ 屏幕高度 - 152px // 可用高度 = 屏幕高度 - 状态栏(44px) - 标题栏(48px) - TabBar(60px) ≈ 屏幕高度 - 152px
'--module-box-height': '420px', '--module-box-height': '350px',
'--swiper-height': 'calc(var(--module-box-height) - 40px)', // 轮播图高度 = module-box - 头部(40px) '--swiper-height': 'calc(var(--module-box-height) - 40px)', // 轮播图高度 = module-box - 头部(40px)
// Entrance 图标尺寸(竖屏) // Entrance 图标尺寸(竖屏)
'--entrance-icon-size': '52px', '--entrance-icon-size': '52px',
...@@ -52,7 +52,7 @@ export default { ...@@ -52,7 +52,7 @@ export default {
landscape: { landscape: {
// 横屏布局 - 产品介绍占 65% // 横屏布局 - 产品介绍占 65%
// 可用高度 = 屏幕高度 - 状态栏(44px) - 标题栏(48px) ≈ 屏幕高度 - 92px (TabBar在左侧,不影响高度) // 可用高度 = 屏幕高度 - 状态栏(44px) - 标题栏(48px) ≈ 屏幕高度 - 92px (TabBar在左侧,不影响高度)
'--module-box-height': '440px', '--module-box-height': '400px',
'--swiper-height': 'calc(var(--module-box-height) - 40px)', // 轮播图高度 = module-box - 头部(40px) '--swiper-height': 'calc(var(--module-box-height) - 40px)', // 轮播图高度 = module-box - 头部(40px)
// Entrance 图标尺寸(横屏) // Entrance 图标尺寸(横屏)
'--entrance-icon-size': '56px', '--entrance-icon-size': '56px',
...@@ -69,7 +69,7 @@ export default { ...@@ -69,7 +69,7 @@ export default {
// 大屏平板横屏 (1174x768) - 产品介绍占 65% // 大屏平板横屏 (1174x768) - 产品介绍占 65%
// 可用高度 = 768 - 44(状态栏) - 54(标题) ≈ 670px // 可用高度 = 768 - 44(状态栏) - 54(标题) ≈ 670px
'landscape-1174x768': { 'landscape-1174x768': {
'--module-box-height': '360px', '--module-box-height': '420px',
'--swiper-height': 'calc(var(--module-box-height) - 40px)', // 320px '--swiper-height': 'calc(var(--module-box-height) - 40px)', // 320px
'--common-title-height': '54px', '--common-title-height': '54px',
'--entrance-icon-size': '64px', '--entrance-icon-size': '64px',
...@@ -117,7 +117,7 @@ export default { ...@@ -117,7 +117,7 @@ export default {
// 大屏平板竖屏 (768x1174) - 产品介绍占 65% // 大屏平板竖屏 (768x1174) - 产品介绍占 65%
// 可用高度 = 1174 - 44(状态栏) - 54(标题) - 70(TabBar) ≈ 1006px // 可用高度 = 1174 - 44(状态栏) - 54(标题) - 70(TabBar) ≈ 1006px
'portrait-768x1174': { 'portrait-768x1174': {
'--module-box-height': '550px', '--module-box-height': '450px',
'--swiper-height': 'calc(var(--module-box-height) - 40px)', // 510px '--swiper-height': 'calc(var(--module-box-height) - 40px)', // 510px
'--common-title-height': '54px', '--common-title-height': '54px',
'--entrance-icon-size': '64px', '--entrance-icon-size': '64px',
......
// 客户接待页响应式变量:方向/分辨率维度由 useScreenVars 自动合并
// 设计规范(对齐 .qoder 规则):
// - 卡片用 1px 边框分隔,不使用 box-shadow,保证 App 端干净自然
// - 横竖屏差异用 CSS 变量承载(margin/宽度/列宽),避免后代选择器
export default {
common: {
// 页面左右/下内边距(顶部单独使用 --desk-shell-padding-top)
"--desk-shell-padding": "14px",
// 顶部内边距:紧贴导航栏占位,避免间距过大
"--desk-shell-padding-top": "2px",
// 面板间距
"--desk-panel-gap": "10px",
// 面板圆角
"--desk-panel-radius": "16px",
// 面板内边距
"--desk-panel-padding": "12px",
// 表单字段高度/间距/字号(紧凑优先)
"--desk-field-height": "42px",
"--desk-field-gap": "6px",
"--desk-field-label-size": "12px",
"--desk-field-input-size": "14px",
// 客户资料区:默认竖屏两行 3+2
"--desk-form-major-col-width": "33.33%",
"--desk-form-minor-col-width": "50%",
// 客户面板宽度:竖屏整行,横屏固定宽度
"--desk-customer-panel-width": "100%",
// 客户面板与素材面板的间距(方向不同,用 margin 变量表达)
"--desk-customer-panel-margin-right": "0px",
"--desk-customer-panel-margin-bottom": "12px"
},
portrait: {
"--desk-panel-gap": "12px",
"--desk-customer-panel-width": "100%",
"--desk-customer-panel-margin-right": "0px",
"--desk-customer-panel-margin-bottom": "12px"
},
landscape: {
// 横屏:1 字段 1 行,利用左侧充足高度换取更好的录入宽度
"--desk-form-major-col-width": "100%",
"--desk-form-minor-col-width": "100%",
"--desk-customer-panel-width": "340px",
"--desk-customer-panel-margin-right": "10px",
"--desk-customer-panel-margin-bottom": "0px",
"--desk-field-gap": "10px"
},
resolutions: {
// 手机竖屏:更紧凑
"portrait-393x816": {
"--desk-shell-padding": "10px",
"--desk-panel-padding": "10px",
"--desk-field-height": "40px",
"--desk-field-gap": "6px"
},
"portrait-414x736": {
"--desk-shell-padding": "10px",
"--desk-field-height": "40px",
"--desk-field-gap": "6px"
},
// 平板竖屏:字段两列
"portrait-768x1174": {
"--desk-form-major-col-width": "33.33%",
"--desk-form-minor-col-width": "50%",
"--desk-shell-padding": "16px"
},
// 小屏 Pad 横屏:压缩面板
"landscape-816x393": {
"--desk-shell-padding": "8px",
"--desk-panel-gap": "8px",
"--desk-customer-panel-width": "300px",
"--desk-panel-padding": "10px",
"--desk-field-height": "40px",
"--desk-field-gap": "8px"
},
"landscape-1024x640": {
"--desk-customer-panel-width": "320px",
"--desk-field-gap": "10px"
},
"landscape-1174x768": {
"--desk-customer-panel-width": "360px",
"--desk-field-gap": "12px"
}
}
}
import { getPadMaterialListApi } from "@/api/common-api.uts";
import { getContents } from "@/api/modules/contents.uts";
export type CustomerReceptionForm = {
customerName: string
phoneNumber: string
plateNumber: string
carBrand: string
carSeries: string
}
const _emptyArr: any[] = [] as any[];
export function createEmptyReceptionForm(): CustomerReceptionForm {
return {
customerName: "",
phoneNumber: "",
plateNumber: "",
carBrand: "",
carSeries: ""
};
}
function toStr(value: any | null): string {
if (value == null) {
return "";
}
return `${value}`;
}
function readShukeDataArray(res: any | null): any[] {
if (res == null) {
return _emptyArr.slice();
}
const root = res as UTSJSONObject;
const data = root["data"];
if (data != null && Array.isArray(data)) {
return data as any[];
}
return _emptyArr.slice();
}
function buildPadMaterialRows(list: any[]): any[] {
const rows: any[] = _emptyArr.slice();
for (let i = 0; i < list.length; i++) {
const raw = list[i] as UTSJSONObject;
const title = readMaterialTitle(raw);
rows.push({
id: raw["id"],
materialName: title,
title: title,
name: title,
contentType: raw["contentType"],
contentTypeName: raw["contentTypeName"],
coverUrl: toStr(raw["coverUrl"]),
thumbnailUrl: toStr(raw["thumbnailUrl"]),
detailUrl: toStr(raw["detailUrl"]),
materialUrl: toStr(raw["materialUrl"])
} as UTSJSONObject);
}
return rows;
}
function buildContentRows(list: any[]): any[] {
const rows: any[] = _emptyArr.slice();
for (let i = 0; i < list.length; i++) {
const raw = list[i] as UTSJSONObject;
const title = readMaterialTitle(raw);
const coverUrl = toStr(raw["coverUrl"]);
rows.push({
id: raw["id"],
materialName: title,
title: title,
name: title,
contentType: raw["contentType"],
contentTypeName: toStr(raw["contentTypeName"]),
coverUrl: coverUrl,
bannerImg: coverUrl,
materialUrl: toStr(raw["bodyUrl"])
} as UTSJSONObject);
}
return rows;
}
export function readMaterialTitle(item: any | null): string {
if (item == null) {
return "";
}
const obj = item as UTSJSONObject;
return (
(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)
?? ""
);
}
export function readMaterialCoverUrl(item: any | null): string {
if (item == null) {
return "";
}
const obj = item as UTSJSONObject;
const candidates = [
obj["coverUrl"],
obj["bannerImg"],
obj["thumbnail"],
obj["thumbnailUrl"],
obj["imageUrl"],
obj["imgUrl"],
obj["detailUrl"]
];
for (let i = 0; i < candidates.length; i++) {
const value = candidates[i];
if (value != null && typeof value === "string" && `${value}` !== "") {
return `${value}`;
}
}
return "";
}
export function readMaterialPreviewUrl(item: any | null): string {
if (item == null) {
return "";
}
const obj = item as UTSJSONObject;
const candidates = [
obj["materialUrl"],
obj["detailUrl"],
obj["bodyUrl"],
obj["contentPicUrl"],
obj["coverUrl"],
obj["thumbnailUrl"]
];
for (let i = 0; i < candidates.length; i++) {
const value = candidates[i];
if (value != null && typeof value === "string" && `${value}` !== "") {
return `${value}`;
}
}
return "";
}
export function buildCustomerInfoPayload(form: CustomerReceptionForm): UTSJSONObject {
return {
customerName: form.customerName,
phoneNumber: form.phoneNumber,
carPlateNumber: form.plateNumber,
carBrand: form.carBrand,
carModel: form.carSeries
} as UTSJSONObject;
}
/**
* 优先加载当前 typeCode 对应的 Pad 首页素材,若未配置则回退到通用展业素材。
*/
export async function loadReceptionMaterials(typeCode: string): Promise<any[]> {
if (typeCode != null && typeCode !== "") {
try {
const shukeHomeRes = await getPadMaterialListApi({
typeCode: typeCode,
status: 0,
showOnHomepage: 1
} as UTSJSONObject);
const padRows = buildPadMaterialRows(readShukeDataArray(shukeHomeRes));
if (padRows.length > 0) {
return padRows;
}
const shukeAllRes = await getPadMaterialListApi({
typeCode: typeCode,
status: 0
} as UTSJSONObject);
const allRows = buildPadMaterialRows(readShukeDataArray(shukeAllRes));
if (allRows.length > 0) {
return allRows;
}
} catch (e) {
console.warn("[ReceptionDesk] load pad materials failed", e);
}
}
try {
const contentRes = await getContents({} as UTSJSONObject);
if (contentRes == null) {
return _emptyArr.slice();
}
const root = contentRes as UTSJSONObject;
const list = root["list"];
if (list != null && Array.isArray(list)) {
return buildContentRows(list as any[]);
}
} catch (e) {
console.warn("[ReceptionDesk] load fallback contents failed", e);
}
return _emptyArr.slice();
}
<template> <template>
<view class="person-page"> <view class="person-page" :style="screenVars">
<!-- <scroll-view class="person-scroll" :scroll-y="true" :show-scrollbar="false"> --> <scroll-view class="person-scroll" :scroll-y="true" :show-scrollbar="false">
<!-- ✅ 统一布局:通过 CSS 变量控制单列/分栏 --> <view class="person-scroll-body">
<view class="person-unified-layout"> <view :class="personDashboardClassName">
<!-- 左侧/上方:用户资料 + 账号信息 --> <view class="person-primary-panel">
<view class="person-primary-panel"> <view class="person-stack-card person-stack-card-first">
<!-- 用户资料卡片 --> <ProfileCard
<ProfileCard :user-name="displayName"
:user-name="userName" :plain-phone="displayPhone"
:plain-phone="plainPhone" :shop-name="displayStoreName"
:shop-name="shopName" :avatar-text="avatarText"
:avatar-text="avatarText" /> :avatar-size="avatarSizeValue"
<!-- 账号信息 --> :avatar-font-size="avatarFontSizeValue" />
<AccountInfo </view>
:user-name="userName" <view class="person-stack-card">
:shop-name="shopName" <AccountInfo
:shop-merchant-id="shopMerchantId" :user-name="displayName"
:plain-phone="plainPhone" /> :shop-name="displayStoreName"
</view> :shop-merchant-id="displayStoreCode"
:plain-phone="displayPhone" />
<!-- 右侧/下方:常用功能 --> </view>
<view class="person-secondary-panel"> </view>
<CommonFunctions
@select-store="goSelectStore" <view :class="personSecondaryClassName">
@attendance="goAttendance" <view class="person-stack-card person-stack-card-first">
@setting="onSetting" <CommonFunctions
@reception-entry="goReceptionCenter" /> @select-store="goSelectStore"
</view> @attendance="goAttendance"
@setting="onSetting"
@reception-entry="goReceptionCenter" />
</view>
</view>
</view>
</view> </view>
</scroll-view>
<!-- ✅ APP 编码页脚(固定在 scroll-view 底部正中间) --> <view class="device-id-panel"
hover-class="device-id-panel-hover"
<view class="device-id-footer" @click="copyDeviceId"> @click="copyDeviceId">
<text class="device-id-footer-text">APP编码: {{ deviceId }}</text> <text class="device-id-panel-text">APP编码: {{ deviceId }}</text>
<un-icon name="fingerprint" size="16" color="#9ca3af" /> <un-icon name="fingerprint" size="16" color="#94a3b8" />
</view> </view>
<!-- </scroll-view> -->
<SettingBox :visible="showSetting" <SettingBox :visible="showSetting"
@update:visible="onSettingVisible" /> @update:visible="onSettingVisible" />
</view> </view>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
import { computed, onMounted, ref } from "vue"; import { computed, onMounted, ref, nextTick } from "vue";
import { navigateToSelectStoreWithSessionStores } from "@/utils/shukeSelectStoreNav.uts"; import { navigateToSelectStoreWithSessionStores } from "@/utils/shukeSelectStoreNav.uts";
import { useOrientation, useScreenVars } from "@/services/adapter/hooks";
import SettingBox from "./SettingBox.uvue"; import SettingBox from "./SettingBox.uvue";
import ProfileCard from "./components/ProfileCard.uvue"; import ProfileCard from "./components/ProfileCard.uvue";
import AccountInfo from "./components/AccountInfo.uvue"; import AccountInfo from "./components/AccountInfo.uvue";
import CommonFunctions from "./components/CommonFunctions.uvue"; import CommonFunctions from "./components/CommonFunctions.uvue";
import { resolveHomeFrameDisplayName } from "@/components/TabBar/tabbarShared.uts"; import pageVars from "./styles/index.vars.uts";
import { toObj,toStr, type ObjOrNull } from "@/utils/common.uts"; import { toObj,toStr } from "@/utils/common.uts";
import { storage } from "@/utils/storage.uts"; import { storage } from "@/utils/storage.uts";
const emit = defineEmits<{ const emit = defineEmits<{
...@@ -60,6 +65,8 @@ const emit = defineEmits<{ ...@@ -60,6 +65,8 @@ const emit = defineEmits<{
}>(); }>();
const showSetting = ref(false); const showSetting = ref(false);
const screenVars = useScreenVars(pageVars);
const orientation = useOrientation();
// ✅ 修复响应式:使用 ref 确保视图能正确更新 // ✅ 修复响应式:使用 ref 确保视图能正确更新
const userName = ref<string>(""); const userName = ref<string>("");
...@@ -69,6 +76,42 @@ const shopMerchantId = ref<string>(""); ...@@ -69,6 +76,42 @@ const shopMerchantId = ref<string>("");
const avatarText = ref<string>("我"); const avatarText = ref<string>("我");
const deviceId = ref<string>(""); const deviceId = ref<string>("");
const displayName = computed((): string => {
return userName.value != "" ? userName.value : "当前账号";
});
const displayStoreName = computed((): string => {
return shopName.value != "" ? shopName.value : "未绑定门店";
});
const displayPhone = computed((): string => {
return plainPhone.value != "" ? plainPhone.value : "未填写手机号";
});
const displayStoreCode = computed((): string => {
return shopMerchantId.value != "" ? shopMerchantId.value : "--";
});
const personDashboardClassName = computed((): string => {
return orientation.isPortrait.value ? "person-dashboard person-dashboard-portrait person-dashboard-first" : "person-dashboard person-dashboard-first";
});
const personSecondaryClassName = computed((): string => {
return orientation.isPortrait.value ? "person-secondary-panel person-secondary-panel-portrait" : "person-secondary-panel";
});
const avatarSizeValue = computed((): string => {
const vars = screenVars.value as UTSJSONObject;
const value = vars["--person-avatar-size"] as string | null;
return value != null && value != "" ? value : "56";
});
const avatarFontSizeValue = computed((): string => {
const vars = screenVars.value as UTSJSONObject;
const value = vars["--person-avatar-font-size"] as string | null;
return value != null && value != "" ? value : "22";
});
/** /**
* 从 storage 获取并提取用户信息 * 从 storage 获取并提取用户信息
*/ */
...@@ -126,15 +169,11 @@ function copyDeviceId(): void { ...@@ -126,15 +169,11 @@ function copyDeviceId(): void {
// ✅ 组件挂载完成后通知父组件 // ✅ 组件挂载完成后通知父组件
onMounted(() => { onMounted(() => {
// ✅ 修复白屏:直接从 storage 获取用户信息,不依赖 props
extractUserInfo(); extractUserInfo();
// ✅ 获取设备 ID(APP 编码)
getDeviceId(); getDeviceId();
void nextTick(() => {
// ✅ 延迟一小段时间确保 DOM 渲染完成
setTimeout(() => {
emit('loaded'); emit('loaded');
}, 16); // 约 16ms,一个帧的时间 });
}); });
function onSettingVisible(v: boolean): void { function onSettingVisible(v: boolean): void {
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<view class="btn-item btn-item-primary" @tap="changeAccount"> <view class="btn-item btn-item-primary" @tap="changeAccount">
<text class="btn-item-text btn-item-text-primary">切换账号</text> <text class="btn-item-text btn-item-text-primary">切换账号</text>
</view> </view>
<view class="btn-item btn-item-ghost" @tap="handleLogout"> <view class="btn-item btn-item-ghost btn-item-last" @tap="handleLogout">
<text class="btn-item-text btn-item-text-ghost">退出</text> <text class="btn-item-text btn-item-text-ghost">退出</text>
</view> </view>
</view> </view>
...@@ -155,11 +155,13 @@ const panelStyle = computed<UTSJSONObject>(() => { ...@@ -155,11 +155,13 @@ const panelStyle = computed<UTSJSONObject>(() => {
<style scoped lang="scss"> <style scoped lang="scss">
.setting-panel { .setting-panel {
// ✅ UVUE 不支持 vw 单位,width 通过 panelStyle 动态计算 width: 100%;
border-radius: 18px; border-radius: 18px;
overflow: hidden; overflow: hidden;
background: #ffffff; background: #ffffff;
box-shadow: none; // border-width: 1px;
// border-style: solid;
// border-color: #e2e8f0;
margin: 0 auto; margin: 0 auto;
} }
...@@ -181,14 +183,13 @@ const panelStyle = computed<UTSJSONObject>(() => { ...@@ -181,14 +183,13 @@ const panelStyle = computed<UTSJSONObject>(() => {
.logo-placeholder { .logo-placeholder {
width: 68px; width: 68px;
height: 68px; height: 68px;
background: #1677ff; background: #2c66f7;
border-radius: 18px; border-radius: 18px;
margin-bottom: 10px; margin-bottom: 10px;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
box-shadow: 0 8px 18px rgba(22, 119, 255, 0.28);
} }
.logo-text { .logo-text {
...@@ -199,21 +200,26 @@ const panelStyle = computed<UTSJSONObject>(() => { ...@@ -199,21 +200,26 @@ const panelStyle = computed<UTSJSONObject>(() => {
.app-name { .app-name {
font-size: 19px; font-size: 19px;
line-height: 24px;
font-weight: 700; font-weight: 700;
color: #1e293b; color: #0f172a;
margin-bottom: 4px; margin-bottom: 4px;
} }
.version { .version {
font-size: 12px; font-size: 12px;
color: #8391a7; line-height: 16px;
color: #64748b;
} }
.version-bar { .version-bar {
width: 100%; width: 100%;
height: 44px; height: 44px;
border-radius: 12px; border-radius: 12px;
background-color: #eef5ff; background-color: #f8fbff;
border-width: 1px;
border-style: solid;
border-color: #dbe6f7;
padding: 0 12px; padding: 0 12px;
box-sizing: border-box; box-sizing: border-box;
display: flex; display: flex;
...@@ -225,13 +231,14 @@ const panelStyle = computed<UTSJSONObject>(() => { ...@@ -225,13 +231,14 @@ const panelStyle = computed<UTSJSONObject>(() => {
.version-bar-text { .version-bar-text {
font-size: 12px; font-size: 12px;
color: #5f7ea8; line-height: 16px;
color: #64748b;
} }
.check-btn { .check-btn {
height: 28px; height: 28px;
padding: 0 12px; padding: 0 12px;
background: #eaf2ff; background: #eef4ff;
border-radius: 14px; border-radius: 14px;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
...@@ -241,7 +248,8 @@ const panelStyle = computed<UTSJSONObject>(() => { ...@@ -241,7 +248,8 @@ const panelStyle = computed<UTSJSONObject>(() => {
.check-btn-text { .check-btn-text {
font-size: 12px; font-size: 12px;
color: #1677ff; line-height: 16px;
color: #2c66f7;
font-weight: 600; font-weight: 600;
} }
...@@ -261,28 +269,29 @@ const panelStyle = computed<UTSJSONObject>(() => { ...@@ -261,28 +269,29 @@ const panelStyle = computed<UTSJSONObject>(() => {
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
margin-bottom: 12px; margin-bottom: 12px;
}
.btn-item:last-child {
margin-bottom: 0;
} }
.btn-item-primary { .btn-item-primary {
background: #1677ff; background: #2c66f7;
box-shadow: 0 8px 16px rgba(22, 119, 255, 0.24);
} }
.btn-item-ghost { .btn-item-ghost {
background: #ffffff; background: #ffffff;
border: none; border-width: 1px;
border-style: solid;
border-color: #dbe4f0;
}
.btn-item-last {
margin-bottom: 0;
} }
.btn-item-text { .btn-item-text {
font-size: 14px; font-size: 14px;
line-height: 18px;
font-weight: 600; font-weight: 600;
opacity: 1; opacity: 1;
// ✅ UVUE 不支持 display: block,父元素已是 flex,子元素默认为块级
} }
.btn-item-text-primary { .btn-item-text-primary {
...@@ -290,9 +299,6 @@ const panelStyle = computed<UTSJSONObject>(() => { ...@@ -290,9 +299,6 @@ const panelStyle = computed<UTSJSONObject>(() => {
} }
.btn-item-text-ghost { .btn-item-text-ghost {
color: #1e293b; color: #0f172a;
} }
// ✅ UVUE 只支持类名选择器,不能使用后代选择器 .setting-panel text
// opacity: 1 是默认值,无需设置
</style> </style>
<template> <template>
<InfoSection title="账号信息" :border="true"> <InfoSection title="账号信息" subtitle="当前登录账号与门店基础信息">
<un-cell title="姓名" :value="userName" icon="account-fill" size="large"/> <view class="account-section">
<un-cell title="门店" :value="shopName" icon="home-fill" size="large"/> <view class="account-row">
<un-cell title="门店号" :value="shopMerchantId" icon="file-text-fill" size="large"/> <text class="account-row-label">姓名</text>
<un-cell title="手机号" :value="plainPhone" icon="phone-fill" size="large"/> <text class="account-row-value">{{ userName }}</text>
</view>
<view class="account-row">
<text class="account-row-label">门店</text>
<text class="account-row-value">{{ shopName }}</text>
</view>
<view class="account-row">
<text class="account-row-label">门店号</text>
<text class="account-row-value">{{ shopMerchantId }}</text>
</view>
<view class="account-row account-row-last">
<text class="account-row-label">手机号</text>
<text class="account-row-value">{{ plainPhone }}</text>
</view>
</view>
</InfoSection> </InfoSection>
</template> </template>
...@@ -17,3 +31,53 @@ defineProps<{ ...@@ -17,3 +31,53 @@ defineProps<{
plainPhone: string plainPhone: string
}>() }>()
</script> </script>
<style scoped lang="scss">
.account-section {
width: 100%;
display: flex;
flex-direction: column;
box-sizing: border-box;
}
.account-row {
width: 100%;
min-height: var(--person-row-height, 52px);
border-radius: 12px;
border-width: 1px;
border-style: solid;
border-color: #e8edf5;
background-color: #fbfdff;
display: flex;
flex-direction: row;
align-items: center;
padding: 0 14px;
box-sizing: border-box;
margin-top: 10px;
}
.account-row-last {
margin-bottom: 0;
}
.account-row-label {
flex-shrink: 0;
width: var(--person-row-label-width, 72px);
font-size: 13px;
line-height: 18px;
font-weight: 600;
color: var(--person-text-secondary, #475569);
}
.account-row-value {
flex: 1;
min-width: 0;
font-size: 14px;
line-height: 18px;
font-weight: 600;
color: var(--person-text-primary, #0f172a);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
</style>
<template> <template>
<InfoSection title="常用功能" :border="false"> <InfoSection title="常用功能" subtitle="进入常用业务入口与设置管理">
<un-cell title="接待记录" <view class="function-list">
icon="chat-fill" <view class="function-row"
isLink hover-class="function-row-hover"
clickable @click="onReceptionEntry">
@click="onReceptionEntry" <view class="function-row-main">
size="large" /> <text class="function-row-title">接待记录</text>
<un-cell title="选择门店" <text class="function-row-desc">查看接待相关入口与记录</text>
icon="home-fill" </view>
isLink <un-icon name="arrow-right" size="16" color="#94a3b8" />
clickable </view>
@click="onSelectStore" <view class="function-row"
size="large" /> hover-class="function-row-hover"
<un-cell title="个人考勤" @click="onSelectStore">
icon="clock-fill" <view class="function-row-main">
isLink <text class="function-row-title">选择门店</text>
clickable <text class="function-row-desc">切换当前登录门店</text>
@click="onAttendance" </view>
size="large" /> <un-icon name="arrow-right" size="16" color="#94a3b8" />
<un-cell title="系统设置" </view>
icon="setting-fill" <view class="function-row"
isLink hover-class="function-row-hover"
@click="onSetting" @click="onAttendance">
size="large" /> <view class="function-row-main">
<text class="function-row-title">个人考勤</text>
<text class="function-row-desc">查看考勤与打卡信息</text>
</view>
<un-icon name="arrow-right" size="16" color="#94a3b8" />
</view>
<view class="function-row function-row-last"
hover-class="function-row-hover"
@click="onSetting">
<view class="function-row-main">
<text class="function-row-title">系统设置</text>
<text class="function-row-desc">检查版本并管理账号</text>
</view>
<un-icon name="arrow-right" size="16" color="#94a3b8" />
</view>
</view>
</InfoSection> </InfoSection>
</template> </template>
...@@ -52,3 +67,59 @@ function onReceptionEntry(): void { ...@@ -52,3 +67,59 @@ function onReceptionEntry(): void {
emit('receptionEntry') emit('receptionEntry')
} }
</script> </script>
<style scoped lang="scss">
.function-list {
width: 100%;
display: flex;
flex-direction: column;
box-sizing: border-box;
}
.function-row {
width: 100%;
min-height: 62px;
border-radius: 14px;
border-width: 1px;
border-style: solid;
border-color: #e8edf5;
background-color: #fbfdff;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
padding: 0 14px;
box-sizing: border-box;
margin-top: 10px;
}
.function-row-hover {
opacity: 0.92;
}
.function-row-last {
margin-bottom: 0;
}
.function-row-main {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
margin-right: 12px;
}
.function-row-title {
font-size: 15px;
line-height: 20px;
font-weight: 700;
color: var(--person-text-primary, #0f172a);
}
.function-row-desc {
margin-top: 4px;
font-size: 12px;
line-height: 16px;
color: var(--person-text-secondary, #475569);
}
</style>
<template> <template>
<view class="section-shell"> <view class="section-shell">
<view class="section-title">{{ title }}</view> <view class="section-head">
<un-cell-group :border="border" round="0" backgroundColor="transparent"> <view class="section-title-row">
<view class="section-title-bar"></view>
<text class="section-title">{{ title }}</text>
</view>
<text v-if="subtitle !== ''" class="section-subtitle">{{ subtitle }}</text>
</view>
<view class="section-body">
<slot></slot> <slot></slot>
</un-cell-group> </view>
</view> </view>
</template> </template>
<script setup lang="uts"> <script setup lang="uts">
defineProps<{ withDefaults(defineProps<{
title: string title: string
subtitle?: string
border?: boolean border?: boolean
}>() }>(), {
subtitle: "",
border: true
})
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.section-shell { .section-shell {
background-color: var(--person-bg-card, #ffffff);
border: 1px solid var(--person-border, #dfe9f7);
border-radius: var(--person-radius-lg, 16px);
padding: var(--person-spacing-lg, 16px) 10px;
flex: 1;
min-height: 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
width: 100%;
min-height: 0;
background-color: transparent;
box-sizing: border-box;
}
.section-head {
display: flex;
flex-direction: column;
margin-bottom: 12px;
}
.section-title-row {
display: flex;
flex-direction: row;
align-items: center;
}
.section-title-bar {
width: 4px;
height: 14px;
border-radius: 2px;
background-color: var(--person-primary, #2c66f7);
margin-right: 8px;
} }
.section-title { .section-title {
font-size: var(--person-section-title-size, 15px); font-size: var(--person-section-title-size, 15px);
font-weight: var(--person-section-title-weight, 600); line-height: 20px;
color: var(--person-text-primary, #1a2433); font-weight: 700;
margin-bottom: var(--person-spacing-md, 12px); color: var(--person-text-primary, #0f172a);
flex-shrink: 0;
} }
.section-shell :deep(.uni-cell-group) { .section-subtitle {
flex: 1; margin-top: 4px;
min-height: 0; font-size: var(--person-section-desc-size, 12px);
display: flex; line-height: 16px;
flex-direction: column; color: var(--person-text-secondary, #475569);
} }
/* ✅ 强制显示所有 un-cell 的下边框(包括最后一个) */ .section-body {
.section-shell :deep(.uni-cell) { display: flex;
border-bottom: 1px solid #e5e7eb !important; flex-direction: column;
width: 100%;
box-sizing: border-box;
} }
</style> </style>
<template> <template>
<view class="profile-card"> <view class="profile-card">
<view class="profile-head"> <view class="profile-top">
<un-avatar :text="avatarText" <view class="profile-badge">
shape="circle" <text class="profile-badge-text">账号概览</text>
:size="avatarSize" </view>
bgColor="#2f6af7" <view class="profile-head">
color="#ffffff" <un-avatar :text="avatarText"
:fontSize="avatarFontSize" /> shape="circle"
<view class="profile-main"> :size="avatarSize"
<text class="profile-name">{{ userName }}</text> bgColor="#2c66f7"
<text class="profile-meta">{{ plainPhone }}</text> color="#ffffff"
:fontSize="avatarFontSize" />
<view class="profile-main">
<text class="profile-name">{{ userName }}</text>
<text class="profile-meta">{{ plainPhone }}</text>
</view>
</view> </view>
</view> </view>
<view class="profile-divider"></view> <view class="profile-divider"></view>
<view class="profile-shop-row"> <view class="profile-info-grid">
<text class="profile-shop-label">当前门店</text> <view class="profile-info-item">
<text class="profile-shop-value">{{ shopName }}</text> <text class="profile-shop-label">当前门店</text>
<text class="profile-shop-value">{{ shopName }}</text>
</view>
<view class="profile-info-item profile-info-item-right">
<text class="profile-shop-label">账号状态</text>
<text class="profile-shop-value">正常</text>
</view>
</view> </view>
</view> </view>
</template> </template>
...@@ -36,18 +47,42 @@ const props = withDefaults(defineProps<{ ...@@ -36,18 +47,42 @@ const props = withDefaults(defineProps<{
<style scoped lang="scss"> <style scoped lang="scss">
.profile-card { .profile-card {
background-color: var(--person-bg-card, #ffffff); width: 100%;
border: 1px solid var(--person-border, #dfe9f7); display: flex;
border-radius: var(--person-radius-lg, 16px); flex-direction: column;
padding: var(--person-profile-padding, 14px); background-color: transparent;
flex-shrink: 0; box-sizing: border-box;
margin-bottom: 16px; }
.profile-top {
display: flex;
flex-direction: column;
}
.profile-badge {
width: 70px;
height: 24px;
border-radius: 12px;
background-color: var(--person-primary-soft, #eef4ff);
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
box-sizing: border-box;
}
.profile-badge-text {
font-size: 11px;
line-height: 14px;
font-weight: 700;
color: var(--person-primary, #2c66f7);
} }
.profile-head { .profile-head {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
margin-top: 12px;
} }
.profile-main { .profile-main {
...@@ -55,21 +90,24 @@ const props = withDefaults(defineProps<{ ...@@ -55,21 +90,24 @@ const props = withDefaults(defineProps<{
min-width: 0; min-width: 0;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
margin-left: var(--person-spacing-md, 4px); margin-left: 12px;
} }
.profile-name { .profile-name {
font-size: var(--person-name-size, 19px); font-size: var(--person-name-size, 19px);
font-weight: 600; line-height: 24px;
color: var(--person-text-primary, #1a2433); font-weight: 700;
color: var(--person-text-primary, #0f172a);
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} }
.profile-meta { .profile-meta {
margin-top: 4px;
font-size: var(--person-meta-size, 13px); font-size: var(--person-meta-size, 13px);
color: var(--person-text-secondary, #64748b); line-height: 18px;
color: var(--person-text-secondary, #475569);
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
...@@ -78,25 +116,41 @@ const props = withDefaults(defineProps<{ ...@@ -78,25 +116,41 @@ const props = withDefaults(defineProps<{
.profile-divider { .profile-divider {
height: 1px; height: 1px;
background-color: var(--person-border, #dfe9f7); background-color: var(--person-border, #dfe9f7);
margin-top: var(--person-spacing-md, 12px); margin-top: 14px;
margin-bottom: var(--person-spacing-md, 12px); margin-bottom: 14px;
} }
.profile-shop-row { .profile-info-grid {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: space-between; align-items: stretch;
align-items: center; }
.profile-info-item {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
}
.profile-info-item-right {
margin-left: 12px;
} }
.profile-shop-label { .profile-shop-label {
font-size: var(--person-shop-label-size, 12px); font-size: 12px;
color: var(--person-text-tertiary, #94a3b8); line-height: 16px;
color: var(--person-text-tertiary, #94a3b8);
} }
.profile-shop-value { .profile-shop-value {
font-size: var(--person-shop-value-size, 14px); margin-top: 4px;
color: var(--person-text-primary, #1a2433); font-size: 14px;
font-weight: 500; line-height: 18px;
color: var(--person-text-primary, #0f172a);
font-weight: 600;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
} }
</style> </style>
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<view class="skeleton-avatar-circle" style="margin-right: 12px"></view> <view class="skeleton-avatar-circle" style="margin-right: 12px"></view>
<view class="skeleton-text-group"> <view class="skeleton-text-group">
<view class="skeleton-line skeleton-line-short"></view> <view class="skeleton-line skeleton-line-short"></view>
<view class="skeleton-line skeleton-line-medium"></view> <view class="skeleton-line skeleton-line-medium skeleton-line-last"></view>
</view> </view>
</view> </view>
<view class="skeleton-divider"></view> <view class="skeleton-divider"></view>
...@@ -23,21 +23,21 @@ ...@@ -23,21 +23,21 @@
<view class="skeleton-line skeleton-line-md"></view> <view class="skeleton-line skeleton-line-md"></view>
</view> </view>
<view class="skeleton-cell-group"> <view class="skeleton-cell-group">
<view class="skeleton-cell-item"> <view class="skeleton-cell-item skeleton-cell-item-last">
<view class="skeleton-row-with-avatar-small"> <view class="skeleton-row-with-avatar-small">
<view class="skeleton-avatar-square" style="margin-right: 8px"></view> <view class="skeleton-avatar-square" style="margin-right: 8px"></view>
<view class="skeleton-text-group-horizontal"> <view class="skeleton-text-group-horizontal">
<view class="skeleton-line skeleton-line-sm"></view> <view class="skeleton-line skeleton-line-sm"></view>
<view class="skeleton-line skeleton-line-md"></view> <view class="skeleton-line skeleton-line-md skeleton-line-last"></view>
</view> </view>
</view> </view>
</view> </view>
<view class="skeleton-cell-item"> <view class="skeleton-cell-item skeleton-cell-item-last">
<view class="skeleton-row-with-avatar-small"> <view class="skeleton-row-with-avatar-small">
<view class="skeleton-avatar-square" style="margin-right: 8px"></view> <view class="skeleton-avatar-square" style="margin-right: 8px"></view>
<view class="skeleton-text-group-horizontal"> <view class="skeleton-text-group-horizontal">
<view class="skeleton-line skeleton-line-sm"></view> <view class="skeleton-line skeleton-line-sm"></view>
<view class="skeleton-line skeleton-line-md"></view> <view class="skeleton-line skeleton-line-md skeleton-line-last"></view>
</view> </view>
</view> </view>
</view> </view>
...@@ -100,8 +100,11 @@ const props = defineProps<{ ...@@ -100,8 +100,11 @@ const props = defineProps<{
<style scoped> <style scoped>
.person-skeleton { .person-skeleton {
display: flex;
padding: 16px; padding: 16px;
flex-direction: column; flex-direction: column;
background-color: #F3F6FB;
box-sizing: border-box;
} }
.person-skeleton-landscape { .person-skeleton-landscape {
...@@ -130,12 +133,15 @@ const props = defineProps<{ ...@@ -130,12 +133,15 @@ const props = defineProps<{
/* 区块标题 */ /* 区块标题 */
.skeleton-section-title { .skeleton-section-title {
display: flex;
flex-direction: row;
margin-bottom: 12px; margin-bottom: 12px;
padding-left: 4px; padding-left: 4px;
} }
/* Cell 组 */ /* Cell 组 */
.skeleton-cell-group { .skeleton-cell-group {
display: flex;
flex-direction: column; flex-direction: column;
} }
...@@ -144,7 +150,7 @@ const props = defineProps<{ ...@@ -144,7 +150,7 @@ const props = defineProps<{
margin-bottom: 12px; margin-bottom: 12px;
} }
.skeleton-cell-item:last-child { .skeleton-cell-item-last {
margin-bottom: 0; margin-bottom: 0;
} }
...@@ -160,7 +166,7 @@ const props = defineProps<{ ...@@ -160,7 +166,7 @@ const props = defineProps<{
margin-bottom: 8px; margin-bottom: 8px;
} }
.skeleton-line:last-child { .skeleton-line-last {
margin-bottom: 0; margin-bottom: 0;
} }
...@@ -209,24 +215,28 @@ const props = defineProps<{ ...@@ -209,24 +215,28 @@ const props = defineProps<{
/* ✅ 带头像的行布局(竖排) */ /* ✅ 带头像的行布局(竖排) */
.skeleton-row-with-avatar { .skeleton-row-with-avatar {
display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
} }
/* ✅ 带小头像的行布局(竖排) */ /* ✅ 带小头像的行布局(竖排) */
.skeleton-row-with-avatar-small { .skeleton-row-with-avatar-small {
display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
} }
/* ✅ 文本组(竖排) */ /* ✅ 文本组(竖排) */
.skeleton-text-group { .skeleton-text-group {
display: flex;
flex: 1; flex: 1;
flex-direction: column; flex-direction: column;
} }
/* ✅ 文本组(横排) */ /* ✅ 文本组(横排) */
.skeleton-text-group-horizontal { .skeleton-text-group-horizontal {
display: flex;
flex: 1; flex: 1;
flex-direction: row; flex-direction: row;
justify-content: space-between; justify-content: space-between;
...@@ -243,6 +253,7 @@ const props = defineProps<{ ...@@ -243,6 +253,7 @@ const props = defineProps<{
/* ✅ 左右分布的行 */ /* ✅ 左右分布的行 */
.skeleton-row-between { .skeleton-row-between {
display: flex;
flex-direction: row; flex-direction: row;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
......
// 个人中心页面样式 - 高性能极简主义设计 v2.0
// ✅ 性能优化原则:零阴影、零动画、零复杂渐变
.person-page { .person-page {
width: 100%; width: 100%;
flex: 1; /* ✅ 通过 flex 自动填充父容器剩余空间 */ height: 100%;
background-color: var(--person-bg-page, #f8fafc); min-height: 0;
padding: var(--person-page-padding, 0px); /* ✅ 通过 CSS 变量控制 */ display: flex;
box-sizing: border-box; flex-direction: column;
display: flex; background-color: var(--person-bg-page, #f3f6fb);
flex-direction: column; box-sizing: border-box;
} }
// .person-scroll { .person-scroll {
// flex: 1; flex: 1;
// min-height: 0; min-height: 0;
// width: 100%; width: 100%;
// display: flex; box-sizing: border-box;
// flex-direction: column;
// padding-bottom: var(--person-scroll-padding-bottom, 12px); /* ✅ 通过 CSS 变量控制 */
// }
/* ========================================
统一布局容器 - 通过 CSS 变量切换单列/分栏
======================================== */
.person-unified-layout {
flex:1;
display: flex;
flex-direction: var(--person-layout-direction, column); /* ✅ 竖屏: column, 横屏: row */
width: 100%; /* ✅ 确保占满宽度 */
padding: var(--person-container-padding) var(--person-container-padding) 0 var(--person-container-padding);
// padding-bottom: var(--person-container-padding-bottom);
background-color: var(--person-unified-layout-bg, transparent); /* ✅ 通过 CSS 变量控制 */
border-radius: var(--person-unified-layout-radius, 0px); /* ✅ 通过 CSS 变量控制 */
// margin-bottom: var(--person-unified-layout-margin-bottom, 0px); /* ✅ 通过 CSS 变量控制 */
border: var(--person-unified-layout-border, none); /* ✅ 通过 CSS 变量控制 */
} }
/* ✅ 主面板(用户资料 + 账号信息) */ .person-scroll-body {
.person-primary-panel { width: 100%;
flex: var(--person-primary-flex, none); /* ✅ 通过 CSS 变量控制 */ min-height: 100%;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
padding-top: var(--person-page-padding-y, 12px);
padding-right: var(--person-page-padding-x, 14px);
padding-bottom: var(--person-page-padding-y, 12px);
padding-left: var(--person-page-padding-x, 14px);
box-sizing: border-box;
} }
/* ✅ 竖屏时,AccountInfo 与 ProfileCard 之间添加间距 */ .person-dashboard {
.account-info-with-gap { width: 100%;
margin-top: var(--person-section-gap, 16px); display: flex;
flex-direction: row;
align-items: stretch;
margin-top: var(--person-section-gap, 12px);
} }
/* ✅ 次面板(常用功能) */ .person-dashboard-first {
.person-secondary-panel { margin-top: 0;
flex: var(--person-secondary-flex, none); /* ✅ 通过 CSS 变量控制 */
display: flex;
flex-direction: column;
margin-top: var(--person-secondary-margin-top, 16px); /* ✅ 通过 CSS 变量控制 */
margin-left: var(--person-secondary-margin-left, 0px); /* ✅ 通过 CSS 变量控制 */
} }
.person-dashboard-portrait {
flex-direction: column;
}
.person-primary-panel {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
}
/* ======================================== .person-secondary-panel {
用户资料卡片 - 核心视觉焦点(已移至 ProfileCard 组件) flex-shrink: 0;
======================================== */ width: var(--person-side-panel-width, 360px);
margin-left: var(--person-section-gap, 12px);
/* ======================================== display: flex;
区块容器(已移至 InfoSection 组件) flex-direction: column;
======================================== */ }
/* ======================================== .person-secondary-panel-portrait {
间距工具类 width: 100%;
======================================== */ margin-top: var(--person-section-gap, 12px);
.spacing-md { margin-left: 0;
height: var(--person-spacing-md, 12px);
} }
.spacing-lg { .person-stack-card {
height: var(--person-spacing-lg, 16px); width: 100%;
border-radius: var(--person-radius-lg, 18px);
border-width: 1px;
border-style: solid;
border-color: var(--person-card-border, #e2e8f0);
background-color: var(--person-bg-card, #ffffff);
padding: var(--person-panel-padding, 14px);
box-sizing: border-box;
margin-top: var(--person-section-gap, 12px);
} }
.person-stack-card-first {
margin-top: 0;
}
/* ======================================== .device-id-panel {
APP 编码页脚 - 固定在 scroll-view 底部正中间 width: auto;
======================================== */ height: var(--person-device-panel-height, 48px);
.device-id-footer { margin-top: 8px;
flex: 0; margin-right: var(--person-page-padding-x, 14px);
display: flex; margin-bottom: var(--person-page-padding-y, 12px);
flex-direction: row; margin-left: var(--person-page-padding-x, 14px);
justify-content: center; // border-radius: 14px;
align-items: center; // border-width: 1px;
padding: 16px 20px; /* ✅ 添加内边距 */ // border-style: solid;
margin-top: var(--person-section-gap, 16px); /* ✅ 与上方内容保持间距 */ // border-color: var(--person-card-border, #e2e8f0);
cursor: pointer; // background-color: var(--person-bg-card, #ffffff);
transition: background-color 0.15s ease; display: flex;
height: var(--person-footer-height, 40px); flex-direction: row;
align-items: center;
justify-content: center;
box-sizing: border-box;
flex-shrink: 0;
} }
/* ✅ 点击反馈 */ .device-id-panel-hover {
.device-id-footer:active { opacity: 0.92;
background-color: rgba(0, 0, 0, 0.03);
} }
.device-id-footer-text { .device-id-panel-text {
font-size: 14px; font-size: 13px;
color: #9ca3af; line-height: 18px;
font-family: 'Courier New', monospace; /* ✅ 等宽字体 */ color: var(--person-text-tertiary, #94a3b8);
letter-spacing: 0.3px; margin-right: 6px;
margin-right: 6px;
} }
// 个人中心响应式样式配置 - 企业级设计规范 v2.0
export default { export default {
common: { common: {
// 品牌色彩系统 - 科技蓝主题 '--person-primary': '#2c66f7',
'--person-primary': '#2f6af7', '--person-primary-soft': '#eef4ff',
'--person-primary-light': '#e8f0ff',
'--person-success': '#10b981', '--person-success': '#10b981',
'--person-warning': '#f59e0b', '--person-text-primary': '#0f172a',
'--person-error': '#ef4444', '--person-text-secondary': '#475569',
// 中性色阶
'--person-text-primary': '#1a2433',
'--person-text-secondary': '#64748b',
'--person-text-tertiary': '#94a3b8', '--person-text-tertiary': '#94a3b8',
'--person-border': '#dfe9f7', '--person-border': '#dbe4f0',
'--person-card-border': '#e2e8f0',
'--person-bg-page': '#f3f6fb',
'--person-bg-card': '#ffffff', '--person-bg-card': '#ffffff',
'--person-bg-page': '#f8fafc', '--person-bg-soft': '#f8fbff',
'--person-bg-hover': '#f1f5f9', '--person-radius-lg': '18px',
'--person-radius-md': '14px',
// ✅ 性能优化:移除所有阴影定义,使用边框替代层级区分 '--person-radius-sm': '10px',
// '--person-shadow-sm': '0 2px 8px rgba(0, 0, 0, 0.04)', '--person-page-padding-x': '16px',
// '--person-shadow-md': '0 4px 16px rgba(0, 0, 0, 0.08)', '--person-page-padding-y': '14px',
'--person-section-gap': '12px',
// 圆角系统 '--person-banner-padding': '14px',
'--person-radius-sm': '8px', '--person-panel-padding': '14px',
'--person-radius-md': '12px', '--person-profile-padding': '16px',
'--person-radius-lg': '16px', '--person-avatar-size': '56px',
'--person-radius-xl': '20px', '--person-avatar-font-size': '22px',
'--person-name-size': '22px',
// 间距系统 '--person-meta-size': '13px',
'--person-spacing-xs': '4px', '--person-section-title-size': '16px',
'--person-spacing-sm': '8px', '--person-section-desc-size': '12px',
'--person-spacing-md': '12px', '--person-row-height': '52px',
'--person-spacing-lg': '16px', '--person-row-label-width': '72px',
'--person-spacing-xl': '24px', '--person-device-panel-height': '48px',
'--person-spacing-2xl': '32px' '--person-side-panel-width': '360px'
'--person-footer-height': '36px'
}, },
portrait: { portrait: {
// 竖屏布局参数 - 单列流式布局 '--person-page-padding-x': '14px',
'--person-container-padding': '20px', '--person-page-padding-y': '12px',
'--person-container-padding-bottom': '0' '--person-section-gap': '12px',
'--person-section-gap': '16px', '--person-banner-padding': '14px',
'--person-panel-padding': '14px',
// ✅ 统一布局控制:竖屏单列(column) '--person-profile-padding': '16px',
'--person-layout-direction': 'column', '--person-avatar-size': '54px',
'--person-primary-flex': 'none', /* ✅ 竖屏不占据剩余空间,自然高度(flex: none = 0 0 auto) */ '--person-avatar-font-size': '20px',
'--person-secondary-flex': 'none', /* ✅ 竖屏不占据剩余空间,自然高度(flex: none = 0 0 auto) */ '--person-name-size': '20px',
// ✅ 页面边距控制
'--person-page-padding': '0px', /* ✅ 竖屏无内边距 */
// ✅ scroll-view 底部留白
'--person-scroll-padding-bottom': '12px',
// ✅ 统一布局容器样式(竖屏无背景、无圆角)
'--person-unified-layout-bg': 'transparent',
'--person-unified-layout-radius': '0px',
'--person-unified-layout-border': 'none',
'--person-unified-layout-margin-bottom': '0px',
// ✅ 次面板间距(竖屏使用 margin-top)
'--person-secondary-margin-top': '16px',
'--person-secondary-margin-left': '0px',
// 用户资料卡片
'--person-profile-padding': '14px',
'--person-avatar-size': '52px',
'--person-name-size': '19px',
'--person-meta-size': '13px', '--person-meta-size': '13px',
'--person-shop-label-size': '12px', '--person-row-height': '50px',
'--person-shop-value-size': '14px', '--person-row-label-width': '64px',
'--person-side-panel-width': '100%'
// 区块标题
'--person-section-title-size': '15px',
'--person-section-title-weight': '600',
// 列表项
'--person-cell-height': '48px',
'--person-cell-title-size': '15px',
'--person-cell-value-size': '14px',
'--person-cell-icon-size': '18px',
}, },
landscape: { landscape: {
// 横屏布局参数 - 左右分栏布局 '--person-page-padding-x': '18px',
'--person-container-padding': '24px', '--person-page-padding-y': '12px',
'--person-container-padding-bottom': '24px' '--person-section-gap': '14px',
'--person-section-gap': '20px', '--person-banner-padding': '16px',
'--person-panel-padding': '16px',
// ✅ 统一布局控制:横屏分栏(row) '--person-profile-padding': '18px',
'--person-layout-direction': 'row', '--person-avatar-size': '62px',
'--person-primary-flex': '1', /* ✅ 横屏占据剩余空间 */ '--person-avatar-font-size': '24px',
'--person-secondary-flex': '1', /* ✅ 横屏占据剩余空间 */
// ✅ 页面边距控制
'--person-page-padding': '12px', /* ✅ 横屏有内边距 */
// ✅ scroll-view 底部不留白
'--person-scroll-padding-bottom': '0px',
// ✅ 统一布局容器样式(横屏有背景、圆角、边框)
'--person-unified-layout-bg': '#ffffff',
'--person-unified-layout-radius': '20px',
'--person-unified-layout-border': '1px solid #dfe9f7',
'--person-unified-layout-margin-bottom': '12px',
// ✅ 次面板间距(横屏使用 margin-left)
'--person-secondary-margin-top': '0px',
'--person-secondary-margin-left': '16px',
// 用户资料卡片(更大更醒目)
'--person-profile-padding': '24px',
'--person-avatar-size': '72px',
'--person-name-size': '24px', '--person-name-size': '24px',
'--person-meta-size': '15px', '--person-meta-size': '14px',
'--person-shop-label-size': '14px', '--person-row-height': '54px',
'--person-shop-value-size': '16px', '--person-row-label-width': '78px',
'--person-side-panel-width': '360px'
// 区块标题
'--person-section-title-size': '17px',
'--person-section-title-weight': '600',
// 列表项
'--person-cell-height': '56px',
'--person-cell-title-size': '16px',
'--person-cell-value-size': '15px',
'--person-cell-icon-size': '22px',
}, },
resolutions: { resolutions: {
// iPad 横屏优化 (1024x768) 'portrait-393x816': {
'landscape-1024x768': { '--person-page-padding-x': '12px',
'--person-container-padding': '32px', '--person-page-padding-y': '10px',
'--person-section-gap': '24px', '--person-section-gap': '10px'
'--person-avatar-size': '72px',
'--person-name-size': '24px',
'--person-profile-padding': '24px',
},
// 小屏 Pad 横屏 (816x393)
'landscape-816x393': {
'--person-container-padding': '16px',
'--person-section-gap': '12px',
'--person-avatar-size': '56px',
'--person-name-size': '20px',
'--person-profile-padding': '16px',
}, },
// 大屏手机竖屏 (414x896)
'portrait-414x896': { 'portrait-414x896': {
'--person-container-padding': '24px', '--person-page-padding-x': '14px'
}, },
'landscape-816x393': {
// iPhone 14 Pro 竖屏 (393x816) '--person-page-padding-x': '10px',
'portrait-393x816': { '--person-page-padding-y': '8px',
'--person-container-padding': '20px', '--person-banner-padding': '12px',
'--person-panel-padding': '12px',
'--person-profile-padding': '14px',
'--person-avatar-size': '52px',
'--person-avatar-font-size': '20px',
'--person-name-size': '20px',
'--person-row-height': '48px',
'--person-side-panel-width': '320px'
}, },
// 矮屏设备横屏优化 (如 iPad Mini 横屏 1024x640)
'landscape-1024x640': { 'landscape-1024x640': {
'--person-container-padding': '16px', '--person-side-panel-width': '332px'
'--person-section-gap': '12px',
'--person-avatar-size': '56px',
'--person-name-size': '20px',
'--person-meta-size': '13px',
'--person-profile-padding': '14px',
'--person-cell-height': '44px',
}, },
'portrait-640x1024': { 'landscape-1024x768': {
'--person-section-gap': '12px', '--person-page-padding-x': '20px',
'--person-side-panel-width': '372px'
}, },
'landscape-1174x768': {
'--person-page-padding-x': '22px',
'--person-side-panel-width': '392px'
}
} }
} }
<template>
<view class="task-card daily-report-module">
<view class="task-segment">
<view v-for="(item, index) in reportScopes"
:key="index"
class="task-segment__item"
:class="activeScopeIndex == index ? 'task-segment__item--active' : ''"
@click="activeScopeIndex = index">
<text class="task-segment__text">{{ item }}</text>
</view>
</view>
<view class="daily-form">
<view class="daily-form__title-row">
<image class="daily-form__title-icon"
mode="aspectFit"
src="/static/images/tabbar/record-active.png" />
<text class="daily-form__title">{{ activeScopeTitle }}</text>
</view>
<CustomForm
:items="dailyReportFormItems"
submit-text="提交日报"
@submit="onSubmitDailyReport">
</CustomForm>
</view>
</view>
</template>
<script setup lang="uts">
import { computed, ref } from "vue";
import CustomForm from "@/components/CustomForm.uvue";
import { DAILY_REPORT_FORM_ITEMS } from "../constants/dailyReportForm.uts";
const reportScopes = ["个人", "门店", "品牌"];
const activeScopeIndex = ref<number>(0);
const dailyReportFormItems = DAILY_REPORT_FORM_ITEMS;
const activeScopeTitle = computed((): string => {
if (activeScopeIndex.value == 1) return "门店日报";
if (activeScopeIndex.value == 2) return "品牌日报";
return "个人日报";
});
function onSubmitDailyReport(data: UTSJSONObject): void {
console.log("[DailyReport] submit", data);
uni.showToast({ title: "提交成功", icon: "success" });
}
</script>
<style scoped lang="scss">
@import "../styles/common.scss";
</style>
<template>
<view class="task-card task-placeholder-module">
<image class="task-placeholder-module__icon"
mode="aspectFit"
src="/static/images/home/setting.png" />
<text class="task-placeholder-module__title">审阅</text>
<text class="task-placeholder-module__desc">审阅模块内容会在这里接入。</text>
</view>
</template>
<script setup lang="uts">
</script>
<style scoped lang="scss">
@import "../styles/common.scss";
</style>
<template>
<view class="task-card task-placeholder-module">
<image class="task-placeholder-module__icon"
mode="aspectFit"
src="/static/images/home/scene-change.png" />
<text class="task-placeholder-module__title">策略</text>
<text class="task-placeholder-module__desc">策略模块内容会在这里接入。</text>
</view>
</template>
<script setup lang="uts">
</script>
<style scoped lang="scss">
@import "../styles/common.scss";
</style>
<template>
<view class="study-module">
<view class="study-side-card">
<text class="study-side-card__title">我的学习时长</text>
<view class="study-duration-box">
<view class="study-duration-item">
<text class="study-duration-item__tag">累计</text>
<text class="study-duration-item__value">0.3小时</text>
</view>
<view class="study-duration-item">
<text class="study-duration-item__tag">本月</text>
<text class="study-duration-item__value">-小时</text>
</view>
</view>
<view class="study-shortcuts">
<view v-for="(item, index) in shortcuts"
:key="index"
class="study-shortcut">
<image class="study-shortcut__icon"
mode="aspectFit"
:src="item.iconSrc" />
<text class="study-shortcut__text">{{ item.label }}</text>
</view>
</view>
</view>
<view class="study-course-panel">
<view class="study-course-tabs">
<view class="study-course-tab study-course-tab--active">
<text class="study-course-tab__text">正在学习</text>
</view>
<view class="study-course-tab">
<text class="study-course-tab__text">全部课程</text>
</view>
</view>
<view class="study-notice">
<text class="study-notice__text">本周学习时长小时</text>
</view>
<view class="study-course-grid">
<view v-for="(item, index) in courses"
:key="index"
class="study-course-card">
<view class="study-course-card__cover">
<text class="study-course-card__type">{{ item.typeText }}</text>
</view>
<view class="study-course-card__body">
<text class="study-course-card__title">{{ item.title }}</text>
<text class="study-course-card__meta">课程时长 {{ item.duration }}</text>
<view class="study-progress-row">
<text class="study-course-card__meta">任务进度</text>
<view class="study-progress">
<view class="study-progress__bar"
:style="{ width: item.progress + '%' }"></view>
</view>
<text class="study-progress__text">{{ item.progress }}%</text>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
type StudyShortcut = {
label: string
iconSrc: string
}
type StudyCourse = {
title: string
duration: string
progress: number
typeText: string
}
const shortcuts: StudyShortcut[] = [
{ label: "我的课程", iconSrc: "/static/images/tabbar/study-active.png" },
{ label: "我的考试", iconSrc: "/static/images/tabbar/record-active.png" },
{ label: "我的任务", iconSrc: "/static/images/tabbar/home-active.png" },
{ label: "排行榜", iconSrc: "/static/images/home/start-btn.png" }
];
const courses: StudyCourse[] = [
{ title: "广联数科公司介绍", duration: "0min", progress: 50, typeText: "文档" },
{ title: "课程名称38420940234...", duration: "33min", progress: 0, typeText: "文档" },
{ title: "零售驻店岗管理制度-宣...", duration: "0min", progress: 50, typeText: "文档" },
{ title: "限制考试次数的课程", duration: "14.5min", progress: 50, typeText: "视频" },
{ title: "比亚迪(海豹06)-权...", duration: "5.6min", progress: 76, typeText: "视频" }
];
</script>
<style scoped lang="scss">
@import "../styles/common.scss";
</style>
import type { CustomFormItem } from "@/components/CustomFormTypes.uts";
export const DAILY_REPORT_FORM_ITEMS: CustomFormItem[] = [
{
key: "deliveryCount",
label: "交车数",
type: "input",
inputType: "number",
placeholder: "0",
required: true,
message: "请输入交车数"
},
{
key: "customerTouchCount",
label: "触客数",
type: "input",
inputType: "number",
placeholder: "0",
required: true,
message: "请输入触客数"
},
// {
// key: "customerLevel",
// label: "客户级别",
// type: "picker",
// placeholder: "请选择客户级别",
// required: true,
// message: "请选择客户级别",
// options: [
// { label: "A级", value: "A" },
// { label: "B级", value: "B" },
// { label: "C级", value: "C" }
// ]
// },
// {
// key: "dealResult",
// label: "成交状态",
// type: "radio",
// required: true,
// message: "请选择成交状态",
// options: [
// { label: "未成交", value: "pending" },
// { label: "已成交", value: "done" }
// ]
// },
// {
// key: "followActions",
// label: "跟进动作",
// type: "checkbox",
// required: true,
// message: "请选择跟进动作",
// options: [
// { label: "电话回访", value: "phone" },
// { label: "到店邀约", value: "invite" },
// { label: "资料发送", value: "material" }
// ]
// },
{
key: "remark",
label: "备注",
type: "textarea",
placeholder: "请输入备注",
full: true
}
];
export type TaskEntryKey = "daily" | "study" | "strategy" | "review";
export const TASK_ENTRY_CONFIGS: UTSJSONObject[] = [
{
key: "daily",
label: "日报",
iconSrc: "/static/images/tabbar/record.png",
activeIconSrc: "/static/images/tabbar/record-active.png"
} as UTSJSONObject,
{
key: "study",
label: "学习",
iconSrc: "/static/images/tabbar/study.png",
activeIconSrc: "/static/images/tabbar/study-active.png"
} as UTSJSONObject,
{
key: "strategy",
label: "策略",
iconSrc: "/static/images/home/scene-change.png",
activeIconSrc: "/static/images/home/scene-change.png"
} as UTSJSONObject,
{
key: "review",
label: "审阅",
iconSrc: "/static/images/home/setting.png",
activeIconSrc: "/static/images/home/setting.png"
} as UTSJSONObject
];
.tasks-page {
width: 100%;
flex: 1;
min-height: 0;
display: flex;
flex-direction: column;
background-color: var(--tasks-bg-page, #f3f5f9);
box-sizing: border-box;
overflow: hidden;
}
.tasks-layout {
flex: 1;
min-height: 0;
display: flex;
flex-direction: var(--tasks-layout-direction, column);
padding: var(--tasks-layout-padding, 14px 16px 0);
box-sizing: border-box;
overflow: hidden;
}
.tasks-entry-panel {
flex: var(--tasks-entry-panel-flex, 0 0 auto);
width: var(--tasks-entry-panel-width, 100%);
height: var(--tasks-entry-panel-height, auto);
min-height: var(--tasks-entry-panel-min-height, 40px);
display: flex;
flex-direction: column;
background-color: var(--module-entry-grid-bg, #ffffff);
border-radius: var(--module-entry-grid-radius, 8px);
margin-right: var(--tasks-entry-panel-margin-right, 0px);
margin-bottom: var(--tasks-entry-panel-margin-bottom, 12px);
box-sizing: border-box;
overflow: hidden;
}
.tasks-content-panel {
flex: 1;
min-width: 0;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
}
.task-card {
width: 100%;
background-color: var(--tasks-bg-card, #ffffff);
border-radius: var(--tasks-card-radius, 12px);
box-sizing: border-box;
}
.task-segment {
height: 38px;
display: flex;
flex-direction: row;
align-items: stretch;
background-color: var(--tasks-bg-card, #ffffff);
border-radius: var(--tasks-segment-radius, 8px);
overflow: hidden;
margin-bottom: 10px;
}
.task-segment__item {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
border-bottom: 2px solid transparent;
}
.task-segment__item--active {
border-bottom-color: var(--tasks-primary, #2f6af7);
}
.task-segment__text {
font-size: 13px;
color: var(--tasks-text-secondary, #475569);
}
.task-segment__item--active .task-segment__text {
color: var(--tasks-primary, #2f6af7);
font-weight: 600;
}
.daily-report-module {
padding: var(--tasks-daily-card-padding, 0px);
background-color: transparent;
}
.daily-form {
background-color: var(--tasks-bg-card, #ffffff);
border-radius: var(--tasks-card-radius, 12px);
padding: var(--tasks-daily-form-padding, 16px);
box-sizing: border-box;
}
.daily-form__title-row {
display: flex;
flex-direction: row;
align-items: center;
margin-bottom: 12px;
}
.daily-form__title-icon {
width: 18px;
height: 18px;
margin-right: 5px;
}
.daily-form__title {
font-size: 17px;
font-weight: 700;
color: var(--tasks-text-primary, #111827);
}
.study-module {
flex: 1;
min-height: 0;
display: flex;
flex-direction: var(--tasks-study-layout-direction, column);
}
.study-side-card {
width: var(--tasks-study-side-width, 100%);
flex-shrink: 0;
background-color: rgba(255, 255, 255, 0.88);
border-radius: 14px;
padding: 14px;
box-sizing: border-box;
margin-right: var(--tasks-study-side-margin-right, 0px);
margin-bottom: var(--tasks-study-side-margin-bottom, 12px);
}
.study-side-card__title {
font-size: 14px;
color: var(--tasks-text-primary, #202939);
}
.study-duration-box {
height: 88px;
display: flex;
flex-direction: row;
margin-top: 10px;
background-color: #f6f8ff;
border-radius: 6px;
padding: 10px 8px;
box-sizing: border-box;
}
.study-duration-item {
flex: 1;
display: flex;
flex-direction: column;
}
.study-duration-item__tag {
width: 44px;
height: 20px;
line-height: 20px;
text-align: center;
border-radius: 3px;
background-color: #e8efff;
font-size: 12px;
color: #5b83ff;
}
.study-duration-item__value {
margin-top: 18px;
font-size: 18px;
color: #5b83ff;
}
.study-shortcuts {
display: flex;
flex-direction: row;
flex-wrap: wrap;
margin-top: 18px;
}
.study-shortcut {
width: 33.33%;
display: flex;
flex-direction: column;
align-items: center;
margin-bottom: 24px;
}
.study-shortcut__icon {
width: 28px;
height: 28px;
}
.study-shortcut__text {
margin-top: 8px;
font-size: 13px;
color: var(--tasks-text-secondary, #475569);
}
.study-course-panel {
flex: 1;
min-width: 0;
min-height: 0;
background-color: var(--tasks-bg-card, #ffffff);
border-radius: 16px;
padding: var(--tasks-study-course-padding, 12px 18px);
box-sizing: border-box;
overflow: hidden;
}
.study-course-tabs {
height: 32px;
display: flex;
flex-direction: row;
align-items: center;
margin-bottom: 8px;
}
.study-course-tab {
width: 160px;
height: 32px;
display: flex;
align-items: center;
justify-content: center;
border-bottom: 3px solid transparent;
}
.study-course-tab--active {
border-bottom-color: var(--tasks-primary, #2f6af7);
}
.study-course-tab__text {
font-size: 14px;
color: var(--tasks-text-secondary, #475569);
}
.study-course-tab--active .study-course-tab__text {
color: var(--tasks-primary, #2f6af7);
font-weight: 600;
}
.study-notice {
height: 20px;
display: flex;
align-items: center;
background-color: #fff3df;
border-radius: 3px;
padding: 0 10px;
margin-bottom: 14px;
}
.study-notice__text {
font-size: 11px;
color: #ff8a00;
}
.study-course-grid {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
.study-course-card {
width: var(--tasks-course-card-width, 31%);
min-width: var(--tasks-course-card-min-width, 156px);
background-color: #ffffff;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 4px 14px rgba(47, 106, 247, 0.1);
margin-right: 14px;
margin-bottom: 14px;
}
.study-course-card__cover {
height: 78px;
display: flex;
flex-direction: row;
justify-content: flex-end;
align-items: flex-start;
background: linear-gradient(135deg, #eaf4ff 0%, #b8e4ff 54%, #f4f9ff 100%);
}
.study-course-card__type {
height: 22px;
line-height: 22px;
padding: 0 7px;
background-color: rgba(36, 90, 150, 0.72);
color: #ffffff;
font-size: 12px;
}
.study-course-card__body {
padding: 10px;
box-sizing: border-box;
}
.study-course-card__title {
font-size: 14px;
color: var(--tasks-text-primary, #202939);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.study-course-card__meta {
margin-top: 6px;
font-size: 12px;
color: #7b8798;
}
.study-progress-row {
display: flex;
flex-direction: row;
align-items: center;
margin-top: 6px;
}
.study-progress {
width: 64px;
height: 6px;
background-color: #bcd2ff;
border-radius: 3px;
overflow: hidden;
margin-left: 8px;
}
.study-progress__bar {
height: 6px;
border-radius: 3px;
background-color: #3773f8;
}
.study-progress__text {
font-size: 11px;
color: #4b7dff;
margin-left: 8px;
}
.task-placeholder-module {
flex: 1;
min-height: 260px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.task-placeholder-module__icon {
width: 44px;
height: 44px;
margin-bottom: 12px;
}
.task-placeholder-module__title {
font-size: 18px;
font-weight: 700;
color: var(--tasks-text-primary, #111827);
}
.task-placeholder-module__desc {
margin-top: 8px;
font-size: 14px;
color: var(--tasks-text-secondary, #64748b);
}
export default {
common: {
"--tasks-primary": "#2f6af7",
"--tasks-text-primary": "#111827",
"--tasks-text-secondary": "#475569",
"--tasks-border-soft": "#edf0f5",
"--tasks-input-border": "#e2e8f0",
"--tasks-bg-page": "#f3f5f9",
"--tasks-bg-card": "#ffffff",
"--tasks-card-radius": "12px",
"--tasks-segment-radius": "8px",
"--module-entry-grid-bg": "#ffffff",
"--module-entry-grid-radius": "8px"
},
portrait: {
"--content-box-padding-side": "14px",
"--tasks-layout-direction": "column",
"--tasks-layout-padding": "14px 16px 0",
"--tasks-entry-panel-flex": "0 0 auto",
"--tasks-entry-panel-width": "100%",
"--tasks-entry-panel-height": "40px",
"--tasks-entry-panel-min-height": "40px",
"--tasks-entry-panel-margin-right": "0px",
"--tasks-entry-panel-margin-bottom": "12px",
"--module-entry-grid-list-direction": "row",
"--module-entry-grid-list-wrap": "nowrap",
"--module-entry-grid-list-padding": "0px",
"--module-entry-grid-item-width": "88px",
"--module-entry-grid-item-height": "40px",
"--module-entry-grid-item-direction": "row",
"--module-entry-grid-item-gap": "0px",
"--module-entry-grid-item-bottom-gap": "0px",
"--module-entry-grid-icon-size": "15px",
"--module-entry-grid-icon-margin-right": "4px",
"--module-entry-grid-icon-margin-bottom": "0px",
"--module-entry-grid-label-size": "13px",
"--tasks-daily-form-padding": "16px",
"--tasks-daily-field-width": "48%",
"--tasks-daily-textarea-height": "60px",
"--tasks-submit-height": "50px",
"--tasks-study-layout-direction": "column",
"--tasks-study-side-width": "100%",
"--tasks-study-side-margin-right": "0px",
"--tasks-study-side-margin-bottom": "12px",
"--tasks-study-course-padding": "12px",
"--tasks-course-card-width": "100%",
"--tasks-course-card-min-width": "0px"
},
landscape: {
"--content-box-padding-side": "12px",
"--tasks-layout-direction": "row",
"--tasks-layout-padding": "12px 0 12px",
"--tasks-entry-panel-flex": "0 0 auto",
"--tasks-entry-panel-width": "276px",
"--tasks-entry-panel-height": "100%",
"--tasks-entry-panel-min-height": "260px",
"--tasks-entry-panel-margin-right": "20px",
"--tasks-entry-panel-margin-bottom": "0px",
"--module-entry-grid-list-direction": "row",
"--module-entry-grid-list-wrap": "wrap",
"--module-entry-grid-list-padding": "22px 14px",
"--module-entry-grid-item-width": "33.33%",
"--module-entry-grid-item-height": "72px",
"--module-entry-grid-item-direction": "column",
"--module-entry-grid-item-gap": "0px",
"--module-entry-grid-item-bottom-gap": "16px",
"--module-entry-grid-icon-size": "28px",
"--module-entry-grid-icon-margin-right": "0px",
"--module-entry-grid-icon-margin-bottom": "8px",
"--module-entry-grid-label-size": "14px",
"--tasks-daily-form-padding": "20px",
"--tasks-daily-field-width": "48%",
"--tasks-daily-textarea-height": "72px",
"--tasks-submit-height": "52px",
"--tasks-study-layout-direction": "row",
"--tasks-study-side-width": "276px",
"--tasks-study-side-margin-right": "20px",
"--tasks-study-side-margin-bottom": "0px",
"--tasks-study-course-padding": "12px 18px",
"--tasks-course-card-width": "31%",
"--tasks-course-card-min-width": "156px"
},
resolutions: {
"landscape-1024x768": {
"--tasks-entry-panel-width": "276px",
"--tasks-layout-padding": "12px 0 12px",
"--tasks-course-card-width": "31%"
},
"landscape-816x393": {
"--tasks-entry-panel-width": "220px",
"--tasks-entry-panel-height": "100%",
"--module-entry-grid-list-padding": "18px 10px",
"--module-entry-grid-item-height": "64px",
"--module-entry-grid-icon-size": "24px",
"--tasks-study-side-width": "220px",
"--tasks-course-card-width": "46%",
"--tasks-course-card-min-width": "140px"
},
"portrait-393x816": {
"--tasks-layout-padding": "14px 16px 0"
},
"portrait-414x896": {
"--tasks-layout-padding": "14px 16px 0"
}
}
}
<template>
<TabBarShell ref="shellRef"
:active-tab-index="2"
:page-vars="taskPageVars as UTSJSONObject">
<view class="tasks-page">
<view class="tasks-layout">
<view class="tasks-entry-panel">
<EntryGrid
:items="taskEntryConfigs"
:active-key="activeEntryKey"
@change="onEntryChange" />
</view>
<view class="tasks-content-panel">
<component :is="activeEntryComponent" />
</view>
</view>
</view>
</TabBarShell>
</template>
<script setup lang="uts">
import { computed, ref } from "vue";
import TabBarShell from "@/components/TabBar/TabBarShell.uvue";
import DailyReport from "./components/DailyReport.uvue";
import ReviewPanel from "./components/ReviewPanel.uvue";
import StrategyPanel from "./components/StrategyPanel.uvue";
import StudyPanel from "./components/StudyPanel.uvue";
import EntryGrid from "@/components/EntryGrid.uvue";
import { TASK_ENTRY_CONFIGS, type TaskEntryKey } from "./constants/taskEntries.uts";
import taskPageVars from "./styles/index.vars.uts";
const shellRef = ref(null);
const taskEntryConfigs = TASK_ENTRY_CONFIGS;
const activeEntryKey = ref<TaskEntryKey>("daily");
const activeEntryComponent = computed((): any => {
if (activeEntryKey.value == "study") return StudyPanel;
if (activeEntryKey.value == "strategy") return StrategyPanel;
if (activeEntryKey.value == "review") return ReviewPanel;
return DailyReport;
});
function onEntryChange(key: string): void {
activeEntryKey.value = key as TaskEntryKey;
}
</script>
<style scoped lang="scss">
@import "./styles/common.scss";
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!