diff --git a/src/App.vue b/src/App.vue index 1bb4db8..081fad3 100644 --- a/src/App.vue +++ b/src/App.vue @@ -30,6 +30,10 @@ onMounted(() => { const code = urlParams.get('code') || undefined; const state = urlParams.get('state') || undefined; const corpid = urlParams.get('corpid') || undefined; + const isAdmin = urlParams.get('isAdmin') || undefined; + if (isAdmin == '1') { + wxStore.setIsCabinetAdmin(true); + } if (code || state) { wxStore.handleWxCallback({ corpid, code, state }) } diff --git a/src/common/apis/cabinet/index.ts b/src/common/apis/cabinet/index.ts new file mode 100644 index 0000000..829b053 --- /dev/null +++ b/src/common/apis/cabinet/index.ts @@ -0,0 +1,17 @@ +import { request } from '@/http/axios' +import type { CabinetDetailResponse } from './type' + +/** 获取智能柜详情接口 */ +export function getCabinetDetailApi() { + return request({ + url: 'cabinet/detail', + method: 'get' + }) +} + +export function openCabinet(lockControlNo: number, pinNo: number) { + return request>({ + url: `cabinet/openCabinet/${lockControlNo}/${pinNo}`, + method: 'post' + }) +} \ No newline at end of file diff --git a/src/common/apis/cabinet/type.ts b/src/common/apis/cabinet/type.ts new file mode 100644 index 0000000..831fcd4 --- /dev/null +++ b/src/common/apis/cabinet/type.ts @@ -0,0 +1,21 @@ +export interface CabinetDetailDTO { + cabinetId: number + cabinetName: string + lockControlNo: number + cells: CellInfoDTO[] +} + +export interface CellInfoDTO { + cellId: number + pinNo: number + product?: ProductInfoDTO +} + +export interface ProductInfoDTO { + goodsId: number + goodsName: string + price: number + coverImg: string +} + +export type CabinetDetailResponse = ApiResponseData \ No newline at end of file diff --git a/src/common/apis/shop/index.ts b/src/common/apis/shop/index.ts index f60a5b1..0f00c3f 100644 --- a/src/common/apis/shop/index.ts +++ b/src/common/apis/shop/index.ts @@ -32,7 +32,7 @@ export function getOpenIdApi(params: GetOpenIdRequestParams) { /** 企业微信登录 */ export function qyLogin(params: QyLoginRequestParams) { return request>({ - url: "common/login/qy", + url: "payment/login/qy", method: "get", params }) diff --git a/src/layout/components/Tabbar.vue b/src/layout/components/Tabbar.vue index f3c6493..1827445 100644 --- a/src/layout/components/Tabbar.vue +++ b/src/layout/components/Tabbar.vue @@ -3,12 +3,16 @@ const router = useRouter() const tabbarItemList = computed(() => { const routes = router.getRoutes() - return routes.filter(route => route.meta.layout?.tabbar?.showTabbar).map(route => ({ + return routes.filter(route => route.meta.layout?.tabbar?.showTabbar && route.path !== '/cabinet') + .map(route => ({ title: route.meta.title, icon: route.meta.layout?.tabbar?.icon, path: route.path })) }) + +import { useWxStoreOutside } from '@/pinia/stores/wx' +const wxStore = useWxStoreOutside() + + + + \ No newline at end of file diff --git a/src/pages/me/index.vue b/src/pages/me/index.vue index 9b099ed..d16e6dd 100644 --- a/src/pages/me/index.vue +++ b/src/pages/me/index.vue @@ -2,6 +2,7 @@ import { useRouter } from 'vue-router' import { useWxStore } from '@/pinia/stores/wx' import { computed } from 'vue' +import { publicPath } from "@/common/utils/path" const router = useRouter() const wxStore = useWxStore() @@ -19,7 +20,7 @@ const balance = computed(() => wxStore.balance) round width="80" height="80" - src="/img/1.jpg" + :src="`${publicPath}img/1.jpg`" class="mr-4" />
diff --git a/src/pinia/stores/wx.ts b/src/pinia/stores/wx.ts index 7d0cb16..fa0cc11 100644 --- a/src/pinia/stores/wx.ts +++ b/src/pinia/stores/wx.ts @@ -27,7 +27,11 @@ export const useWxStore = defineStore("wx", () => { balance.value = amount; } - const handleWxCallback = async (params: { corpid?: string; code?: string; state?: string }) => { + const setIsCabinetAdmin = (isAdmin: boolean) => { + isCabinetAdmin.value = isAdmin; + } + + const handleWxCallback = async (params: { corpid?: string; code?: string; state?: string; }) => { console.log('handleWxCallback:', params) if (params.code) { code.value = params.code @@ -78,7 +82,8 @@ export const useWxStore = defineStore("wx", () => { } } - return { code, state, openid, corpid, userid, balance, setOpenid, setBalance, handleWxCallback } + return { code, state, openid, corpid, userid, balance, isCabinetAdmin, + setOpenid, setBalance, handleWxCallback, setIsCabinetAdmin } }) /** diff --git a/src/router/index.ts b/src/router/index.ts index 803d31a..a4b414e 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -82,6 +82,25 @@ export const routes: RouteRecordRaw[] = [ } } }, + { + path: '/cabinet', + component: () => import('@/pages/cabinet/index.vue'), + name: "Cabinet", + meta: { + title: '柜机管理', + keepAlive: true, + layout: { + navBar: { + showNavBar: false, + showLeftArrow: false + }, + tabbar: { + showTabbar: true, + icon: "home-o" + } + } + } + }, { path: "/me", component: () => import("@/pages/me/index.vue"),