From 03e7fc564021db202836ae32eb67c6c0d43814c8 Mon Sep 17 00:00:00 2001 From: dzq Date: Tue, 23 Dec 2025 15:25:28 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E6=A8=AA=E5=B1=8F?= =?UTF-8?q?=E6=9A=82=E5=AD=98=E6=9F=9C=E7=AE=A1=E7=90=86=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=8F=8A=E7=9B=B8=E5=85=B3=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refactor(router): 添加横屏路由配置并优化路由守卫逻辑 feat(api): 新增企业corpid查询接口 feat(components): 实现地址选择面板组件 feat(pinia): 扩展wx store添加corpid设置方法 style(images): 更新柜格图标为更清晰的SVG版本 fix(postcss): 调整移动端适配配置 --- .claude/settings.local.json | 4 +- postcss.config.ts | 5 +- public/images/cabinet/extra-large-cell.svg | 8 +- public/images/cabinet/large-cell.svg | 8 +- public/images/cabinet/medium-cell.svg | 8 +- public/images/cabinet/small-cell.svg | 8 +- src/App.vue | 18 +- src/common/apis/qy/index.ts | 10 + .../components/AddressSelectionPanel.vue | 177 ++++++++++++++++++ .../components/StorageCellsSummary.vue | 131 ++++++++++--- src/pages/cabinet/storage-horizontal.vue | 162 ++++++++++++++++ src/pinia/stores/wx.ts | 6 +- src/router/guard.ts | 4 + src/router/index.ts | 18 ++ 14 files changed, 519 insertions(+), 48 deletions(-) create mode 100644 src/common/apis/qy/index.ts create mode 100644 src/pages/cabinet/components/AddressSelectionPanel.vue create mode 100644 src/pages/cabinet/storage-horizontal.vue diff --git a/.claude/settings.local.json b/.claude/settings.local.json index 2714c8b..5e9efc6 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -3,7 +3,9 @@ "allow": [ "Bash(mkdir:*)", "Bash(tree -L 3 -I 'node_modules|dist')", - "Bash(cat:*)" + "Bash(cat:*)", + "Bash(dir:*)", + "Bash(find:*)" ], "deny": [], "ask": [] diff --git a/postcss.config.ts b/postcss.config.ts index ffe0dcb..5d561fb 100644 --- a/postcss.config.ts +++ b/postcss.config.ts @@ -8,7 +8,7 @@ export default { // UI 设计稿宽度 viewportWidth: (file: string) => file.includes("vant") ? 375 : 375, // 限制视图的最大宽度 - maxDisplayWidth: 750, + // maxDisplayWidth: 750, // 页面最外层选择器 appSelector: "#app", // 是否对「页面最外层选择器」对应的元素进行描边 @@ -18,7 +18,8 @@ export default { // 转换后的单位 mobileUnit: "vw", // 需要转换的属性 - propList: ["*"], + // propList: ["*"], + propList: [], // 忽略的选择器 selectorBlackList: [".ignore", "keep-px"], // 忽略的属性 diff --git a/public/images/cabinet/extra-large-cell.svg b/public/images/cabinet/extra-large-cell.svg index d44a393..0ef9993 100644 --- a/public/images/cabinet/extra-large-cell.svg +++ b/public/images/cabinet/extra-large-cell.svg @@ -1,4 +1,4 @@ - - - 超大格 - \ No newline at end of file + + + diff --git a/public/images/cabinet/large-cell.svg b/public/images/cabinet/large-cell.svg index d3eb1a5..2c24493 100644 --- a/public/images/cabinet/large-cell.svg +++ b/public/images/cabinet/large-cell.svg @@ -1,4 +1,4 @@ - - - 大格 - \ No newline at end of file + + + diff --git a/public/images/cabinet/medium-cell.svg b/public/images/cabinet/medium-cell.svg index 0b4a76e..0bede55 100644 --- a/public/images/cabinet/medium-cell.svg +++ b/public/images/cabinet/medium-cell.svg @@ -1,4 +1,4 @@ - - - 中格 - \ No newline at end of file + + + diff --git a/public/images/cabinet/small-cell.svg b/public/images/cabinet/small-cell.svg index 1fb8737..94b5f51 100644 --- a/public/images/cabinet/small-cell.svg +++ b/public/images/cabinet/small-cell.svg @@ -1,4 +1,4 @@ - - - 小格 - \ No newline at end of file + + + diff --git a/src/App.vue b/src/App.vue index 51316b6..9e505a7 100644 --- a/src/App.vue +++ b/src/App.vue @@ -6,6 +6,7 @@ import { useWxStore } from "@/pinia/stores/wx" import { tokenLogin } from '@/common/apis/ab98' import { useAb98UserStore } from '@/pinia/stores/ab98-user' import { useProductStore } from "./pinia/stores/product" +import { getCorpidByIdApi } from "./common/apis/qy" // const userStore = useUserStore() const wxStore = useWxStore(); @@ -30,14 +31,27 @@ const isLoading = false; // ) initDark() -onMounted(() => { +onMounted(async () => { const urlParams = new URLSearchParams(window.location.search); console.log('urlParams', urlParams); const code = urlParams.get('code') || undefined; const state = urlParams.get('state') || undefined; - const corpid = urlParams.get('corpid') || undefined; + let corpid = urlParams.get('corpid') || undefined; + const cid = urlParams.get('cid') || undefined; let isAdmin = urlParams.get('isAdmin') || undefined; + if (cid && Number(cid)) { + try { + const corpidRes = await getCorpidByIdApi(Number(cid)); + if (corpidRes?.code === 0 && corpidRes.data) { + corpid = corpidRes.data; + wxStore.setCorpid(corpid); + } + } catch (error) { + console.log('getCorpidByIdApi error', error); + } + } + if (state && state.indexOf('token') !== -1) { const token = state.split('token_')[1]; if (token) { diff --git a/src/common/apis/qy/index.ts b/src/common/apis/qy/index.ts new file mode 100644 index 0000000..4c5d2a0 --- /dev/null +++ b/src/common/apis/qy/index.ts @@ -0,0 +1,10 @@ +import { request } from "@/http/axios" + +/** 根据企业ID查询corpid */ +export function getCorpidByIdApi(id: number) { + return request>({ + url: "qy/getCorpidById", + method: "get", + params: { id } + }) +} \ No newline at end of file diff --git a/src/pages/cabinet/components/AddressSelectionPanel.vue b/src/pages/cabinet/components/AddressSelectionPanel.vue new file mode 100644 index 0000000..f3c3798 --- /dev/null +++ b/src/pages/cabinet/components/AddressSelectionPanel.vue @@ -0,0 +1,177 @@ + + + + + \ No newline at end of file diff --git a/src/pages/cabinet/components/StorageCellsSummary.vue b/src/pages/cabinet/components/StorageCellsSummary.vue index d009e4c..b5e3d84 100644 --- a/src/pages/cabinet/components/StorageCellsSummary.vue +++ b/src/pages/cabinet/components/StorageCellsSummary.vue @@ -80,20 +80,27 @@ v-model:show="popupVisible" position="bottom" round - :style="{ padding: '32px', background: '#fff', maxHeight: '80vh' }" + :style="popupStyle" @close="handlePopupCancel"> - @@ -152,6 +160,7 @@ import { } from '@/common/apis/cabinet' import type { AvailableStorageCellDTO } from '@/common/apis/cabinet/type' import { usePopupState } from '@/common/composables/usePopupState' +import { publicPath } from '@/common/utils/path' // 格口类型映射 const CELL_TYPE_MAP = { @@ -214,6 +223,36 @@ const { handleKeyboardClose } = usePopupState() +// 弹窗样式计算属性 +const popupStyle = computed(() => { + const baseStyle = { + padding: '32px', + background: '#fff' + } + + if (keyboardVisible.value) { + return { + ...baseStyle, + maxHeight: 'calc(100vh - 360px)', + overflow: 'auto' + } + } + + return { + ...baseStyle, + maxHeight: '80vh' + } +}) + +const popupContentStyle = computed(() => { + if (keyboardVisible.value) { + return { + paddingBottom: '160px' + } + } + return {} +}) + // 统计计算属性 const availableCells = computed(() => cellsData.value.filter(cell => !cell.hasPassword) @@ -387,7 +426,7 @@ const CELL_TYPE_ICON_MAP = { function getCellImg(type: number): string { // 假设图片放在 public/images/cabinet/ 目录下 - const basePath = '/images/cabinet/' + const basePath = publicPath + 'images/cabinet/' switch (type) { case 1: return `${basePath}small-cell.svg` case 2: return `${basePath}medium-cell.svg` @@ -420,21 +459,21 @@ onMounted(() => { \ No newline at end of file diff --git a/src/pages/cabinet/storage-horizontal.vue b/src/pages/cabinet/storage-horizontal.vue new file mode 100644 index 0000000..bfc3910 --- /dev/null +++ b/src/pages/cabinet/storage-horizontal.vue @@ -0,0 +1,162 @@ + + + + + \ No newline at end of file diff --git a/src/pinia/stores/wx.ts b/src/pinia/stores/wx.ts index a205709..a9608d5 100644 --- a/src/pinia/stores/wx.ts +++ b/src/pinia/stores/wx.ts @@ -45,6 +45,10 @@ export const useWxStore = defineStore("wx", () => { balance.value = amount; } + const setCorpid = (id: string) => { + corpid.value = id; + } + const setIsCabinetAdmin = (isAdmin: boolean) => { isCabinetAdmin.value = isAdmin; } @@ -178,7 +182,7 @@ export const useWxStore = defineStore("wx", () => { return { code, state, openid, corpid, userid, balance, useBalance, balanceLimit, isCabinetAdmin, corpidLogin, name, ab98User, qyUserId, isFakeQyLogin, - isHandleWxCallbackComplete, setOpenid, setBalance, handleWxCallback, setIsCabinetAdmin, + isHandleWxCallbackComplete, setOpenid, setBalance, setCorpid, handleWxCallback, setIsCabinetAdmin, refreshBalance, setAb98User, fakeQyLogin, waitForHandleWxCallbackComplete } }) diff --git a/src/router/guard.ts b/src/router/guard.ts index ecc3f9c..610b23e 100644 --- a/src/router/guard.ts +++ b/src/router/guard.ts @@ -29,6 +29,10 @@ export function registerNavigationGuard(router: Router) { if (isAdmin) { return true; } + const cid = urlParams.get('cid') || undefined; + if (cid) { + return true; + } // useAb98UserStore位置不能放在外面,否则会导致路由守卫无法正常工作 const ab98UserStore = useAb98UserStore(); diff --git a/src/router/index.ts b/src/router/index.ts index ba65a31..ccb0e0f 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -143,6 +143,24 @@ export const routes: RouteRecordRaw[] = [ } } }, + { + path: "/storage", + component: () => import("@/pages/cabinet/storage-horizontal.vue"), + name: "StorageHorizontal", + meta: { + title: "暂存柜管理(横屏)", + keepAlive: false, + layout: { + navBar: { + showNavBar: false, + showLeftArrow: false + }, + tabbar: { + showTabbar: false + } + } + } + }, { path: "/approval/list", component: () => import("@/pages/approval/list.vue"),