From 12cef7b84f51358fd19e96bd99d1552022f15b5e Mon Sep 17 00:00:00 2001 From: dzq Date: Tue, 3 Jun 2025 16:25:51 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E7=94=A8=E6=88=B7=E8=AE=A4=E8=AF=81):=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BC=81=E4=B8=9A=E5=BE=AE=E4=BF=A1=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E7=BB=91=E5=AE=9A=E5=8A=9F=E8=83=BD=E5=B9=B6=E5=AE=8C?= =?UTF-8?q?=E5=96=84=E5=95=86=E5=93=81=E8=AF=A6=E6=83=85=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在登录流程中存储企业微信用户信息到store - 添加企业微信用户绑定接口及相关类型定义 - 当检测到未绑定用户时显示绑定对话框 - 新增商品详情路由及页面,优化商品列表交互 - 改进商品卡片样式和点击跳转逻辑 --- src/api/ab98/user.ts | 10 +++ src/api/common/login.ts | 68 ++++++++++++++- src/router/index.ts | 1 + src/router/modules/global.ts | 8 ++ src/store/modules/wx.ts | 12 ++- src/views/login/index.vue | 2 + src/views/shop/goods/detail.vue | 148 ++++++++++++++++++++++++++++++++ src/views/shop/goods/index.vue | 115 ++++++++++++++++--------- src/views/welcome/index.vue | 49 +++++++++++ 9 files changed, 372 insertions(+), 41 deletions(-) create mode 100644 src/views/shop/goods/detail.vue diff --git a/src/api/ab98/user.ts b/src/api/ab98/user.ts index 5a6980d..7ceb5a1 100644 --- a/src/api/ab98/user.ts +++ b/src/api/ab98/user.ts @@ -84,6 +84,12 @@ export interface UpdateAb98UserCommand extends AddAb98UserCommand { ab98UserId: number; } +export interface BindQyUserCommand { + qyUserId: number; + name: string; + idNum: string; +} + export const getAb98UserListApi = (params: Ab98UserQuery) => { return http.request>>("get", "/ab98/users", { params }); }; @@ -102,4 +108,8 @@ export const deleteAb98UserApi = (ids: number[]) => { export const getAb98UserDetailApi = (id: number) => { return http.request>("get", `/ab98/users/detail/${id}`); +}; + +export const bindQyUserApi = (data: BindQyUserCommand) => { + return http.request>("post", "/ab98/users/bindQyUser", { data }); }; \ No newline at end of file diff --git a/src/api/common/login.ts b/src/api/common/login.ts index fa517b6..7395673 100644 --- a/src/api/common/login.ts +++ b/src/api/common/login.ts @@ -37,6 +37,8 @@ export type TokenDTO = { token: string; /** 当前登录的用户 */ currentUser: CurrentLoginUserDTO; + /** 企业微信用户信息 */ + qyUser: QyUserLoginDTO; }; export type CurrentLoginUserDTO = { @@ -121,4 +123,68 @@ type qyUserinfoQuery = { /** 获取企业微信访问用户身份接口 */ export const getQyUserinfo = (params: qyUserinfoQuery) => { return http.request>("get", "/getQyUserinfo", { params }); -}; \ No newline at end of file +}; + + +export interface QyUserLoginDTO { + /** 用户ID */ + id?: number; + /** 全局唯一ID */ + openUserid?: string; + /** 企业用户ID */ + userid?: string; + /** 汇邦云用户ID */ + ab98UserId?: number; + /** 用户姓名 */ + name?: string; + /** 手机号码 */ + mobile?: string; + /** 所属部门 */ + department?: string; + /** 部门排序 */ + userOrder?: string; + /** 职务信息 */ + position?: string; + /** 性别 */ + gender?: string; + /** 邮箱 */ + email?: string; + /** 企业邮箱 */ + bizMail?: string; + /** 部门负责人 */ + isLeaderInDept?: string; + /** 直属上级 */ + directLeader?: string; + /** 头像地址 */ + avatar?: string; + /** 座机号码 */ + telephone?: string; + /** 别名 */ + alias?: string; + /** 激活状态 */ + status?: string; + /** 个人二维码 */ + qrCode?: string; + /** 操作人 */ + operator?: string; + /** 有效状态 */ + enableStatus?: string; + /** 创建时间 */ + createTimeStr?: string; + /** 企业ID */ + corpid?: string; + /** 应用ID */ + appid?: string; + /** 用户余额 */ + balance?: number; + /** 已使用用户余额 */ + useBalance?: number; + /** 用户余额额度 */ + balanceLimit?: number; + /** 系统角色ID */ + sysRoleId?: number; + /** 角色ID */ + roleId?: number; + /** 角色名称 */ + roleName?: string; +} \ No newline at end of file diff --git a/src/router/index.ts b/src/router/index.ts index 04c93ed..5d80f6c 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -130,6 +130,7 @@ router.beforeEach(async (to: ToRouteType, _from, next) => { }); // 登录成功后 将token存储到sessionStorage中 setTokenFromBackend(data); + wxStore.setQyUser(data.qyUser); // 获取后端路由 await initRouter(); next({ path: getTopMenu(true).path }); diff --git a/src/router/modules/global.ts b/src/router/modules/global.ts index 33df1fc..4367c2c 100644 --- a/src/router/modules/global.ts +++ b/src/router/modules/global.ts @@ -39,6 +39,14 @@ export default { meta: { title: "用户详情" } + }, + { + path: "/shop/goods/detail", + name: "GoodsDetail", + component: () => import("@/views/shop/goods/detail.vue"), + meta: { + title: "商品详情" + } } ] } as RouteConfigsTable; diff --git a/src/store/modules/wx.ts b/src/store/modules/wx.ts index 97762c7..e6c3600 100644 --- a/src/store/modules/wx.ts +++ b/src/store/modules/wx.ts @@ -2,6 +2,7 @@ import { defineStore } from "pinia"; import { ref } from "vue"; import { store } from "@/store"; +import { QyUserLoginDTO } from "@/api/common/login"; export const useWxStore = defineStore("wx", () => { @@ -15,12 +16,18 @@ export const useWxStore = defineStore("wx", () => { const userid = ref("") // 初始化 const isInit = ref(false); + const qyUser = ref(null); // 设置 userid const setUserid = (id: string) => { userid.value = id } + const setQyUser = (user: QyUserLoginDTO) => { + if (!user) return; + qyUser.value = user; + } + const initWx = () => { if (isInit.value) return; isInit.value = true; @@ -49,7 +56,10 @@ export const useWxStore = defineStore("wx", () => { } } - return { corpid, code, state, userid, isInit, setUserid, handleWxCallback, initWx } + return { + corpid, code, state, userid, isInit, qyUser, + setUserid, handleWxCallback, initWx, setQyUser + } }) /** diff --git a/src/views/login/index.vue b/src/views/login/index.vue index f25ddab..3dd2caf 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -103,6 +103,7 @@ const onLogin = async (formEl: FormInstance | undefined) => { .then(({ data }) => { // 登录成功后 将token存储到sessionStorage中 setTokenFromBackend(data); + wxStore.setQyUser(data.qyUser); // 获取后端路由 initRouter().then(() => { router.push(getTopMenu(true).path); @@ -132,6 +133,7 @@ const onLogin = async (formEl: FormInstance | undefined) => { .then(({ data }) => { // 登录成功后 将token存储到sessionStorage中 setTokenFromBackend(data); + wxStore.setQyUser(data.qyUser); // 获取后端路由 initRouter().then(() => { router.push(getTopMenu(true).path); diff --git a/src/views/shop/goods/detail.vue b/src/views/shop/goods/detail.vue new file mode 100644 index 0000000..a8c688f --- /dev/null +++ b/src/views/shop/goods/detail.vue @@ -0,0 +1,148 @@ + + + + + \ No newline at end of file diff --git a/src/views/shop/goods/index.vue b/src/views/shop/goods/index.vue index d33eb7d..eda86ca 100644 --- a/src/views/shop/goods/index.vue +++ b/src/views/shop/goods/index.vue @@ -14,11 +14,14 @@ import GoodsFormModal from "./goods-form-modal.vue"; import GoodsEditModal from "./goods-edit-modal.vue"; import { ElMessage, ElMessageBox } from "element-plus"; import { deleteGoodsApi } from "@/api/shop/goods"; +import { useMultiTagsStoreHook } from "@/store/modules/multiTags"; +import { useRouter } from "vue-router"; defineOptions({ name: "ShopGoods" }); +const router = useRouter(); const formRef = ref(); const tableRef = ref(); const modalVisible = ref(false); @@ -126,6 +129,25 @@ const handleEdit = (row: GoodsDTO) => { editVisible.value = true; }; +const handleViewDetail = (row: GoodsDTO) => { + // 保存信息到标签页 + useMultiTagsStoreHook().handleTags("push", { + path: `/shop/goods/detail`, + name: "GoodsDetail", + query: { id: row.goodsId }, + meta: { + title: `${row.goodsName}`, + dynamicLevel: 3 + } + }); + router.push({ + path: '/shop/goods/detail', + query: { + id: row.goodsId + } + }); +}; +